From 147c8ea6b0922251d5a3cbd093fe29ee8103b9b8 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 13:30:44 -0500 Subject: [PATCH 01/15] FlagRecord: Display Difference --- Classic/scripts/CTFGame.cs | 85 ++++++++++++--------------- Classic/scripts/SCtFGame.cs | 113 +++++++++++++++++------------------- 2 files changed, 89 insertions(+), 109 deletions(-) diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index a4715e8..bc1ebf7 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -503,10 +503,10 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) if(%grabspeed) { - messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); - messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); - messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); - messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (Speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); + messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); if(%grabspeed > 300) messageAll('', "~wfx/Bonuses/high-level4-blazing.wav"); @@ -620,60 +620,49 @@ function CTFGame::flagCap(%game, %player) } } - %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? + %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag? %game.playerLostFlagTarget(%player); if($Host::ClassicEvoStats) { %record = false; + %mincheck = false; if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) - %recordit = true; + %mincheck = true; if(%game.totalFlagHeldTime[%flag]) { - %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; - %realtime = %game.formatTime(%held2, true); - if(%client.team == 1) - { - if((%held2 < $flagstats::heldTeam1) || $flagstats::heldTeam1 == 0) - { - if(%recordit) - { - $flagstats::heldTeam1 = %held2; - $flagstats::realTeam1 = %realTime; - $flagstats::nickTeam1 = %client.nameBase; - } - %record = true; - } - } - else if(%client.team == 2) - { - if((%held2 < $flagstats::heldTeam2) || $flagstats::heldTeam2 == 0) - { - if(%recordit) - { - $flagstats::heldTeam2 = %held2; - $flagstats::realTeam2 = %realTime; - $flagstats::nickTeam2 = %client.nameBase; - } - %record = true; - } - } + %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; + %realtime = %game.formatTime(%held2, true); + %tm = %client.team; - if(%record == true) - { - if(%recordit) - { - %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; - export("$flagstats::*", %fileOut, false); - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2.~wfx/misc/hunters_horde.wav"); - } - else - schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); - } - - if(!$Host::TournamentMode) - bottomprint(%client, "You captured the flag in " @ %realTime @ " seconds", 3); + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + { + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; + } + + if(%record == true) + { + if(%mincheck) + { + %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; + export("$flagstats::*", %fileOut, false); + if(%prevheld2) + %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); + } + else + schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); + } + + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); $stats::caps[%client]++; if($stats::caps[%client] > $stats::caps_counter) diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index 159425e..dedd42c 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -730,10 +730,10 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) if(%grabspeed) { - messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); - messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); - messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); - messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (Speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); + messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); + messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); if(%grabspeed > 300) messageAll('', "~wfx/Bonuses/high-level4-blazing.wav"); @@ -845,73 +845,64 @@ function SCtFGame::flagCap(%game, %player) } } - %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? - - %game.playerLostFlagTarget(%player); + %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag? + %game.playerLostFlagTarget(%player); + if($Host::ClassicEvoStats) { - %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; - %realtime = %game.formatTime(%held2, true); %record = false; + %mincheck = false; + if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) + %mincheck = true; if(%game.totalFlagHeldTime[%flag]) { - if(%client.team == 1) - { - if((%held2 < $flagstats::heldTeam1) || $flagstats::heldTeam1 == 0) - { - if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount) - { - $flagstats::heldTeam1 = %held2; - $flagstats::realTeam1 = %realTime; - $flagstats::nickTeam1 = %client.nameBase; - } - %record = true; - } - } - else if(%client.team == 2) - { - if((%held2 < $flagstats::heldTeam2) || $flagstats::heldTeam2 == 0) - { - if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount) - { - $flagstats::heldTeam2 = %held2; - $flagstats::realTeam2 = %realTime; - $flagstats::nickTeam2 = %client.nameBase; - } - %record = true; - } - } + %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; + %realtime = %game.formatTime(%held2, true); + %tm = %client.team; - if(%record == true) + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + { + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; + } + + if(%record == true) + { + if(%mincheck) + { + %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; + export("$flagstats::*", %fileOut, false); + if(%prevheld2) + %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); + } + else + schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); + } + + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); + + $stats::caps[%client]++; + if($stats::caps[%client] > $stats::caps_counter) { - if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount) - { - %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; - export("$flagstats::*", %fileOut, false); - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2.~wfx/misc/hunters_horde.wav"); - } - else - schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); + $stats::caps_counter = $stats::caps[%client]; + $stats::caps_client = getTaggedString(%client.name); + } + + if(%held2 < $stats::fastestCap || !$stats::fastestCap) + { + $stats::fastestCap = %held2; + $stats::fastcap_time = %realTime; + $stats::fastcap_client = getTaggedString(%client.name); } } - - if(!$Host::TournamentMode) - bottomprint(%client, "You captured the flag in " @ %realTime @ " seconds", 3); - - $stats::caps[%client]++; - if($stats::caps[%client] > $stats::caps_counter) - { - $stats::caps_counter = $stats::caps[%client]; - $stats::caps_client = getTaggedString(%client.name); - } - - if(%held2 < $stats::fastestCap || !$stats::fastestCap) - { - $stats::fastestCap = %held2; - $stats::fastcap_time = %realTime; - $stats::fastcap_client = getTaggedString(%client.name); - } } //award points to player and team From 5f105f8c45820c3ae3b4302ddf49d6bde1de4d06 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 13:54:00 -0500 Subject: [PATCH 02/15] Team Check --- Classic/scripts/CTFGame.cs | 17 ++++++++++------- Classic/scripts/SCtFGame.cs | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index bc1ebf7..5fcd48f 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -636,16 +636,19 @@ function CTFGame::flagCap(%game, %player) %realtime = %game.formatTime(%held2, true); %tm = %client.team; - if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + if(%tm == 1 || %tm == 2) { - if(%mincheck) + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) { - %prevheld2 = $flagstats::heldTeam[%tm]; - $flagstats::heldTeam[%tm] = %held2; - $flagstats::realTeam[%tm] = %realTime; - $flagstats::nickTeam[%tm] = %client.nameBase; + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; } - %record = true; } if(%record == true) diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index dedd42c..abdb4d4 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -861,16 +861,19 @@ function SCtFGame::flagCap(%game, %player) %realtime = %game.formatTime(%held2, true); %tm = %client.team; - if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + if(%tm == 1 || %tm == 2) { - if(%mincheck) + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) { - %prevheld2 = $flagstats::heldTeam[%tm]; - $flagstats::heldTeam[%tm] = %held2; - $flagstats::realTeam[%tm] = %realTime; - $flagstats::nickTeam[%tm] = %client.nameBase; + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; } - %record = true; } if(%record == true) From 510b766a72201acba20804944434d21185bfcc66 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 13:56:59 -0500 Subject: [PATCH 03/15] Display flag records longer --- Classic/scripts/defaultGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/scripts/defaultGame.cs b/Classic/scripts/defaultGame.cs index 7db98d1..0a12959 100755 --- a/Classic/scripts/defaultGame.cs +++ b/Classic/scripts/defaultGame.cs @@ -1782,7 +1782,7 @@ function DefaultGame::clientMissionDropReady(%game, %client) %nickTeam2 = ($flagstats::heldTeam2 ? $flagstats::nickTeam2 : "N/A"); %realTeam2 = ($flagstats::heldTeam2 ? $flagstats::realTeam2 : "N/A"); - BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3); + BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 20, 3); } } else From b02201ed8cf9cbcd41bae2b2524972d98068b634 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 14:13:52 -0500 Subject: [PATCH 04/15] Formatting No change --- Classic/scripts/CTFGame.cs | 76 ++++++++++++++++++------------------- Classic/scripts/SCtFGame.cs | 76 ++++++++++++++++++------------------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index 5fcd48f..d5912e3 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -636,51 +636,51 @@ function CTFGame::flagCap(%game, %player) %realtime = %game.formatTime(%held2, true); %tm = %client.team; - if(%tm == 1 || %tm == 2) - { - if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + if(%tm == 1 || %tm == 2) + { + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + { + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; + } + } + + if(%record == true) { if(%mincheck) { - %prevheld2 = $flagstats::heldTeam[%tm]; - $flagstats::heldTeam[%tm] = %held2; - $flagstats::realTeam[%tm] = %realTime; - $flagstats::nickTeam[%tm] = %client.nameBase; + %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; + export("$flagstats::*", %fileOut, false); + if(%prevheld2) + %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); } - %record = true; + else + schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); } - } - - if(%record == true) - { - if(%mincheck) - { - %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; - export("$flagstats::*", %fileOut, false); - if(%prevheld2) - %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); - } - else - schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); - } - bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); - $stats::caps[%client]++; - if($stats::caps[%client] > $stats::caps_counter) - { - $stats::caps_counter = $stats::caps[%client]; - $stats::caps_client = getTaggedString(%client.name); - } - - if(%held2 < $stats::fastestCap || !$stats::fastestCap) - { - $stats::fastestCap = %held2; - $stats::fastcap_time = %realTime; - $stats::fastcap_client = getTaggedString(%client.name); - } - } + $stats::caps[%client]++; + if($stats::caps[%client] > $stats::caps_counter) + { + $stats::caps_counter = $stats::caps[%client]; + $stats::caps_client = getTaggedString(%client.name); + } + + if(%held2 < $stats::fastestCap || !$stats::fastestCap) + { + $stats::fastestCap = %held2; + $stats::fastcap_time = %realTime; + $stats::fastcap_client = getTaggedString(%client.name); + } + } } //award points to player and team diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index abdb4d4..d10795c 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -861,51 +861,51 @@ function SCtFGame::flagCap(%game, %player) %realtime = %game.formatTime(%held2, true); %tm = %client.team; - if(%tm == 1 || %tm == 2) - { - if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + if(%tm == 1 || %tm == 2) + { + if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0) + { + if(%mincheck) + { + %prevheld2 = $flagstats::heldTeam[%tm]; + $flagstats::heldTeam[%tm] = %held2; + $flagstats::realTeam[%tm] = %realTime; + $flagstats::nickTeam[%tm] = %client.nameBase; + } + %record = true; + } + } + + if(%record == true) { if(%mincheck) { - %prevheld2 = $flagstats::heldTeam[%tm]; - $flagstats::heldTeam[%tm] = %held2; - $flagstats::realTeam[%tm] = %realTime; - $flagstats::nickTeam[%tm] = %client.nameBase; + %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; + export("$flagstats::*", %fileOut, false); + if(%prevheld2) + %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); } - %record = true; + else + schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); } - } - - if(%record == true) - { - if(%mincheck) - { - %fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt"; - export("$flagstats::*", %fileOut, false); - if(%prevheld2) - %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); - } - else - schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); - } - bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); - $stats::caps[%client]++; - if($stats::caps[%client] > $stats::caps_counter) - { - $stats::caps_counter = $stats::caps[%client]; - $stats::caps_client = getTaggedString(%client.name); - } - - if(%held2 < $stats::fastestCap || !$stats::fastestCap) - { - $stats::fastestCap = %held2; - $stats::fastcap_time = %realTime; - $stats::fastcap_client = getTaggedString(%client.name); - } - } + $stats::caps[%client]++; + if($stats::caps[%client] > $stats::caps_counter) + { + $stats::caps_counter = $stats::caps[%client]; + $stats::caps_client = getTaggedString(%client.name); + } + + if(%held2 < $stats::fastestCap || !$stats::fastestCap) + { + $stats::fastestCap = %held2; + $stats::fastcap_time = %realTime; + $stats::fastcap_client = getTaggedString(%client.name); + } + } } //award points to player and team From f4247a67466001bff226b2141c9cd99ebce44d38 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 14:34:07 -0500 Subject: [PATCH 05/15] Removed all trailing spaces --- Classic/scripts/CTFGame.cs | 310 +++++++++++++-------------- Classic/scripts/SCtFGame.cs | 404 ++++++++++++++++++------------------ 2 files changed, 357 insertions(+), 357 deletions(-) diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index d5912e3..b05ed33 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -2,7 +2,7 @@ //--- GAME RULES BEGIN --- //Prevent enemy from capturing your flag -//Score one point for grabbing the enemy's flag +//Score one point for grabbing the enemy's flag //To capture, your flag must be at its stand //Score 100 points each time enemy flag is captured //--- GAME RULES END --- @@ -13,14 +13,14 @@ exec("scripts/aiCTF.cs"); //-- tracking --- function CTFGame::initGameVars(%game) { - // --------------------------------------------------- + // --------------------------------------------------- // z0dd - ZOD, 9/29/02. Removed T2 demo code from here %game.SCORE_PER_SUICIDE = 0; // z0dd - ZOD, 8/19/02. No penalty for suicide! Was -10 %game.SCORE_PER_TEAMKILL = -10; - %game.SCORE_PER_DEATH = 0; + %game.SCORE_PER_DEATH = 0; %game.SCORE_PER_TK_DESTROY = -10; // z0dd - ZOD, 10/03/02. Penalty for TKing equiptment. - %game.SCORE_PER_KILL = 10; + %game.SCORE_PER_KILL = 10; %game.SCORE_PER_PLYR_FLAG_CAP = 30; %game.SCORE_PER_PLYR_FLAG_TOUCH = 20; %game.SCORE_PER_TEAM_FLAG_CAP = 100; @@ -32,7 +32,7 @@ function CTFGame::initGameVars(%game) %game.SCORE_PER_TURRET_KILL = 10; // controlled %game.SCORE_PER_TURRET_KILL_AUTO = 5; // uncontrolled, z0dd - ZOD, 5/27/03. More points, was 3 - %game.SCORE_PER_FLAG_DEFEND = 5; + %game.SCORE_PER_FLAG_DEFEND = 5; %game.SCORE_PER_CARRIER_KILL = 5; %game.SCORE_PER_FLAG_RETURN = 10; %game.SCORE_PER_STALEMATE_RETURN = 15; @@ -74,7 +74,7 @@ function CTFGame::initGameVars(%game) %game.TIME_CONSIDERED_FLAGCARRIER_THREAT = 3 * 1000; //after damaging enemy flag carrier %game.RADIUS_GEN_DEFENSE = 20; //meters - %game.RADIUS_FLAG_DEFENSE = 20; //meters + %game.RADIUS_FLAG_DEFENSE = 20; //meters %game.TOUCH_DELAY_MS = 20000; //20 secs @@ -87,9 +87,9 @@ function CTFGame::initGameVars(%game) %game.stalemateTimeMS = 60000; %game.stalemateFreqMS = 15000; %game.stalemateDurationMS = 6000; - - - // --------------------------------------------------- + + + // --------------------------------------------------- // z0dd - ZOD, 9/29/02. Removed T2 demo code from here } @@ -242,7 +242,7 @@ function Flag::onEnterLiquid(%data, %obj, %coverage, %type) if(%type > 3) // 1-3 are water, 4+ is lava and quicksand(?) { //error("flag("@%obj@") is in liquid type" SPC %type); - // Changed slightly so this can be cancelled if it leaves the + // Changed slightly so this can be cancelled if it leaves the // lava before its supposed to be returned - Ilys %obj.lavaEnterThread = Game.schedule(3000, "flagReturn", %obj); } @@ -251,7 +251,7 @@ function Flag::onEnterLiquid(%data, %obj, %coverage, %type) function Flag::onLeaveLiquid(%data, %obj, %type) { // Added to stop the flag retrun if it slides out of the lava - Ilys - if(isEventPending(%obj.lavaEnterThread)) + if(isEventPending(%obj.lavaEnterThread)) cancel(%obj.lavaEnterThread); } @@ -298,35 +298,35 @@ function CTFGame::getTeamSkin(%game, %team) else if(%team == 2) %skin = 'dsword'; else %skin = 'base'; - + case "badlands": if(%team == 1) %skin = 'swolf'; else if(%team == 2) %skin = 'dsword'; else %skin = 'base'; - + case "ice": if(%team == 1) %skin = 'swolf'; else if(%team == 2) %skin = 'beagle'; else %skin = 'base'; - + case "desert": if(%team == 1) %skin = 'cotp'; else if(%team == 2) %skin = 'beagle'; else %skin = 'base'; - + case "Volcanic": if(%team == 1) %skin = 'dsword'; else if(%team == 2) %skin = 'cotp'; else %skin = 'base'; - + default: if(%team == 2) %skin = 'baseb'; @@ -334,7 +334,7 @@ function CTFGame::getTeamSkin(%game, %team) } } else %skin = $teamSkin[%team]; - + //error("%skin = " SPC getTaggedString(%skin)); return %skin; } @@ -358,7 +358,7 @@ function CTFGame::missionLoadDone(%game) for(%i = 1; %i < (%game.numTeams + 1); %i++) $teamScore[%i] = 0; - // remove + // remove MissionGroup.clearFlagWaypoints(); //reset some globals, just in case... @@ -376,7 +376,7 @@ function CTFGame::playerTouchFlag(%game, %player, %flag) if ((%flag.carrier $= "") && (%player.getState() !$= "Dead")) { // z0dd - ZOD, 5/07/04. Cancel the lava return. - if(isEventPending(%obj.lavaEnterThread)) + if(isEventPending(%obj.lavaEnterThread)) cancel(%obj.lavaEnterThread); //flag isn't held and has been touched by a live player @@ -390,7 +390,7 @@ function CTFGame::playerTouchFlag(%game, %player, %flag) } function CTFGame::playerTouchOwnFlag(%game, %player, %flag) -{ +{ if(%flag.isHome) { if (%player.holdingFlag !$= "") @@ -400,7 +400,7 @@ function CTFGame::playerTouchOwnFlag(%game, %player, %flag) %game.flagReturn(%flag, %player); //call the AI function - %game.AIplayerTouchOwnFlag(%player, %flag); + %game.AIplayerTouchOwnFlag(%player, %flag); } function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) @@ -419,7 +419,7 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) %client = %player.client; %player.holdingFlag = %flag; //%player has this flag %flag.carrier = %player; //this %flag is carried by %player - + // attach the camera to the flag.carrier if($Observers) { @@ -430,10 +430,10 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) observeFlag(%cl, %player.client, 2, %flag.team); } } - + %player.mountImage(FlagImage, $FlagSlot, true, %game.getTeamSkin(%flag.team)); %game.playerGotFlagTarget(%player); - + //only cancel the return timer if the player is in bounds... if(!%client.outOfBounds) { @@ -484,7 +484,7 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) { // get the grab speed %grabspeed = mFloor(VectorLen(setWord(%player.getVelocity(), 2, 0)) * 3.6); - + if(%grabspeed > $stats::MaxGrabSpeed || ($stats::MaxGrabSpeed $= "")) { $stats::MaxGrabSpeed = %grabspeed; @@ -493,14 +493,14 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) } %flag.hide(true); - %flag.startFade(0, 0, false); + %flag.startFade(0, 0, false); %flag.isHome = false; if(%flag.stand) %flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand $flagStatus[%flag.team] = %client.nameBase; %teamName = %game.getTeamName(%flag.team); - + if(%grabspeed) { messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); @@ -519,7 +519,7 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag) messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag.~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase); } logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") took team "@%flag.team@" flag ("@%grabspeed@")"); // MP: 6/15/2011 added grabspeed. - + //call the AI function %game.AIplayerTouchEnemyFlag(%player, %flag); @@ -559,19 +559,19 @@ function CTFGame::playerDroppedFlag(%game, %player) { %client = %player.client; %flag = %player.holdingFlag; - + %game.updateFlagTransform(%flag); // z0dd - ZOD, 8/4/02, Call to KineticPoet's flag updater %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + %game.playerLostFlagTarget(%player); - + if($Host::ClassicEvoStats) %game.totalFlagHeldTime[%flag] = 0; %player.holdingFlag = ""; //player isn't holding a flag anymore - %flag.carrier = ""; //flag isn't held anymore + %flag.carrier = ""; //flag isn't held anymore $flagStatus[%flag.team] = ""; - + // attach the camera to the flag if($Observers) { @@ -582,9 +582,9 @@ function CTFGame::playerDroppedFlag(%game, %player) observeFlag(%cl, $TeamFlag[%flag.team], 1, %flag.team); } } - - %player.unMountImage($FlagSlot); - %flag.hide(false); //Does the throwItem function handle this? + + %player.unMountImage($FlagSlot); + %flag.hide(false); //Does the throwItem function handle this? %teamName = %game.getTeamName(%flag.team); messageTeamExcept(%client, 'MsgCTFFlagDropped', '\c2Teammate %1 dropped the %2 flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, %teamName, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held @@ -598,7 +598,7 @@ function CTFGame::playerDroppedFlag(%game, %player) //don't duplicate the schedule if there's already one in progress... if ($FlagReturnTimer[%flag] <= 0) $FlagReturnTimer[%flag] = %game.schedule(%game.FLAG_RETURN_DELAY - %game.fadeTimeMS, "flagReturnFade", %flag); - + //call the AI function %game.AIplayerDroppedFlag(%player, %flag); } @@ -608,7 +608,7 @@ function CTFGame::flagCap(%game, %player) %client = %player.client; %flag = %player.holdingFlag; %flag.carrier = ""; - + // when a player cap the flag, attach to flag again if($Observers) { @@ -621,7 +621,7 @@ function CTFGame::flagCap(%game, %player) } %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + %game.playerLostFlagTarget(%player); if($Host::ClassicEvoStats) @@ -659,21 +659,21 @@ function CTFGame::flagCap(%game, %player) export("$flagstats::*", %fileOut, false); if(%prevheld2) %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); } else schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); } - + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); - + $stats::caps[%client]++; if($stats::caps[%client] > $stats::caps_counter) { $stats::caps_counter = $stats::caps[%client]; $stats::caps_client = getTaggedString(%client.name); } - + if(%held2 < $stats::fastestCap || !$stats::fastestCap) { $stats::fastestCap = %held2; @@ -686,26 +686,26 @@ function CTFGame::flagCap(%game, %player) //award points to player and team %teamName = %game.getTeamName(%flag.team); messageTeamExcept(%client, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); - messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %held); - messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); + messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %held); + messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); messageClient(%client, 'MsgCTFFlagCapped', '\c2You captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") capped team "@%client.team@" flag"@" (Held: "@%held@")"); // MP: 6/14/2011 The team is wrong, but the stats program auto-corrects it, so just leave as is %player.holdingFlag = ""; //no longer holding it. %player.unMountImage($FlagSlot); - %game.awardScoreFlagCap(%client, %flag); + %game.awardScoreFlagCap(%client, %flag); %game.flagReset(%flag); - + //call the AI function %game.AIflagCap(%player, %flag); //Determine score status %caplimit = MissionGroup.CTF_scoreLimit; - %otherteam = ( %client.team == 1 ) ? 2 : 1; + %otherteam = ( %client.team == 1 ) ? 2 : 1; //Find out caps from score %clientteamcaps = mFloor($TeamScore[%client.team] / %game.SCORE_PER_TEAM_FLAG_CAP); %otherteamcaps = mFloor($TeamScore[%otherteam] / %game.SCORE_PER_TEAM_FLAG_CAP); - + //Determine Gamepoint if(%clientteamcaps >= (%caplimit - 1)) { @@ -758,7 +758,7 @@ function CTFGame::flagReturn(%game, %flag, %player) else %otherTeam = 1; %teamName = %game.getTeamName(%flag.team); - + // when the flag return, attach to flag again if($Observers) { @@ -769,7 +769,7 @@ function CTFGame::flagReturn(%game, %flag, %player) observeFlag(%cl, $TeamFlag[%flag.team], 1, %flag.team); } } - + if (%player !$= "") { //a player returned it @@ -779,7 +779,7 @@ function CTFGame::flagReturn(%game, %flag, %player) messageTeam(0, 'MsgCTFFlagReturned', '\c2%1 returned the %2 flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); messageClient(%client, 'MsgCTFFlagReturned', '\c2You returned your flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") returned team "@%flag.team@" flag"); - + // find out what type of return it is // stalemate return? @@ -795,14 +795,14 @@ function CTFGame::flagReturn(%game, %flag, %player) { %enemyFlagDist = vectorDist($flagPos[%flag.team], $flagPos[%otherTeam]); %dist = vectorDist(%flag.position, %flag.originalPosition); - + %rawRatio = %dist/%enemyFlagDist; %ratio = %rawRatio < 1 ? %rawRatio : 1; %percentage = mFloor( (%ratio) * 10 ) * 10; - %game.awardScoreFlagReturn(%player.client, %percentage); + %game.awardScoreFlagReturn(%player.client, %percentage); } // --------------------------------------------------- - } + } else { //returned due to timer @@ -888,10 +888,10 @@ function CTFGame::antiTurtle(%game) if(%game.stalemateSchedule > 0) %game.stalemateSchedule = 0; - + for (%i = 1; %i <= Game.numTeams; %i++) Game.flagReturn($TeamFlag[%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"); } @@ -923,7 +923,7 @@ function CTFGame::flagReset(%game, %flag) %flag.stand.getDataBlock().onFlagReturn(%flag.stand);//animate, if exterior stand //fade the flag in... - %flag.startFade(%game.fadeTimeMS, 0, false); + %flag.startFade(%game.fadeTimeMS, 0, false); // dont render base target setTargetRenderMask(%flag.waypoint.getTarget(), 0); @@ -941,7 +941,7 @@ function CTFGame::flagReset(%game, %flag) { cancel(%flag.searchSchedule); } - // -------------------------------------------------------------------------- + // -------------------------------------------------------------------------- } function CTFGame::timeLimitReached(%game) @@ -1027,7 +1027,7 @@ function CTFGame::gameOver(%game) } messageAll('MsgClearObjHud', ""); - for(%i = 0; %i < ClientGroup.getCount(); %i ++) + for(%i = 0; %i < ClientGroup.getCount(); %i ++) { %client = ClientGroup.getObject(%i); %game.resetScore(%client); @@ -1037,7 +1037,7 @@ function CTFGame::gameOver(%game) } function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) -{ +{ if(%clVictim.headshot && %damageType == $DamageType::Laser && %clVictim.team != %clAttacker.team) { %clAttacker.scoreHeadshot++; @@ -1065,16 +1065,16 @@ function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %i //the DefaultGame will set some vars DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); - + //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) if ((%clVictim.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) { %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer + cancel(%clAttacker.threatTimer); //restart timer %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT, %clAttacker.dmgdFlagCarrier = false); } } - + //////////////////////////////////////////////////////////////////////////////////////// function CTFGame::clientMissionDropReady(%game, %client) { @@ -1088,8 +1088,8 @@ function CTFGame::clientMissionDropReady(%game, %client) //%game.populateTeamRankArray(%client); //messageClient(%client, 'MsgYourRankIs', "", -1); - - messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); + + messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); DefaultGame::clientMissionDropReady(%game, %client); } @@ -1114,34 +1114,34 @@ function CTFGame::recalcScore(%game, %cl) // --------------------------------------------------- // z0dd - ZOD, 9/29/02. Removed T2 demo code from here %cl.offenseScore = %killPoints + - %cl.suicides * %game.SCORE_PER_SUICIDE + + %cl.suicides * %game.SCORE_PER_SUICIDE + %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + - %cl.teamKills * %game.SCORE_PER_TEAMKILL + + %cl.teamKills * %game.SCORE_PER_TEAMKILL + %cl.tkDestroys * %game.SCORE_PER_TK_DESTROY + // z0dd - ZOD, 10/03/02. Penalty for tking equiptment. - %cl.scoreHeadshot * %game.SCORE_PER_HEADSHOT + + %cl.scoreHeadshot * %game.SCORE_PER_HEADSHOT + %cl.scoreRearshot * %game.SCORE_PER_REARSHOT + // z0dd - ZOD, 8/25/02. Added Lance rear shot messages - %cl.scoreMidAir * %game.SCORE_PER_MIDAIR + - %cl.flagCaps * %game.SCORE_PER_PLYR_FLAG_CAP + - %cl.flagGrabs * %game.SCORE_PER_PLYR_FLAG_TOUCH + - %cl.genDestroys * %game.SCORE_PER_DESTROY_GEN + - %cl.sensorDestroys * %game.SCORE_PER_DESTROY_SENSOR + - %cl.turretDestroys * %game.SCORE_PER_DESTROY_TURRET + - %cl.iStationDestroys * %game.SCORE_PER_DESTROY_ISTATION + - %cl.vstationDestroys * %game.SCORE_PER_DESTROY_VSTATION + + %cl.scoreMidAir * %game.SCORE_PER_MIDAIR + + %cl.flagCaps * %game.SCORE_PER_PLYR_FLAG_CAP + + %cl.flagGrabs * %game.SCORE_PER_PLYR_FLAG_TOUCH + + %cl.genDestroys * %game.SCORE_PER_DESTROY_GEN + + %cl.sensorDestroys * %game.SCORE_PER_DESTROY_SENSOR + + %cl.turretDestroys * %game.SCORE_PER_DESTROY_TURRET + + %cl.iStationDestroys * %game.SCORE_PER_DESTROY_ISTATION + + %cl.vstationDestroys * %game.SCORE_PER_DESTROY_VSTATION + %cl.mpbtstationDestroys * %game.SCORE_PER_DESTROY_MPBTSTATION + // z0dd - ZOD 3/30/02. MPB Teleporter - %cl.solarDestroys * %game.SCORE_PER_DESTROY_SOLAR + - %cl.sentryDestroys * %game.SCORE_PER_DESTROY_SENTRY + - %cl.depSensorDestroys * %game.SCORE_PER_DESTROY_DEP_SENSOR + - %cl.depTurretDestroys * %game.SCORE_PER_DESTROY_DEP_TUR + + %cl.solarDestroys * %game.SCORE_PER_DESTROY_SOLAR + + %cl.sentryDestroys * %game.SCORE_PER_DESTROY_SENTRY + + %cl.depSensorDestroys * %game.SCORE_PER_DESTROY_DEP_SENSOR + + %cl.depTurretDestroys * %game.SCORE_PER_DESTROY_DEP_TUR + %cl.depStationDestroys * %game.SCORE_PER_DESTROY_DEP_INV + - %cl.vehicleScore + %cl.vehicleBonus; + %cl.vehicleScore + %cl.vehicleBonus; - %cl.defenseScore = %cl.genDefends * %game.SCORE_PER_GEN_DEFEND + + %cl.defenseScore = %cl.genDefends * %game.SCORE_PER_GEN_DEFEND + %cl.flagDefends * %game.SCORE_PER_FLAG_DEFEND + - %cl.carrierKills * %game.SCORE_PER_CARRIER_KILL + - %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + - %cl.turretKills * %game.SCORE_PER_TURRET_KILL_AUTO + - %cl.mannedturretKills * %game.SCORE_PER_TURRET_KILL + + %cl.carrierKills * %game.SCORE_PER_CARRIER_KILL + + %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + + %cl.turretKills * %game.SCORE_PER_TURRET_KILL_AUTO + + %cl.mannedturretKills * %game.SCORE_PER_TURRET_KILL + %cl.genRepairs * %game.SCORE_PER_REPAIR_GEN + %cl.SensorRepairs * %game.SCORE_PER_REPAIR_SENSOR + %cl.TurretRepairs * %game.SCORE_PER_REPAIR_TURRET + @@ -1153,7 +1153,7 @@ function CTFGame::recalcScore(%game, %cl) %cl.sentryRepairs * %game.SCORE_PER_REPAIR_SENTRY + %cl.depInvRepairs * %game.SCORE_PER_REPAIR_DEP_INV + %cl.depTurretRepairs * %game.SCORE_PER_REPAIR_DEP_TUR + - %cl.returnPts; + %cl.returnPts; // --------------------------------------------------- // z0dd - ZOD, 9/29/02. Removed T2 demo code from here @@ -1166,14 +1166,14 @@ function CTFGame::recalcScore(%game, %cl) function CTFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement) { // is this a vehicle kill rather than a player kill - + // console error message suppression if( isObject( %implement ) ) { if( %implement.getDataBlock().getName() $= "AssaultPlasmaTurret" || %implement.getDataBlock().getName() $= "BomberTurret" ) // gunner %clKiller = %implement.vehicleMounted.getMountNodeObject(1).client; else if(%implement.getDataBlock().catagory $= "Vehicles") // pilot - %clKiller = %implement.getMountNodeObject(0).client; + %clKiller = %implement.getMountNodeObject(0).client; } if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill @@ -1187,7 +1187,7 @@ function CTFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %im if (%game.testGenDefend(%clVictim, %clKiller)) %game.awardScoreGenDefend(%clKiller); - if(%game.testCarrierKill(%clVictim, %clKiller)) + if(%game.testCarrierKill(%clVictim, %clKiller)) %game.awardScoreCarrierKill(%clKiller); else { @@ -1195,35 +1195,35 @@ function CTFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %im %game.awardScoreFlagDefend(%clKiller); } if (%game.testEscortAssist(%clVictim, %clKiller)) - %game.awardScoreEscortAssist(%clKiller); - } + %game.awardScoreEscortAssist(%clKiller); + } else - { + { if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide { - %game.awardScoreSuicide(%clVictim); + %game.awardScoreSuicide(%clVictim); } else { if (%game.testTeamKill(%clVictim, %clKiller, %damageType)) //otherwise test for a teamkill %game.awardScoreTeamKill(%clVictim, %clKiller); } - } + } } function CTFGame::testFlagDefend(%game, %victimID, %killerID) { InitContainerRadiusSearch(%victimID.plyrPointOfDeath, %game.RADIUS_FLAG_DEFENSE, $TypeMasks::ItemObjectType); - %objID = containerSearchNext(); - while(%objID != 0) + %objID = containerSearchNext(); + while(%objID != 0) { %objType = %objID.getDataBlock().getName(); - if ((%objType $= "Flag") && (%objID.team == %killerID.team)) + if ((%objType $= "Flag") && (%objID.team == %killerID.team)) return true; //found the(a) killer's flag near the victim's point of death else - %objID = containerSearchNext(); + %objID = containerSearchNext(); } - return false; //didn't find a qualifying flag within required radius of victims point of death + return false; //didn't find a qualifying flag within required radius of victims point of death } function CTFGame::testGenDefend(%game, %victimID, %killerID) @@ -1233,23 +1233,23 @@ function CTFGame::testGenDefend(%game, %victimID, %killerID) while(%objID != 0) { %objType = %objID.getDataBlock().ClassName; - if ((%objType $= "generator") && (%objID.team == %killerID.team)) + if ((%objType $= "generator") && (%objID.team == %killerID.team)) return true; //found a killer's generator within required radius of victim's death else %objID = containerSearchNext(); } - return false; //didn't find a qualifying gen within required radius of victim's point of death + return false; //didn't find a qualifying gen within required radius of victim's point of death } function CTFGame::testCarrierKill(%game, %victimID, %killerID) { %flag = %victimID.plyrDiedHoldingFlag; - return ((%flag !$= "") && (%flag.team == %killerID.team)); + return ((%flag !$= "") && (%flag.team == %killerID.team)); } function CTFGame::testEscortAssist(%game, %victimID, %killerID) { - return (%victimID.dmgdFlagCarrier); + return (%victimID.dmgdFlagCarrier); } function CTFGame::awardScoreFlagCap(%game, %cl, %flag) @@ -1336,14 +1336,14 @@ function CTFGame::checkScoreLimit(%game, %team) // default of 5 if scoreLimit not defined if(%scoreLimit $= "") %scoreLimit = 5 * %game.SCORE_PER_TEAM_FLAG_CAP; - if($TeamScore[%team] >= %scoreLimit) + if($TeamScore[%team] >= %scoreLimit) %game.scoreLimitReached(); } function CTFGame::awardScoreFlagReturn(%game, %cl, %perc) { %cl.flagReturns++; //give flagreturn stat - + // --------------------------------------------------- // z0dd - ZOD, 9/29/02. Removed T2 demo code from here if (%game.SCORE_PER_FLAG_RETURN != 0) @@ -1353,7 +1353,7 @@ function CTFGame::awardScoreFlagReturn(%game, %cl, %perc) messageClient(%cl, 'scoreFlaRetMsg', 'Flag return - exceeded capping distance - %1 point bonus.', %pts, %perc); else if(%perc == 0) messageClient(%cl, 'scoreFlaRetMsg', 'You gently place the flag back on the stand.', %pts, %perc); - else + else messageClient(%cl, 'scoreFlaRetMsg', '\c0Flag return from %2%% of capping distance - %1 point bonus.', %pts, %perc); %cl.returnPts += %pts; } @@ -1395,7 +1395,7 @@ function CTFGame::awardScoreCarrierKill(%game, %killerID) messageTeamExcept(%killerID, 'msgCarKill', '\c2%1 stopped the enemy flag carrier.', %killerID.name); // z0dd - ZOD, 8/15/02. Tell team //messageTeamExcept(%killerID, 'msgCarKill', '\c0Teammate %1 received a %2 point bonus for stopping the enemy flag carrier!', %killerID.name, %game.SCORE_PER_CARRIER_KILL); } - %game.recalcScore(%killerID); + %game.recalcScore(%killerID); return %game.SCORE_PER_CARRIER_KILL; } @@ -1407,7 +1407,7 @@ function CTFGame::awardScoreFlagDefend(%game, %killerID) messageClient(%killerID, 'msgFlagDef', '\c0You received a %1 point bonus for defending your flag!', %game.SCORE_PER_FLAG_DEFEND); messageTeamExcept(%killerID, 'msgFlagDef', '\c2%1 defended our flag.', %killerID.name); // z0dd - ZOD, 8/15/02. Tell team //messageTeamExcept(%killerID, 'msgFlagDef', '\c0Teammate %1 received a %2 point bonus for defending your flag!', %killerID.name, %game.SCORE_PER_FLAG_DEFEND); - } + } %game.recalcScore(%killerID); return %game.SCORE_PER_FLAG_DEFEND; } @@ -1561,7 +1561,7 @@ function CTFGame::testValidRepair(%game, %obj) return false; else if(%obj.team != %obj.repairedBy.team) return false; - else + else { if(%obj.soiledByEnemyRepair) %obj.soiledByEnemyRepair = false; @@ -1714,8 +1714,8 @@ function CTFGame::resetScore(%game, %client) %client.depSensorDestroys = 0; %client.depTurretDestroys = 0; %client.depStationDestroys = 0; - %client.vehicleScore = 0; - %client.vehicleBonus = 0; + %client.vehicleScore = 0; + %client.vehicleBonus = 0; %client.flagDefends = 0; %client.defenseScore = 0; @@ -1744,7 +1744,7 @@ function CTFGame::enterMissionArea(%game, %playerData, %player) { if(%player.getState() $= "Dead") return; - %player.client.outOfBounds = false; + %player.client.outOfBounds = false; messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.'); logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area"); @@ -1791,7 +1791,7 @@ function CTFGame::boundaryLoseFlag(%game, %player) %flag.setCollisionTimeout(%player); %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + if($Host::ClassicEvoStats) %game.totalFlagHeldTime[%flag] = 0; @@ -1852,28 +1852,28 @@ function CTFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %vehicleType = getTaggedString(%data.targetTypeTag); if(%vehicleType !$= "MPB") %vehicleType = strlwr(%vehicleType); - + %enemyTeam = ( %destroyer.team == 1 ) ? 2 : 1; - + %scorer = 0; %multiplier = 1; - + %passengers = 0; for(%i = 0; %i < %data.numMountPoints; %i++) if(%vehicle.getMountNodeObject(%i)) %passengers++; - + //what destroyed this vehicle if(%destroyer.client) { //it was a player, or his mine, satchel, whatever... %destroyer = %destroyer.client; %scorer = %destroyer; - + // determine if the object used was a mine if(%vehicle.lastDamageType == $DamageType::Mine) %multiplier = 2; - } + } else if(%destroyer.getClassName() $= "Turret") { if(%destroyer.getControllingClient()) @@ -1882,12 +1882,12 @@ function CTFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %destroyer = %destroyer.getControllingClient(); %scorer = %destroyer; } - else + else { %destroyerName = "A turret"; %multiplier = 0; } - } + } else if(%destroyer.getDataBlock().catagory $= "Vehicles") { // Vehicle vs vehicle kill! @@ -1895,7 +1895,7 @@ function CTFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %gunnerNode = 1; else %gunnerNode = 0; - + if(%destroyer.getMountNodeObject(%gunnerNode)) { %destroyer = %destroyer.getMountNodeObject(%gunnerNode).client; @@ -1906,23 +1906,23 @@ function CTFGame::vehicleDestroyed(%game, %vehicle, %destroyer) else // Is there anything else we care about? return; - + if(%destroyerName $= "") %destroyerName = %destroyer.name; - + if(%vehicle.team == %destroyer.team) // team kill { %pref = (%vehicleType $= "Assault Tank") ? "an" : "a"; messageAll( 'msgVehicleTeamDestroy', '\c0%1 TEAMKILLED %3 %2!', %destroyerName, %vehicleType, %pref); } - + else // legit kill { //messageTeamExcept(%destroyer, 'msgVehicleDestroy', '\c0%1 destroyed an enemy %2.', %destroyerName, %vehicleType); // z0dd - ZOD, 8/20/02. not needed with new messenger on line below teamDestroyMessage(%destroyer, 'msgVehDestroyed', '\c5%1 destroyed an enemy %2!', %destroyerName, %vehicleType); // z0dd - ZOD, 8/20/02. Send teammates a destroy message messageTeam(%enemyTeam, 'msgVehicleDestroy', '\c0%1 destroyed your team\'s %2.', %destroyerName, %vehicleType); //messageClient(%destroyer, 'msgVehicleDestroy', '\c0You destroyed an enemy %1.', %vehicleType); - + if(%scorer) { %value = %game.awardScoreVehicleDestroyed(%scorer, %vehicleType, %multiplier, %passengers); @@ -1934,7 +1934,7 @@ function CTFGame::vehicleDestroyed(%game, %vehicle, %destroyer) function CTFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mult, %passengers) { // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - + if(%vehicleType $= "Grav Cycle") %base = %game.SCORE_PER_DESTROY_WILDCAT; else if(%vehicleType $= "Assault Tank") @@ -1947,11 +1947,11 @@ function CTFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mult %base = %game.SCORE_PER_DESTROY_BOMBER; else if(%vehicleType $= "Heavy Transport") %base = %game.SCORE_PER_DESTROY_TRANSPORT; - - %total = ( %base * %mult ) + ( %passengers * %game.SCORE_PER_PASSENGER ); + + %total = ( %base * %mult ) + ( %passengers * %game.SCORE_PER_PASSENGER ); %client.vehicleScore += %total; - + messageClient(%client, 'msgVehicleScore', '\c0You received a %1 point bonus for destroying an enemy %2.', %total, %vehicleType); %game.recalcScore(%client); return %total; @@ -1959,9 +1959,9 @@ function CTFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mult function CTFGame::shareScore(%game, %client, %amount) { - // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - - //error("share score of"SPC %amount SPC "from client:" SPC %client); + // z0dd - ZOD, 9/29/02. Removed T2 demo code from here + + //error("share score of"SPC %amount SPC "from client:" SPC %client); // all of the player in the bomber and tank share the points // gained from any of the others %vehicle = %client.vehicleMounted; @@ -1983,9 +1983,9 @@ function CTFGame::shareScore(%game, %client, %amount) %occCl.vehicleBonus += %amount; %game.recalcScore(%occCl); } - } + } } - + } } @@ -1995,7 +1995,7 @@ function CTFGame::awardScoreTurretKill(%game, %victimID, %implement) { if (%killer == %victimID) %game.awardScoreSuicide(%victimID); - else if (%killer.team == %victimID.team) //player controlling a turret killed a teammate + else if (%killer.team == %victimID.team) //player controlling a turret killed a teammate { %killer.teamKills++; %game.awardScoreTurretTeamKill(%victimID, %killer); @@ -2006,22 +2006,22 @@ function CTFGame::awardScoreTurretKill(%game, %victimID, %implement) %killer.mannedturretKills++; %game.recalcScore(%killer); %game.awardScoreDeath(%victimID); - } - } + } + } else if ((%killer = %implement.owner) != 0) //if it isn't controlled, award score to whoever deployed it { - if (%killer.team == %victimID.team) + if (%killer.team == %victimID.team) { %game.awardScoreDeath(%victimID); } - else + else { %killer.turretKills++; %game.recalcScore(%killer); %game.awardScoreDeath(%victimID); } - } - //default is, no one was controlling it, no one owned it. No score given. + } + //default is, no one was controlling it, no one owned it. No score given. } function CTFGame::testKill(%game, %victimID, %killerID) @@ -2031,8 +2031,8 @@ function CTFGame::testKill(%game, %victimID, %killerID) function CTFGame::awardScoreKill(%game, %killerID) { - %killerID.kills++; - %game.recalcScore(%killerID); + %killerID.kills++; + %game.recalcScore(%killerID); return %game.SCORE_PER_KILL; } @@ -2042,7 +2042,7 @@ function checkVehicleCamping( %team ) %position = $flagPos[%team]; %radius = 15; InitContainerRadiusSearch(%position, %radius, $TypeMasks::VehicleObjectType ); - + while ((%vehicle = containerSearchNext()) != 0) { %dist = containerSearchCurrRadDamageDist(); @@ -2050,12 +2050,12 @@ function checkVehicleCamping( %team ) if (%dist > %radius) continue; else - { + { //if( %vehicle.team == %team ) applyVehicleCampDamage( %vehicle ); } } - + if( %team == 1 ) Game.campThread_1 = schedule( 1000, 0, "checkVehicleCamping", 1 ); else @@ -2071,9 +2071,9 @@ function applyVehicleCampDamage( %vehicle ) return; %client = %vehicle.getMountNodeObject(0).client; // grab the pilot - + messageClient( %client, 'serverMessage', "Can't park vehicles in flag zones!" ); - %vehicle.getDataBlock().damageObject( %vehicle, 0, "0 0 0", 0.5, 0); + %vehicle.getDataBlock().damageObject( %vehicle, 0, "0 0 0", 0.5, 0); } // z0dd - ZOD, 10/02/02. Hack for flag collision bug. @@ -2144,14 +2144,14 @@ function CTFGame::voteAntiTurtleTime(%game, %admin, %newLimit) else { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; - if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) { - messageAll('MsgVotePassed', '\c2The anti-turtle time is set to %1.', %display); + messageAll('MsgVotePassed', '\c2The anti-turtle time is set to %1.', %display); $Host::ClassicAntiTurtleTime = %newLimit; %cause = "(vote)"; } - else - messageAll('MsgVoteFailed', '\c2The vote to change the anti-turtle time did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); + else + messageAll('MsgVoteFailed', '\c2The vote to change the anti-turtle time did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); } if(%cause !$= "") logEcho($AdminCl.name @ ": anti-turtle time set to "@%display SPC %cause, 1); diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index d10795c..c870ba8 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -2,7 +2,7 @@ //--- GAME RULES BEGIN --- //Prevent enemy from capturing your flag -//Score one point for grabbing the enemy's flag +//Score one point for grabbing the enemy's flag //To capture, your flag must be at its stand //Score 100 points each time enemy flag is captured //--- GAME RULES END --- @@ -32,10 +32,10 @@ function SCtFGame::initGameVars(%game) { %game.SCORE_PER_SUICIDE = 0; %game.SCORE_PER_TEAMKILL = -10; - %game.SCORE_PER_DEATH = 0; + %game.SCORE_PER_DEATH = 0; %game.SCORE_PER_TK_DESTROY = -10; - %game.SCORE_PER_KILL = 10; + %game.SCORE_PER_KILL = 10; %game.SCORE_PER_PLYR_FLAG_CAP = 30; %game.SCORE_PER_PLYR_FLAG_TOUCH = 20; %game.SCORE_PER_TEAM_FLAG_CAP = 100; @@ -47,12 +47,12 @@ function SCtFGame::initGameVars(%game) %game.SCORE_PER_TURRET_KILL = 10; %game.SCORE_PER_TURRET_KILL_AUTO = 5; - %game.SCORE_PER_FLAG_DEFEND = 5; + %game.SCORE_PER_FLAG_DEFEND = 5; %game.SCORE_PER_CARRIER_KILL = 5; %game.SCORE_PER_FLAG_RETURN = 10; %game.SCORE_PER_STALEMATE_RETURN = 15; %game.SCORE_PER_GEN_DEFEND = 5; - + %game.SCORE_PER_DESTROY_GEN = 10; %game.SCORE_PER_DESTROY_SENSOR = 4; %game.SCORE_PER_DESTROY_TURRET = 5; @@ -72,7 +72,7 @@ function SCtFGame::initGameVars(%game) %game.SCORE_PER_DESTROY_TANK = 8; %game.SCORE_PER_DESTROY_MPB = 12; %game.SCORE_PER_PASSENGER = 2; - + %game.SCORE_PER_REPAIR_GEN = 8; %game.SCORE_PER_REPAIR_SENSOR = 1; %game.SCORE_PER_REPAIR_TURRET = 4; @@ -89,7 +89,7 @@ function SCtFGame::initGameVars(%game) %game.TIME_CONSIDERED_FLAGCARRIER_THREAT = 3 * 1000; %game.RADIUS_GEN_DEFENSE = 20; - %game.RADIUS_FLAG_DEFENSE = 20; + %game.RADIUS_FLAG_DEFENSE = 20; %game.TOUCH_DELAY_MS = 20000; @@ -250,7 +250,7 @@ package SCtFGame if(%type > 3) // 1-3 are water, 4+ is lava and quicksand(?) { //error("flag("@%obj@") is in liquid type" SPC %type); - // Changed slightly so this can be cancelled if it leaves the + // Changed slightly so this can be cancelled if it leaves the // lava before its supposed to be returned - Ilys %obj.lavaEnterThread = Game.schedule(3000, "flagReturn", %obj); } @@ -259,17 +259,17 @@ package SCtFGame function Flag::onLeaveLiquid(%data, %obj, %type) { // Added to stop the flag retrun if it slides out of the lava - Ilys - if(isEventPending(%obj.lavaEnterThread)) + if(isEventPending(%obj.lavaEnterThread)) cancel(%obj.lavaEnterThread); } - - function stationTrigger::onEnterTrigger(%data, %obj, %colObj) + + function stationTrigger::onEnterTrigger(%data, %obj, %colObj) { //make sure it's a player object, and that that object is still alive if(%colObj.getDataBlock().className !$= "Armor" || %colObj.getState() $= "Dead") return; - // z0dd - ZOD, 7/13/02 Part of hack to keep people from mounting + // z0dd - ZOD, 7/13/02 Part of hack to keep people from mounting // vehicles in disallowed armors. if(%obj.station.getDataBlock().getName() !$= "StationVehicle") %colObj.client.inInv = true; @@ -311,23 +311,23 @@ package SCtFGame } } } - + function deployMineCheck(%mineObj, %player) { // explode it vgc schedule(2000, %mineObj, "explodeMine", %mineObj, true); } - + //Take out anything vehicle related function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC) - { + { //error("Armor::damageObject( "@%data@", "@%targetObject@", "@%sourceObject@", "@%position@", "@%amount@", "@%damageType@", "@%momVec@" )"); if(%targetObject.invincible || %targetObject.getState() $= "Dead") return; %targetClient = %targetObject.getOwnerClient(); if(isObject(%mineSC)) - %sourceClient = %mineSC; + %sourceClient = %mineSC; else %sourceClient = isObject(%sourceObject) ? %sourceObject.getOwnerClient() : 0; @@ -340,7 +340,7 @@ package SCtFGame %sourceTeam = %sourceClient.getSensorGroup(); else if(%damageType == $DamageType::Suicide) %sourceTeam = 0; - + // if teamdamage is off, and both parties are on the same team // (but are not the same person), apply no damage if(!$teamDamage && (%targetClient != %sourceClient) && (%targetTeam == %sourceTeam)) @@ -348,7 +348,7 @@ package SCtFGame if(%targetObject.isShielded && %damageType != $DamageType::Blaster) %amount = %data.checkShields(%targetObject, %position, %amount, %damageType); - + if(%amount == 0) return; @@ -356,14 +356,14 @@ package SCtFGame %damageScale = %data.damageScale[%damageType]; if(%damageScale !$= "") %amount *= %damageScale; - + if(%damageType == $DamageType::Laser && $InvBanList[SctF, "SniperRifle"]) //banned return; - + %flash = %targetObject.getDamageFlash() + (%amount * 2); if (%flash > 0.75) %flash = 0.75; - + // Teratos: Originally from Eolk? Mine+Disc tracking/death message support. // No Schedules by DarkTiger Ver.2 %targetClient.mineDisc = false; @@ -372,17 +372,17 @@ package SCtFGame case $DamageType::Disc: if((getSimTime() - %targetClient.mdcTime1) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime2 = getSimTime(); + + %targetClient.mdcTime2 = getSimTime(); case $DamageType::Mine: if((getSimTime() - %targetClient.mdcTime2) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime1 = getSimTime(); + + %targetClient.mdcTime1 = getSimTime(); } // -- End Mine+Disc insert. - + %previousDamage = %targetObject.getDamagePercent(); %targetObject.setDamageFlash(%flash); %targetObject.applyDamage(%amount); @@ -390,43 +390,43 @@ package SCtFGame %targetClient.lastDamagedBy = %damagingClient; %targetClient.lastDamaged = getSimTime(); - - //now call the "onKilled" function if the client was... you know... + + //now call the "onKilled" function if the client was... you know... if(%targetObject.getState() $= "Dead") { // where did this guy get it? %damLoc = %targetObject.getDamageLocation(%position); - + // should this guy be blown apart? - if( %damageType == $DamageType::Explosion || - %damageType == $DamageType::Mortar || - %damageType == $DamageType::SatchelCharge || - %damageType == $DamageType::Missile ) + if( %damageType == $DamageType::Explosion || + %damageType == $DamageType::Mortar || + %damageType == $DamageType::SatchelCharge || + %damageType == $DamageType::Missile ) { if( %previousDamage >= 0.35 ) // only if <= 35 percent damage remaining { %targetObject.setMomentumVector(%momVec); - %targetObject.blowup(); + %targetObject.blowup(); } } - + // If we were killed, max out the flash %targetObject.setDamageFlash(0.75); - + %damLoc = %targetObject.getDamageLocation(%position); Game.onClientKilled(%targetClient, %sourceClient, %damageType, %sourceObject, %damLoc); } else if ( %amount > 0.1 ) - { + { if( %targetObject.station $= "" && %targetObject.isCloaked() ) { %targetObject.setCloaked( false ); - %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); + %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); } - + playPain( %targetObject ); } - } + } }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -441,7 +441,7 @@ function SCtFGame::missionLoadDone(%game) for(%i = 1; %i < (%game.numTeams + 1); %i++) $teamScore[%i] = 0; - // remove + // remove MissionGroup.clearFlagWaypoints(); //reset some globals, just in case... @@ -451,7 +451,7 @@ function SCtFGame::missionLoadDone(%game) echo( "starting camp thread..." ); %game.campThread_1 = schedule( 1000, 0, "checkVehicleCamping", 1 ); %game.campThread_2 = schedule( 1000, 0, "checkVehicleCamping", 2 ); - + deleteNonSCtFObjectsFromMap(); } @@ -465,7 +465,7 @@ function SCtFGame::clientMissionDropReady(%game, %client) $Teams[%i].score = 0; messageClient(%client, 'MsgCTFAddTeam', "", %i, %game.getTeamName(%i), $flagStatus[%i], $TeamScore[%i]); } - messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); + messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); DefaultGame::clientMissionDropReady(%game, %client); } @@ -499,7 +499,7 @@ function SCtFGame::equip(%game, %player) %player.setInventory(GrenadeLauncher,1); %player.setInventory(DiscAmmo, %player.getDataBlock().max[DiscAmmo]); %player.setInventory(GrenadeLauncherAmmo, %player.getDataBlock().max[GrenadeLauncherAmmo]); - %player.setInventory(Grenade, %player.getDataBlock().max[Grenade]); + %player.setInventory(Grenade, %player.getDataBlock().max[Grenade]); %player.setInventory(Mine, %player.getDataBlock().max[Mine]); %player.setInventory(RepairKit,1); %player.setInventory(EnergyPack,1); @@ -594,7 +594,7 @@ function SCtFGame::gameOver(%game) } messageAll('MsgClearObjHud', ""); - for(%i = 0; %i < ClientGroup.getCount(); %i ++) + for(%i = 0; %i < ClientGroup.getCount(); %i ++) { %client = ClientGroup.getObject(%i); %game.resetScore(%client); @@ -614,7 +614,7 @@ function SCtFGame::playerTouchFlag(%game, %player, %flag) if ((%flag.carrier $= "") && (%player.getState() !$= "Dead")) { // z0dd - ZOD, 5/07/04. Cancel the lava return. - if(isEventPending(%obj.lavaEnterThread)) + if(isEventPending(%obj.lavaEnterThread)) cancel(%obj.lavaEnterThread); //flag isn't held and has been touched by a live player @@ -628,17 +628,17 @@ function SCtFGame::playerTouchFlag(%game, %player, %flag) } function SCtFGame::playerTouchOwnFlag(%game, %player, %flag) -{ +{ if(%flag.isHome) { - if (%player.holdingFlag !$= "") + if (%player.holdingFlag !$= "") %game.flagCap(%player); } - else + else %game.flagReturn(%flag, %player); - + //call the AI function - %game.AIplayerTouchOwnFlag(%player, %flag); + %game.AIplayerTouchOwnFlag(%player, %flag); } function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) @@ -667,10 +667,10 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) observeFlag(%cl, %player.client, 2, %flag.team); } } - + %player.mountImage(FlagImage, $FlagSlot, true, %game.getTeamSkin(%flag.team)); %game.playerGotFlagTarget(%player); - + //only cancel the return timer if the player is in bounds... if (!%client.outOfBounds) { @@ -692,7 +692,7 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) if (%startStalemate) %game.stalemateSchedule = %game.schedule(%game.stalemateTimeMS, beginStalemate); - + if($Host::ClassicEvoStats) { $stats::grabs[%client]++; @@ -702,39 +702,39 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) $stats::grabs_client = getTaggedString(%client.name); } } - + if($Host::ClassicEvoStats) %game.totalFlagHeldTime[%flag] = getSimTime(); } - + if($Host::ClassicEvoStats && !%player.flagStatsWait) { // get the grab speed %grabspeed = mFloor(VectorLen(setWord(%player.getVelocity(), 2, 0)) * 3.6); - + if(%grabspeed > $stats::MaxGrabSpeed || ($stats::MaxGrabSpeed $= "")) { $stats::MaxGrabSpeed = %grabspeed; $stats::Grabber = getTaggedString(%client.name); } } - + %flag.hide(true); - %flag.startFade(0, 0, false); + %flag.startFade(0, 0, false); %flag.isHome = false; if(%flag.stand) %flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand $flagStatus[%flag.team] = %client.nameBase; %teamName = %game.getTeamName(%flag.team); - + if(%grabspeed) { messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (Speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed); messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed); - + if(%grabspeed > 300) messageAll('', "~wfx/Bonuses/high-level4-blazing.wav"); } @@ -746,7 +746,7 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag) messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag.~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase); } logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") took team "@%flag.team@" flag ("@%grabspeed@")"); // MP: 6/15/2011 added grabspeed. - + //call the AI function %game.AIplayerTouchEnemyFlag(%player, %flag); @@ -787,16 +787,16 @@ function SCtFGame::playerDroppedFlag(%game, %player) %flag = %player.holdingFlag; %game.updateFlagTransform(%flag); // z0dd - ZOD, 8/4/02, Call to KineticPoet's flag updater %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + %game.playerLostFlagTarget(%player); - + if($Host::ClassicEvoStats) %game.totalFlagHeldTime[%flag] = 0; %player.holdingFlag = ""; //player isn't holding a flag anymore - %flag.carrier = ""; //flag isn't held anymore + %flag.carrier = ""; //flag isn't held anymore $flagStatus[%flag.team] = ""; - + // attach the camera to the flag if($Observers) { @@ -807,9 +807,9 @@ function SCtFGame::playerDroppedFlag(%game, %player) observeFlag(%cl, $TeamFlag[%flag.team], 1, %flag.team); } } - - %player.unMountImage($FlagSlot); - %flag.hide(false); //Does the throwItem function handle this? + + %player.unMountImage($FlagSlot); + %flag.hide(false); //Does the throwItem function handle this? %teamName = %game.getTeamName(%flag.team); messageTeamExcept(%client, 'MsgCTFFlagDropped', '\c2Teammate %1 dropped the %2 flag. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, %teamName, %flag.team, %held); // z0dd - ZOD, 8/15/02. How long flag was held @@ -823,7 +823,7 @@ function SCtFGame::playerDroppedFlag(%game, %player) //don't duplicate the schedule if there's already one in progress... if ($FlagReturnTimer[%flag] <= 0) $FlagReturnTimer[%flag] = %game.schedule(%game.FLAG_RETURN_DELAY - %game.fadeTimeMS, "flagReturnFade", %flag); - + //call the AI function %game.AIplayerDroppedFlag(%player, %flag); } @@ -833,7 +833,7 @@ function SCtFGame::flagCap(%game, %player) %client = %player.client; %flag = %player.holdingFlag; %flag.carrier = ""; - + // when a player cap the flag, attach to flag again if($Observers) { @@ -846,7 +846,7 @@ function SCtFGame::flagCap(%game, %player) } %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + %game.playerLostFlagTarget(%player); if($Host::ClassicEvoStats) @@ -884,21 +884,21 @@ function SCtFGame::flagCap(%game, %player) export("$flagstats::*", %fileOut, false); if(%prevheld2) %saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2"; - schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); + schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav"); } else schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players."); } - + bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1); - + $stats::caps[%client]++; if($stats::caps[%client] > $stats::caps_counter) { $stats::caps_counter = $stats::caps[%client]; $stats::caps_client = getTaggedString(%client.name); } - + if(%held2 < $stats::fastestCap || !$stats::fastestCap) { $stats::fastestCap = %held2; @@ -907,30 +907,30 @@ function SCtFGame::flagCap(%game, %player) } } } - + //award points to player and team %teamName = %game.getTeamName(%flag.team); messageTeamExcept(%client, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); - messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %held); - messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); + messageTeam(%flag.team, 'MsgCTFFlagCapped', '\c2Your flag was captured by %1. (Held: %5)~wfx/misc/flag_lost.wav', %client.name, 0, %flag.team, %client.team, %held); + messageTeam(0, 'MsgCTFFlagCapped', '\c2%1 captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); messageClient(%client, 'MsgCTFFlagCapped', '\c2You captured the %2 flag! (Held: %5)~wfx/misc/flag_capture.wav', %client.name, %teamName, %flag.team, %client.team, %held); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") capped team "@%client.team@" flag"@" (Held: "@%held@")"); %player.holdingFlag = ""; //no longer holding it. %player.unMountImage($FlagSlot); - %game.awardScoreFlagCap(%client, %flag); + %game.awardScoreFlagCap(%client, %flag); %game.flagReset(%flag); - + //call the AI function %game.AIflagCap(%player, %flag); //Determine score status %caplimit = MissionGroup.CTF_scoreLimit; - %otherteam = ( %client.team == 1 ) ? 2 : 1; + %otherteam = ( %client.team == 1 ) ? 2 : 1; //Find out caps from score %clientteamcaps = mFloor($TeamScore[%client.team] / %game.SCORE_PER_TEAM_FLAG_CAP); %otherteamcaps = mFloor($TeamScore[%otherteam] / %game.SCORE_PER_TEAM_FLAG_CAP); - + //Determine Gamepoint if(%clientteamcaps >= (%caplimit - 1)) { @@ -979,7 +979,7 @@ function SCtFGame::flagReturn(%game, %flag, %player) else %otherTeam = 1; %teamName = %game.getTeamName(%flag.team); - + // when the flag return, attach to flag again if($Observers) { @@ -990,7 +990,7 @@ function SCtFGame::flagReturn(%game, %flag, %player) observeFlag(%cl, $TeamFlag[%flag.team], 1, %flag.team); } } - + if (%player !$= "") { //a player returned it @@ -1000,7 +1000,7 @@ function SCtFGame::flagReturn(%game, %flag, %player) messageTeam(0, 'MsgCTFFlagReturned', '\c2%1 returned the %2 flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); messageClient(%client, 'MsgCTFFlagReturned', '\c2You returned your flag.~wfx/misc/flag_return.wav', %client.name, %teamName, %flag.team); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name logEcho(%client.nameBase@" (pl "@%player@"/cl "@%client@") returned team "@%flag.team@" flag"); - + // find out what type of return it is // stalemate return? // --------------------------------------------------- @@ -1015,13 +1015,13 @@ function SCtFGame::flagReturn(%game, %flag, %player) { %enemyFlagDist = vectorDist($flagPos[%flag.team], $flagPos[%otherTeam]); %dist = vectorDist(%flag.position, %flag.originalPosition); - + %rawRatio = %dist/%enemyFlagDist; %ratio = %rawRatio < 1 ? %rawRatio : 1; %percentage = mFloor( (%ratio) * 10 ) * 10; - %game.awardScoreFlagReturn(%player.client, %percentage); + %game.awardScoreFlagReturn(%player.client, %percentage); } - } + } else { //returned due to timer @@ -1107,10 +1107,10 @@ function SCtFGame::antiTurtle(%game) if(%game.stalemateSchedule > 0) %game.stalemateSchedule = 0; - + for (%i = 1; %i <= Game.numTeams; %i++) Game.flagReturn($TeamFlag[%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"); } @@ -1142,7 +1142,7 @@ function SCtFGame::flagReset(%game, %flag) %flag.stand.getDataBlock().onFlagReturn(%flag.stand);//animate, if exterior stand //fade the flag in... - %flag.startFade(%game.fadeTimeMS, 0, false); + %flag.startFade(%game.fadeTimeMS, 0, false); // dont render base target setTargetRenderMask(%flag.waypoint.getTarget(), 0); @@ -1159,7 +1159,7 @@ function SCtFGame::flagReset(%game, %flag) if(%flag.searchSchedule !$="") { cancel(%flag.searchSchedule); - } + } } function SCtFGame::notifyMineDeployed(%game, %mine) @@ -1206,11 +1206,11 @@ function SCtFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, % if ((%clVictim.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) { %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer + cancel(%clAttacker.threatTimer); //restart timer %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT, %clAttacker.dmgdFlagCarrier = false); } } - + //////////////////////////////////////////////////////////////////////////////////////// function SCtFGame::recalcScore(%game, %cl) @@ -1224,34 +1224,34 @@ function SCtFGame::recalcScore(%game, %cl) %killPoints = (%killValue * %killValue) / (%killValue - %deathValue); %cl.offenseScore = %killPoints + - %cl.suicides * %game.SCORE_PER_SUICIDE + + %cl.suicides * %game.SCORE_PER_SUICIDE + %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + - %cl.teamKills * %game.SCORE_PER_TEAMKILL + + %cl.teamKills * %game.SCORE_PER_TEAMKILL + %cl.tkDestroys * %game.SCORE_PER_TK_DESTROY + %cl.scoreHeadshot * %game.SCORE_PER_HEADSHOT + %cl.scoreRearshot * %game.SCORE_PER_REARSHOT + - %cl.scoreMidAir * %game.SCORE_PER_MIDAIR + - %cl.flagCaps * %game.SCORE_PER_PLYR_FLAG_CAP + - %cl.flagGrabs * %game.SCORE_PER_PLYR_FLAG_TOUCH + - %cl.genDestroys * %game.SCORE_PER_DESTROY_GEN + - %cl.sensorDestroys * %game.SCORE_PER_DESTROY_SENSOR + - %cl.turretDestroys * %game.SCORE_PER_DESTROY_TURRET + - %cl.iStationDestroys * %game.SCORE_PER_DESTROY_ISTATION + - %cl.vstationDestroys * %game.SCORE_PER_DESTROY_VSTATION + + %cl.scoreMidAir * %game.SCORE_PER_MIDAIR + + %cl.flagCaps * %game.SCORE_PER_PLYR_FLAG_CAP + + %cl.flagGrabs * %game.SCORE_PER_PLYR_FLAG_TOUCH + + %cl.genDestroys * %game.SCORE_PER_DESTROY_GEN + + %cl.sensorDestroys * %game.SCORE_PER_DESTROY_SENSOR + + %cl.turretDestroys * %game.SCORE_PER_DESTROY_TURRET + + %cl.iStationDestroys * %game.SCORE_PER_DESTROY_ISTATION + + %cl.vstationDestroys * %game.SCORE_PER_DESTROY_VSTATION + %cl.mpbtstationDestroys * %game.SCORE_PER_DESTROY_MPBTSTATION + - %cl.solarDestroys * %game.SCORE_PER_DESTROY_SOLAR + + %cl.solarDestroys * %game.SCORE_PER_DESTROY_SOLAR + %cl.sentryDestroys * %game.SCORE_PER_DESTROY_SENTRY + %cl.depSensorDestroys * %game.SCORE_PER_DESTROY_DEP_SENSOR + %cl.depTurretDestroys * %game.SCORE_PER_DESTROY_DEP_TUR + %cl.depStationDestroys * %game.SCORE_PER_DESTROY_DEP_INV + - %cl.vehicleScore + %cl.vehicleBonus; + %cl.vehicleScore + %cl.vehicleBonus; - %cl.defenseScore = %cl.genDefends * %game.SCORE_PER_GEN_DEFEND + + %cl.defenseScore = %cl.genDefends * %game.SCORE_PER_GEN_DEFEND + %cl.flagDefends * %game.SCORE_PER_FLAG_DEFEND + - %cl.carrierKills * %game.SCORE_PER_CARRIER_KILL + - %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + - %cl.turretKills * %game.SCORE_PER_TURRET_KILL_AUTO + - %cl.mannedturretKills * %game.SCORE_PER_TURRET_KILL + + %cl.carrierKills * %game.SCORE_PER_CARRIER_KILL + + %cl.escortAssists * %game.SCORE_PER_ESCORT_ASSIST + + %cl.turretKills * %game.SCORE_PER_TURRET_KILL_AUTO + + %cl.mannedturretKills * %game.SCORE_PER_TURRET_KILL + %cl.genRepairs * %game.SCORE_PER_REPAIR_GEN + %cl.SensorRepairs * %game.SCORE_PER_REPAIR_SENSOR + %cl.TurretRepairs * %game.SCORE_PER_REPAIR_TURRET + @@ -1260,7 +1260,7 @@ function SCtFGame::recalcScore(%game, %cl) %cl.mpbtstationRepairs * %game.SCORE_PER_REPAIR_MPBTSTATION + %cl.solarRepairs * %game.SCORE_PER_REPAIR_SOLAR + %cl.sentryRepairs * %game.SCORE_PER_REPAIR_SENTRY + - %cl.depSensorRepairs * %game.SCORE_PER_REPAIR_DEP_SEN + + %cl.depSensorRepairs * %game.SCORE_PER_REPAIR_DEP_SEN + %cl.depInvRepairs * %game.SCORE_PER_REPAIR_DEP_INV + %cl.depTurretRepairs * %game.SCORE_PER_REPAIR_DEP_TUR + %cl.returnPts; @@ -1278,7 +1278,7 @@ function SCtFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %i if( %implement.getDataBlock().getName() $= "AssaultPlasmaTurret" || %implement.getDataBlock().getName() $= "BomberTurret" ) // gunner %clKiller = %implement.vehicleMounted.getMountNodeObject(1).client; else if(%implement.getDataBlock().catagory $= "Vehicles") // pilot - %clKiller = %implement.getMountNodeObject(0).client; + %clKiller = %implement.getMountNodeObject(0).client; } if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill @@ -1292,7 +1292,7 @@ function SCtFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %i if (%game.testGenDefend(%clVictim, %clKiller)) %game.awardScoreGenDefend(%clKiller); - if(%game.testCarrierKill(%clVictim, %clKiller)) + if(%game.testCarrierKill(%clVictim, %clKiller)) %game.awardScoreCarrierKill(%clKiller); else { @@ -1300,35 +1300,35 @@ function SCtFGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %i %game.awardScoreFlagDefend(%clKiller); } if (%game.testEscortAssist(%clVictim, %clKiller)) - %game.awardScoreEscortAssist(%clKiller); - } + %game.awardScoreEscortAssist(%clKiller); + } else - { + { if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide { - %game.awardScoreSuicide(%clVictim); + %game.awardScoreSuicide(%clVictim); } else { if (%game.testTeamKill(%clVictim, %clKiller, %damageType)) //otherwise test for a teamkill %game.awardScoreTeamKill(%clVictim, %clKiller); } - } + } } function SCtFGame::testFlagDefend(%game, %victimID, %killerID) { InitContainerRadiusSearch(%victimID.plyrPointOfDeath, %game.RADIUS_FLAG_DEFENSE, $TypeMasks::ItemObjectType); - %objID = containerSearchNext(); - while(%objID != 0) + %objID = containerSearchNext(); + while(%objID != 0) { %objType = %objID.getDataBlock().getName(); - if ((%objType $= "Flag") && (%objID.team == %killerID.team)) + if ((%objType $= "Flag") && (%objID.team == %killerID.team)) return true; //found the(a) killer's flag near the victim's point of death else - %objID = containerSearchNext(); + %objID = containerSearchNext(); } - return false; //didn't find a qualifying flag within required radius of victims point of death + return false; //didn't find a qualifying flag within required radius of victims point of death } function SCtFGame::testGenDefend(%game, %victimID, %killerID) @@ -1338,23 +1338,23 @@ function SCtFGame::testGenDefend(%game, %victimID, %killerID) while(%objID != 0) { %objType = %objID.getDataBlock().ClassName; - if ((%objType $= "generator") && (%objID.team == %killerID.team)) + if ((%objType $= "generator") && (%objID.team == %killerID.team)) return true; //found a killer's generator within required radius of victim's death else %objID = containerSearchNext(); } - return false; //didn't find a qualifying gen within required radius of victim's point of death + return false; //didn't find a qualifying gen within required radius of victim's point of death } function SCtFGame::testCarrierKill(%game, %victimID, %killerID) { %flag = %victimID.plyrDiedHoldingFlag; - return ((%flag !$= "") && (%flag.team == %killerID.team)); + return ((%flag !$= "") && (%flag.team == %killerID.team)); } function SCtFGame::testEscortAssist(%game, %victimID, %killerID) { - return (%victimID.dmgdFlagCarrier); + return (%victimID.dmgdFlagCarrier); } function SCtFGame::testValidRepair(%game, %obj) @@ -1374,13 +1374,13 @@ function SCtFGame::testValidRepair(%game, %obj) //error(%obj SPC "was repaired by an enemy"); return false; } - else + else { if(%obj.soiledByEnemyRepair) %obj.soiledByEnemyRepair = false; return true; } -} +} function SCtFGame::awardScoreFlagCap(%game, %cl, %flag) { @@ -1422,7 +1422,7 @@ function SCtFGame::awardScoreFlagCap(%game, %cl, %flag) function SCtFGame::awardScoreFlagTouch(%game, %cl, %flag) { - + %flag.grabber = %cl; %flag.grabber.flagGrabs++; //moved from awardScoreFlagCap to correctly count flaggrabs %team = %cl.team; @@ -1458,14 +1458,14 @@ function SCtFGame::checkScoreLimit(%game, %team) // default of 5 if scoreLimit not defined if(%scoreLimit $= "") %scoreLimit = 5 * %game.SCORE_PER_TEAM_FLAG_CAP; - if($TeamScore[%team] >= %scoreLimit) + if($TeamScore[%team] >= %scoreLimit) %game.scoreLimitReached(); } function SCtFGame::awardScoreFlagReturn(%game, %cl, %perc) { %cl.flagReturns++; //give flagreturn stat - + if (%game.SCORE_PER_FLAG_RETURN != 0) { %pts = mfloor( %game.SCORE_PER_FLAG_RETURN * (%perc/100) ); @@ -1473,7 +1473,7 @@ function SCtFGame::awardScoreFlagReturn(%game, %cl, %perc) messageClient(%cl, 'scoreFlaRetMsg', 'Flag return - exceeded capping distance - %1 point bonus.', %pts, %perc); else if(%perc == 0) messageClient(%cl, 'scoreFlaRetMsg', 'You gently place the flag back on the stand.', %pts, %perc); - else + else messageClient(%cl, 'scoreFlaRetMsg', '\c0Flag return from %2%% of capping distance - %1 point bonus.', %pts, %perc); %cl.returnPts += %pts; } @@ -1512,7 +1512,7 @@ function SCtFGame::awardScoreCarrierKill(%game, %killerID) messageClient(%killerID, 'msgCarKill', '\c0You received a %1 point bonus for stopping the enemy flag carrier!', %game.SCORE_PER_CARRIER_KILL); messageTeamExcept(%killerID, 'msgCarKill', '\c2%1 stopped the enemy flag carrier.', %killerID.name); // z0dd - ZOD, 8/15/02. Tell team } - %game.recalcScore(%killerID); + %game.recalcScore(%killerID); return %game.SCORE_PER_CARRIER_KILL; } @@ -1523,7 +1523,7 @@ function SCtFGame::awardScoreFlagDefend(%game, %killerID) { messageClient(%killerID, 'msgFlagDef', '\c0You received a %1 point bonus for defending your flag!', %game.SCORE_PER_FLAG_DEFEND); messageTeamExcept(%killerID, 'msgFlagDef', '\c2%1 defended our flag.', %killerID.name); // z0dd - ZOD, 8/15/02. Tell team - } + } %game.recalcScore(%killerID); return %game.SCORE_PER_FLAG_DEFEND; } @@ -1563,8 +1563,8 @@ function SCtFGame::resetScore(%game, %client) %client.depSensorDestroys = 0; %client.depTurretDestroys = 0; %client.depStationDestroys = 0; - %client.vehicleScore = 0; - %client.vehicleBonus = 0; + %client.vehicleScore = 0; + %client.vehicleBonus = 0; %client.flagDefends = 0; %client.defenseScore = 0; @@ -1723,7 +1723,7 @@ function SCtFGame::testValidRepair(%game, %obj) return false; else if(%obj.team != %obj.repairedBy.team) return false; - else + else { if(%obj.soiledByEnemyRepair) %obj.soiledByEnemyRepair = false; @@ -1856,7 +1856,7 @@ function SCtFGame::enterMissionArea(%game, %playerData, %player) if(%player.getState() $= "Dead") return; - %player.client.outOfBounds = false; + %player.client.outOfBounds = false; messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.'); logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area"); @@ -1905,10 +1905,10 @@ function SCtFGame::boundaryLoseFlag(%game, %player) %flag.setCollisionTimeout(%player); %held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag? - + if($Host::ClassicEvoStats) %game.totalFlagHeldTime[%flag] = 0; - + %game.playerDroppedFlag(%player); // now for the tricky part -- throwing the flag back into the mission area @@ -1942,7 +1942,7 @@ function SCtFGame::boundaryLoseFlag(%game, %player) } function SCtFGame::dropFlag(%game, %player) -{ +{ if(%player.holdingFlag > 0) { if (!%player.client.outOfBounds) @@ -1965,28 +1965,28 @@ function SCtFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %vehicleType = getTaggedString(%data.targetTypeTag); if(%vehicleType !$= "MPB") %vehicleType = strlwr(%vehicleType); - + %enemyTeam = ( %destroyer.team == 1 ) ? 2 : 1; - + %scorer = 0; %multiplier = 1; - + %passengers = 0; for(%i = 0; %i < %data.numMountPoints; %i++) if(%vehicle.getMountNodeObject(%i)) %passengers++; - + //what destroyed this vehicle if(%destroyer.client) { //it was a player, or his mine, satchel, whatever... %destroyer = %destroyer.client; %scorer = %destroyer; - + // determine if the object used was a mine if(%vehicle.lastDamageType == $DamageType::Mine) %multiplier = 2; - } + } else if(%destroyer.getClassName() $= "Turret") { if(%destroyer.getControllingClient()) @@ -1995,12 +1995,12 @@ function SCtFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %destroyer = %destroyer.getControllingClient(); %scorer = %destroyer; } - else + else { %destroyerName = "A turret"; %multiplier = 0; } - } + } else if(%destroyer.getDataBlock().catagory $= "Vehicles") { // Vehicle vs vehicle kill! @@ -2008,7 +2008,7 @@ function SCtFGame::vehicleDestroyed(%game, %vehicle, %destroyer) %gunnerNode = 1; else %gunnerNode = 0; - + if(%destroyer.getMountNodeObject(%gunnerNode)) { %destroyer = %destroyer.getMountNodeObject(%gunnerNode).client; @@ -2019,23 +2019,23 @@ function SCtFGame::vehicleDestroyed(%game, %vehicle, %destroyer) else // Is there anything else we care about? return; - + if(%destroyerName $= "") %destroyerName = %destroyer.name; - + if(%vehicle.team == %destroyer.team) // team kill { %pref = (%vehicleType $= "Assault Tank") ? "an" : "a"; messageAll( 'msgVehicleTeamDestroy', '\c0%1 TEAMKILLED %3 %2!', %destroyerName, %vehicleType, %pref); } - + else // legit kill { //messageTeamExcept(%destroyer, 'msgVehicleDestroy', '\c0%1 destroyed an enemy %2.', %destroyerName, %vehicleType); // z0dd - ZOD, 8/20/02. not needed with new messenger on line below teamDestroyMessage(%destroyer, 'msgVehDestroyed', '\c5%1 destroyed an enemy %2!', %destroyerName, %vehicleType); // z0dd - ZOD, 8/20/02. Send teammates a destroy message messageTeam(%enemyTeam, 'msgVehicleDestroy', '\c0%1 destroyed your team\'s %2.', %destroyerName, %vehicleType); //messageClient(%destroyer, 'msgVehicleDestroy', '\c0You destroyed an enemy %1.', %vehicleType); - + if(%scorer) { %value = %game.awardScoreVehicleDestroyed(%scorer, %vehicleType, %multiplier, %passengers); @@ -2047,7 +2047,7 @@ function SCtFGame::vehicleDestroyed(%game, %vehicle, %destroyer) function SCtFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mult, %passengers) { // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - + if(%vehicleType $= "Grav Cycle") %base = %game.SCORE_PER_DESTROY_WILDCAT; else if(%vehicleType $= "Assault Tank") @@ -2060,11 +2060,11 @@ function SCtFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mul %base = %game.SCORE_PER_DESTROY_BOMBER; else if(%vehicleType $= "Heavy Transport") %base = %game.SCORE_PER_DESTROY_TRANSPORT; - - %total = ( %base * %mult ) + ( %passengers * %game.SCORE_PER_PASSENGER ); + + %total = ( %base * %mult ) + ( %passengers * %game.SCORE_PER_PASSENGER ); %client.vehicleScore += %total; - + messageClient(%client, 'msgVehicleScore', '\c0You received a %1 point bonus for destroying an enemy %2.', %total, %vehicleType); %game.recalcScore(%client); return %total; @@ -2072,9 +2072,9 @@ function SCtFGame::awardScoreVehicleDestroyed(%game, %client, %vehicleType, %mul function SCtFGame::shareScore(%game, %client, %amount) { - // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - - //error("share score of"SPC %amount SPC "from client:" SPC %client); + // z0dd - ZOD, 9/29/02. Removed T2 demo code from here + + //error("share score of"SPC %amount SPC "from client:" SPC %client); // all of the player in the bomber and tank share the points // gained from any of the others %vehicle = %client.vehicleMounted; @@ -2097,7 +2097,7 @@ function SCtFGame::shareScore(%game, %client, %amount) %occCl.vehicleBonus += %amount; %game.recalcScore(%occCl); } - } + } } } } @@ -2108,7 +2108,7 @@ function SCtFGame::awardScoreTurretKill(%game, %victimID, %implement) { if (%killer == %victimID) %game.awardScoreSuicide(%victimID); - else if (%killer.team == %victimID.team) //player controlling a turret killed a teammate + else if (%killer.team == %victimID.team) //player controlling a turret killed a teammate { %killer.teamKills++; %game.awardScoreTurretTeamKill(%victimID, %killer); @@ -2119,22 +2119,22 @@ function SCtFGame::awardScoreTurretKill(%game, %victimID, %implement) %killer.mannedturretKills++; %game.recalcScore(%killer); %game.awardScoreDeath(%victimID); - } - } + } + } else if ((%killer = %implement.owner) != 0) //if it isn't controlled, award score to whoever deployed it { - if (%killer.team == %victimID.team) + if (%killer.team == %victimID.team) { %game.awardScoreDeath(%victimID); } - else + else { %killer.turretKills++; %game.recalcScore(%killer); %game.awardScoreDeath(%victimID); } - } - //default is, no one was controlling it, no one owned it. No score given. + } + //default is, no one was controlling it, no one owned it. No score given. } function SCtFGame::testKill(%game, %victimID, %killerID) @@ -2144,8 +2144,8 @@ function SCtFGame::testKill(%game, %victimID, %killerID) function SCtFGame::awardScoreKill(%game, %killerID) { - %killerID.kills++; - %game.recalcScore(%killerID); + %killerID.kills++; + %game.recalcScore(%killerID); return %game.SCORE_PER_KILL; } @@ -2154,7 +2154,7 @@ function checkVehicleCamping( %team ) %position = $flagPos[%team]; %radius = 5; InitContainerRadiusSearch(%position, %radius, $TypeMasks::VehicleObjectType ); - + while ((%vehicle = containerSearchNext()) != 0) { %dist = containerSearchCurrRadDamageDist(); @@ -2162,12 +2162,12 @@ function checkVehicleCamping( %team ) if (%dist > %radius) continue; else - { + { //if( %vehicle.team == %team ) applyVehicleCampDamage( %vehicle ); } } - + if( %team == 1 ) Game.campThread_1 = schedule( 1000, 0, "checkVehicleCamping", 1 ); else @@ -2183,9 +2183,9 @@ function applyVehicleCampDamage( %vehicle ) return; %client = %vehicle.getMountNodeObject(0).client; // grab the pilot - + messageClient( %client, 'serverMessage', "Can't park vehicles in flag zones!" ); - %vehicle.getDataBlock().damageObject( %vehicle, 0, "0 0 0", 0.5, 0); + %vehicle.getDataBlock().damageObject( %vehicle, 0, "0 0 0", 0.5, 0); } // z0dd - ZOD, 10/02/02. Hack for flag collision bug. @@ -2208,12 +2208,12 @@ function SCtFGame::startFlagCollisionSearch(%game, %flag) function SCtFGame::sendGameVoteMenu(%game, %client, %key) { parent::sendGameVoteMenu( %game, %client, %key ); - + %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); - + if(!%client.canVote && !%isAdmin) return; - + if ( %game.scheduleVote $= "" ) { if(!%client.isAdmin) @@ -2270,7 +2270,7 @@ function SCtFGame::sendGameVoteMenu(%game, %client, %key) //} function SCtFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) -{ +{ switch$ (%typeName) { //case "voteAntiTurtleTime": @@ -2280,7 +2280,7 @@ function SCtFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4 case "SCtFProMode": %game.SCtFProMode(%admin, %arg1, %arg2, %arg3, %arg4); } - + parent::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); } @@ -2301,14 +2301,14 @@ function SCtFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4 // else // { // %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; -// if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) +// if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) // { -// messageAll('MsgVotePassed', '\c2The anti-turtle time is set to %1.', %display); +// messageAll('MsgVotePassed', '\c2The anti-turtle time is set to %1.', %display); // $Host::ClassicAntiTurtleTime = %newLimit; // %cause = "(vote)"; // } -// else -// messageAll('MsgVoteFailed', '\c2The vote to change the anti-turtle time did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); +// else +// messageAll('MsgVoteFailed', '\c2The vote to change the anti-turtle time did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); // } // if(%cause !$= "") // logEcho($AdminCl.name @ ": anti-turtle time set to "@%display SPC %cause, 1); @@ -2326,14 +2326,14 @@ function SCtFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4 // else // { // %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; -// if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) +// if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount)) > ($Host::VotePasspercent / 100)) // { -// messageAll('MsgVotePassed', '\c2The armor class was set to %1.', %newLimit); +// messageAll('MsgVotePassed', '\c2The armor class was set to %1.', %newLimit); // $Sctf::Armor = %newLimit; // %cause = "(vote)"; // } -// else -// messageAll('MsgVoteFailed', '\c2The vote to change the armor class did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); +// else +// messageAll('MsgVoteFailed', '\c2The vote to change the armor class did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount) * 100)); // } // switch$ ( %newLimit ) // { @@ -2371,18 +2371,18 @@ function SCtFGame::SCtFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) { if( $countdownStarted && $MatchStarted ) { - if(%admin) + if(%admin) { killeveryone(); if($Host::SCtFProMode) { messageAll('MsgAdminForce', '\c2The Admin has disabled Pro Mode.'); - + $InvBanList[SCtF, "Chaingun"] = 0; $InvBanList[SCtF, "ShockLance"] = 0; $InvBanList[SCtF, "Plasma"] = 0; - + $Host::SCtFProMode = false; } else @@ -2392,11 +2392,11 @@ function SCtFGame::SCtFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) $InvBanList[SCtF, "Chaingun"] = 1; $InvBanList[SCtF, "ShockLance"] = 1; $InvBanList[SCtF, "Plasma"] = 1; - + $Host::SCtFProMode = true; } } - else + else { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; if(%totalVotes > 0 && (%game.totalVotesFor / ClientGroup.getCount()) > ($Host::VotePasspercent / 100)) @@ -2410,7 +2410,7 @@ function SCtFGame::SCtFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) $InvBanList[SCtF, "Chaingun"] = 0; $InvBanList[SCtF, "ShockLance"] = 0; $InvBanList[SCtF, "Plasma"] = 0; - + $Host::SCtFProMode = false; } else @@ -2420,12 +2420,12 @@ function SCtFGame::SCtFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) $InvBanList[SCtF, "Chaingun"] = 1; $InvBanList[SCtF, "ShockLance"] = 1; $InvBanList[SCtF, "Plasma"] = 1; - + $Host::SCtFProMode = true; } } else - messageAll('MsgVoteFailed', '\c2Mode change did not pass: %1 percent.', mFloor(%game.totalVotesFor/ClientGroup.getCount() * 100)); + messageAll('MsgVoteFailed', '\c2Mode change did not pass: %1 percent.', mFloor(%game.totalVotesFor/ClientGroup.getCount() * 100)); } } } @@ -2504,7 +2504,7 @@ function deleteObjectsFromMapByType(%type) return; } - + deleteObjectsFromGroupByType(%team1Base0Group, %type); deleteObjectsFromGroupByType(%team2Base0Group, %type); } @@ -2540,7 +2540,7 @@ function deleteObjectsFromGroupByType(%group, %type) } function deleteNonSCtFObjectsFromMap() -{ +{ deleteObjectsFromGroupByType(MissionGroup, "Turret"); deleteObjectsFromGroupByType(MissionGroup, "StaticShape"); deleteObjectsFromGroupByType(MissionGroup, "FlyingVehicle"); From 1bff94ac83bda07b0e54fadfa39697325023a7e4 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 18 Feb 2022 15:54:51 -0500 Subject: [PATCH 06/15] Fomatting --- Classic/scripts/CTFGame.cs | 12 ++++++------ Classic/scripts/SCtFGame.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index b05ed33..db28732 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -626,12 +626,12 @@ function CTFGame::flagCap(%game, %player) if($Host::ClassicEvoStats) { - %record = false; - %mincheck = false; - if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) - %mincheck = true; - if(%game.totalFlagHeldTime[%flag]) - { + %record = false; + %mincheck = false; + if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) + %mincheck = true; + if(%game.totalFlagHeldTime[%flag]) + { %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; %realtime = %game.formatTime(%held2, true); %tm = %client.team; diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index c870ba8..31ff31f 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -851,12 +851,12 @@ function SCtFGame::flagCap(%game, %player) if($Host::ClassicEvoStats) { - %record = false; - %mincheck = false; - if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) - %mincheck = true; - if(%game.totalFlagHeldTime[%flag]) - { + %record = false; + %mincheck = false; + if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount) + %mincheck = true; + if(%game.totalFlagHeldTime[%flag]) + { %held2 = getSimTime() - %game.totalFlagHeldTime[%flag]; %realtime = %game.formatTime(%held2, true); %tm = %client.team; From d3bbf4b6dc3005bb2abdbeddc0dbdf07f4e8ee90 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Thu, 3 Mar 2022 14:00:33 -0500 Subject: [PATCH 07/15] More features --- Classic/scripts/autoexec/zzDiscordBot.cs | 196 ++++++++++++++++++++--- 1 file changed, 177 insertions(+), 19 deletions(-) diff --git a/Classic/scripts/autoexec/zzDiscordBot.cs b/Classic/scripts/autoexec/zzDiscordBot.cs index 1c9ca92..d94e5c8 100644 --- a/Classic/scripts/autoexec/zzDiscordBot.cs +++ b/Classic/scripts/autoexec/zzDiscordBot.cs @@ -12,9 +12,10 @@ $discordBot::autoStart = 0; //used on the bot to help split thigns up $discordBot::cmdSplit = "%c%"; $discordBot::cmdSubSplit = "%t%"; -//These are set via the bot +//These are set via the bot $discordBot::monitorChannel = 0; $discordBot::serverFeed = 1; + package discordPackage { @@ -202,6 +203,7 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6) sendToDiscordEmote(%msg, $discordBot::serverFeed); } } + function sendToDiscord(%msg,%channel) { if(isObject(discord) && %msg !$= "") @@ -223,14 +225,16 @@ function sendToDiscordEmote(%msg,%channel)//emote filter will be applyed used in } } function discordCon(){ - if(discord.lastState !$= "Connected"){ + if(discord.lastState !$= "Connected" && discord.lastState !$= "Connecting"){ if(isEventPending($discordBot::reconnectEvent)) cancel($discordBot::reconnectEvent); if(isObject(discord)) discord.delete(); new TCPObject(discord); discord.lastState = "Connecting"; - discord.connect($discordBot::IP); + //discord.connect($discordBot::IP); + discord.schedule(1000, "connect", $discordBot::IP); + //discord.schedule(5000, "send", "AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n"); } } function discordKill(){ @@ -241,36 +245,39 @@ function discordKill(){ function discord::onDNSFailed(%this){ %this.lastState = "DNSFailed"; - error(%this.lastState); + error("Discord" SPC %this.lastState); } function discord::onConnectFailed(%this){ - %this.lastState = "ConnectFailed"; - error(%this.lastState); - discord.delete(); if(isEventPending($discordBot::reconnectEvent)) cancel($discordBot::reconnectEvent); $discordBot::reconnectEvent = schedule($discordBot::reconnectTimeout,0,"discordCon"); + %this.lastState = "ConnectFailed"; + error("Discord" SPC %this.lastState); + discord.delete(); } function discord::onDNSResolved(%this){ %this.lastState = "DNSResolved"; - error(%this.lastState); + error("Discord" SPC %this.lastState); } function discord::onConnected(%this){ + discord.schedule(1000, "send", "AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n"); %this.lastState = "Connected"; - error(%this.lastState); - discord.send("AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n"); + error("Discord" SPC %this.lastState); } function discord::onDisconnect(%this){ - %this.lastState = "Disconnected"; - error(%this.lastState); - discord.delete(); + if(%this.lastState $= "Connecting" && $discordBot::failCon++ < 20){ + schedule(5000,0,"discordCon"); + } if(isEventPending($discordBot::reconnectEvent)) cancel($discordBot::reconnectEvent); $discordBot::reconnectEvent = schedule($discordBot::reconnectTimeout,0,"discordCon"); + %this.lastState = "Disconnected"; + error("Discord" SPC %this.lastState); + discord.delete(); } function discord::onLine(%this, %line){ @@ -279,6 +286,34 @@ function discord::onLine(%this, %line){ switch$(%cmd){ //case "Discord": //messageAll( 'MsgDiscord', '\c3Discord: \c4%1 %2',getWord(%lineStrip,1),getWords(%lineStrip,2,getWordCount(%lineStrip) -1)); + case "PLOTSTOP": + $pathMaps::running = 0; + case "PLOTPLAYER": + startPlayerPlot(getWord(%lineStrip,1)); + case "GETSTAT": + %var = getWord(%lineStrip,1); + %mon = getWord(%lineStrip,2); + %year = getWord(%lineStrip,3); + %game = getWord(%lineStrip,4); + %returnIndex = getWord(%lineStrip,5); + %nameList = $lData::name[%var,%game,"month",%mon,%year]; + %dataList = $lData::data[%var,%game,"month",%mon,%year]; + %nameList = strreplace(%nameList,"\t","%t"); + %dataList = strreplace(%dataList,"\t","%t"); + error("Discord" SPC "GETSTAT" SPC %var SPC %mon SPC %year SPC %game SPC %returnIndex); + discord.schedule(32,"send","SINSTAT" @ "%c%" @ %nameList @ "%c%" @ %dataList @ "%c%" @ %returnIndex @ "%c%" @ %var @ "\r\n"); + case "GENSTATS": + if(!$genStatsLockout){ + $genStatsLockout = 1; + %month = getWord(%lineStrip,1); + %year = getWord(%lineStrip,2); + if(%month > 0 && %year > 0){ + schedule(1000, 0, "sendLDATA", %month, %year, "CTFGame"); + } + } + else{ + sendToDiscord("Already Building Please Wait", $discordBot::monitorChannel); + } case "PING": discord.send("PONG" @ $discordBot::cmdSplit @ "\r\n"); case "PINGAVG": @@ -308,20 +343,143 @@ function discord::onLine(%this, %line){ } case "PINGLIST": if(isObject(discord) && discord.lastState $= "Connected"){ - %channel = 1; if(ClientGroup.getCount() > 0){ for(%i = 0; %i < ClientGroup.getCount(); %i++){ %cl = ClientGroup.getObject(%i); %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); %msg = %cl.namebase @ $discordBot::cmdSubSplit @ %ping @ $discordBot::cmdSubSplit @ %i; - discord.schedule(%i*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ (%channel-1) @ $discordBot::cmdSplit @ %msg @ "\r\n"); + discord.schedule(%i*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ %msg @ "\r\n"); } - discord.schedule((%i+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ (%channel-1) @ $discordBot::cmdSplit @ "msgList" @ "\r\n"); + discord.schedule((%i+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "msgList" @ "\r\n"); } } default: - error("Bad Command" SPC %line); + error("Discord Bad Command" SPC %line); } } -if(!isObject(discord) && $discordBot::autoStart) - discordCon(); +if(!isObject(discord) && $discordBot::autoStart){ + discordCon(); +} + +function sendLDATA(%month, %year, %type){ + %file = new FileObject(); + RootGroup.add(%file); + %folderPath = "serverStats/LData/*.cs"; + %count = getFileCount(%folderPath); + %found = 0; + for (%i = 0; %i < %count; %i++){ + %filepath = findNextfile(%folderPath); + %fieldPath =strreplace(%filePath,"-","\t"); + %game = getField(%fieldPath,1); + %m = getField(%fieldPath,2); // 0 path / 1 game / 2 mon / 3 year / 4 type / 5 .cs + %y = getField(%fieldPath,3); + //%lType = getField(%fieldPath,4); + if(%month $= %m && %y $= %year && %game $= %type){ + %found = 1; + break; + } + } + $dtSendDataMon = %month; + $dtSendDataYear = %year; + $dtSendDataType = %type; + if(isFile(%filepath) && %found){ + sendToDiscord("Building Big Stats", $discordBot::monitorChannel); + %file.OpenForRead(%filepath); + %i = 0; + while(!%file.isEOF()){ + %line = %file.readLine(); + if(strPos(%line,"%tguid") == -1){ + discord.schedule((%i++)*32,"send","STATSDATA" @ "%c%" @ $dtSendDataMon @ "%c%" @ $dtSendDataType @ "%c%" @ %line @ "\r\n"); + } + } + error("Sent LData To Discord" SPC %month SPC %year SPC %type SPC %i); + discord.schedule((%i++*32)+1000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildStats" @ $discordBot::cmdSplit @ %month @ $discordBot::cmdSplit @ %year @ $discordBot::cmdSplit @ %type @ $discordBot::cmdSplit @ "\r\n"); + schedule((%i++*32)+1000, 0, "unlockStatGen"); + + } + else{ + sendToDiscord("Error no file found", $discordBot::monitorChannel); + $genStatsLockout = 0; + } + %file.close(); + %file.delete(); +} +function unlockStatGen(){ + $genStatsLockout = 0; +} + +//////////////////////////////////////////////////////////////////////////////// +//Player Path Maps +//////////////////////////////////////////////////////////////////////////////// + +$pathMaps::maxCount = 32000;// default point count +$pathMaps::speed = 500; +function sendPrx(%x){ + for(%i = %x; %i < $prx::count && (%i - %x) < 100; %i++){ + %line = $prx::data[%i]; + %msg = "CDATA" @ "%c%" @ %i @ "%c%" @ %line @ "\r\n"; + if(isObject(discord)) + discord.send(%msg); + //discord.schedule(%i,"send",%msg); + } + if(%i < $prx::count) + schedule(128, 0, "sendPrx", %i); + else + discord.schedule(5000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildprx" @ $discordBot::cmdSplit @ $prx::terFile @ $discordBot::cmdSplit @ $prx::misFile @ "\r\n"); +} + +function startPlayerPlot(%count){ + if(!$pathMaps::running && (($MatchStarted + $missionRunning) == 2)){ + if(%count > 1000){ + $pathMaps::maxCount = %count; + } + $prx::terFile = Terrain.terrainFile; + $prx::misFile = $missionName; + $prx::count = 0; + $pathMaps::running = 1; + pathMapData(); + sendToDiscord("Player Plot Started" SPC $pathMaps::maxCount, $discordBot::monitorChannel); + error("Player Plot Started"); + } + else{ + sendToDiscord("Game Has Not Started Yet", $discordBot::monitorChannel); + } +} +function floorVector(%vec){ + return mFloor(getWord(%vec,0)) SPC mFloor(getWord(%vec,1)) SPC mFloor(getWord(%vec,2)); +} +function pathDataPoint(%client){ + %player = %client.player; + if(isObject(%player)){ + %veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0; + $prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime(); + $prx::count++; + } +} +function pathMapData(){ //loop to collect player position data + for(%x = 0; %x < ClientGroup.getCount(); %x++){ + %client = ClientGroup.getObject(%x); + %player = %client.player; + if(isObject(%player)){ + %pos = %player.getPosition(); + %fpos = floorVector(%pos); + if(%player.lpm !$= %fpos){ + %veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0; + $prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime(); + $prx::count++; + } + %player.lpm = %fpos; + } + } + if(!($prx::eCount++ % 10)){error("pathMapData" SPC $prx::Count);} + + if($pathMaps::running && (($MatchStarted + $missionRunning) == 2) && $prx::Count < $pathMaps::maxCount){// note will stop at end of mission + schedule($pathMaps::speed, 0,"pathMapData"); + } + else{ + $pathMaps::running = 0; + sendToDiscord("Player Plot Processing", $discordBot::monitorChannel); + error("Player Plot Tracking Has Ended"); + sendPrx(0); + } +} \ No newline at end of file From 905cf7ae4477a1f2ba8d7caaf9b325a510b86670 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Sun, 6 Mar 2022 17:15:37 -0500 Subject: [PATCH 08/15] Tournament Mode Changes No Team Damage in Tournymode Attempt to fix No Stop Vote TourneyMode (Always allow) Clear CenterPrint "Press FIRE" when teams are locked No VoteOvertime in TournyMode Disable Votekicks in Tournament Mode (Mostly Troll Votes) --- Classic/scripts/autoexec/VoteMenu.cs | 24 ++++++++++++++++-------- Classic/scripts/autoexec/VoteOverTime.cs | 3 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 991aa10..8b6e3e9 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -157,13 +157,13 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key) messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - } + //if(%multipleTeams) + //{ + // if($teamDamage) + // messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); + // else + // messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); + //} } } else @@ -258,6 +258,12 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % switch$(%typeName) { case "VoteKickPlayer": + if($Host::TournamentMode) // Dont allow Votekicks in Tournament Mode + { + messageClient(%client, "", "\c2No votekicks in Tournament Mode."); + return; + } + if(%client == %arg1) // client is trying to votekick himself return; // Use the leave button instead, pal. @@ -428,6 +434,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % %msg = %client.nameBase @ " initiated a vote to change the time limit to " @ %time SPC "minutes."; // VoteOvertime StartVOTimeVote(%game); + $CMHasVoted[%client.guid]++; } @@ -494,7 +501,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % } case "stopRunningVote": - if($VOStatus !$="InProgress") //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime + if($VOStatus !$="InProgress" || $Host::TournamentMode) //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime { if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) { @@ -1538,6 +1545,7 @@ function serverCmdClientPickedTeam(%client, %option) if($Host::TournamentMode && %client.team !$= 0) //Added { messageClient( %client, '', "Teams are locked. Ask an admin to set your team." ); + schedule(1000, 0, "ClearCenterPrint", %client); //So Press FIRE when ready is cleared, later down the pipe serverCmdClientMakeObserver( %client ); } return; diff --git a/Classic/scripts/autoexec/VoteOverTime.cs b/Classic/scripts/autoexec/VoteOverTime.cs index 314beb2..70eb648 100644 --- a/Classic/scripts/autoexec/VoteOverTime.cs +++ b/Classic/scripts/autoexec/VoteOverTime.cs @@ -76,7 +76,8 @@ function DefaultGame::gameOver(%game) // Starting a TimeVote - Sets flags so the game wont end during this vote function StartVOTimeVote(%game) { - $VOStatus = "Starting"; + if(!$Host::TournamentMode) + $VOStatus = "Starting"; } // Tribes wont change the time after its reached zero and you cant change it again afterwards until a gameover/map change. From 2e4b832642e894326f59b8775c1eda61789ec976 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 7 Mar 2022 14:08:41 -0500 Subject: [PATCH 09/15] MapChange Centerprint Message Centerprint between mapchanges --- Classic/prefs/serverPrefs.cs | 3 +++ Classic/scripts/autoexec/MissionTypeOptions.cs | 7 +++++++ Classic/scripts/serverDefaults.cs | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index 0ac2c09..e532699 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -13,6 +13,7 @@ $Host::AllowPlayerVoteSkipMission = 1; $Host::AllowPlayerVoteTeamDamage = 0; $Host::AllowPlayerVoteTimeLimit = 1; $Host::AllowPlayerVoteTournamentMode = 0; +$Host::AllowPlayerTournamentModeVotekick = 0; $Host::AnimateWithTransitions = 1; $Host::AntiPackEnable = 1; $Host::AntiPackPlayerCount = 6; @@ -139,6 +140,8 @@ $Host::LoadScreenShowLogo = 0; $Host::LoadScreenShowLogoName = "dpub/DPUB_logo"; $Host::LogIntentionalQuit = 1; $Host::Map = "VaubanLak"; +$Host::MapChangeMSG = 0; +$Host::MapChangeMSGContent = "Pickup Night\nSaturday, March 5th\nJoin discord for details"; $Host::MarkDnDObjectives = 1; $Host::MaxBotDifficulty = 0; $Host::MaxMessageLen = 140; diff --git a/Classic/scripts/autoexec/MissionTypeOptions.cs b/Classic/scripts/autoexec/MissionTypeOptions.cs index e5bf44d..baf682e 100644 --- a/Classic/scripts/autoexec/MissionTypeOptions.cs +++ b/Classic/scripts/autoexec/MissionTypeOptions.cs @@ -11,6 +11,10 @@ // $Host::PUGPassword = "pickup"; // PUG Password is always on no matter what // $Host::$PUGpasswordAlwaysOn = 1; +// Enable a center print between map changes +// $Host::MapChangeMSG = 0; +// Message Content +// $Host::MapChangeMSGContent = "Pickup Night\nSaturday, March 5th\nJoin discord for details"; package MissionTypeOptions { @@ -62,6 +66,9 @@ function loadMissionStage2() deactivatePackage(LockedTeams); parent::loadMissionStage2(); + + if($Host::MapChangeMSG) + centerPrintAll($Host::MapChangeMSGContent, 12, 3); } }; diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index 3154496..c4a395f 100755 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -186,8 +186,9 @@ $Host::AllowAdminVotes = 1; $Host::AllowPlayerVoteChangeMission = 1; $Host::AllowPlayerVoteSkipMission = 1; $Host::AllowPlayerVoteTimeLimit = 1; -$Host::AllowPlayerVoteTournamentMode = 0; -$Host::AllowPlayerVoteTeamDamage = 0; +$Host::AllowPlayerVoteTournamentMode = 1; +$Host::AllowPlayerVoteTeamDamage = 1; +$Host::AllowPlayerTournamentModeVotekick = 1; $Host::NoBaseRapeEnabled = 1; //Enable or Disable No Base Rape $Host::NoBaseRapePlayerCount = 14; //Min number players the turn off No Base Rape $Host::AveragePings = 1; //Show Average ping in F2 menu @@ -209,6 +210,8 @@ $Host::ClassicDailyHardRestart = 0; $Host::ClassicDailyHardRestartTime = "10\t00\tam"; //Hard Restart Server Time Ex:10am $Host::LoadScreenShowLogo = 0; //Special Logo on LoadScreen $Host::LoadScreenShowLogoName = "dpub/DPUB_logo"; //Logo location Filename +$Host::MapChangeMSG = 0; //Center Print between mapchanges +$Host::MapChangeMSGContent = "Pickup Night\nSaturday, March 5th\nJoin discord for details"; //LakRabbit $Host::LakRabbitUnlimitedDJ = 1; //Unlimited disc-jumps if enabled From 9c5cab55e8f678be726a3a32946d0a51a0f1fe2d Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 7 Mar 2022 14:11:46 -0500 Subject: [PATCH 10/15] Added Flags Flag for TeamDamage Voteable Flag for Votekicking in TournamentMode --- Classic/scripts/autoexec/VoteMenu.cs | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 8b6e3e9..bf9eb90 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -4,12 +4,12 @@ //$Host::AllowAdminVotes = 1; //$Host::AllowAdminStopVote = 1; //$Host::AllowAdminPassVote = 1; -//$Host::AllowMapScript = "True"; //$Host::AllowPlayerVoteChangeMission = 1; //$Host::AllowPlayerVoteSkipMission = 1; //$Host::AllowPlayerVoteTimeLimit = 1; //$Host::AllowPlayerVoteTournamentMode = 1; //$Host::AllowPlayerVoteTeamDamage = 0; +//$Host::AllowPlayerTournamentModeVotekick = 0; //Vote Delay //Delay the ability to vote (For everyone) at the beginning of the match @@ -157,13 +157,13 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key) messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - //if(%multipleTeams) - //{ - // if($teamDamage) - // messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - // else - // messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - //} + if(%multipleTeams && $Host::AllowPlayerVoteTeamDamage) + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); + } } } else @@ -258,12 +258,12 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % switch$(%typeName) { case "VoteKickPlayer": - if($Host::TournamentMode) // Dont allow Votekicks in Tournament Mode + if($Host::TournamentMode && $Host::AllowPlayerTournamentModeVotekick) // Dont allow Votekicks in Tournament Mode { messageClient(%client, "", "\c2No votekicks in Tournament Mode."); return; } - + if(%client == %arg1) // client is trying to votekick himself return; // Use the leave button instead, pal. @@ -298,7 +298,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % %msg = %client.nameBase @ " initiated a vote to kick player " @ %arg1.nameBase @ "."; //Notify any admins on the other team - for(%i = 0; %i < ClientGroup.getCount(); %i++) + for(%i = 0; %i < ClientGroup.getCount(); %i++) { %cl = ClientGroup.getObject(%i); if(%cl.isAdmin == true && %cl.team !$= %arg1.team) //Not on admins team @@ -809,7 +809,7 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client) } else { - + for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ ) { %cl = ClientGroup.getObject( %idx ); @@ -1573,22 +1573,22 @@ function serverCmdClientTeamChange(%client, %option) // 3 for three reminder notifications function VoteSound(%teamSpecific, %typename, %arg1, %arg2, %msg) -{ +{ if(Game.scheduleVote !$= "" && $Host::EnableVoteSoundReminders > 0) //Game.scheduleVote !$= "" is if vote is active { %vip = "Vote in Progress:"; //%yn = "Press Insert for Yes or Delete for No."; - + switch$(%typeName) { case "VoteKickPlayer": if(%arg1.team != 0 && Game.numTeams > 1) //Not observer { - for(%i = 0; %i < ClientGroup.getCount(); %i++) + for(%i = 0; %i < ClientGroup.getCount(); %i++) { %cl = ClientGroup.getObject(%i); if (%cl.isAdmin == true) - { + { if(%cl.team !$= %arg1.team) //Not on admins team messageClient(%cl, '', '\c5[A]\c1%1 \c0To kick %2 on the other team.~wgui/objective_notification.wav', %vip, %arg1.name); else //Is on admins team From e8aa66ba0c81f0b9d3f0aaa4583cf6de98b45330 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 7 Mar 2022 14:15:48 -0500 Subject: [PATCH 11/15] Moved --- Classic/prefs/serverPrefs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index e532699..987858b 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -8,12 +8,12 @@ $Host::AllowAdminStopVote = 1; $Host::AllowAdminStopVotes = 1; $Host::AllowAdminVotes = 1; $Host::AllowMapScript = "True"; +$Host::AllowPlayerTournamentModeVotekick = 0; $Host::AllowPlayerVoteChangeMission = 1; $Host::AllowPlayerVoteSkipMission = 1; $Host::AllowPlayerVoteTeamDamage = 0; $Host::AllowPlayerVoteTimeLimit = 1; $Host::AllowPlayerVoteTournamentMode = 0; -$Host::AllowPlayerTournamentModeVotekick = 0; $Host::AnimateWithTransitions = 1; $Host::AntiPackEnable = 1; $Host::AntiPackPlayerCount = 6; From fca50623811a0ed9928735b1d161a1dbd585678a Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 7 Mar 2022 15:12:59 -0500 Subject: [PATCH 12/15] Oops false --- Classic/scripts/autoexec/VoteMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index bf9eb90..7bf3357 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -258,7 +258,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % switch$(%typeName) { case "VoteKickPlayer": - if($Host::TournamentMode && $Host::AllowPlayerTournamentModeVotekick) // Dont allow Votekicks in Tournament Mode + if($Host::TournamentMode && !$Host::AllowPlayerTournamentModeVotekick) // Dont allow Votekicks in Tournament Mode { messageClient(%client, "", "\c2No votekicks in Tournament Mode."); return; From f913bd803a21618d7d8bc17bf84858d5af1c13c5 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Tue, 8 Mar 2022 18:28:12 -0500 Subject: [PATCH 13/15] Lowered --- Classic/scripts/autoexec/zzDiscordBot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/scripts/autoexec/zzDiscordBot.cs b/Classic/scripts/autoexec/zzDiscordBot.cs index d94e5c8..9e36c79 100644 --- a/Classic/scripts/autoexec/zzDiscordBot.cs +++ b/Classic/scripts/autoexec/zzDiscordBot.cs @@ -415,7 +415,7 @@ function unlockStatGen(){ $pathMaps::maxCount = 32000;// default point count $pathMaps::speed = 500; function sendPrx(%x){ - for(%i = %x; %i < $prx::count && (%i - %x) < 100; %i++){ + for(%i = %x; %i < $prx::count && (%i - %x) < 50; %i++){ %line = $prx::data[%i]; %msg = "CDATA" @ "%c%" @ %i @ "%c%" @ %line @ "\r\n"; if(isObject(discord)) From 57778142c65782921c67544c1da8f68361618d1b Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Sun, 3 Apr 2022 15:31:43 -0400 Subject: [PATCH 14/15] Added Classic weapTurretCode.cs --- Classic/scripts/weapTurretCode.cs | 985 ++++++++++++++++++++++++++++++ 1 file changed, 985 insertions(+) create mode 100644 Classic/scripts/weapTurretCode.cs diff --git a/Classic/scripts/weapTurretCode.cs b/Classic/scripts/weapTurretCode.cs new file mode 100644 index 0000000..2d34adf --- /dev/null +++ b/Classic/scripts/weapTurretCode.cs @@ -0,0 +1,985 @@ +//-------------------------------------- Ammo functions +function Ammo::onCollision(%data, %obj, %col) +{ + // %data = datablock of object; %obj = object number + // %col = thing that collided with object (hopefully a player) + + if (%col.getDataBlock().className $= Armor) + { + %ammoName = %data.getName(); + %ammoStore = %col.inv[%ammoName]; + + // if player has ammo pack, increase max amount of ammo + if(%col.getMountedImage($BackpackSlot) != 0) + { + if(%col.getMountedImage($BackpackSlot).getName() $= "AmmoPackImage") + %aMax = (%col.getDataBlock().max[%ammoName]) + AmmoPack.max[%ammoName]; + else + %aMax = %col.getDataBlock().max[%ammoName]; + } + else + %aMax = %col.getDataBlock().max[%ammoName]; + + if(%col.inv[%ammoName] < %aMax) + { + if( %obj.ammoStore $= "" ) + %obj.ammoStore = $AmmoIncrement[ %ammoName ]; + + %col.incInventory(%ammoName, %obj.ammoStore); + serverPlay3D(ItemPickupSound, %col.getTransform()); + %obj.respawn(); + if (%col.client > 0) + messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName); + } + } +} + +function GrenadeThrown::onCollision(%data, %obj, %col) +{ + // nothing you can do now... +} + +function HandInventory::onCollision(%data, %obj, %col) +{ + // %data = datablock of object; %obj = object number + // %col = thing that collided with object (hopefully a player) + if (%col.getDataBlock().className $= Armor) + { + %ammoName = %data.getName(); + %ammoStore = %col.inv[%ammoName]; + + // if player has ammo pack, increase max amount of ammo + if(%col.getMountedImage($BackpackSlot) != 0) + { + if(%col.getMountedImage($BackpackSlot).getName() $= "AmmoPackImage") + %aMax = (%col.getDataBlock().max[%ammoName]) + AmmoPack.max[%ammoName]; + else + %aMax = %col.getDataBlock().max[%ammoName]; + } + else + %aMax = %col.getDataBlock().max[%ammoName]; + + if(%data.isGrenade) + { + // it's a grenade -- see if it matches the type the player is carrying + %pgType = "None"; + for(%x = 0; $InvGrenade[%x] !$= ""; %x++) + { + %gren = $NameToInv[$InvGrenade[%x]]; + if(%col.inv[%gren] > 0) + { + %pgType = %gren; + break; + } + } + if((%pgType $= "None") || (%pgType $= %ammoName)) + { + // player either has no grenades or this type of grenades -- OK to pick up more + %canPickup = true; + } + else + { + // player has a different kind of grenade -- don't pick this kind up + %canPickup = false; + } + } + else if(%data.isMine) // z0dd - ZOD, 5/19/03. Check mines too! + { + // it's a mine -- see if it matches the type the player is carrying + %pmType = "None"; + for(%y = 0; $InvMine[%y] !$= ""; %y++) + { + %mine = $NameToInv[$InvMine[%y]]; + if(%col.inv[%mine] > 0) + { + %pmType = %mine; + break; + } + } + if((%pmType $= "None") || (%pmType $= %ammoName)) + { + // player either has no mines or this type of mine -- OK to pick up more + %canPickup = true; + } + else + { + // player has a different kind of mine -- don't pick this kind up + %canPickup = false; + } + } + else + %canPickup = true; + + if(%canPickup) + { + if(%col.inv[%ammoName] < %aMax) + { + //------------------------------------------------------------------------------------------- + // z0dd - ZOD, 4/17/02. Don't allow player to pickup full ammo if they tossed less than full. + if( %obj.ammoStore $= "" ) + %obj.ammoStore = $AmmoIncrement[ %ammoName ]; + %col.incInventory(%ammoName, %obj.ammoStore); + //------------------------------------------------------------------------------------------- + serverPlay3D(ItemPickupSound, %col.getTransform()); + %obj.respawn(); + if (%col.client > 0) + messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName); + } + } + } +} + +//-------------------------------------- Specific turret functions + +function SentryTurret::onAdd(%data, %obj) +{ + Parent::onAdd(%data, %obj); + + //error("error"); + %obj.mountImage(%data.barrel, 0, true); +} + +function TurretDeployedCamera::onAdd(%this, %obj) +{ + Parent::onAdd(%this, %obj); + %obj.mountImage(DeployableCameraBarrel, 0, true); + %obj.setRechargeRate(%this.rechargeRate); + + %obj.setAutoFire(false); // z0dd - ZOD, 4/17/02. Server crash fix related to controlable cameras +} + +function TurretDeployedCamera::onDestroyed(%this, %obj, %prevState) +{ + Parent::onDestroyed(%this, %obj, %prevState); + $TeamDeployedCount[%obj.team, DeployedCamera]--; + // doesn't seem to delete itself, so... + %obj.schedule(500, "delete"); +} + +function ScoutFlyer::onTrigger(%data, %obj, %trigger, %state) +{ + // data = ScoutFlyer datablock + // obj = ScoutFlyer object number + // trigger = 0 for "fire", 1 for "jump", 3 for "thrust" + // state = 1 for firing, 0 for not firing + if(%trigger == 0) + { + switch (%state) { + case 0: + %obj.fireWeapon = false; + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(3, false); + case 1: + %obj.fireWeapon = true; + if(%obj.nextWeaponFire == 2) { + %obj.setImageTrigger(2, true); + %obj.setImageTrigger(3, false); + } + else { + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(3, true); + } + } + } +} + +function ScoutFlyer::playerDismounted(%data, %obj, %player) +{ + %obj.fireWeapon = false; + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(3, false); + setTargetSensorGroup(%obj.getTarget(), %obj.team); + + if( %player.client.observeCount > 0 ) + resetObserveFollow( %player.client, true ); +} + +function ScoutChaingunImage::onFire(%data,%obj,%slot) +{ + // obj = ScoutFlyer object number + // slot = 2 + + Parent::onFire(%data,%obj,%slot); + %obj.nextWeaponFire = 3; + schedule(%data.fireTimeout, 0, "fireNextGun", %obj); +} + +function ScoutChaingunPairImage::onFire(%data,%obj,%slot) +{ + // obj = ScoutFlyer object number + // slot = 3 + + Parent::onFire(%data,%obj,%slot); + %obj.nextWeaponFire = 2; + schedule(%data.fireTimeout, 0, "fireNextGun", %obj); +} + +function fireNextGun(%obj) +{ + if(%obj.fireWeapon) + { + if(%obj.nextWeaponFire == 2) + { + %obj.setImageTrigger(2, true); + %obj.setImageTrigger(3, false); + } + else + { + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(3, true); + } + } + else + { + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(3, false); + } +} + +function ScoutChaingunImage::onTriggerDown(%this, %obj, %slot) +{ +} + +function ScoutChaingunImage::onTriggerUp(%this, %obj, %slot) +{ +} + +function ScoutChaingunImage::onMount(%this, %obj, %slot) +{ +// %obj.setImageAmmo(%slot,true); +} + +function ScoutChaingunPairImage::onMount(%this, %obj, %slot) +{ +// %obj.setImageAmmo(%slot,true); +} + +function ScoutChaingunImage::onUnmount(%this,%obj,%slot) +{ +} + +function ScoutChaingunPairImage::onUnmount(%this,%obj,%slot) +{ +} + + +function BomberTurret::onDamage(%data, %obj) +{ + %newDamageVal = %obj.getDamageLevel(); + if(%obj.lastDamageVal !$= "") + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + %obj.getObjectMount().setDamageLevel(%newDamageVal); + %obj.lastDamageVal = %newDamageVal; +} + +function BomberTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile) +{ + //If vehicle turret is hit then apply damage to the vehicle + %vehicle = %targetObject.getObjectMount(); + if(%vehicle) + %vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile); +} + +function VehicleTurret::onEndSequence(%data, %obj, %thread) +{ + if($DeployThread == %thread) + %obj.stopThread($DeployThread); +} + +function BomberTurret::onTrigger(%data, %obj, %trigger, %state) +{ + //error("onTrigger: trigger = " @ %trigger @ ", state = " @ %state); + //error("obj = " @ %obj @ ", class " @ %obj.getClassName()); + switch (%trigger) + { + case 0: + %obj.fireTrigger = %state; + if(%obj.selectedWeapon == 1) + { + %obj.setImageTrigger(4, false); + if(%obj.getImageTrigger(6)) + { + %obj.setImageTrigger(6, false); + ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj); + } + if(%state) + %obj.setImageTrigger(2, true); + else + %obj.setImageTrigger(2, false); + } + else if(%obj.selectedWeapon == 2) + { + %obj.setImageTrigger(2, false); + if(%obj.getImageTrigger(6)) + { + %obj.setImageTrigger(6, false); + ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj); + } + if(%state) + %obj.setImageTrigger(4, true); + else + %obj.setImageTrigger(4, false); + } + else + { + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(4, false); + if(%state) + %obj.setImageTrigger(6, true); + else + { + %obj.setImageTrigger(6, false); + BomberTargetingImage::deconstruct(%obj.getMountedImage(6), %obj); + } + } + + case 2: + if(%state) + { + %obj.getDataBlock().playerDismount(%obj); + } + } +} + +function BomberTurret::playerDismount(%data, %obj) +{ + //Passenger Exiting + %obj.fireTrigger = 0; + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(4, false); + if(%obj.getImageTrigger(6)) + { + %obj.setImageTrigger(6, false); + ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj); + } + %client = %obj.getControllingClient(); + %client.player.isBomber = false; + commandToClient(%client, 'endBomberSight'); +// %client.player.setControlObject(%client.player); + %client.player.mountVehicle = false; +// %client.player.getDataBlock().doDismount(%client.player); + + //turret auto fire if ai mounted, if ai, %client = -1 - Lagg... + if (%client > 0) + { + if(%client.player.getState() !$= "Dead") + %client.player.mountImage(%client.player.lastWeapon, $WeaponSlot); + } + setTargetSensorGroup(%obj.getTarget(), 0); + setTargetNeverVisMask(%obj.getTarget(), 0xffffffff); +} + +//function BomberTurret::getHudNum(%data, %num) +//{ +// if(%num == 1) +// return 0; +// else +// return 4; +//} + +function AIAimingTurretBarrel::onFire(%this,%obj,%slot) +{ +} + +function BomberBombImage::onUnmount(%this,%obj,%slot) +{ +} + +function BomberBombPairImage::onUnmount(%this,%obj,%slot) +{ +} + +function BomberTurretBarrel::firePair(%this, %obj, %slot) +{ + %obj.setImageTrigger( 3, true); +} + +function BomberTurretBarrelPair::stopFire(%this, %obj, %slot) +{ + %obj.setImageTrigger( 3, false); +} + +function BomberTurretBarrelPair::onMount(%this, %obj, %slot) +{ +// %obj.setImageAmmo(%slot,true); +} + +function BomberTurretBarrel::onMount(%this, %obj, %slot) +{ +// %obj.setImageAmmo(%slot,true); +} + +function BomberBombImage::firePair(%this, %obj, %slot) +{ + %obj.setImageTrigger( 5, true); +} + +function BomberBombPairImage::stopFire(%this, %obj, %slot) +{ + %obj.setImageTrigger( 5, false); +} + +function BomberBombPairImage::onMount(%this, %obj, %slot) +{ +// %obj.setImageAmmo(%slot,true); +} + +function BomberBombImage::onMount(%this, %obj, %slot) +{ +} + +function BomberBombImage::onUnmount(%this,%obj,%slot) +{ +} + +function BomberBombPairImage::onUnmount(%this,%obj,%slot) +{ +} + +function MobileTurretBase::onAdd(%this, %obj) +{ + Parent::onAdd(%this, %obj); + setTargetSensorGroup(%obj.target, %obj.team); +// setTargetNeverVisMask(%obj.target, 0xffffffff); // z0dd - ZOD, 4/17/02. Causes mpb sensor to be shown in middle of map on cmd screen instead of MPB as origin. no idea why +} + +function MobileTurretBase::onDamage(%data, %obj) +{ + %newDamageVal = %obj.getDamageLevel(); + if(%obj.lastDamageVal !$= "") + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + %obj.getObjectMount().setDamageLevel(%newDamageVal); + %obj.lastDamageVal = %newDamageVal; +} + +function MobileTurretBase::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile) +{ + //If vehicle turret is hit then apply damage to the vehicle + %vehicle = %targetObject.getObjectMount(); + if(%vehicle) + %vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile); +} + +function MobileTurretBase::onEndSequence(%data, %obj, %thread) +{ + //Used so that the parent wont be called.. +} + +function AssaultPlasmaTurret::onDamage(%data, %obj) +{ + %newDamageVal = %obj.getDamageLevel(); + if(%obj.lastDamageVal !$= "") + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + %obj.getObjectMount().setDamageLevel(%newDamageVal); + %obj.lastDamageVal = %newDamageVal; +} + +function AssaultPlasmaTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile) +{ + //If vehicle turret is hit then apply damage to the vehicle + %vehicle = %targetObject.getObjectMount(); + if(%vehicle) + %vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile); +} + +function AssaultPlasmaTurret::onTrigger(%data, %obj, %trigger, %state) +{ + switch (%trigger) { + case 0: + %obj.fireTrigger = %state; + if(%obj.selectedWeapon == 1) + { + %obj.setImageTrigger(4, false); + if(%state) + %obj.setImageTrigger(2, true); + else + %obj.setImageTrigger(2, false); + } + else + { + %obj.setImageTrigger(2, false); + if(%state) + %obj.setImageTrigger(4, true); + else + %obj.setImageTrigger(4, false); + } + case 2: + if(%state) + { + %obj.getDataBlock().playerDismount(%obj); + } + } +} + +function AssaultPlasmaTurret::playerDismount(%data, %obj) +{ + //Passenger Exiting + %obj.fireTrigger = 0; + %obj.setImageTrigger(2, false); + %obj.setImageTrigger(4, false); + %client = %obj.getControllingClient(); +// %client.setControlObject(%client.player); + //turret auto fire if ai mounted, if ai, %client = -1 - Lagg... + if (%client > 0) + { + %client.player.mountImage(%client.player.lastWeapon, $WeaponSlot); + } + %client.player.mountVehicle = false; + setTargetSensorGroup(%obj.getTarget(), 0); + setTargetNeverVisMask(%obj.getTarget(), 0xffffffff); +// %client.player.getDataBlock().doDismount(%client.player); +} + +//function AssaultPlasmaTurret::getHudNum(%data, %num) +//{ +// if(%num == 1) +// return 1; +// else +// return 3; +//} + + +// ------------------------------------------ +// camera functions +// ------------------------------------------ + +$CameraDeployTime = 1000; +$CameraDeployCheckMax = 6; +$CameraMinVelocity = 0.1; + +function CameraGrenadeThrown::onThrow(%this, %gren) +{ + // schedule a check to see if the camera is at rest but not deployed + %gren.checkCount = 0; + %gren.velocCheck = %this.schedule($CameraDeployTime, "checkCameraDeploy", %gren); +} + +function CameraGrenadeThrown::onStickyCollision(%data, %obj) +{ + cancel(%obj.velocCheck); + %pos = %obj.getLastStickyPos(); + %norm = %obj.getLastStickyNormal(); + + %intAngle = getTerrainAngle(%norm); // staticShape.cs + %rotAxis = vectorNormalize(vectorCross(%norm, "0 0 1")); + if (getWord(%norm, 2) == 1 || getWord(%norm, 2) == -1) + %rotAxis = vectorNormalize(vectorCross(%norm, "0 1 0")); + + %rotation = %rotAxis @ " " @ %intAngle; + %dcSucc = activateCamera(%pos, %rotation, %obj.sourceObject, %obj.sourceObject.team); + if(%dcSucc == 0) + messageClient(%obj.sourceObject.client, 'MsgDeployFailed', '\c2Your team\'s control network has reached its capacity for this item.~wfx/misc/misc.error.wav'); + %obj.schedule(50,"delete"); +} + +function CameraGrenadeThrown::checkCameraDeploy(%this, %gren) +{ + %gren.checkCount++; + if(VectorLen(%gren.getVelocity()) < $CameraMinVelocity) + { + // camera has come to rest but not deployed -- probably on a staticshape (station, gen, etc) + // no resolution, so get rid of it + %gren.schedule(50, "delete"); + } + else if(%gren.checkCount >= $CameraDeployCheckMax) + { + // camera's still moving but it's been check several times -- it was thrown from too great + // a height or off the edge of the world -- delete it + %gren.schedule(50, "delete"); + } + else + { + // check back in a little while + %gren.velocCheck = %this.schedule($CameraDeployTime, "checkCameraDeploy", %gren); + } +} + +function activateCamera(%position, %rotation, %sourceObj, %team) +{ + if($TeamDeployedCount[%team, DeployedCamera] >= $TeamDeployableMax[DeployedCamera]) + { + // team has too many cameras deployed already, don't deploy this one + return 0; + } + %dCam = new Turret() + { + dataBlock = "TurretDeployedCamera"; + team = %team; + needsNoPower = true; + owner = %sourceObj.client; + ownerHandle = %sourceObj.client.handle; + position = %position; + rotation = %rotation; + }; + addToDeployGroup(%dCam); + + if(%dCam.getTarget() != -1) + setTargetSensorGroup(%dCam.getTarget(), %team); + + %dCam.playAudio($DeploySound, CameraGrenadeAttachSound); + %dCam.deploy(); + %dCam.playThread($AmbientThread, "ambient"); + + // increment team's deployed count for cameras + $TeamDeployedCount[%team, DeployedCamera]++; + return 1; +} + +function FlareGrenade::onUse(%this, %obj) +{ + // a stripped-down version of HandInventory::onUse from weapons.cs + if(Game.handInvOnUse(%data, %obj)) { + %obj.decInventory(%this, 1); + %p = new FlareProjectile() { + dataBlock = FlareGrenadeProj; + initialDirection = %obj.getEyeVector(); + initialPosition = getBoxCenter(%obj.getWorldBox()); + sourceObject = %obj; + sourceSlot = 0; + }; + FlareSet.add(%p); + MissionCleanup.add(%p); + serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox())); + %p.schedule(6000, "delete"); + // miscellaneous grenade-throwing cleanup stuff + %obj.lastThrowTime[%data] = getSimTime(); + %obj.throwStrength = 0; + } +} + +// uncomment when explosion type can be set from script (dont want underwater explosion here) +//function grenadeOnEnterLiquid(%data, %obj, %coverage, %type, %flash) +//{ +// // 4: Lava +// // 5: Hot Lava +// // 6: Crusty Lava +// if(%type >=4 && %type <= 6) +// { +// if(%obj.getDamageState() !$= "Destroyed") +// { +// cancel(%obj.detThread); +// if(%flash) +// detonateFlashGrenade(%obj); +// else +// detonateGrenade(%obj); +// return(true); +// } +// } +// +// // flash grenades do not ignore quicksand +// if((%type == 7) && !%flash) +// return(true); +// +// return(false); +//} + +function GrenadeThrown::onThrow(%this, %gren) +{ + AIGrenadeThrown(%gren); + %gren.detThread = schedule(1500, %gren, "detonateGrenade", %gren); +} + +//function GrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type) +//{ +// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, false)) +// Parent::onEnterLiquid(%data, %obj, %coverage, %type); +//} + +function ConcussionGrenadeThrown::onThrow(%this, %gren) +{ + AIGrenadeThrown(%gren); + %gren.detThread = schedule(2000, %gren, "detonateGrenade", %gren); +} + +//function ConcussionGrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type) +//{ +// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, false)) +// Parent::onEnterLiquid(%data, %obj, %coverage, %type); +//} + +function detonateGrenade(%obj) +{ + %obj.setDamageState(Destroyed); + %data = %obj.getDataBlock(); + RadiusExplosion( %obj, %obj.getPosition(), %data.damageRadius, %data.indirectDamage, + %data.kickBackStrength, %obj.sourceObject, %data.radiusDamageType); + %obj.schedule(500,"delete"); +} + +function FlashGrenadeThrown::onThrow(%this, %gren) +{ + %gren.detThread = schedule(2000, %gren, "detonateFlashGrenade", %gren); +} + +//function FlashGrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type) +//{ +// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, true)) +// Parent::onEnterLiquid(%data, %obj, %coverage, %type); +//} + +function detonateFlashGrenade(%hg) +{ + %maxWhiteout = %hg.getDataBlock().maxWhiteout; + %thrower = %hg.sourceObject.client; + %hg.setDamageState(Destroyed); + %hgt = %hg.getTransform(); + %plX = firstword(%hgt); + %plY = getWord(%hgt, 1); + %plZ = getWord(%hgt, 2); + %pos = %plX @ " " @ %plY @ " " @ %plZ; + //all this stuff below ripped from projectiles.cs + + InitContainerRadiusSearch(%pos, 100.0, $TypeMasks::PlayerObjectType | + $TypeMasks::TurretObjectType); + + while ((%damage = containerSearchNext()) != 0) + { + %dist = containerSearchCurrDist(); + + %eyeXF = %damage.getEyeTransform(); + %epX = firstword(%eyeXF); + %epY = getWord(%eyeXF, 1); + %epZ = getWord(%eyeXF, 2); + %eyePos = %epX @ " " @ %epY @ " " @ %epZ; + %eyeVec = %damage.getEyeVector(); + + // Make sure we can see the thing... + if (ContainerRayCast(%eyePos, %pos, $TypeMasks::TerrainObjectType | + $TypeMasks::InteriorObjectType | + $TypeMasks::StaticObjectType, %damage) !$= "0") + { + continue; + } + + %distFactor = 1.0; + if (%dist >= 100) + %distFactor = 0.0; + else if (%dist >= 20) { + %distFactor = 1.0 - ((%dist - 20.0) / 80.0); + } + + %dif = VectorNormalize(VectorSub(%pos, %eyePos)); + %dot = VectorDot(%eyeVec, %dif); + + %difAcos = mRadToDeg(mAcos(%dot)); + %dotFactor = 1.0; + if (%difAcos > 60) + %dotFactor = ((1.0 - ((%difAcos - 60.0) / 120.0)) * 0.2) + 0.3; + else if (%difAcos > 45) + %dotFactor = ((1.0 - ((%difAcos - 45.0) / 15.0)) * 0.5) + 0.5; + + %totalFactor = %dotFactor * %distFactor; + + %prevWhiteOut = %damage.getWhiteOut(); + + if(!%prevWhiteOut) + if(!$teamDamage) + { + if(%damage.client != %thrower && %damage.client.team == %thrower.team) + messageClient(%damage.client, 'teamWhiteOut', '\c1You were hit by %1\'s whiteout grenade.', getTaggedString(%thrower.name)); + } + + %whiteoutVal = %prevWhiteOut + %totalFactor; + if(%whiteoutVal > %maxWhiteout) + { + //error("whitout at max"); + %whiteoutVal = %maxWhiteout; + } + //bot cheat! don't blind the thrower - Lagg... 1-8-2004 + if (%damage.client == %thrower && %thrower.isAIControlled()) + continue; + + %damage.setWhiteOut( %whiteoutVal ); + } + %hg.schedule( 500, "delete" ); +} + +// ---------------------------------------------- +// mine functions +// ---------------------------------------------- + + +function MineDeployed::onThrow(%this, %mine, %thrower) +{ + %mine.armed = false; + %mine.damaged = 0; + %mine.detonated = false; + %mine.depCount = 0; + %mine.theClient = %thrower.client; + $TeamDeployedCount[%mine.sourceObject.team, MineDeployed]++; // z0dd - ZOD, 8/13/02, Moved this from deployMineCheck to here. Fixes mine count bug + + schedule(1500, %mine, "deployMineCheck", %mine, %thrower); +} + +function deployMineCheck(%mineObj, %player) +{ + if(%mineObj.depCount > %mineObj.getDatablock().maxDepCount) + explodeMine(%mineObj, true); + + // wait until the mine comes to rest + if(%mineObj.getVelocity() $= "0 0 0") + { + // 2-second delay before mine is armed -- let deploy thread play out etc. + schedule(%mineObj.getDatablock().armTime, %mineObj, "armDeployedMine", %mineObj); + + // check for other deployed mines in the vicinity + InitContainerRadiusSearch(%mineObj.getWorldBoxCenter(), %mineObj.getDatablock().spacing, $TypeMasks::ItemObjectType); + while((%itemObj = containerSearchNext()) != 0) + { + if(%itemObj == %mineObj) + continue; + %ioType = %itemObj.getDatablock().getName(); + if(%ioType $= "MineDeployed") + schedule(100, %mineObj, "explodeMine", %mineObj, true); + else + continue; + } + // play "deploy" thread + %mineObj.playThread(0, "deploy"); + serverPlay3D(MineDeploySound, %mineObj.getTransform()); + %mineTeam = %mineObj.sourceObject.team; + //$TeamDeployedCount[%mineTeam, MineDeployed]++; // z0dd - ZOD, 8/13/02, Moved the increment to MineDeployed::onThrow. Fixes mine count bug + if($TeamDeployedCount[%mineTeam, MineDeployed] > $TeamDeployableMax[MineDeployed]) + { + messageClient( %player.client, '', 'Maximum allowable mines deployed.' ); + schedule(100, %mineObj, "explodeMine", %mineObj, true); + } + else + { + //start the thread that keeps checking for objects near the mine... + mineCheckVicinity(%mineObj); + + //let the AI know *after* it's come to rest... + AIDeployMine(%mineObj); + + //let the game know there's a deployed mine + Game.notifyMineDeployed(%mineObj); + } + } + else + { + //schedule this deploy check again a little later + %mineObj.depCount++; + schedule(500, %mineObj, "deployMineCheck", %mineObj, %player); + } +} + +function armDeployedMine(%mine) +{ + %mine.armed = true; +} + +function mineCheckVicinity(%mine) +{ + // this function is called after the mine has been deployed. It will check the + // immediate area around the mine (2.5 meters at present) for players or vehicles + // passing by, and detonate if any are found. This is to extend the range of the + // mine so players don't have to collide with them to set them off. + + // don't bother to check if mine isn't armed yet + if(%mine.armed) + { + // don't keep checking if mine is already detonating + if(!%mine.boom) + { + // the actual check for objects in the area + %mineLoc = %mine.getWorldBoxCenter(); + %masks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType; + %detonateRange = %mine.getDatablock().proximity; + %noExplode = 0; + InitContainerRadiusSearch(%mineLoc, %detonateRange, %masks); + while((%tgt = containerSearchNext()) != 0) + { + if(!$TeamDamage) + { + if(%mine.team == %tgt.team) + %noExplode = 1; + } + if(%noExplode == 0) + { + %mine.detonated = true; + schedule(50, %mine, "explodeMine", %mine, false); + break; + } + } + } + } + // if nothing set off the mine, schedule another check + if(!%mine.detonated) + schedule(300, %mine, "mineCheckVicinity", %mine); +} + +function MineDeployed::onCollision(%data, %obj, %col) +{ + // don't detonate if mine isn't armed yet + if(!%obj.armed) + return; + + // don't detonate if mine is already detonating + if(%obj.boom) + return; + + %noExplode = 0; + //check to see what it is that collided with the mine + %struck = %col.getClassName(); + if(%struck $= "Player" || %struck $= "WheeledVehicle" || %struck $= "FlyingVehicle") + { + if(!$teamDamage) + { + if(%obj.team == %col.getOwnerClient().team) + %noExplode = 1; + } + if(%noExplode == 0) + { + //error("Mine detonated due to collision with #"@%col@" ("@%struck@"); armed = "@%obj.armed); + explodeMine(%obj, false); + } + } +} + +function explodeMine(%mo, %noDamage) +{ + %mo.noDamage = %noDamage; + %mo.setDamageState(Destroyed); +} + +function MineDeployed::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) +{ + // ----------------------------- + // z0dd - ZOD, 5/09/04. If gameplay changes in affect, no mine disc + if($Host::ClassicLoadMineChanges) + { + if(!%targetObject.armed) + return; + } + // ----------------------------- + + if(%targetObject.boom) + return; + + %targetObject.damaged += %amount; + + if(%targetObject.damaged >= %data.maxDamage) + { + %targetObject.setDamageState(Destroyed); + } +} + +function MineDeployed::onDestroyed(%data, %obj, %lastState) +{ + %obj.boom = true; + %mineTeam = %obj.team; + $TeamDeployedCount[%mineTeam, MineDeployed]--; + // %noDamage is a boolean flag -- don't want to set off all other mines in + // vicinity if there's a "mine overload", so apply no damage/impulse if true + if(!%obj.noDamage) + RadiusExplosion(%obj, + %obj.getPosition(), + %data.damageRadius, + %data.indirectDamage, + %data.kickBackStrength, + %obj.sourceObject, + %data.radiusDamageType); + + %obj.schedule(600, "delete"); +} From 2ae5b4c489f09b57840ce5a4cad066f99c2debf1 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Sun, 3 Apr 2022 15:33:47 -0400 Subject: [PATCH 15/15] Item respawn bugfix Line 124 Removed extra spaces --- Classic/scripts/weapTurretCode.cs | 64 +++++++++++++++++-------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/Classic/scripts/weapTurretCode.cs b/Classic/scripts/weapTurretCode.cs index 2d34adf..add1185 100644 --- a/Classic/scripts/weapTurretCode.cs +++ b/Classic/scripts/weapTurretCode.cs @@ -8,7 +8,7 @@ function Ammo::onCollision(%data, %obj, %col) { %ammoName = %data.getName(); %ammoStore = %col.inv[%ammoName]; - + // if player has ammo pack, increase max amount of ammo if(%col.getMountedImage($BackpackSlot) != 0) { @@ -115,13 +115,19 @@ function HandInventory::onCollision(%data, %obj, %col) if(%col.inv[%ammoName] < %aMax) { //------------------------------------------------------------------------------------------- - // z0dd - ZOD, 4/17/02. Don't allow player to pickup full ammo if they tossed less than full. + // z0dd - ZOD, 4/17/02. Don't allow player to pickup full ammo if they tossed less than full. if( %obj.ammoStore $= "" ) %obj.ammoStore = $AmmoIncrement[ %ammoName ]; %col.incInventory(%ammoName, %obj.ammoStore); //------------------------------------------------------------------------------------------- serverPlay3D(ItemPickupSound, %col.getTransform()); - %obj.respawn(); + + //Item respawn fix + if (%obj.isStatic()) + %obj.respawn(); + else + %obj.delete(); + if (%col.client > 0) messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName); } @@ -141,7 +147,7 @@ function SentryTurret::onAdd(%data, %obj) function TurretDeployedCamera::onAdd(%this, %obj) { - Parent::onAdd(%this, %obj); + Parent::onAdd(%this, %obj); %obj.mountImage(DeployableCameraBarrel, 0, true); %obj.setRechargeRate(%this.rechargeRate); @@ -267,7 +273,7 @@ function BomberTurret::onDamage(%data, %obj) { %newDamageVal = %obj.getDamageLevel(); if(%obj.lastDamageVal !$= "") - if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) %obj.getObjectMount().setDamageLevel(%newDamageVal); %obj.lastDamageVal = %newDamageVal; } @@ -319,7 +325,7 @@ function BomberTurret::onTrigger(%data, %obj, %trigger, %state) %obj.setImageTrigger(4, true); else %obj.setImageTrigger(4, false); - } + } else { %obj.setImageTrigger(2, false); @@ -330,7 +336,7 @@ function BomberTurret::onTrigger(%data, %obj, %trigger, %state) { %obj.setImageTrigger(6, false); BomberTargetingImage::deconstruct(%obj.getMountedImage(6), %obj); - } + } } case 2: @@ -447,7 +453,7 @@ function MobileTurretBase::onDamage(%data, %obj) { %newDamageVal = %obj.getDamageLevel(); if(%obj.lastDamageVal !$= "") - if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) %obj.getObjectMount().setDamageLevel(%newDamageVal); %obj.lastDamageVal = %newDamageVal; } @@ -469,13 +475,13 @@ function AssaultPlasmaTurret::onDamage(%data, %obj) { %newDamageVal = %obj.getDamageLevel(); if(%obj.lastDamageVal !$= "") - if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) + if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal) %obj.getObjectMount().setDamageLevel(%newDamageVal); %obj.lastDamageVal = %newDamageVal; } function AssaultPlasmaTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile) -{ +{ //If vehicle turret is hit then apply damage to the vehicle %vehicle = %targetObject.getObjectMount(); if(%vehicle) @@ -494,17 +500,17 @@ function AssaultPlasmaTurret::onTrigger(%data, %obj, %trigger, %state) %obj.setImageTrigger(2, true); else %obj.setImageTrigger(2, false); - } + } else { %obj.setImageTrigger(2, false); if(%state) %obj.setImageTrigger(4, true); - else + else %obj.setImageTrigger(4, false); - } + } case 2: - if(%state) + if(%state) { %obj.getDataBlock().playerDismount(%obj); } @@ -559,7 +565,7 @@ function CameraGrenadeThrown::onStickyCollision(%data, %obj) cancel(%obj.velocCheck); %pos = %obj.getLastStickyPos(); %norm = %obj.getLastStickyNormal(); - + %intAngle = getTerrainAngle(%norm); // staticShape.cs %rotAxis = vectorNormalize(vectorCross(%norm, "0 0 1")); if (getWord(%norm, 2) == 1 || getWord(%norm, 2) == -1) @@ -603,7 +609,7 @@ function activateCamera(%position, %rotation, %sourceObj, %team) } %dCam = new Turret() { - dataBlock = "TurretDeployedCamera"; + dataBlock = "TurretDeployedCamera"; team = %team; needsNoPower = true; owner = %sourceObj.client; @@ -650,7 +656,7 @@ function FlareGrenade::onUse(%this, %obj) // uncomment when explosion type can be set from script (dont want underwater explosion here) //function grenadeOnEnterLiquid(%data, %obj, %coverage, %type, %flash) //{ -// // 4: Lava +// // 4: Lava // // 5: Hot Lava // // 6: Crusty Lava // if(%type >=4 && %type <= 6) @@ -665,7 +671,7 @@ function FlareGrenade::onUse(%this, %obj) // return(true); // } // } -// +// // // flash grenades do not ignore quicksand // if((%type == 7) && !%flash) // return(true); @@ -701,7 +707,7 @@ function detonateGrenade(%obj) { %obj.setDamageState(Destroyed); %data = %obj.getDataBlock(); - RadiusExplosion( %obj, %obj.getPosition(), %data.damageRadius, %data.indirectDamage, + RadiusExplosion( %obj, %obj.getPosition(), %data.damageRadius, %data.indirectDamage, %data.kickBackStrength, %obj.sourceObject, %data.radiusDamageType); %obj.schedule(500,"delete"); } @@ -721,7 +727,7 @@ function detonateFlashGrenade(%hg) { %maxWhiteout = %hg.getDataBlock().maxWhiteout; %thrower = %hg.sourceObject.client; - %hg.setDamageState(Destroyed); + %hg.setDamageState(Destroyed); %hgt = %hg.getTransform(); %plX = firstword(%hgt); %plY = getWord(%hgt, 1); @@ -769,23 +775,23 @@ function detonateFlashGrenade(%hg) %dotFactor = ((1.0 - ((%difAcos - 45.0) / 15.0)) * 0.5) + 0.5; %totalFactor = %dotFactor * %distFactor; - + %prevWhiteOut = %damage.getWhiteOut(); if(!%prevWhiteOut) if(!$teamDamage) { if(%damage.client != %thrower && %damage.client.team == %thrower.team) - messageClient(%damage.client, 'teamWhiteOut', '\c1You were hit by %1\'s whiteout grenade.', getTaggedString(%thrower.name)); + messageClient(%damage.client, 'teamWhiteOut', '\c1You were hit by %1\'s whiteout grenade.', getTaggedString(%thrower.name)); } - + %whiteoutVal = %prevWhiteOut + %totalFactor; if(%whiteoutVal > %maxWhiteout) { //error("whitout at max"); %whiteoutVal = %maxWhiteout; } - //bot cheat! don't blind the thrower - Lagg... 1-8-2004 + //bot cheat! don't blind the thrower - Lagg... 1-8-2004 if (%damage.client == %thrower && %thrower.isAIControlled()) continue; @@ -815,7 +821,7 @@ function deployMineCheck(%mineObj, %player) { if(%mineObj.depCount > %mineObj.getDatablock().maxDepCount) explodeMine(%mineObj, true); - + // wait until the mine comes to rest if(%mineObj.getVelocity() $= "0 0 0") { @@ -840,7 +846,7 @@ function deployMineCheck(%mineObj, %player) %mineTeam = %mineObj.sourceObject.team; //$TeamDeployedCount[%mineTeam, MineDeployed]++; // z0dd - ZOD, 8/13/02, Moved the increment to MineDeployed::onThrow. Fixes mine count bug if($TeamDeployedCount[%mineTeam, MineDeployed] > $TeamDeployableMax[MineDeployed]) - { + { messageClient( %player.client, '', 'Maximum allowable mines deployed.' ); schedule(100, %mineObj, "explodeMine", %mineObj, true); } @@ -888,7 +894,7 @@ function mineCheckVicinity(%mine) %detonateRange = %mine.getDatablock().proximity; %noExplode = 0; InitContainerRadiusSearch(%mineLoc, %detonateRange, %masks); - while((%tgt = containerSearchNext()) != 0) + while((%tgt = containerSearchNext()) != 0) { if(!$TeamDamage) { @@ -953,14 +959,14 @@ function MineDeployed::damageObject(%data, %targetObject, %sourceObject, %positi return; } // ----------------------------- - + if(%targetObject.boom) return; %targetObject.damaged += %amount; if(%targetObject.damaged >= %data.maxDamage) - { + { %targetObject.setDamageState(Destroyed); } }