(Cont.) Server Core updates

This commit is contained in:
ChocoTaco 2019-12-12 23:32:45 -05:00
parent 4a7325a74d
commit 20cb3584b9
4 changed files with 74 additions and 50 deletions

View file

@ -3,28 +3,34 @@
// To help decrease the chances of a repeated map in the map rotation by correcting repeated maps thru script // 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 // 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 // If any are repeating it picks a new map
// //
// $EvoCachedNextMission = "RoundTheMountain"; // $EvoCachedNextMission = "RoundTheMountain";
// $EvoCachedNextMission = "Arrakis"; // $EvoCachedNextMission = "Arrakis";
// $EvoCachedNextMission = "RoundTheMountainLT"; // $EvoCachedNextMission = "RoundTheMountainLT";
// $EvoCachedNextMission = "ArenaDomeDM"; // $EvoCachedNextMission = "ArenaDomeDM";
//
// How many previous maps you want to compare TheNextCached Map to
$MRC::PastMapsDepth = 6;
$PreviousMission4back = ""; for(%x = 1; %x <= $MRC::PastMapsDepth; %x++)
$PreviousMission3back = ""; {
$PreviousMission2back = ""; $MRC::PrevMap[%x] = "";
$PreviousMission1back = ""; //echo("PM" @ %x @ ": " @ $MRC::PrevMap[%x]);
}
//Ran in MissionTypeOptions.cs //Ran in MissionTypeOptions.cs
function MapRepetitionChecker( %game ) function MapRepetitionChecker( %game )
{ {
//Debug //Debug
//%MapRepetitionCheckerDebug = true; %MapRepetitionCheckerDebug = true;
if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present if(isEventPending($MapRepetitionSchedule))
cancel($MapRepetitionSchedule);
//Make sure GetRandomMaps.cs is present
if(!$GetRandomMapsLoaded)
return; return;
if($EvoCachedNextMission $= "") if($EvoCachedNextMission $= "")
@ -32,32 +38,41 @@ function MapRepetitionChecker( %game )
if(!$Host::TournamentMode && $Host::EnableMapRepetitionChecker) if(!$Host::TournamentMode && $Host::EnableMapRepetitionChecker)
{ {
//Do work //Do work
if( $PreviousMission1back $= $EvoCachedNextMission || $PreviousMission2back $= $EvoCachedNextMission || for(%x = 1; %x <= $MRC::PastMapsDepth; %x++)
$PreviousMission3back $= $EvoCachedNextMission || $PreviousMission4back $= $EvoCachedNextMission || {
$CurrentMission $= $EvoCachedNextMission ) if( $MRC::PrevMap[%x] !$= "" && $MRC::PrevMap[%x] $= $EvoCachedNextMission )
MapRepetitionCheckerFindRandom(); MapRepetitionCheckerFindRandom();
}
//Set vars //Set vars
if($PreviousMission3back !$= "") $PreviousMission4back = $PreviousMission3back; for(%x = $MRC::PastMapsDepth; %x >= 1; %x = %x - 1)
if($PreviousMission2back !$= "") $PreviousMission3back = $PreviousMission2back; {
if($PreviousMission1back !$= "") $PreviousMission2back = $PreviousMission1back; if(%x > 1)
$PreviousMission1back = $CurrentMission; {
if($MRC::PrevMap[%x - 1] !$= "")
$MRC::PrevMap[%x] = $MRC::PrevMap[%x - 1];
}
else if(%x $= 1)
$MRC::PrevMap[%x] = $CurrentMission;
}
//Debug //Debug
if(%MapRepetitionCheckerDebug) if(%MapRepetitionCheckerDebug)
{ {
if($PreviousMission1back !$= "") echo("PM1: " @ $PreviousMission1back); for(%x = 1; %x <= $MRC::PastMapsDepth; %x++)
if($PreviousMission2back !$= "") echo("PM2: " @ $PreviousMission2back); {
if($PreviousMission3back !$= "") echo("PM3: " @ $PreviousMission3back); if( $MRC::PrevMap[%x] !$= "" )
if($PreviousMission4back !$= "") echo("PM4: " @ $PreviousMission4back); echo("PM" @ %x @ ": " @ $MRC::PrevMap[%x]);
}
} }
} }
} }
function MapRepetitionCheckerFindRandom() function MapRepetitionCheckerFindRandom()
{ {
if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present //Make sure GetRandomMaps.cs is present
if(!$GetRandomMapsLoaded)
return; return;
//Backup //Backup
@ -68,9 +83,14 @@ function MapRepetitionCheckerFindRandom()
$EvoCachedNextMission = getRandomMap(); $EvoCachedNextMission = getRandomMap();
//Make sure new map still complies //Make sure new map still complies
if( $EvoCachedNextMission $= $PreviousMission1back || $EvoCachedNextMission $= $PreviousMission2back || %redo = 0;
$EvoCachedNextMission $= $PreviousMission3back || $EvoCachedNextMission $= $PreviousMission4back || for(%x = 1; %x <= $MRC::PastMapsDepth; %x++)
$CurrentMission $= $EvoCachedNextMission ) {
if($MRC::PrevMap[%x] !$= "" && $MRC::PrevMap[%x] $= $EvoCachedNextMission)
%redo = 1;
}
if( %redo )
MapRepetitionCheckerFindRandom(); MapRepetitionCheckerFindRandom();
else else
{ {

View file

@ -17,30 +17,37 @@ package MissionTypeOptions
function loadMissionStage2() 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; $Host::Password = $Host::PUGPassword;
else if( !$Host::TournamentMode ) $Host::HiVisibility = "0"; //always SPEED
$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";
} }
if( $Host::PUGpasswordAlwaysOn ) if(isEventPending($MapRepetitionSchedule))
$Host::Password = $Host::PUGPassword; cancel($MapRepetitionSchedule);
//Start MapRepetitionChecker //Start MapRepetitionChecker
schedule(20000, 0, "MapRepetitionChecker", %game); $MapRepetitionSchedule = schedule(20000, 0, "MapRepetitionChecker", %game);
parent::loadMissionStage2(); parent::loadMissionStage2();
} }

View file

@ -80,7 +80,6 @@ function DefaultGame::gameOver(%game)
function StartVOTimeVote(%game) function StartVOTimeVote(%game)
{ {
$VOStatus = "Starting"; $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. // 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) function ResetVOTimeChanged(%game)
{ {
$VOStatus = "TimeChanged"; $VOStatus = "TimeChanged";
$VoteSoundInProgress = false;
} }
// Reset everything. So everything functions normally after a map change. // Reset everything. So everything functions normally after a map change.
function ResetVOall(%game) function ResetVOall(%game)
{ {
$VOStatus = "Normal"; $VOStatus = "Normal";
$VoteSoundInProgress = false;
} }

View file

@ -10,7 +10,7 @@
function VoteSound( %game, %typename, %arg1, %arg2, %VoteSoundRandom ) 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."; %votemsg = "Press Insert for Yes or Delete for No.";