diff --git a/Classic/scripts/autoexec/MapRepetitionChecker.cs b/Classic/scripts/autoexec/MapRepetitionChecker.cs index 427cc92..f9a2c32 100644 --- a/Classic/scripts/autoexec/MapRepetitionChecker.cs +++ b/Classic/scripts/autoexec/MapRepetitionChecker.cs @@ -3,28 +3,34 @@ // To help decrease the chances of a repeated map in the map rotation by correcting repeated maps thru script // // Runs at the beginning of every map change -// Keeps track of maps played (Last 4) +// Keeps track of maps played (Last [$MRC::PastMapsDepth] Maps) // If any are repeating it picks a new map // // $EvoCachedNextMission = "RoundTheMountain"; // $EvoCachedNextMission = "Arrakis"; // $EvoCachedNextMission = "RoundTheMountainLT"; // $EvoCachedNextMission = "ArenaDomeDM"; -// +// How many previous maps you want to compare TheNextCached Map to +$MRC::PastMapsDepth = 6; -$PreviousMission4back = ""; -$PreviousMission3back = ""; -$PreviousMission2back = ""; -$PreviousMission1back = ""; +for(%x = 1; %x <= $MRC::PastMapsDepth; %x++) +{ + $MRC::PrevMap[%x] = ""; + //echo("PM" @ %x @ ": " @ $MRC::PrevMap[%x]); +} //Ran in MissionTypeOptions.cs function MapRepetitionChecker( %game ) { //Debug - //%MapRepetitionCheckerDebug = true; - - if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present + %MapRepetitionCheckerDebug = true; + + if(isEventPending($MapRepetitionSchedule)) + cancel($MapRepetitionSchedule); + + //Make sure GetRandomMaps.cs is present + if(!$GetRandomMapsLoaded) return; if($EvoCachedNextMission $= "") @@ -32,32 +38,41 @@ function MapRepetitionChecker( %game ) if(!$Host::TournamentMode && $Host::EnableMapRepetitionChecker) { - //Do work - if( $PreviousMission1back $= $EvoCachedNextMission || $PreviousMission2back $= $EvoCachedNextMission || - $PreviousMission3back $= $EvoCachedNextMission || $PreviousMission4back $= $EvoCachedNextMission || - $CurrentMission $= $EvoCachedNextMission ) - MapRepetitionCheckerFindRandom(); + //Do work + for(%x = 1; %x <= $MRC::PastMapsDepth; %x++) + { + if( $MRC::PrevMap[%x] !$= "" && $MRC::PrevMap[%x] $= $EvoCachedNextMission ) + MapRepetitionCheckerFindRandom(); + } //Set vars - if($PreviousMission3back !$= "") $PreviousMission4back = $PreviousMission3back; - if($PreviousMission2back !$= "") $PreviousMission3back = $PreviousMission2back; - if($PreviousMission1back !$= "") $PreviousMission2back = $PreviousMission1back; - $PreviousMission1back = $CurrentMission; - + for(%x = $MRC::PastMapsDepth; %x >= 1; %x = %x - 1) + { + if(%x > 1) + { + if($MRC::PrevMap[%x - 1] !$= "") + $MRC::PrevMap[%x] = $MRC::PrevMap[%x - 1]; + } + else if(%x $= 1) + $MRC::PrevMap[%x] = $CurrentMission; + } + //Debug if(%MapRepetitionCheckerDebug) - { - if($PreviousMission1back !$= "") echo("PM1: " @ $PreviousMission1back); - if($PreviousMission2back !$= "") echo("PM2: " @ $PreviousMission2back); - if($PreviousMission3back !$= "") echo("PM3: " @ $PreviousMission3back); - if($PreviousMission4back !$= "") echo("PM4: " @ $PreviousMission4back); + { + for(%x = 1; %x <= $MRC::PastMapsDepth; %x++) + { + if( $MRC::PrevMap[%x] !$= "" ) + echo("PM" @ %x @ ": " @ $MRC::PrevMap[%x]); + } } } } function MapRepetitionCheckerFindRandom() { - if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present + //Make sure GetRandomMaps.cs is present + if(!$GetRandomMapsLoaded) return; //Backup @@ -68,9 +83,14 @@ function MapRepetitionCheckerFindRandom() $EvoCachedNextMission = getRandomMap(); //Make sure new map still complies - if( $EvoCachedNextMission $= $PreviousMission1back || $EvoCachedNextMission $= $PreviousMission2back || - $EvoCachedNextMission $= $PreviousMission3back || $EvoCachedNextMission $= $PreviousMission4back || - $CurrentMission $= $EvoCachedNextMission ) + %redo = 0; + for(%x = 1; %x <= $MRC::PastMapsDepth; %x++) + { + if($MRC::PrevMap[%x] !$= "" && $MRC::PrevMap[%x] $= $EvoCachedNextMission) + %redo = 1; + } + + if( %redo ) MapRepetitionCheckerFindRandom(); else { diff --git a/Classic/scripts/autoexec/MissionTypeOptions.cs b/Classic/scripts/autoexec/MissionTypeOptions.cs index 7972e8b..a8b117a 100644 --- a/Classic/scripts/autoexec/MissionTypeOptions.cs +++ b/Classic/scripts/autoexec/MissionTypeOptions.cs @@ -17,30 +17,37 @@ package MissionTypeOptions function loadMissionStage2() { - if( $CurrentMissionType !$= "LakRabbit" ) + switch$($Host::PUGpasswordAlwaysOn) { - if( $Host::TournamentMode && $Host::PUGautoPassword ) + case 0: + if( $CurrentMissionType !$= "LakRabbit" ) + { + if( $Host::TournamentMode && $Host::PUGautoPassword ) + $Host::Password = $Host::PUGPassword; + else if( !$Host::TournamentMode ) + $Host::Password = ""; + + //Set server mode to SPEED + $Host::HiVisibility = "0"; + } + else if( $CurrentMissionType $= "LakRabbit" ) + { + $Host::Password = ""; + $Host::TournamentMode = 0; + + //Set server mode to DISTANCE + $Host::HiVisibility = "1"; + } + case 1: $Host::Password = $Host::PUGPassword; - else if( !$Host::TournamentMode ) - $Host::Password = ""; - - //Set server mode to SPEED - $Host::HiVisibility = "0"; - } - else if( $CurrentMissionType $= "LakRabbit" ) - { - $Host::Password = ""; - $Host::TournamentMode = 0; - - //Set server mode to DISTANCE - $Host::HiVisibility = "1"; + $Host::HiVisibility = "0"; //always SPEED } - if( $Host::PUGpasswordAlwaysOn ) - $Host::Password = $Host::PUGPassword; + if(isEventPending($MapRepetitionSchedule)) + cancel($MapRepetitionSchedule); //Start MapRepetitionChecker - schedule(20000, 0, "MapRepetitionChecker", %game); + $MapRepetitionSchedule = schedule(20000, 0, "MapRepetitionChecker", %game); parent::loadMissionStage2(); } diff --git a/Classic/scripts/autoexec/VoteOverTime.cs b/Classic/scripts/autoexec/VoteOverTime.cs index e14a8b1..6e6ce4e 100644 --- a/Classic/scripts/autoexec/VoteOverTime.cs +++ b/Classic/scripts/autoexec/VoteOverTime.cs @@ -80,7 +80,6 @@ function DefaultGame::gameOver(%game) function StartVOTimeVote(%game) { $VOStatus = "Starting"; - $VoteSoundInProgress = true; } // Tribes wont change the time after its reached zero and you cant change it again afterwards until a gameover/map change. @@ -88,14 +87,12 @@ function StartVOTimeVote(%game) function ResetVOTimeChanged(%game) { $VOStatus = "TimeChanged"; - $VoteSoundInProgress = false; } // Reset everything. So everything functions normally after a map change. function ResetVOall(%game) { $VOStatus = "Normal"; - $VoteSoundInProgress = false; } diff --git a/Classic/scripts/autoexec/VoteSound.cs b/Classic/scripts/autoexec/VoteSound.cs index 8cea7cb..0d241c1 100644 --- a/Classic/scripts/autoexec/VoteSound.cs +++ b/Classic/scripts/autoexec/VoteSound.cs @@ -10,7 +10,7 @@ function VoteSound( %game, %typename, %arg1, %arg2, %VoteSoundRandom ) { - if( $VoteSoundInProgress && $Host::EnableVoteSound && $VoteSoundRandom $= %VoteSoundRandom ) + if( Game.scheduleVote !$= "" && $Host::EnableVoteSound && $VoteSoundRandom $= %VoteSoundRandom ) //Game.scheduleVote !$= "" is if vote is active { %votemsg = "Press Insert for Yes or Delete for No.";