Skip to content

Commit 6a02b60

Browse files
Merge pull request NebulaSS13#5135 from out-of-phaze/codequality/oxy-impl
Implement icon_state_active on oxygen pump
2 parents da9fafe + cf9feb2 commit 6a02b60

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

code/game/machinery/oxygen_pump.dm

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
var/mask_type = /obj/item/clothing/mask/breath/emergency
1818
var/icon_state_open = "emerg_open"
1919
var/icon_state_closed = "emerg"
20-
var/icon_state_active // TODO implement
20+
var/icon_state_active
2121

2222
power_channel = ENVIRON
2323
idle_power_usage = 10
@@ -136,16 +136,24 @@
136136
return
137137
return 1
138138

139+
/obj/machinery/oxygen_pump/on_update_icon()
140+
if(stat & MAINT)
141+
icon_state = icon_state_open
142+
else if(icon_state_active && use_power == POWER_USE_ACTIVE) // the base type doesn't have an active state
143+
icon_state = icon_state_active
144+
else
145+
icon_state = icon_state_closed
146+
139147
/obj/machinery/oxygen_pump/attackby(obj/item/used_item, mob/user)
140148
if(IS_SCREWDRIVER(used_item))
141149
stat ^= MAINT
142150
user.visible_message(SPAN_NOTICE("\The [user] [stat & MAINT ? "opens" : "closes"] \the [src]."), SPAN_NOTICE("You [stat & MAINT ? "open" : "close"] \the [src]."))
143-
if(stat & MAINT)
144-
icon_state = icon_state_open
145-
if(!stat)
146-
icon_state = icon_state_closed
151+
queue_icon_update()
147152
return TRUE
148-
if(istype(used_item, /obj/item/tank) && (stat & MAINT))
153+
if(istype(used_item, /obj/item/tank))
154+
if(!(stat & MAINT))
155+
to_chat(user, SPAN_WARNING("Please open the maintenance hatch first."))
156+
return TRUE
149157
if(tank)
150158
to_chat(user, SPAN_WARNING("\The [src] already has a tank installed!"))
151159
return TRUE
@@ -155,9 +163,6 @@
155163
user.visible_message(SPAN_NOTICE("\The [user] installs \the [tank] into \the [src]."), SPAN_NOTICE("You install \the [tank] into \the [src]."))
156164
src.add_fingerprint(user)
157165
return TRUE
158-
if(istype(used_item, /obj/item/tank) && !stat)
159-
to_chat(user, SPAN_WARNING("Please open the maintenance hatch first."))
160-
return TRUE
161166
return FALSE // TODO: should this be a parent call? do we want this to be (de)constructable?
162167

163168
/obj/machinery/oxygen_pump/get_examine_strings(mob/user, distance, infix, suffix)

0 commit comments

Comments
 (0)