Skip to content

Commit

Permalink
fixes gas reagents + action buttons when dead (#5937)
Browse files Browse the repository at this point in the history
bandaids but w/e

---------

Co-authored-by: silicons <no@you.cat>
  • Loading branch information
silicons and silicons authored Sep 4, 2023
1 parent 784efe9 commit e22bf52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@

gas_reagent_id = "sacid"
gas_reagent_amount = 10
gas_reagent_threshold = 5


/datum/gas/sulfur_dioxide
Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -579,16 +579,19 @@
breath.adjust_gas(GAS_ID_NITROUS_OXIDE, -breath.gas[GAS_ID_NITROUS_OXIDE]/6, update = 0) //update after

for(var/gasname in breath.gas)
// todo: all this needs rewritten.
if(gasname == breath_type)
continue
var/list/reagent_gas_data = global.gas_data.reagents[gasname]
if(!reagent_gas_data)
continue
if(breath.gas[gasname] < reagent_gas_data[GAS_REAGENT_LIST_THRESHOLD])
return
// up-convert since intuitively reagent gas uses mols in tile air, rather than in breath.
var/effective_moles = breath.gas[gasname] * (CELL_VOLUME / BREATH_VOLUME)
if(effective_moles < reagent_gas_data[GAS_REAGENT_LIST_THRESHOLD])
continue
// Little bit of sanity so we aren't trying to add 0.0000000001 units of CO2, and so we don't end up with 99999 units of CO2.
var/reagent_id = reagent_gas_data[GAS_REAGENT_LIST_ID]
var/reagent_amount = (breath.gas[gasname] * reagent_gas_data[GAS_REAGENT_LIST_FACTOR] + reagent_gas_data[GAS_REAGENT_LIST_AMOUNT]) * gas_to_process_ratio
var/reagent_amount = ((effective_moles - reagent_gas_data[GAS_REAGENT_LIST_THRESHOLD]) * reagent_gas_data[GAS_REAGENT_LIST_FACTOR] + reagent_gas_data[GAS_REAGENT_LIST_AMOUNT]) * gas_to_process_ratio
reagent_amount = min(reagent_amount, reagent_gas_data[GAS_REAGENT_LIST_MAX] - reagents.get_reagent_amount(reagent_id))
if(reagent_amount < 0.05)
continue
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/login.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
mind.active = 1 //indicates that the mind is currently synced with a client

update_antag_icons(mind)
update_action_buttons()

if(ai_holder && !ai_holder.autopilot)
ai_holder.go_sleep()
Expand Down

0 comments on commit e22bf52

Please sign in to comment.