Removes pipe pressure check copypaste. Fixes pipe caps to always be removable.

This commit is contained in:
Cyantime
2017-09-09 21:24:52 -04:00
parent a40fb8256d
commit 82626c6936
13 changed files with 43 additions and 50 deletions

View File

@@ -125,3 +125,10 @@ obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/a
/obj/machinery/atmospherics/update_icon()
return null
/obj/machinery/atmospherics/proc/can_unwrench()
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)
return 0
return 1

View File

@@ -242,10 +242,8 @@
if (unlocked)
user << "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>"
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 << "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -221,10 +221,8 @@ Thus, the two variables affect pump operation are set in New():
if (!(stat & NOPOWER) && use_power)
user << "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>"
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 << "<span class='warning'>You cannot unwrench this [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench this [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -82,12 +82,8 @@
if(!istype(W, /obj/item/weapon/wrench))
return ..()
var/int_pressure = 0
for(var/datum/omni_port/P in ports)
int_pressure += P.air.return_pressure()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_pressure - env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
@@ -100,6 +96,15 @@
new /obj/item/pipe(loc, make_from=src)
qdel(src)
/obj/machinery/atmospherics/omni/can_unwrench()
var/int_pressure = 0
for(var/datum/omni_port/P in ports)
int_pressure += P.air.return_pressure()
var/datum/gas_mixture/env_air = loc.return_air()
if((int_pressure - env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
return 0
return 1
/obj/machinery/atmospherics/omni/attack_hand(user as mob)
if(..())
return

View File

@@ -136,10 +136,8 @@
return 1
if (locate(/obj/machinery/portable_atmospherics, src.loc))
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 << "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -131,10 +131,8 @@
/obj/machinery/atmospherics/trinary/filter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
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 << "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -106,10 +106,8 @@
/obj/machinery/atmospherics/trinary/mixer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
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 << "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -348,10 +348,8 @@
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
user << "<span class='warning'>You cannot unwrench \the [src], it's too complicated.</span>"
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 << "<span class='warnng'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warnng'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -72,9 +72,7 @@
if (level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
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)
if (!can_unwrench())
user << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1

View File

@@ -401,10 +401,8 @@
if (node && node.level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
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 << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -272,10 +272,8 @@
if (node && node.level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
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 << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -292,10 +292,8 @@
if (istype(src, /obj/machinery/atmospherics/valve/digital) && !src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
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 << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)

View File

@@ -82,10 +82,8 @@
if (level==1 && isturf(T) && !T.is_plating())
user << "<span class='warning'>You must remove the plating first.</span>"
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 << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
@@ -1014,6 +1012,9 @@
if(level == 1 && !T.is_plating()) hide(1)
update_icon()
/obj/machinery/atmospherics/pipe/cap/can_unwrench()
return 1
/obj/machinery/atmospherics/pipe/cap/visible
level = 2
icon_state = "cap"