Fixes inhalers having odd interactions with masks (#4988)

The code for whether or not gas could be inhaled wasn't good. This fixes that.
This commit is contained in:
BurgerLUA
2018-07-14 03:13:21 -07:00
committed by Erki
parent 5e915363a8
commit ddaf0b0d3e
4 changed files with 46 additions and 6 deletions

View File

@@ -5,13 +5,16 @@
if(SSair.times_fired%4==2 || failed_last_breath || (health < config.health_threshold_crit)) //First, resolve location and get a breath
breathe()
/mob/living/carbon/proc/inhale(var/datum/reagents/from, var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0)
/mob/living/carbon/proc/inhale(var/datum/reagents/from, var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/bypass_mask = FALSE)
if(species && (species.flags & NO_BREATHE)) //Check for species
return 0
if (contents.Find(internal) && wear_mask && (wear_mask.item_flags & AIRTIGHT)) //Check for internals
return 0
if(!bypass_mask)
if(wear_mask && wear_mask.item_flags & BLOCK_GAS_SMOKE_EFFECT) //Check if the gasmask blocks an effect
return 0
if (internals && internals.icon_state == "internal1") //Check for internals
return 0
return from.trans_to_holder(target,amount,multiplier,copy) //complete transfer

View File

@@ -385,7 +385,7 @@
return trans_to_mob(target, amount*0.75, CHEM_TOUCH, multiplier, copy) + trans_to_mob(target, amount*0.25, CHEM_BREATHE, multiplier, copy)
/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0, var/bypass_checks = FALSE) // Transfer after checking into which holder...
if(!target || !istype(target) || !target.simulated)
return 0
@@ -394,7 +394,7 @@
if(istype(C))
if(type == CHEM_BREATHE)
var/datum/reagents/R = C.breathing
return C.inhale(src, R, amount, multiplier, copy)
return C.inhale(src, R, amount, multiplier, copy, bypass_checks)
if(type == CHEM_BLOOD)
var/datum/reagents/R = C.reagents
return trans_to_holder(R, amount, multiplier, copy)

View File

@@ -63,7 +63,7 @@
if(M.reagents)
var/contained = reagentlist()
var/trans = reagents.trans_to_mob(M, amount_per_transfer_from_this, CHEM_BREATHE)
var/trans = reagents.trans_to_mob(M, amount_per_transfer_from_this, CHEM_BREATHE, bypass_mask = TRUE)
admin_inject_log(user, M, src, contained, trans)
playsound(src.loc, 'sound/items/stimpack.ogg', 50, 1)
to_chat(user,"<span class='notice'>[trans] units injected. [reagents.total_volume] units remaining in \the [src].</span>")

View File

@@ -0,0 +1,37 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
#################################
# Your name.
author: BurgerBB
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Fixes inhalers having odd gasmask interaction."