mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-20 00:24:49 +00:00
Added Observer AFK options by DarkTiger
This commit is contained in:
parent
7bbe52ffd8
commit
27b7386250
|
|
@ -164,6 +164,7 @@ $Host::EvoTKWarn2 = 6;
|
|||
$Host::EvoTourneySameMap = 1;
|
||||
$Host::EvoUseHighPerformanceCounter = 0;
|
||||
$Host::FloodProtectionEnabled = 1;
|
||||
$Host::ForceAFKObserverTime = 1;
|
||||
$Host::GameName = "Discord PU";
|
||||
$Host::HiVisibility = "1";
|
||||
$Host::holoName1 = "Storm";
|
||||
|
|
|
|||
133
Classic/scripts/autoexec/zDarkTigerAFK.cs
Normal file
133
Classic/scripts/autoexec/zDarkTigerAFK.cs
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
//Observer AFK
|
||||
//Script BY: DarkTiger
|
||||
//
|
||||
//TacoServer:
|
||||
//Change to how many minutes to set forced Observer for AFK players
|
||||
//Setting to 0 disables this feature
|
||||
//$Host::ForceAFKObserverTime = 1;
|
||||
|
||||
$dtVar::AFKtime = 60000 * $Host::ForceAFKObserverTime;//if player is afk specific amount of time, force them into observer
|
||||
$dtVar::AFKloop = 1000 * 30;//loop check timer currently set to 30 secs
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package afkScript
|
||||
{
|
||||
|
||||
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
|
||||
{
|
||||
Parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch );
|
||||
|
||||
if($dtVar::AFKtime > 0)
|
||||
%client.afkLoopCheck();// starts it
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(afkScript))
|
||||
activatePackage(afkScript);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
function GameConnection::afkLoopCheck(%this)
|
||||
{
|
||||
if(isObject(%this) && !%this.isAiControlled())// make sure client is still there other wise stop
|
||||
%this.schedule($dtVar::AFKloop,"afkLoopCheck");
|
||||
else
|
||||
return;
|
||||
|
||||
if(isObject(%this.player) && %this.player.getState() !$= "Dead" && $matchStarted)
|
||||
AFKChk(%this);
|
||||
}
|
||||
|
||||
function AFKChk(%client)
|
||||
{
|
||||
if(%client.player.curTransform $= %client.player.getTransform())//checks to see if there position and rotation are the same.
|
||||
{
|
||||
//echo("is not moving");
|
||||
// error(%client.player.curTransform SPC %client.player.getTransform());
|
||||
%client.player.afkTimer += $dtVar::AFKloop;
|
||||
if(%client.player.afkTimer >= $dtVar::AFKtime)
|
||||
{
|
||||
Game.AFKForceObserver(%client);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo("is moving");
|
||||
%client.player.afkTimer = 0;//reset if moveing
|
||||
}
|
||||
|
||||
%client.player.curTransform = %client.player.getTransform();//save current transform
|
||||
}
|
||||
|
||||
function DefaultGame::AFKForceObserver(%game, %client)
|
||||
{
|
||||
//make sure we have a valid client...
|
||||
if (%client <= 0)
|
||||
return;
|
||||
|
||||
// first kill this player
|
||||
if(%client.player)
|
||||
%client.player.scriptKill(0);
|
||||
|
||||
if( %client.respawnTimer )
|
||||
cancel(%client.respawnTimer);
|
||||
|
||||
%client.respawnTimer = "";
|
||||
|
||||
// remove them from the team rank array
|
||||
%game.removeFromTeamRankArray(%client);
|
||||
|
||||
// place them in observer mode
|
||||
%client.lastObserverSpawn = -1;
|
||||
%client.observerStartTime = getSimTime();
|
||||
|
||||
|
||||
%client.camera.getDataBlock().setMode( %client.camera, "observerFly" );
|
||||
messageClient(%client, 'MsgClientJoinTeam', '\c2You have been placed into observer mode due to being AFK.', %client.name, %game.getTeamName(0), %client, 0 );
|
||||
logEcho(%client.nameBase@" (cl "@%client@") was forced into observer mode for being AFK");
|
||||
%client.lastTeam = %client.team;
|
||||
|
||||
if($Host::TournamentMode)
|
||||
{
|
||||
if(!$matchStarted)
|
||||
{
|
||||
if(%client.camera.Mode $= "pickingTeam")
|
||||
{
|
||||
commandToClient( %client, 'processPickTeam');
|
||||
clearBottomPrint( %client );
|
||||
}
|
||||
else
|
||||
{
|
||||
clearCenterPrint(%client);
|
||||
%client.notReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// switch client to team 0 (observer)
|
||||
%client.team = 0;
|
||||
%client.player.team = 0;
|
||||
setTargetSensorGroup( %client.target, %client.team );
|
||||
%client.setSensorGroup( %client.team );
|
||||
|
||||
// set their control to the obs. cam
|
||||
%client.setControlObject( %client.camera );
|
||||
commandToClient(%client, 'setHudMode', 'Observer');
|
||||
|
||||
// display the hud
|
||||
//displayObserverHud(%client, 0);
|
||||
updateObserverFlyHud(%client);
|
||||
|
||||
messageAllExcept(%client, -1, 'MsgClientJoinTeam', '\c2%1 has been placed into observer mode due to being AFK.', %client.name, %game.getTeamName(0), %client, 0 );
|
||||
|
||||
updateCanListenState( %client );
|
||||
|
||||
// call the onEvent for this game type
|
||||
%game.onClientEnterObserverMode(%client); //Bounty uses this to remove this client from others' hit lists
|
||||
}
|
||||
|
|
@ -202,8 +202,9 @@ $Host::loadingmsgline2content = "https://github.com/ChocoTaco1/TacoServer"; //L
|
|||
$Host::loadingmsgline3 = "Required Mappacks: "; //Loading screen msg line 3
|
||||
$Host::loadingmsgline3content = "S5 S8 TWL TWL2"; //Loading screen msg content 3
|
||||
$Host::loadingmsgline4 = "Hosted by: "; //Loading screen msg line 4
|
||||
$Host::loadingmsgline4content = "Branzone";
|
||||
$Host::loadingmsgline4content = "Branzone"; //Loading screen msg content 4
|
||||
$Host::ForceAFKObserverTime = 1; //Change the time in minutes it takes to force a player into observer mode for being AFK
|
||||
//LakRabbit
|
||||
$Host::EnableLakUnlimitedDJ = 1; //Unlimited disc-jumps if enabled
|
||||
$Host::LakRabbitNoSplashDamage = 0; //Splash Damage enabled or not
|
||||
$Host::ShowFlagIcon = 1; //Show flag Icon in lak
|
||||
$Host::ShowFlagIcon = 1; //Show flag Icon in lak
|
||||
|
|
|
|||
Loading…
Reference in a new issue