Refactored

This commit is contained in:
ChocoTaco 2022-04-18 13:14:14 -04:00
parent cbaf5818e5
commit 8ef58d73d3

View file

@ -14,8 +14,8 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType)
return false; // is not a tk return false; // is not a tk
// No Bots // No Bots
// if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled()) //if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
// return true; //return true;
// Log TeamKill // Log TeamKill
teamkillLog(%victimID, %killerID, %damageType); teamkillLog(%victimID, %killerID, %damageType);
@ -133,7 +133,15 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
if($Host::TournamentMode) if($Host::TournamentMode)
return; return;
// admins can't be kicked
if(%arg1.isAdmin)
return;
//Stop current votes
if(Game.scheduleVote !$= "")
{
//Added for vote overtime //Added for vote overtime
//Dont stop if under 90 secs left
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
if(%curTimeLeftMS <= 90000) if(%curTimeLeftMS <= 90000)
{ {
@ -148,6 +156,18 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
echo($tkvoteLog); echo($tkvoteLog);
return; return;
} }
else //Stop any current votes
{
//Notify clients the vote is being cancelled
for(%i = 0; %i < %count; %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl !$= %arg1) //dont notify the team killer
messageClient(%cl, 'VoteStarted', '\c2Vote has been cancelled due to teamkill autovote.');
}
stopCurrentVote();
}
}
//notify any admins on the other team //notify any admins on the other team
for(%i = 0; %i < ClientGroup.getCount(); %i++) for(%i = 0; %i < ClientGroup.getCount(); %i++)
@ -156,21 +176,13 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
if (%cl.isAdmin == true) if (%cl.isAdmin == true)
{ {
if(%cl.team !$= %arg1.team) //Not on admins team if(%cl.team !$= %arg1.team) //Not on admins team
messageClient(%cl, '', '\c5[A]\c1%1 \c0Teamkill Autovote started to kick %2.~wgui/objective_notification.wav', "Vote in Progress:", %arg1.nameBase); messageClient(%cl, '', '\c5[A]\c1%1 \c0Teamkill Autovote started to kick %2 on the other team.~wgui/objective_notification.wav', "Vote in Progress:", %arg1.nameBase);
} }
} }
echo(formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "Teamkill Autovote started for..." SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "#P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]"); echo(formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "Teamkill Autovote started for..." SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "#P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]");
// a vote is already running, cancel it
if(Game.scheduleVote !$= "")
stopCurrentVote();
%clientsVoting = 0; %clientsVoting = 0;
// admins can't be kicked
if(%arg1.isAdmin)
return;
Game.kickClient = %arg1; Game.kickClient = %arg1;
Game.kickClientName = %arg1.name; Game.kickClientName = %arg1.name;
Game.kickGuid = %arg1.guid; Game.kickGuid = %arg1.guid;