Skip to content

Commit

Permalink
Space heater can now be toggled on/off with right click (tgstation#61334
Browse files Browse the repository at this point in the history
)

Also copy pasted code from other machines, it worked without issue but if there is anything that can be improved on it, please tell.

I won't open a tgui menu 20 times per shift now.
  • Loading branch information
GuillaumePrata committed Sep 15, 2021
1 parent f702f62 commit 15c0080
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/game/machinery/spaceheater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
. += "There is no power cell installed."
if(in_range(user, src) || isobserver(user))
. += span_notice("The status display reads: Temperature range at <b>[settable_temperature_range]°C</b>.<br>Heating power at <b>[siunit(heating_power, "W", 1)]</b>.<br>Power consumption at <b>[(efficiency*-0.0025)+150]%</b>.") //100%, 75%, 50%, 25%
. += span_notice("<b>Right-click</b> to toggle [on ? "off" : "on"].")

/obj/machinery/space_heater/update_icon_state()
. = ..()
Expand Down Expand Up @@ -176,6 +177,13 @@
return TRUE
return ..()

/obj/machinery/space_heater/attack_hand_secondary(mob/user, list/modifiers)
if(!can_interact(user))
return
on = !on
update_appearance()
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/machinery/space_heater/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
Expand Down

0 comments on commit 15c0080

Please sign in to comment.