Optimize a bit how to pick Malus
This commit is contained in:
parent
ee5d4c12a9
commit
7fcde52a04
@ -346,7 +346,6 @@ foreach (Event in RacePendingEvents) {
|
|||||||
|
|
||||||
if (Event.Player == Null) continue;
|
if (Event.Player == Null) continue;
|
||||||
|
|
||||||
// Waypoint
|
|
||||||
switch (Event.Type) {
|
switch (Event.Type) {
|
||||||
case Events::C_Type_Waypoint: {
|
case Events::C_Type_Waypoint: {
|
||||||
ThrottleUpdate = True;
|
ThrottleUpdate = True;
|
||||||
@ -437,21 +436,12 @@ if (Players.count > 0 && S_MalusDuration > 0 && MalusTime != -1 && Now > MalusTi
|
|||||||
if (!ActiveMalus && !PendingMalus) {
|
if (!ActiveMalus && !PendingMalus) {
|
||||||
if (S_TimeBeforeNightmare >= 0 && Now > (StartTime + (S_TimeBeforeNightmare * 1000))) {
|
if (S_TimeBeforeNightmare >= 0 && Now > (StartTime + (S_TimeBeforeNightmare * 1000))) {
|
||||||
MalusIndex = C_Malus_Nightmare;
|
MalusIndex = C_Malus_Nightmare;
|
||||||
} else {
|
} else if (AllPlayersAreInTurtle()) {
|
||||||
declare Boolean AllPlayersInTurtle = True;
|
|
||||||
foreach (Player in Players) {
|
|
||||||
if (Player.WheelsContactCount > 1 || Player.Speed > 1) {
|
|
||||||
AllPlayersInTurtle = False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (AllPlayersInTurtle) {
|
|
||||||
log("All players are in turtle");
|
log("All players are in turtle");
|
||||||
MalusIndex = ML::Rand(7, 10); // Boost if all players in Turtle
|
MalusIndex = ML::Rand(7, 10); // Boost if all players in Turtle
|
||||||
} else {
|
} else {
|
||||||
MalusIndex = ML::Rand(1, 15);
|
MalusIndex = ML::Rand(1, 15);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
PendingMalus = True;
|
PendingMalus = True;
|
||||||
ActiveMalus = False;
|
ActiveMalus = False;
|
||||||
NextStepMalusTime = Now + (S_NextMalusPreparationTime*1000);
|
NextStepMalusTime = Now + (S_NextMalusPreparationTime*1000);
|
||||||
@ -574,6 +564,7 @@ if (Round_ForceEndRound || Round_SkipPauseRound) {
|
|||||||
// Functions
|
// Functions
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
|
|
||||||
|
// Reset Network Variables
|
||||||
Void ResetNetworkVariables() {
|
Void ResetNetworkVariables() {
|
||||||
declare netwrite Boolean Net_DisplayUI for Teams[0] = False;
|
declare netwrite Boolean Net_DisplayUI for Teams[0] = False;
|
||||||
Net_DisplayUI = False;
|
Net_DisplayUI = False;
|
||||||
@ -617,6 +608,19 @@ Boolean IsEliminated(CUser _User, CSmScore _Score) {
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Detect if all players are in Turtle
|
||||||
|
*
|
||||||
|
* @return Return False if one player is not in turtle
|
||||||
|
*/
|
||||||
|
Boolean AllPlayersAreInTurtle() {
|
||||||
|
foreach (Player in Players) {
|
||||||
|
if (Player.WheelsContactCount > 1 || Player.Speed > 1) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the Time Before the first Malus or NightMare Mode
|
/** Get the Time Before the first Malus or NightMare Mode
|
||||||
*
|
*
|
||||||
* @param _StartTime The starting time of the map
|
* @param _StartTime The starting time of the map
|
||||||
|
Loading…
Reference in New Issue
Block a user