From 555287302fce80921e83dac7396a282586c50ac4 Mon Sep 17 00:00:00 2001 From: "Lila S." Date: Mon, 21 Oct 2024 00:28:33 +0200 Subject: [PATCH] water breathing quirk --- .../dna_infuser/organ_sets/fish_organs.dm | 6 +-- .../surgery/organs/internal/lungs/_lungs.dm | 3 ++ .../breather}/accessories.dm | 25 +++++++++++ .../nitrogen_breather/icons/belt.dmi | Bin .../nitrogen_breather/icons/tank.dmi | Bin .../icons/tanks_lefthand.dmi | Bin .../icons/tanks_righthand.dmi | Bin .../nitrogen_breather/nitrogen_breather.dm | 0 .../nitrogen_breather/nitrogen_tanks.dm | 8 ++-- .../breather/water_breather/water_breather.dm | 39 ++++++++++++++++++ .../nitrogen_breather/accessories.dm | 24 ----------- modular_doppler/modular_species/_species.dm | 1 + tgstation.dme | 8 ++-- 13 files changed, 79 insertions(+), 35 deletions(-) rename modular_doppler/{modular_cosmetics/code/accessories => modular_quirks/breather}/accessories.dm (76%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/icons/belt.dmi (100%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/icons/tank.dmi (100%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/icons/tanks_lefthand.dmi (100%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/icons/tanks_righthand.dmi (100%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/nitrogen_breather.dm (100%) rename modular_doppler/modular_quirks/{ => breather}/nitrogen_breather/nitrogen_tanks.dm (87%) create mode 100644 modular_doppler/modular_quirks/breather/water_breather/water_breather.dm delete mode 100644 modular_doppler/modular_quirks/nitrogen_breather/accessories.dm diff --git a/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm b/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm index a1fd9a112c5ce..eb9014df95580 100644 --- a/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm +++ b/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm @@ -224,7 +224,7 @@ safe_oxygen_min = 0 //We don't breathe this ///The required partial pressure of water_vapor for not suffocating. - var/safe_water_level = parent_type::safe_oxygen_min +// var/safe_water_level = parent_type::safe_oxygen_min // DOPPLER EDIT REMOVAL - moved to parent type /// Bodypart overlay applied to the chest where the lungs are in var/datum/bodypart_overlay/simple/gills/gills @@ -261,7 +261,7 @@ owner.clear_alert(ALERT_NOT_ENOUGH_WATER) /// Requires the spaceman to have either water vapor or be wet. -/obj/item/organ/internal/lungs/fish/proc/breathe_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp, old_water_pp) +/obj/item/organ/internal/lungs/proc/breathe_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp, old_water_pp) // DOPPLER EDIT, old code: /obj/item/organ/internal/lungs/fish/proc/breathe_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp, old_water_pp) var/need_to_breathe = !HAS_TRAIT(src, TRAIT_SPACEBREATHING) && !HAS_TRAIT(breather, TRAIT_IS_WET) if(water_pp < safe_water_level && need_to_breathe) on_low_water(breather, breath, water_pp) @@ -278,7 +278,7 @@ breather.adjustOxyLoss(-5) /// Called when there isn't enough water to breath -/obj/item/organ/internal/lungs/fish/proc/on_low_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp) +/obj/item/organ/internal/lungs/proc/on_low_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp) // DOPPLER EDIT, old code: /obj/item/organ/internal/lungs/fish/proc/on_low_water(mob/living/carbon/breather, datum/gas_mixture/breath, water_pp) breather.throw_alert(ALERT_NOT_ENOUGH_WATER, /atom/movable/screen/alert/not_enough_water) var/gas_breathed = handle_suffocation(breather, water_pp, safe_water_level, breath.gases[/datum/gas/water_vapor][MOLES]) if(water_pp) diff --git a/code/modules/surgery/organs/internal/lungs/_lungs.dm b/code/modules/surgery/organs/internal/lungs/_lungs.dm index b2d85a26f8fdc..02ec157932489 100644 --- a/code/modules/surgery/organs/internal/lungs/_lungs.dm +++ b/code/modules/surgery/organs/internal/lungs/_lungs.dm @@ -42,6 +42,9 @@ //These thresholds are checked against what amounts to total_mix_pressure * (gas_type_mols/total_mols) var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa var/safe_oxygen_max = 0 + // DOPPLER ADDITION START + var/safe_water_level = 16 + // DOPPLER ADDITION END var/safe_nitro_min = 0 var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? var/safe_plasma_min = 0 diff --git a/modular_doppler/modular_cosmetics/code/accessories/accessories.dm b/modular_doppler/modular_quirks/breather/accessories.dm similarity index 76% rename from modular_doppler/modular_cosmetics/code/accessories/accessories.dm rename to modular_doppler/modular_quirks/breather/accessories.dm index 67eda7e826ec9..97cfaf183271a 100644 --- a/modular_doppler/modular_cosmetics/code/accessories/accessories.dm +++ b/modular_doppler/modular_quirks/breather/accessories.dm @@ -1,3 +1,28 @@ +/obj/item/clothing/accessory/breathing + name = "breathing dogtag" + desc = "Dogtag that lists what you breathe." + icon_state = "allergy" + above_suit = FALSE + minimize_when_attached = TRUE + attachment_slot = CHEST + var/breath_type + +/obj/item/clothing/accessory/breathing/examine(mob/user) + . = ..() + . += "The dogtag reads: I breathe [breath_type]." + +/obj/item/clothing/accessory/breathing/accessory_equipped(obj/item/clothing/under/uniform, user) + . = ..() + RegisterSignal(uniform, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) + +/obj/item/clothing/accessory/breathing/accessory_dropped(obj/item/clothing/under/uniform, user) + . = ..() + UnregisterSignal(uniform, COMSIG_ATOM_EXAMINE) + +/obj/item/clothing/accessory/breathing/proc/on_examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += "The dogtag reads: I breathe [breath_type]." + // Accessory for Akula species, it makes them wet and happy! :) /obj/item/clothing/accessory/vaporizer diff --git a/modular_doppler/modular_quirks/nitrogen_breather/icons/belt.dmi b/modular_doppler/modular_quirks/breather/nitrogen_breather/icons/belt.dmi similarity index 100% rename from modular_doppler/modular_quirks/nitrogen_breather/icons/belt.dmi rename to modular_doppler/modular_quirks/breather/nitrogen_breather/icons/belt.dmi diff --git a/modular_doppler/modular_quirks/nitrogen_breather/icons/tank.dmi b/modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tank.dmi similarity index 100% rename from modular_doppler/modular_quirks/nitrogen_breather/icons/tank.dmi rename to modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tank.dmi diff --git a/modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_lefthand.dmi b/modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_lefthand.dmi similarity index 100% rename from modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_lefthand.dmi rename to modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_lefthand.dmi diff --git a/modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_righthand.dmi b/modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_righthand.dmi similarity index 100% rename from modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_righthand.dmi rename to modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_righthand.dmi diff --git a/modular_doppler/modular_quirks/nitrogen_breather/nitrogen_breather.dm b/modular_doppler/modular_quirks/breather/nitrogen_breather/nitrogen_breather.dm similarity index 100% rename from modular_doppler/modular_quirks/nitrogen_breather/nitrogen_breather.dm rename to modular_doppler/modular_quirks/breather/nitrogen_breather/nitrogen_breather.dm diff --git a/modular_doppler/modular_quirks/nitrogen_breather/nitrogen_tanks.dm b/modular_doppler/modular_quirks/breather/nitrogen_breather/nitrogen_tanks.dm similarity index 87% rename from modular_doppler/modular_quirks/nitrogen_breather/nitrogen_tanks.dm rename to modular_doppler/modular_quirks/breather/nitrogen_breather/nitrogen_tanks.dm index a9f334602e9da..8f58978589e5d 100644 --- a/modular_doppler/modular_quirks/nitrogen_breather/nitrogen_tanks.dm +++ b/modular_doppler/modular_quirks/breather/nitrogen_breather/nitrogen_tanks.dm @@ -14,10 +14,10 @@ air_contents.gases[/datum/gas/nitrogen][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) /obj/item/tank/internals/nitrogen/belt - icon = 'modular_doppler/modular_quirks/nitrogen_breather/icons/tank.dmi' - worn_icon = 'modular_doppler/modular_quirks/nitrogen_breather/icons/belt.dmi' - lefthand_file = 'modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_lefthand.dmi' - righthand_file = 'modular_doppler/modular_quirks/nitrogen_breather/icons/tanks_righthand.dmi' + icon = 'modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tank.dmi' + worn_icon = 'modular_doppler/modular_quirks/breather/nitrogen_breather/icons/belt.dmi' + lefthand_file = 'modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_lefthand.dmi' + righthand_file = 'modular_doppler/modular_quirks/breather/nitrogen_breather/icons/tanks_righthand.dmi' icon_state = "nitrogen_extended" inhand_icon_state = "nitrogen" slot_flags = ITEM_SLOT_BELT diff --git a/modular_doppler/modular_quirks/breather/water_breather/water_breather.dm b/modular_doppler/modular_quirks/breather/water_breather/water_breather.dm new file mode 100644 index 0000000000000..82a29b658e2c2 --- /dev/null +++ b/modular_doppler/modular_quirks/breather/water_breather/water_breather.dm @@ -0,0 +1,39 @@ +/datum/quirk/item_quirk/breather/water_breather + name = "Water Breather" + desc = "You have a pair of gills and are only capable of breathing oxygen through water, stay wet to breathe!" + icon = FA_ICON_FISH + medical_record_text = "Patient has a pair of gills on their body." + gain_text = "You suddenly have a hard time breathing through thin air." + lose_text = "You suddenly feel like you aren't bound to breathing through liquid anymore." + value = 0 + breath_type = "water" + +/datum/quirk/item_quirk/breather/water_breather/add_unique(client/client_source) + var/mob/living/carbon/human/target = quirk_holder + var/obj/item/organ/internal/lungs/target_lungs = target.get_organ_slot(ORGAN_SLOT_LUNGS) + var/obj/item/bodypart/chest/target_chest = target.get_bodypart(BODY_ZONE_CHEST) + var/obj/item/clothing/accessory/breathing/target_tag = new(get_turf(target)) + target_tag.breath_type = breath_type + + give_item_to_holder(target_tag, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS)) + give_item_to_holder( + /obj/item/clothing/accessory/vaporizer, + list( + LOCATION_HANDS = ITEM_SLOT_HANDS, + LOCATION_LPOCKET = ITEM_SLOT_LPOCKET, + LOCATION_RPOCKET = ITEM_SLOT_RPOCKET, + LOCATION_BACKPACK = ITEM_SLOT_BACKPACK + ), "Be sure to equip your vaporizer, or you may end up choking to death!" + ) + // if your lungs already have this trait, no need to update + if(target_lungs.type == /obj/item/organ/internal/lungs/fish) + return + target_lungs.safe_oxygen_min = 0 + // update lung procs + target_lungs.breathe_always = list(/datum/gas/water_vapor = "breathe_water") + // reflect correct lung flags + target_lungs.respiration_type = RESPIRATION_OXYGEN + // flavor + target_lungs.AddElement(/datum/element/noticable_organ, "%PRONOUN_Theyve a set of gills on %PRONOUN_their neck.", BODY_ZONE_PRECISE_MOUTH) + target_lungs.AddComponent(/datum/component/bubble_icon_override, "fish", BUBBLE_ICON_PRIORITY_ORGAN) + target_chest.add_bodypart_overlay(new /datum/bodypart_overlay/simple/gills) diff --git a/modular_doppler/modular_quirks/nitrogen_breather/accessories.dm b/modular_doppler/modular_quirks/nitrogen_breather/accessories.dm deleted file mode 100644 index 579cb211a70c2..0000000000000 --- a/modular_doppler/modular_quirks/nitrogen_breather/accessories.dm +++ /dev/null @@ -1,24 +0,0 @@ -/obj/item/clothing/accessory/breathing - name = "breathing dogtag" - desc = "Dogtag that lists what you breathe." - icon_state = "allergy" - above_suit = FALSE - minimize_when_attached = TRUE - attachment_slot = CHEST - var/breath_type - -/obj/item/clothing/accessory/breathing/examine(mob/user) - . = ..() - . += "The dogtag reads: I breathe [breath_type]." - -/obj/item/clothing/accessory/breathing/accessory_equipped(obj/item/clothing/under/uniform, user) - . = ..() - RegisterSignal(uniform, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) - -/obj/item/clothing/accessory/breathing/accessory_dropped(obj/item/clothing/under/uniform, user) - . = ..() - UnregisterSignal(uniform, COMSIG_ATOM_EXAMINE) - -/obj/item/clothing/accessory/breathing/proc/on_examine(datum/source, mob/user, list/examine_list) - SIGNAL_HANDLER - examine_list += "The dogtag reads: I breathe [breath_type]." diff --git a/modular_doppler/modular_species/_species.dm b/modular_doppler/modular_species/_species.dm index deca10777cab8..4badc76aec68d 100644 --- a/modular_doppler/modular_species/_species.dm +++ b/modular_doppler/modular_species/_species.dm @@ -119,6 +119,7 @@ target.AddElement(/datum/element/cliff_walking) if(FISH) ADD_TRAIT(target, TRAIT_WATER_ADAPTATION, SPECIES_TRAIT) + target.add_quirk(/datum/quirk/item_quirk/breather/water_breather) // this trait necessitates you get this 'item_quirk' if(FROG) ADD_TRAIT(target, TRAIT_WATER_ADAPTATION, SPECIES_TRAIT) diff --git a/tgstation.dme b/tgstation.dme index 1b27c4a667f96..2f49d2fc5d06c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6722,7 +6722,6 @@ #include "modular_doppler\modular_cosmetics\code\jacket_pockets.dm" #include "modular_doppler\modular_cosmetics\code\towels.dm" #include "modular_doppler\modular_cosmetics\code\uniform_overrides.dm" -#include "modular_doppler\modular_cosmetics\code\accessories\accessories.dm" #include "modular_doppler\modular_cosmetics\code\belt\med_bandolier.dm" #include "modular_doppler\modular_cosmetics\code\face\basemasks.dm" #include "modular_doppler\modular_cosmetics\code\face\glasses.dm" @@ -6919,14 +6918,15 @@ #include "modular_doppler\modular_mood\code\mood_events\dog_wag.dm" #include "modular_doppler\modular_mood\code\mood_events\hotspring.dm" #include "modular_doppler\modular_mood\code\mood_events\race_drink.dm" +#include "modular_doppler\modular_quirks\breather\accessories.dm" +#include "modular_doppler\modular_quirks\breather\nitrogen_breather\nitrogen_breather.dm" +#include "modular_doppler\modular_quirks\breather\nitrogen_breather\nitrogen_tanks.dm" +#include "modular_doppler\modular_quirks\breather\water_breather\water_breather.dm" #include "modular_doppler\modular_quirks\excitable\excitable.dm" #include "modular_doppler\modular_quirks\hardened_soles\hardened_soles.dm" #include "modular_doppler\modular_quirks\left_handed\left_handed.dm" #include "modular_doppler\modular_quirks\linguist\linguist.dm" #include "modular_doppler\modular_quirks\night_vision\night_vision.dm" -#include "modular_doppler\modular_quirks\nitrogen_breather\accessories.dm" -#include "modular_doppler\modular_quirks\nitrogen_breather\nitrogen_breather.dm" -#include "modular_doppler\modular_quirks\nitrogen_breather\nitrogen_tanks.dm" #include "modular_doppler\modular_quirks\overwrites\musician.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\quirk.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\rationpacks.dm"