Skip to content

Commit

Permalink
Merge pull request #16216 from phil235/CanisterBreakFix
Browse files Browse the repository at this point in the history
Canister breaking open now properly disconnects from possible connect…
  • Loading branch information
Cheridan committed Mar 20, 2016
2 parents f3fcbb6 + 09e3f1e commit c533a17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion code/game/machinery/machinery.dm
Expand Up @@ -262,7 +262,6 @@ Class Procs:
user << "<span class='warning'>You momentarily forget how to use [src]!</span>"
return 1
if(!is_interactable())
user << "<span class='danger'>\The [src] seems offline.</span>"
return 1
if(set_machine)
user.set_machine(src)
Expand Down
16 changes: 9 additions & 7 deletions code/modules/atmospherics/machinery/portable/canister.dm
Expand Up @@ -102,7 +102,7 @@
#define FULL 16
#define DANGER 32
/obj/machinery/portable_atmospherics/canister/update_icon()
if(destroyed)
if(stat & BROKEN)
overlays.Cut()
icon_state = "[initial(icon_state)]-1"
return
Expand Down Expand Up @@ -153,15 +153,17 @@
healthcheck()

/obj/machinery/portable_atmospherics/canister/proc/healthcheck()
if(destroyed)
if(stat & BROKEN)
return

if(health <= 10)
disconnect()
var/datum/gas_mixture/expelled_gas = air_contents.remove(air_contents.total_moles())
var/turf/T = get_turf(src)
T.assume_air(air_contents)
T.assume_air(expelled_gas)
air_update_turf()

destroyed = TRUE
stat |= BROKEN
density = 0
playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
update_icon()
Expand All @@ -173,7 +175,7 @@

/obj/machinery/portable_atmospherics/canister/process_atmos()
..()
if(destroyed)
if(stat & BROKEN)
return PROCESS_KILL
if(!valve_open)
pump.AIR1 = null
Expand Down Expand Up @@ -204,13 +206,13 @@
/obj/machinery/portable_atmospherics/canister/ex_act(severity, target)
switch(severity)
if(1)
if(destroyed || prob(30))
if((stat & BROKEN) || prob(30))
qdel(src)
return
else
health = 0
if(2)
if(destroyed)
if(stat & BROKEN)
qdel(src)
return
else
Expand Down
Expand Up @@ -8,7 +8,6 @@
var/obj/item/weapon/tank/holding

var/volume = 0
var/destroyed = 0

var/maximum_pressure = 90 * ONE_ATMOSPHERE

Expand All @@ -25,6 +24,7 @@
/obj/machinery/portable_atmospherics/Destroy()
SSair.atmos_machinery -= src

disconnect()
qdel(air_contents)
air_contents = null

Expand Down Expand Up @@ -69,14 +69,14 @@
return air_contents

/obj/machinery/portable_atmospherics/attackby(obj/item/weapon/W, mob/user, params)
if((istype(W, /obj/item/weapon/tank) && !destroyed))
if(istype(W, /obj/item/weapon/tank) && !(stat & BROKEN))
var/obj/item/weapon/tank/T = W
if(holding || !user.drop_item())
return
T.loc = src
holding = T
update_icon()
else if(istype(W, /obj/item/weapon/wrench))
else if(istype(W, /obj/item/weapon/wrench) && !(stat & BROKEN))
if(connected_port)
disconnect()
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
Expand Down

0 comments on commit c533a17

Please sign in to comment.