mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Cleanup of pipe unwrenching code.
Fixes #1509 Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ obj/machinery/atmospherics
|
||||
active_power_usage = 0
|
||||
power_channel = ENVIRON
|
||||
var/nodealert = 0
|
||||
var/can_unwrench = 0
|
||||
|
||||
|
||||
|
||||
@@ -55,3 +56,34 @@ obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
|
||||
|
||||
obj/machinery/atmospherics/update_icon()
|
||||
return null
|
||||
|
||||
obj/machinery/atmospherics/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(can_unwrench && istype(W, /obj/item/weapon/wrench))
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
add_fingerprint(user)
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
var/obj/item/pipe/newpipe = new(loc, make_from=src)
|
||||
transfer_fingerprints_to(newpipe)
|
||||
if(istype(src, /obj/machinery/atmospherics/pipe))
|
||||
for(var/obj/machinery/meter/meter in T)
|
||||
if(meter.target == src)
|
||||
new /obj/item/pipe_meter(T)
|
||||
del(meter)
|
||||
del(src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -7,6 +7,8 @@ obj/machinery/atmospherics/binary/passive_gate
|
||||
name = "Passive gate"
|
||||
desc = "A one-way air valve that does not require power"
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
@@ -166,23 +168,4 @@ obj/machinery/atmospherics/binary/passive_gate
|
||||
if (on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -19,6 +19,8 @@ obj/machinery/atmospherics/binary/pump
|
||||
name = "Gas pump"
|
||||
desc = "A pump"
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
@@ -178,22 +180,5 @@ obj/machinery/atmospherics/binary/pump
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ obj/machinery/atmospherics/binary/volume_pump
|
||||
name = "Volumetric gas pump"
|
||||
desc = "A volumetric pump"
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
var/transfer_rate = 200
|
||||
|
||||
@@ -177,23 +179,4 @@ obj/machinery/atmospherics/binary/volume_pump
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/obj/machinery/portable_atmospherics/connected_device
|
||||
|
||||
var/obj/machinery/atmospherics/node
|
||||
@@ -137,24 +139,4 @@
|
||||
if (connected_device)
|
||||
user << "\red You cannot unwrench this [src], dettach [connected_device] first."
|
||||
return 1
|
||||
if (locate(/obj/machinery/portable_atmospherics, src.loc))
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
return ..()
|
||||
@@ -7,6 +7,8 @@ obj/machinery/atmospherics/trinary/filter
|
||||
|
||||
req_access = list(access_atmospherics)
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
var/temp = null // -- TLE
|
||||
|
||||
@@ -134,31 +136,7 @@ Filter types:
|
||||
|
||||
initialize()
|
||||
set_frequency(frequency)
|
||||
..()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
|
||||
obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
|
||||
if(..())
|
||||
|
||||
@@ -7,6 +7,8 @@ obj/machinery/atmospherics/trinary/mixer
|
||||
|
||||
req_access = list(access_atmospherics)
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/on = 0
|
||||
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
@@ -95,29 +97,6 @@ obj/machinery/atmospherics/trinary/mixer
|
||||
|
||||
return 1
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
name = "Heat Exchanger"
|
||||
desc = "Exchanges heat between two input gases. Setup for fast heat transfer"
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
|
||||
var/update_cycle
|
||||
|
||||
@@ -64,26 +66,3 @@
|
||||
partner.network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
@@ -6,6 +6,8 @@
|
||||
desc = "Has a valve and pump attached to it"
|
||||
use_power = 1
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/area/initial_loc
|
||||
level = 1
|
||||
var/area_uid
|
||||
@@ -312,25 +314,7 @@
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/Del()
|
||||
if(initial_loc)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
level = 1
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/area/initial_loc
|
||||
var/id_tag = null
|
||||
var/frequency = 1439
|
||||
@@ -248,25 +250,7 @@
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/Del()
|
||||
if(initial_loc)
|
||||
|
||||
@@ -8,6 +8,8 @@ obj/machinery/atmospherics/valve
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/open = 0
|
||||
var/openDuringInit = 0
|
||||
|
||||
@@ -317,22 +319,4 @@ obj/machinery/atmospherics/valve
|
||||
if (istype(src, /obj/machinery/atmospherics/valve/digital))
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
return ..()
|
||||
@@ -9,6 +9,8 @@ obj/machinery/atmospherics/pipe
|
||||
layer = 2.4 //under wires with their 2.44
|
||||
use_power = 0
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/alert_pressure = 80*ONE_ATMOSPHERE
|
||||
//minimum pressure before check_pressure(...) should be called
|
||||
|
||||
@@ -343,6 +345,8 @@ obj/machinery/atmospherics/pipe
|
||||
initialize_directions = SOUTH
|
||||
density = 1
|
||||
|
||||
can_unwrench = 0
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
|
||||
New()
|
||||
@@ -500,6 +504,8 @@ obj/machinery/atmospherics/pipe
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH
|
||||
|
||||
can_unwrench = 0
|
||||
|
||||
var/build_killswitch = 1
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
@@ -805,35 +811,7 @@ obj/machinery/atmospherics/pipe
|
||||
icon_state = "manifold-y-f"
|
||||
|
||||
obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (istype(src, /obj/machinery/atmospherics/pipe/tank))
|
||||
return ..()
|
||||
else if (istype(src, /obj/machinery/atmospherics/pipe/vent))
|
||||
return ..()
|
||||
else if (istype(W, /obj/item/weapon/wrench))
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
for (var/obj/machinery/meter/meter in T)
|
||||
if (meter.target == src)
|
||||
new /obj/item/pipe_meter(T)
|
||||
del(meter)
|
||||
del(src)
|
||||
else if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1)
|
||||
if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1)
|
||||
atmosanalyzer_scan(parent.air, user)
|
||||
else
|
||||
return ..()
|
||||
Reference in New Issue
Block a user