Auto-update checkpoint assignment to parkour goal in editor

qteditor
Sven Eberhardt 2016-08-06 02:38:01 -04:00
parent a21a1a8051
commit 7aaa581908
2 changed files with 16 additions and 2 deletions

View File

@ -81,6 +81,7 @@ local cp_con;
public func SetCPController(object con)
{
cp_con = con;
UpdateEditorHelp();
return;
}

View File

@ -28,7 +28,7 @@ local transfer_contents; // Set to true if contents should be transferred on res
/*-- General --*/
protected func Initialize()
protected func Initialize(...)
{
finished = false;
no_respawn_handling = false;
@ -45,9 +45,22 @@ protected func Initialize()
AddMsgBoardCmd("resetpb", "Goal_Parkour->~ResetPersonalBest(%player%)");
// Activate restart rule, if there isn't any.
if (!ObjectCount(Find_ID(Rule_Restart)))
CreateObject(Rule_Restart, 0, 0, NO_OWNER);
CreateObject(Rule_Restart, Min(GetX()+64, LandscapeWidth()-32), 0, NO_OWNER);
// Scoreboard.
InitScoreboard();
// Assign unassigned checkpoints
for (var obj in FindObjects(Find_ID(ParkourCheckpoint)))
if (!obj->GetCPController())
obj->SetCPController(this);
return _inherited(...);
}
protected func Destruction(...)
{
// Unassign checkpoints (updates editor help message)
for (var obj in FindObjects(Find_ID(ParkourCheckpoint)))
if (obj->GetCPController() == this)
obj->SetCPController(nil);
return _inherited(...);
}