Ensure tower pain fields start up correctly

This commit is contained in:
Mazo 2020-05-04 13:23:10 +01:00
parent 61360d97e0
commit 01a8ecd39e

View file

@ -18,6 +18,8 @@ class PainboxControl(painbox: Painbox) extends Actor {
var bBoxMaxCorner = Vector3.Zero var bBoxMaxCorner = Vector3.Zero
var bBoxMidPoint = Vector3.Zero var bBoxMidPoint = Vector3.Zero
var disabled = false // Temporary to disable cavern non-radius fields
def receive: Receive = { def receive: Receive = {
case "startup" => case "startup" =>
if (painbox.Definition.HasNearestDoorDependency) { if (painbox.Definition.HasNearestDoorDependency) {
@ -35,14 +37,12 @@ class PainboxControl(painbox: Painbox) extends Actor {
case _ => case _ =>
log.error(s"Painbox ${painbox.GUID} on ${painbox.Owner.Continent} - ${painbox.Position} can not find a door that it is dependent on") log.error(s"Painbox ${painbox.GUID} on ${painbox.Owner.Continent} - ${painbox.Position} can not find a door that it is dependent on")
} }
} else {
context.become(Stopped)
}
else {
if (painbox.Definition.Radius == 0f) { if (painbox.Definition.Radius == 0f) {
if (painbox.Owner.Continent.matches("c[0-9]")) { if (painbox.Owner.Continent.matches("c[0-9]")) {
// todo: handle non-radius painboxes in caverns properly // todo: handle non-radius painboxes in caverns properly
log.warn(s"Skipping initialization of ${painbox.GUID} on ${painbox.Owner.Continent} - ${painbox.Position}") log.warn(s"Skipping initialization of ${painbox.GUID} on ${painbox.Owner.Continent} - ${painbox.Position}")
disabled = true
} else { } else {
painbox.Owner match { painbox.Owner match {
case obj: Building => case obj: Building =>
@ -83,9 +83,13 @@ class PainboxControl(painbox: Painbox) extends Actor {
case _ => None case _ => None
} }
} }
context.become(Stopped)
} }
} }
if(!disabled) {
context.become(Stopped)
}
case _ => ; case _ => ;
} }