Air tank interface fix

- Allows tanks to be toggled on and off as internals from their UI.
- If internals are off, all tanks capable of being used for internals
will display "tank is connected to a mask".
- If internals are on, only the tank that is actively supplying air is
listed as "connected" and "open". All others will display as "not
connected".
- Tanks inside rigs will correctly display their status in their UI (if
you open it before putting it in the rig, but cannot be toggled on
through the interface. Toggling them on with the internals button works.
This commit is contained in:
Loganbacca
2015-01-13 23:19:58 +13:00
parent cac7f64fdc
commit 985d410657

View File

@@ -117,10 +117,16 @@
ui_interact(user)
/obj/item/weapon/tank/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/mob/living/carbon/location = null
if(istype(loc, /obj/item/weapon/rig)) // check for tanks in rigs
if(istype(loc.loc, /mob/living/carbon))
location = loc.loc
else if(istype(loc, /mob/living/carbon))
location = loc
var/using_internal
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(istype(location))
if(location.internal==src)
using_internal = 1
@@ -133,9 +139,20 @@
data["valveOpen"] = using_internal ? 1 : 0
data["maskConnected"] = 0
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(location.internal == src)
if(istype(location))
var/mask_check = 0
if(location.internal == src) // if tank is current internal
mask_check = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
else if(istype(src.loc, /obj/item/weapon/rig) && src.loc in location) // or the rig is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
data["maskConnected"] = 1
else if(istype(location, /mob/living/carbon/human))