Fix restart rule creation in parkour goal

Was created at a large offset and multiple copies could be created.
qteditor
Sven Eberhardt 2016-08-06 21:34:01 -04:00
parent 40abe71a8c
commit 1cdf22ae81
1 changed files with 9 additions and 3 deletions

View File

@ -43,9 +43,8 @@ protected func Initialize(...)
AddEffect("IntBestTime", this, 100, 1, this);
// Add a message board command "/resetpb" to reset the pb for this round.
AddMsgBoardCmd("resetpb", "Goal_Parkour->~ResetPersonalBest(%player%)");
// Activate restart rule, if there isn't any.
if (!ObjectCount(Find_ID(Rule_Restart)))
CreateObject(Rule_Restart, Min(GetX()+64, LandscapeWidth()-32), 0, NO_OWNER);
// Activate restart rule, if there isn't any. But check delayed because it may be created later.
ScheduleCall(this, this.EnsureRestartRule, 1, 1);
// Scoreboard.
InitScoreboard();
// Assign unassigned checkpoints
@ -55,6 +54,13 @@ protected func Initialize(...)
return _inherited(...);
}
private func EnsureRestartRule()
{
if (!ObjectCount(Find_ID(Rule_Restart)))
CreateObject(Rule_Restart, Min(64, LandscapeWidth()-GetX()-32), 0, NO_OWNER);
return true;
}
protected func Destruction(...)
{
// Unassign checkpoints (updates editor help message)