Fixes machine using power from the area it was created in, rather than using the area it is in (#23188)

* Update machine area when power_change() is called.

* Do not attempt to unregister from null powernet

* Move to wrench and update wrench_acts

* Remove accidental pseudocode

---------

Co-authored-by: Adrer <adrermail@gmail.com>
This commit is contained in:
Adrer
2023-11-20 14:10:23 -05:00
committed by GitHub
co-authored by Adrer
parent 5ac1cc817d
commit 39005bea2b
17 changed files with 21 additions and 87 deletions
@@ -202,10 +202,7 @@
if(on)
to_chat(user, "<span class='warning'>Turn it off first!</span>")
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
anchored = !anchored
to_chat(user, "<span class='notice'>You [anchored ? "wrench" : "unwrench"] [src].</span>")
default_unfasten_wrench(user, I, 4 SECONDS)
/obj/machinery/atmospherics/portable/scrubber/huge/stationary
name = "Stationary Air Scrubber"
@@ -86,13 +86,7 @@
/obj/machinery/bottler/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
anchored = !anchored
if(anchored)
WRENCH_ANCHOR_MESSAGE
else
WRENCH_UNANCHOR_MESSAGE
default_unfasten_wrench(user, I, 0)
/obj/machinery/bottler/proc/insert_item(obj/item/O, mob/user)
if(!O || !user)
@@ -203,6 +203,4 @@
/obj/machinery/cooker/deepfryer/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
return
default_unfasten_wrench(user, I, 30)
@@ -263,7 +263,5 @@
/obj/machinery/icemachine/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
return
default_unfasten_wrench(user, I, 30)
@@ -129,12 +129,7 @@
if(operating)
return
I.play_tool_sound(src)
if(anchored)
to_chat(user, "<span class='alert'>[src] can now be moved.</span>")
else
to_chat(user, "<span class='alert'>[src] is now secured.</span>")
anchored = !anchored
default_unfasten_wrench(user, I, 0)
return TRUE
/obj/machinery/kitchen_machine/proc/add_item(obj/item/I, mob/user)
@@ -158,8 +158,6 @@
/obj/machinery/smartfridge/wrench_act(mob/living/user, obj/item/I)
. = default_unfasten_wrench(user, I, time = 4 SECONDS)
if(.)
power_change()
/obj/machinery/smartfridge/crowbar_act(mob/living/user, obj/item/I)
. = default_deconstruction_crowbar(user, I)
+1 -18
View File
@@ -901,24 +901,7 @@
if(using_irrigation)
to_chat(user, "<span class='warning'>Disconnect the hoses first!</span>")
return
if(!anchored && !isinspace())
user.visible_message("[user] begins to wrench [src] into place.", "<span class='notice'>You begin to wrench [src] in place...</span>")
if(I.use_tool(src, user, 20, volume = I.tool_volume))
if(anchored)
return
anchored = TRUE
user.visible_message("[user] wrenches [src] into place.", \
"<span class='notice'>You wrench [src] in place.</span>")
else if(anchored)
user.visible_message("[user] begins to unwrench [src].", \
"<span class='notice'>You begin to unwrench [src]...</span>")
if(I.use_tool(src, user, 20, volume = I.tool_volume))
if(!anchored)
return
anchored = FALSE
user.visible_message("[user] unwrenches [src].", \
"<span class='notice'>You unwrench [src].</span>")
default_unfasten_wrench(user, I)
/obj/machinery/hydroponics/attack_hand(mob/user)
if(issilicon(user)) //How does AI know what plant is?
@@ -191,7 +191,7 @@
/obj/machinery/power/teg/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
if(!default_unfasten_wrench(user, I, 0))
return
anchored = !anchored
if(!anchored)
@@ -294,14 +294,7 @@
/obj/machinery/chem_dispenser/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 4 SECONDS, volume = I.tool_volume))
return
if(anchored)
anchored = FALSE
WRENCH_UNANCHOR_MESSAGE
else if(!anchored)
anchored = TRUE
WRENCH_ANCHOR_MESSAGE
default_unfasten_wrench(user, I, 4 SECONDS)
/obj/machinery/chem_dispenser/attack_ai(mob/user)
return attack_hand(user)
@@ -148,9 +148,7 @@
/obj/machinery/chem_master/wrench_act(mob/user, obj/item/I)
if(panel_open)
return
if(default_unfasten_wrench(user, I, time = 4 SECONDS))
power_change()
return TRUE
default_unfasten_wrench(user, I, 4 SECONDS)
/obj/machinery/chem_master/ui_act(action, params, datum/tgui/ui, datum/ui_state/state)
if(..())