diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index fd62eda..7451852 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -171,10 +171,14 @@ $Host::TeamSkin4 = "dsword"; $Host::TeamSkin5 = "beagle"; $Host::TeamSkin6 = "cotp"; $Host::TimeLimit = 45; +$Host::TKMax = 12; +$Host::TKWarn1 = 4; +$Host::TKWarn2 = 8; $Host::TN::beat = 3; $Host::TN::echo = 1; $Host::TournamentMode = 0; $Host::useCustomSkins = 1; +$Host::VoteCooldown = 120; $Host::VotePassPercent = 60; $Host::VoteSpread = 20; $Host::VoteTime = "45"; diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index 4360194..39a2a07 100644 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -1143,11 +1143,13 @@ function SCtFGame::beginStalemate(%game) { %game.stalemate = true; %game.showStalemateTargets(); + // z0dd - ZOD, 5/27/03. Added anti-turtling, return flags after x minutes if(!$Host::TournamentMode) { - messageAll( 'MsgStalemate', '\c3Anti turtle initialized. Flags will be returned to bases in %1 minutes.', $Host::ClassicAntiTurtleTime); - %game.turtleSchedule = %game.schedule($Host::ClassicAntiTurtleTime * 60000, 'antiTurtle'); + messageAll( 'MsgStalemate', "\c3Anti turtle initialized. Flags will be returned to bases in " @ $Host::ClassicAntiTurtleTime @ " minutes."); + %game.turtleSchedule = %game.schedule($Host::ClassicAntiTurtleTime * 60000, "antiTurtle"); + error(formatTimeString("HH:nn:ss") SPC "Anti-Turtle thread beginning now - ID:" SPC %game.turtleSchedule); } } @@ -1156,19 +1158,28 @@ function SCtFGame::endStalemate(%game) %game.stalemate = false; %game.hideStalemateTargets(); cancel(%game.stalemateSchedule); + cancel(%game.turtleSchedule); } -// z0dd - ZOD, 5/27/03. Anti-turtle function -function CTFGame::antiTurtle(%game) +function SCtFGame::antiTurtle(%game) { if(isEventPending(%game.turtleSchedule)) - cancel(%game.turtleSchedule); + cancel(%game.turtleSchedule); - for (%i = 1; %i <= 2; %i++) - { + if(%game.turtleSchedule > 0) + %game.turtleSchedule = 0; + + if(isEventPending(%game.stalemateSchedule)) + cancel(%game.stalemateSchedule); + + if(%game.stalemateSchedule > 0) + %game.stalemateSchedule = 0; + + for (%i = 1; %i <= Game.numTeams; %i++) Game.flagReturn($TeamFlag[%i]); - messageAll( 'MsgCTFFlagReturned', '\c3Both flags returned to bases to break stalemate.~wfx/misc/flag_return.wav', 0, 0, %i); - } + + messageAll( "", "\c3Both flags returned to bases to break stalemate.~wfx/misc/flag_return.wav"); + error(formatTimeString("HH:nn:ss") SPC "Anti-Turtle thread ended"); } function SCtFGame::flagReset(%game, %flag) diff --git a/Classic/scripts/autoexec/EnableLogs.cs b/Classic/scripts/autoexec/EnableLogs.cs index 685197e..3751b21 100644 --- a/Classic/scripts/autoexec/EnableLogs.cs +++ b/Classic/scripts/autoexec/EnableLogs.cs @@ -18,7 +18,7 @@ function adminLog(%client, %msg) %ip = getField(strreplace(%client.getAddress(),":","\t"),1); // this is the info that will be logged - $AdminLog = formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ ", " @ %ip @ ", " @ %client.guid @ ", " @ %client.getAddress() @ ")" @ %msg SPC "[" @ $CurrentMission @ "]"; + $AdminLog = formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ ", " @ %ip @ ", " @ %client.guid @ ", " @ %client.getAddress() @ ")" @ %msg SPC "[" @ $CurrentMission @ "]"; %logpath = $Host::ClassicAdminLogPath; export("$AdminLog", %logpath, true); @@ -53,7 +53,7 @@ function connectLog(%client, %isDisconnect) else %name = %client.nameBase; - $ConnectLog = %inout SPC "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %name SPC "(" @ getField(%authInfo, 0) @ "," SPC %client.guid @ "," SPC %ip @ ")" SPC "[" @ $CurrentMission @ "]" SPC "NTC[" @ %ntc @ "]"; + $ConnectLog = %inout SPC "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC %name SPC "(" @ getField(%authInfo, 0) @ "," SPC %client.guid @ "," SPC %ip @ ")" SPC "[" @ $CurrentMission @ "]" SPC "NTC[" @ %ntc @ "]"; %logpath = $Host::ClassicConnLogPath; export("$ConnectLog", %logpath, true); @@ -71,7 +71,7 @@ function connectLog(%client, %isDisconnect) %arg1 = %arg1.nameBase; // this is the info that will be logged - $VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4 SPC "CM[" @ $CurrentMission @ "]"; + $VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4 SPC "CM[" @ $CurrentMission @ "]"; %logpath = $Host::ClassicVoteLogPath; export("$VoteLog", %logpath, true); @@ -115,7 +115,7 @@ function ClassicChatLog(%client, %id, %team, %msg) %team = "[Centerprint]"; } - $ClassicChatLog = "["@formattimestring("H:nn:ss")@"] "@%team SPC getTaggedString(%client.name)@": "@%msg; + $ClassicChatLog = "["@formattimestring("hh:nn:ss:a")@"] "@%team SPC getTaggedString(%client.name)@": "@%msg; $ClassicChatLog = stripChars($ClassicChatLog, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\x10\x11\co\cp"); %path = $Host::ClassicChatLogPath @ formatTimeString("/yy/mm-MM/dd.log"); export("$ClassicChatLog", %path, true); diff --git a/Classic/scripts/autoexec/NoBaseRape.cs b/Classic/scripts/autoexec/NoBaseRape.cs index f3a43e0..e93b61a 100644 --- a/Classic/scripts/autoexec/NoBaseRape.cs +++ b/Classic/scripts/autoexec/NoBaseRape.cs @@ -10,6 +10,10 @@ function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %pos %targetname = %targetObject.getDataBlock().getName(); + //Used on some maps to make invs invincible + if( %targetObject.invincible && %targetname $= "StationInventory" ) + return; + if(!$Host::TournamentMode && $Host::NoBaseRapeEnabled && $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount) { if( %targetname $= "GeneratorLarge" || %targetname $= "StationInventory" || %targetname $= "SolarPanel" ) @@ -25,37 +29,8 @@ function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %pos parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType); } -function loadMissionStage2() -{ - parent::loadMissionStage2(); - - if( $CurrentMission $= "SmallCrossing" || $CurrentMission $= "Bulwark" ) - { - if (!isActivePackage(InvincibleInvToggle)) - activatePackage(InvincibleInvToggle); - } - else if (isActivePackage(InvincibleInvToggle)) - deactivatePackage(InvincibleInvToggle); -} - }; // Prevent package from being activated if it is already if (!isActivePackage(NoBaseRape)) - activatePackage(NoBaseRape); - -package InvincibleInvToggle -{ - -function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) -{ - %targetname = %targetObject.getDataBlock().getName(); - - //Used on some maps to make invs invincible - if( %targetObject.invincible && %targetname $= "StationInventory" ) - return; - - parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType); -} - -}; \ No newline at end of file + activatePackage(NoBaseRape); \ No newline at end of file diff --git a/Classic/scripts/autoexec/TKwarn.cs b/Classic/scripts/autoexec/TKwarn.cs new file mode 100644 index 0000000..17257ec --- /dev/null +++ b/Classic/scripts/autoexec/TKwarn.cs @@ -0,0 +1,35 @@ +package TKwarn +{ + + +// From Evo +function DefaultGame::testTeamKill(%game, %victimID, %killerID) +{ + %tk = Parent::testTeamKill(%game, %victimID, %killerID); + if(!%tk) + return false; // is not a tk + + if($Host::TournamentMode || %killerID.isAdmin || %killerID.isAIcontrolled() || %victimID.isAIcontrolled()) + return true; + + // warn the player + if((%killerID.teamkills == $Host::TKWarn1 - 1) && $Host::TKWarn1 != 0) + centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nCut it out!", 5, 3); + // warn the player of his imminent kick + else if((%killerID.teamkills == $Host::TKWarn2 - 1) && $Host::TKWarn2 != 0) + centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nWith " @ $Host::TKMax @ " teamkills, you will be kicked.", 5, 3); + // kick the player + else if((%killerID.teamkills >= $Host::TKMax - 1) && $Host::TKMax != 0) + { + Game.kickClientName = %killerID.name; + kick(%killerID, false, %killerID.guid); + adminLog( %killerID, " was autokicked for too many teamkills." ); + } + return true; +} + +}; + +// Prevent package from being activated if it is already +if (!isActivePackage(TKwarn)) + activatePackage(TKwarn); \ No newline at end of file diff --git a/Classic/scripts/autoexec/TacoOverrides.cs b/Classic/scripts/autoexec/TacoOverrides.cs index 6ffbae6..2cf905c 100644 --- a/Classic/scripts/autoexec/TacoOverrides.cs +++ b/Classic/scripts/autoexec/TacoOverrides.cs @@ -3,6 +3,9 @@ // Various Overrides // +// Global water viscosity +$globalviscosity = 3; + package TacoOverrides { @@ -158,6 +161,33 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC); } +//Item 'Use' Console spam fix +function serverCmdUse(%client,%data) +{ + // Item names from the client must converted + // into DataBlocks + // %data = ItemDataBlock[%item]; + //if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix + //%client.player.use(%data); + + //Spam Fix 7/2020 + if(isObject(%client.player) && isObject(%client.getControlObject())) + %client.getControlObject().use(%data); +} + +// Global water viscosity +function DefaultGame::missionLoadDone(%game) +{ + parent::missionLoadDone(%game); + + for(%i = 0; %i < MissionGroup.getCount(); %i++) + { + %obj = MissionGroup.getObject(%i); + if(%obj.getClassName() $= "WaterBlock") + %obj.viscosity = $globalviscosity; + } +} + }; // Prevent package from being activated if it is already diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index aeca655..e7d3d3c 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -300,6 +300,12 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % } case "VoteChangeTimeLimit": + if($CMHasVoted[%client.guid] >= $Host::ClassicMaxVotes && !%isAdmin) + { + messageClient(%client, "", "\c2You have exhausted your voting rights for this mission."); + return; + } + if($CurrentMissionType $= "Siege") // Can't change time in this one { messageClient(%client, "", "\c2Cannot change the time limit in this gametype."); @@ -318,6 +324,9 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % messageClient(%client, "", "\c2Switching to this time wouldn't affect the time limit at all."); return; } + + if(%arg1 < $Host::TimeLimit) + return; if((!%isAdmin && $Host::AllowPlayerVoteTimeLimit) || (%isAdmin && %client.ForceVote)) { @@ -325,6 +334,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % %msg = %client.nameBase @ " initiated a vote to change the time limit to " @ %time @ "."; // VoteOvertime StartVOTimeVote(%game); + $CMHasVoted[%client.guid]++; } case "VoteMatchStart": @@ -612,7 +622,7 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea clearBottomPrint(%client); %client.canVote = false; - %client.rescheduleVote = schedule(($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client); + %client.rescheduleVote = schedule(($Host::VoteCooldown * 1000) + ($Host::VoteTime * 1000) , 0, "resetVotePrivs", %client); // Log Vote voteLog(%client, %typeName, %arg1, %arg2, %arg3, %arg4); diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index 4cd8e51..73b9fda 100644 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -193,6 +193,10 @@ $Host::AveragePings = 1; $Host::GuidCheck = 1; $Host::MinFlagRecordPlayerCount = 6; $Host::ItemRespawnTime = 30; +$Host::VoteCooldown = 120; +$Host::TKMax = 12; +$Host::TKWarn1 = 4; +$Host::TKWarn2 = 8; //LakRabbit $Host::LakRabbitUnlimitedDJ = 1; //Unlimited disc-jumps if enabled