Moved initialization code into first tick.
This commit is contained in:
parent
fd674d870e
commit
78f4c30c2c
28
zscript.zs
28
zscript.zs
@ -9,6 +9,7 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
{
|
{
|
||||||
Map<int, int> originalLinedefSpecials2;
|
Map<int, int> originalLinedefSpecials2;
|
||||||
Array<JumperCablesDeployed> deployedCables;
|
Array<JumperCablesDeployed> deployedCables;
|
||||||
|
bool worldScanCompleted;
|
||||||
|
|
||||||
static JumperCablesMapLoader Get()
|
static JumperCablesMapLoader Get()
|
||||||
{
|
{
|
||||||
@ -17,13 +18,31 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
override void WorldLoaded(WorldEvent e)
|
override void WorldUnloaded(WorldEvent e)
|
||||||
{
|
{
|
||||||
JumperCablesMapLoader loader = Get();
|
JumperCablesMapLoader loader = Get();
|
||||||
|
|
||||||
// Clear out anything from the last level.
|
// Clear out anything from the last level.
|
||||||
deployedCables.Clear();
|
deployedCables.Clear();
|
||||||
loader.originalLinedefSpecials2.Clear();
|
loader.originalLinedefSpecials2.Clear();
|
||||||
|
worldScanCompleted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void WorldLoaded(WorldEvent e)
|
||||||
|
{
|
||||||
|
// JumperCablesMapLoader loader = Get();
|
||||||
|
|
||||||
|
// // Clear out anything from the last level.
|
||||||
|
// deployedCables.Clear();
|
||||||
|
// loader.originalLinedefSpecials2.Clear();
|
||||||
|
// worldScanCompleted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void WorldTick()
|
||||||
|
{
|
||||||
|
JumperCablesMapLoader loader = Get();
|
||||||
|
|
||||||
|
if(!loader.worldScanCompleted) {
|
||||||
|
|
||||||
// Go through all the linedefs and make note of what they're
|
// Go through all the linedefs and make note of what they're
|
||||||
// supposed to do.
|
// supposed to do.
|
||||||
@ -33,6 +52,11 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
loader.originalLinedefSpecials2.Insert(line.index(), line.special);
|
loader.originalLinedefSpecials2.Insert(line.index(), line.special);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loader.worldScanCompleted = true;
|
||||||
|
|
||||||
|
Console.printf("JMP: World scan completed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override void WorldLineActivated(WorldEvent e)
|
override void WorldLineActivated(WorldEvent e)
|
||||||
@ -57,7 +81,7 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
deployedCables.Push(cableActor);
|
deployedCables.Push(cableActor);
|
||||||
|
|
||||||
// FIXME: Remove this.
|
// FIXME: Remove this.
|
||||||
Console.printf("Cables registered %d\n", deployedCables.size());
|
// Console.printf("Cables registered %d\n", deployedCables.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user