Skip to content

Commit

Permalink
water breathing quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
carpotoxin committed Oct 20, 2024
1 parent ee4fed0 commit 5552873
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 35 deletions.
6 changes: 3 additions & 3 deletions code/game/machinery/dna_infuser/organ_sets/fish_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/surgery/organs/internal/lungs/_lungs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "<span class='danger'>You suddenly have a hard time breathing through thin air."
lose_text = "<span class='notice'>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)
24 changes: 0 additions & 24 deletions modular_doppler/modular_quirks/nitrogen_breather/accessories.dm

This file was deleted.

1 change: 1 addition & 0 deletions modular_doppler/modular_species/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 5552873

Please sign in to comment.