From b007c3cff77306d8422caabbc1609852803c8f8e Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Tue, 24 Nov 2015 07:07:52 -0800 Subject: [PATCH 1/2] Fix internals dropping exploit. --- code/modules/mob/living/carbon/human/life.dm | 44 ++++++++++++-------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 155cb7ab376..02916034467 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -363,27 +363,37 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc /mob/living/carbon/human/get_breath_from_internal(volume_needed) //making this call the parent would be far too complicated - var/null_internals = 0 + if(internal) - if(istype(back, /obj/item/weapon/rig)) - var/obj/item/weapon/rig/rig = back - if(rig.offline && (rig.air_supply && internal == rig.air_supply)) - null_internals = 1 + var/null_internals = 0 //internals are invalid, therefore turn them off + var/skip_contents_check = 0 //rigsuit snowflake, oxygen tanks aren't stored inside the mob, so the 'contents.Find' check has to be skipped. - if(!(wear_mask && (wear_mask.flags & AIRTIGHT))) //not wearing mask - if(!(head && (head.flags & AIRTIGHT))) //not wearing helmet - null_internals = 1 + if(!(wear_mask && wear_mask.flags & AIRTIGHT)) //if NOT (wear_mask AND wear_mask.flags CONTAIN AIRTIGHT) + if(!(head && head.flags & AIRTIGHT)) //if NOT (head AND head.flags CONTAIN AIRTIGHT) + null_internals = 1 //not wearing a mask or suitable helmet - if(null_internals) - internal = null + if(istype(back, /obj/item/weapon/rig)) //wearing a rigsuit + var/obj/item/weapon/rig/rig = back //needs to be typecasted because this doesn't use get_rig() for some reason + if(rig.offline && (rig.air_supply && internal == rig.air_supply)) //if rig IS offline AND (rig HAS air_supply AND internal IS air_supply) + null_internals = 1 //offline suits do not breath - if(internal) - if(internals) - internals.icon_state = "internal1" - return internal.remove_air_volume(volume_needed) - else - if(internals) - internals.icon_state = "internal0" + else if(rig.air_supply && internal == rig.air_supply) //if rig HAS air_supply AND internal IS rig air_supply + skip_contents_check = 1 //skip contents.Find() check, the oxygen is valid even being outside of the mob + + if(!contents.Find(internal) && (!skip_contents_check)) //if internal NOT IN contents AND skip_contents_check IS false + null_internals = 1 //not a rigsuit and your oxygen is gone + + if(null_internals) //something wants internals gone + internal = null //so do it + + + if(internal) //check for hud updates every time this is called + if(internals) + internals.icon_state = "internal1" + return internal.remove_air_volume(volume_needed) //returns the valid air + else + if(internals) + internals.icon_state = "internal0" return null From b37d04d567cafee91bfda89980e0bc97a546e4d3 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Tue, 24 Nov 2015 07:08:02 -0800 Subject: [PATCH 2/2] Fix tank UI bugs. --- code/game/objects/items/weapons/tanks/tanks.dm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index db59ffc3492..cee2996904f 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -118,13 +118,16 @@ 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(location.wear_mask && (location.wear_mask.flags & AIRTIGHT)) + + if(iscarbon(loc)) + var/mob/living/carbon/C = loc + if(C.internal == src) + data["maskConnected"] = 1 + else + if(C.wear_mask && (C.wear_mask.flags & AIRTIGHT)) data["maskConnected"] = 1 - else if(ishuman(location)) - var/mob/living/carbon/human/H = location + else if(ishuman(C)) + var/mob/living/carbon/human/H = C if(H.head && (H.head.flags & AIRTIGHT)) data["maskConnected"] = 1