mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-04-28 23:15:23 +00:00
Merge branch 'NoEvo'
This commit is contained in:
commit
510b7759d4
9 changed files with 8872 additions and 4637 deletions
|
|
@ -2073,7 +2073,7 @@ function CTFGame::awardScoreKill(%game, %killerID)
|
|||
function checkVehicleCamping( %team )
|
||||
{
|
||||
%position = $flagPos[%team];
|
||||
%radius = 5;
|
||||
%radius = 15;
|
||||
InitContainerRadiusSearch(%position, %radius, $TypeMasks::VehicleObjectType );
|
||||
|
||||
while ((%vehicle = containerSearchNext()) != 0)
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am
|
|||
}
|
||||
else if(%points >= 100)
|
||||
{
|
||||
%sound = '~wfx/Misc/MA1.wav';
|
||||
messageAll('', '~wfx/Misc/Flair.wav');
|
||||
}
|
||||
|
||||
Game.recalcScore(%sourceObject.client);
|
||||
|
|
@ -1768,11 +1768,6 @@ function LakRabbitGame::playerDroppedFlag(%game, %player)
|
|||
}
|
||||
}
|
||||
|
||||
function ResetCantPickUpFlag(%player)
|
||||
{
|
||||
%player.client.CantPickUpFlag = false;
|
||||
}
|
||||
|
||||
function LakRabbitGame::playerTouchFlag(%game, %player, %flag)
|
||||
{
|
||||
if(%player.getState() $= "Dead" || %player.client.flagDeny)
|
||||
|
|
@ -1781,11 +1776,11 @@ function LakRabbitGame::playerTouchFlag(%game, %player, %flag)
|
|||
// borlak - can't pick up flag until 2 ppl are on
|
||||
if(PlayingPlayers() < 2)
|
||||
{
|
||||
if(!%player.client.CantPickUpFlag)
|
||||
%timeDif = getSimTime() - %player.client.pickUpTime;
|
||||
if(%timeDif > 5000 || !%player.client.pickUpTime)
|
||||
{
|
||||
messageClient(%player.client, 'msgNoFlagWarning', "\c2You can't pick up the flag until another person joins." );
|
||||
%player.client.CantPickUpFlag = true;
|
||||
schedule(5000, 0, "ResetCantPickUpFlag", %player ); //message only every 5 seconds
|
||||
%player.client.pickUpTime = getSimTime();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -471,59 +471,7 @@ package SCtFGame
|
|||
function SCtFGame::missionLoadDone(%game)
|
||||
{
|
||||
//default version sets up teams - must be called first...
|
||||
%game.initGameVars(); //set up scoring variables and other game specific globals
|
||||
|
||||
// make team0 visible/friendly to all
|
||||
setSensorGroupAlwaysVisMask(0, 0xffffffff);
|
||||
setSensorGroupFriendlyMask(0, 0xffffffff);
|
||||
|
||||
// update colors:
|
||||
// - enemy teams are red
|
||||
// - same team is green
|
||||
// - team 0 is white
|
||||
for(%i = 0; %i < 32; %i++)
|
||||
{
|
||||
%team = (1 << %i);
|
||||
setSensorGroupColor(%i, %team, "0 255 0 255");
|
||||
setSensorGroupColor(%i, ~%team, "255 0 0 255");
|
||||
setSensorGroupColor(%i, 1, "255 255 255 255");
|
||||
|
||||
// setup the team targets (alwyas friendly and visible to same team)
|
||||
setTargetAlwaysVisMask(%i, %team);
|
||||
setTargetFriendlyMask(%i, %team);
|
||||
}
|
||||
|
||||
//set up the teams
|
||||
%game.setUpTeams();
|
||||
|
||||
//clear out the team rank array...
|
||||
for (%i = 0; %i < 32; %i++)
|
||||
$TeamRank[%i, count] = "";
|
||||
|
||||
// objectiveInit has to take place after setupTeams -- objective HUD relies on flags
|
||||
// having their team set
|
||||
MissionGroup.objectiveInit();
|
||||
|
||||
//initialize the AI system
|
||||
%game.aiInit();
|
||||
|
||||
//need to reset the teams if we switch from say, CTF to Bounty...
|
||||
// assign the bots team
|
||||
if ($currentMissionType !$= $previousMissionType)
|
||||
{
|
||||
$previousMissionType = $currentMissionType;
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAIControlled())
|
||||
%game.assignClientTeam(%cl);
|
||||
}
|
||||
}
|
||||
|
||||
//Save off respawn or Siege Team switch information...
|
||||
if(%game.class !$= "SiegeGame")
|
||||
MissionGroup.setupPositionMarkers(true);
|
||||
echo("Default game mission load done.");
|
||||
DefaultGame::missionLoadDone(%game);
|
||||
|
||||
for(%i = 1; %i < (%game.numTeams + 1); %i++)
|
||||
$teamScore[%i] = 0;
|
||||
|
|
@ -539,7 +487,7 @@ function SCtFGame::missionLoadDone(%game)
|
|||
%game.campThread_1 = schedule( 1000, 0, "checkVehicleCamping", 1 );
|
||||
%game.campThread_2 = schedule( 1000, 0, "checkVehicleCamping", 2 );
|
||||
|
||||
deleteNonSCtFObjectsFromMap();
|
||||
deleteNonSCtFObjectsFromMap();
|
||||
}
|
||||
|
||||
function SCtFGame::clientMissionDropReady(%game, %client)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,15 @@
|
|||
// Team Autobalance Script
|
||||
//
|
||||
// Determines which team needs players and proceeds to find candidates
|
||||
// Candidates are based on low scores then switches the candidate
|
||||
// Determines which team needs players and proceeds to switch them
|
||||
// Goon style: At respawn
|
||||
//
|
||||
// Enable or Disable Autobalance
|
||||
// $Host::EnableAutobalance = 1;
|
||||
//
|
||||
// exec("scripts/autoexec/Autobalance.cs");
|
||||
|
||||
// How far behind littleTeam must be to use All Mode.
|
||||
// Meaning picking from a pool of all players on the bigTeam instead of just the lowest scoring player.
|
||||
// 400 equals 400 points. 4 caps behind.
|
||||
$AllModeThreshold = 300;
|
||||
|
||||
|
||||
// Run from TeamBalanceNotify.cs via UnbalancedSound( %game )
|
||||
function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||
// Run from TeamBalanceNotify.cs via NotifyUnbalanced
|
||||
function Autobalance( %game )
|
||||
{
|
||||
if(isEventPending($AutoBalanceSchedule))
|
||||
cancel($AutoBalanceSchedule);
|
||||
|
|
@ -21,111 +17,67 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
|||
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
|
||||
return;
|
||||
|
||||
//Debug: Uncomment to enable
|
||||
//%AutobalanceDebug = true;
|
||||
|
||||
//Difference Variables
|
||||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||
|
||||
//Determine bigTeam
|
||||
//Determine BigTeam
|
||||
if( %team1difference >= 2 )
|
||||
%bigTeam = 1;
|
||||
$BigTeam = 1;
|
||||
else if( %team2difference >= 2 )
|
||||
%bigTeam = 2;
|
||||
$BigTeam = 2;
|
||||
else
|
||||
return;
|
||||
|
||||
%otherteam = $BigTeam == 1 ? 2 : 1;
|
||||
if($TeamRank[$BigTeam, count] - $TeamRank[%otherteam, count] >= 3)
|
||||
%s = "s";
|
||||
|
||||
//Warning message
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance will switch the next respawning player%2 on Team %1.', $TeamName[$BigTeam], %s);
|
||||
}
|
||||
|
||||
%littleTeam = ( %bigTeam == 1 ) ? 2 : 1;
|
||||
|
||||
//Toggle for All Mode
|
||||
//If a team is behind pick anyone, not just a low scoring player
|
||||
if( $TeamScore[%bigTeam] > ($TeamScore[%littleTeam] + $AllModeThreshold))
|
||||
{
|
||||
%UseAllMode = 1;
|
||||
%autobalanceRandom = getRandom(1,($PlayerCount[%bigTeam] - 1));
|
||||
}
|
||||
|
||||
//Pick a client for autobalance
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%team = %client.team;
|
||||
|
||||
//Holding flag?
|
||||
if(%client.player.holdingFlag !$= "")
|
||||
continue;
|
||||
|
||||
if(%UseAllMode)
|
||||
{
|
||||
//Try to pick any player
|
||||
if(%autobalanceRandom == %AllmodeLoop || %lastclient[%team] $= "")
|
||||
%teamcanidate[%team] = %client;
|
||||
|
||||
%AllmodeLoop++;
|
||||
package Autobalance
|
||||
{
|
||||
|
||||
// called from player scripts
|
||||
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation)
|
||||
{
|
||||
parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation);
|
||||
|
||||
if($BigTeam !$= "" && %clVictim.team == $BigTeam)
|
||||
{
|
||||
%otherteam = $BigTeam == 1 ? 2 : 1;
|
||||
if($TeamRank[$BigTeam, count] - $TeamRank[%otherteam, count] >= 2)
|
||||
{
|
||||
//If someone switches to observer or disconnects
|
||||
if(%damageType !$= 0)
|
||||
{
|
||||
echo(%clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing.");
|
||||
messageClient(%clVictim, 'MsgTeamBalanceNotify', '\c0You were switched to Team %1 for balancing.~wfx/powered/vehicle_screen_on.wav', $TeamName[%otherteam]);
|
||||
messageAllExcept(%clVictim, -1, 'MsgTeamBalanceNotify', '~wfx/powered/vehicle_screen_on.wav');
|
||||
|
||||
Game.clientChangeTeam( %clVictim, %otherTeam, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Normal circumstances
|
||||
//Try to pick a low scoring player
|
||||
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "")
|
||||
%teamcanidate[%team] = %client;
|
||||
$BigTeam = "";
|
||||
ResetTBNStatus();
|
||||
}
|
||||
%lastclient[%team] = %client;
|
||||
}
|
||||
|
||||
//Debug
|
||||
if( %AutobalanceDebug )
|
||||
AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys, %UseAllMode);
|
||||
|
||||
%client = %teamcanidate[%bigTeam];
|
||||
%team = %teamcanidate[%bigTeam].team;
|
||||
%otherTeam = ( %team == 1 ) ? 2 : 1;
|
||||
|
||||
// Fire Autobalance
|
||||
Game.clientChangeTeam( %client, %otherTeam, 0 );
|
||||
messageClient(%client, 'MsgTeamBalanceNotify', "\c0You were switched to the other team for balancing.~wfx/powered/vehicle_screen_on.wav");
|
||||
messageAllExcept(%client, -1, 'MsgTeamBalanceNotify', "~wfx/powered/vehicle_screen_on.wav");
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetGetCountsStatus();
|
||||
//Reset TBN
|
||||
ResetTBNStatus();
|
||||
}
|
||||
}
|
||||
|
||||
function AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys, %UseAllMode)
|
||||
function DefaultGame::gameOver(%game)
|
||||
{
|
||||
if( %teamcanidate[%bigTeam] $= "" )
|
||||
{
|
||||
%AutobalanceSafetynetTrys++;
|
||||
if(%AutobalanceSafetynetTrys $= 3)
|
||||
return;
|
||||
|
||||
if( %teamcanidate1 $= "" && %teamcanidate2 $= "" )
|
||||
%error = "Both Teams";
|
||||
else if( %teamcanidate[%bigTeam] $= "" )
|
||||
%error = "Team " @ %bigTeam;
|
||||
|
||||
if( %error !$= "" )
|
||||
messageAll('MsgTeamBalanceNotify', '\c0Autobalance error: %1', %error );
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetGetCountsStatus();
|
||||
//Rerun in 10 secs
|
||||
schedule(10000, 0, "Autobalance", %game, %AutobalanceSafetynetTrys );
|
||||
}
|
||||
Parent::gameOver(%game);
|
||||
|
||||
if(%UseAllMode)
|
||||
%mode = "All Mode";
|
||||
else
|
||||
%mode = "Low Mode";
|
||||
|
||||
if( %teamcanidate1 $= "" )
|
||||
%teamcanidate1 = "NULL";
|
||||
if( %teamcanidate2 $= "" )
|
||||
%teamcanidate2 = "NULL";
|
||||
|
||||
messageAll('MsgTeamBalanceNotify', '\c0Autobalance stat: %1, %2, %3, %4, %5', %teamcanidate1, %team1difference, %teamcanidate2, %team2difference, %mode );
|
||||
|
||||
return;
|
||||
}
|
||||
//Reset Autobalance
|
||||
$BigTeam = "";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(Autobalance))
|
||||
activatePackage(Autobalance);
|
||||
|
|
@ -10,24 +10,23 @@ package ObserverTimeout
|
|||
function serverCmdClientMakeObserver( %client )
|
||||
{
|
||||
//10 second cooldown on becoming an observer
|
||||
if( !%client.MakeObserverTimeout || %client.isAdmin )
|
||||
{
|
||||
%timeDif = getSimTime() - %client.observerTimeout;
|
||||
%timeDif1 = getSimTime() - %client.observerMsg;
|
||||
if(%timeDif > 10000 || !%client.observerTimeout || %client.isAdmin)
|
||||
{
|
||||
if ( isObject( Game ) && Game.kickClient != %client )
|
||||
Game.forceObserver( %client, "playerChoose" );
|
||||
|
||||
%client.MakeObserverTimeout = true;
|
||||
%client.ObserverProtectStart = getSimTime();
|
||||
schedule(10000, 0, "ResetMakeObserverTimeout", %client );
|
||||
%client.observerProtectStart = getSimTime();
|
||||
%client.observerTimeout = getSimTime();
|
||||
}
|
||||
//5 second cooldown on the notification
|
||||
else if( !%client.ObserverCooldownMsgPlayed )
|
||||
//1 second cooldown on message
|
||||
else if((%timeDif1 > 1000 || !%client.observerMsg))
|
||||
{
|
||||
%wait = mFloor((10000 - (getSimTime() - %client.ObserverProtectStart)) / 1000);
|
||||
%wait = mFloor((10000 - (getSimTime() - %client.observerProtectStart)) / 1000);
|
||||
messageClient(%client, 'MsgObserverCooldown', '\c3Observer Cooldown:\cr Please wait another %1 seconds.', %wait );
|
||||
//messageClient(%client, 'MsgObserverCooldown', '\c2Observer is on cooldown.' );
|
||||
|
||||
%client.ObserverCooldownMsgPlayed = true;
|
||||
schedule(2000, 0, "ResetObserverCooldownMsgPlayed", %client );
|
||||
%client.observerMsg = getSimTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,16 +34,4 @@ function serverCmdClientMakeObserver( %client )
|
|||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(ObserverTimeout))
|
||||
activatePackage(ObserverTimeout);
|
||||
|
||||
//Allow client to become observer again
|
||||
function ResetMakeObserverTimeout( %client )
|
||||
{
|
||||
%client.MakeObserverTimeout = false;
|
||||
}
|
||||
|
||||
//Allow a notification again
|
||||
function ResetObserverCooldownMsgPlayed( %client )
|
||||
{
|
||||
%client.ObserverCooldownMsgPlayed = false;
|
||||
}
|
||||
activatePackage(ObserverTimeout);
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -68,7 +68,6 @@ $dtLoadingScreen::ShowImages = 0;
|
|||
if( $Host::LoadScreenColor1 $= " " ) $Host::LoadScreenColor1 = "05edad";
|
||||
if( $Host::LoadScreenColor2 $= " " ) $Host::LoadScreenColor2 = "29DEE7";
|
||||
if( $Host::LoadScreenColor3 $= " " ) $Host::LoadScreenColor3 = "33CCCC";
|
||||
if( $Host::Info !$= " " ) $Host::Info = " ";
|
||||
|
||||
// So ServerDefaults wont replace a "" value when meant to be blank
|
||||
for(%x = 1; %x <= 4; %x++)
|
||||
|
|
@ -458,8 +457,8 @@ function NORMALsendModInfoToClient(%client)
|
|||
messageClient(%client, 'MsgLoadObjectiveLine', "", %SpecialTextLine[%line], !%singlePlayer);
|
||||
|
||||
// Send server info:
|
||||
if(!%singlePlayer)
|
||||
messageClient(%client, 'MsgLoadRulesLine', "", "<color:29DEE7>" @ $Host::Info, false);
|
||||
//if(!%singlePlayer)
|
||||
// messageClient(%client, 'MsgLoadRulesLine', "", "<color:29DEE7>" @ $Host::Info, false);
|
||||
|
||||
for(%line = 0; %line < %ServerCnt; %line++)
|
||||
if (%ServerTextLine[%line] !$= "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue