Fixes Cargo-ordered PAs and Wrenching-down Machines in Powered/DePowered Areas

Particle Accelerators will now update with current powernet information
upon being wrenched, just like all other machines. Fixes a bug where PAs
ordered from cargo would never detect parts.

Fixes a bug where machines taken from a depowered area and wrenched into
a powered area wouldn't be powered until you flicked the lights on and
off (or something to that effect).
This commit is contained in:
KasparoVy
2016-12-24 00:13:55 -05:00
parent a8f6f6a0ad
commit b80323f8bc
3 changed files with 17 additions and 3 deletions
@@ -366,6 +366,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
temp_state++
power_change()
if(1)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
@@ -373,6 +374,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
"You remove the external bolts.")
temp_state--
power_change()
else if(iscoil(O))
if(O:use(1))
user.visible_message("[user.name] adds wires to the [src.name].", \
@@ -24,6 +24,7 @@
/obj/machinery/particle_accelerator/control_box/New()
wires = new(src)
connected_parts = list()
update_icon()
..()
/obj/machinery/particle_accelerator/control_box/Destroy()
@@ -62,9 +63,12 @@
/obj/machinery/particle_accelerator/control_box/update_icon()
if(active)
icon_state = "[reference]p1"
icon_state = "[reference]p[strength]"
else
if(use_power)
if(stat & NOPOWER)
icon_state = "[reference]w"
return
else if(use_power)
if(assembled)
icon_state = "[reference]p"
else
@@ -89,7 +93,7 @@
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
return
if( href_list["close"] )
if(href_list["close"])
usr << browse(null, "window=pacontrol")
usr.unset_machine()
return
@@ -152,6 +156,11 @@
use_power = 0
else if(!stat && construction_state <= 3)
use_power = 1
src.update_icon()
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
part.powered = 0
part.update_icon()
return