diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 7b07c65dc7f..08424513949 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -119,6 +119,7 @@ // common trait sources #define TRAIT_GENERIC "generic" #define GENERIC_ITEM_TRAIT "generic_item" +#define DISABILITY_TRAIT "disability" /// cannot be removed without admin intervention #define ROUNDSTART_TRAIT "roundstart" @@ -174,3 +175,12 @@ /// Traits given by psionics. #define TRAIT_SOURCE_PSIONICS "psionics" + + +// DISABILITY TRAITS + +/// Causes the mob to take twice as long to clot their wounds +#define TRAIT_DISABILITY_HEMOPHILIA "disability_hemophilia" + +/// Causes the mob to never clot their wounds +#define TRAIT_DISABILITY_HEMOPHILIA_MAJOR "disability_hemophilia_major" diff --git a/code/modules/mob/abstract/new_player/character_traits.dm b/code/modules/mob/abstract/new_player/character_traits.dm index bcd2d317a84..d0e8afc1345 100644 --- a/code/modules/mob/abstract/new_player/character_traits.dm +++ b/code/modules/mob/abstract/new_player/character_traits.dm @@ -66,3 +66,16 @@ H.max_stamina *= 0.8 H.stamina = H.max_stamina +/datum/character_disabilities/hemophilia + name = "Hemophilia" + desc = "Your blood lacks some clotting factors, causing wounds to take twice as long to stop bleeding." + /// This takes a TRAIT_DISABILITY_* type trait, and assigns it to the character on apply_self + var/trait_type = TRAIT_DISABILITY_HEMOPHILIA + +/datum/character_disabilities/hemophilia/apply_self(var/mob/living/carbon/human/H) + ADD_TRAIT(H, trait_type, DISABILITY_TRAIT) + +/datum/character_disabilities/hemophilia/major + name = "Major Hemophilia" + desc = "Your blood lacks ALL clotting factors, causing wounds to never stop bleeding." + trait_type = TRAIT_DISABILITY_HEMOPHILIA_MAJOR diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index d47121505a8..b9d9b5a3d70 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -940,8 +940,7 @@ Note that amputating the affected organ does in fact remove the infection from t cut_dam += W.damage if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && !(H.species.flags & NO_BLOOD))) - W.bleed_timer-- - status |= ORGAN_BLEEDING + W.handle_bleeding(H, src) clamped |= W.clamped diff --git a/code/modules/organs/wound.dm b/code/modules/organs/wound.dm index 78840431b4b..0e6ab4b3749 100644 --- a/code/modules/organs/wound.dm +++ b/code/modules/organs/wound.dm @@ -3,45 +3,51 @@ WOUNDS ****************************************************/ /datum/wound - // number representing the current stage + /// number representing the current stage var/current_stage = 0 - // description of the wound + /// description of the wound var/desc = "wound" //default in case something borks - // amount of damage this wound causes + /// amount of damage this wound causes var/damage = 0 - // ticks of bleeding left. + + /// how many times we've tried to lower the bleed timer, used to determine whether hemophilia should let bleed timer lower + var/bleed_timer_increment = 0 + + /// ticks of bleeding left. var/bleed_timer = 0 - // Above this amount wounds you will need to treat the wound to stop bleeding, regardless of bleed_timer + + /// Above this amount wounds you will need to treat the wound to stop bleeding, regardless of bleed_timer var/bleed_threshold = 30 - // amount of damage the current wound type requires(less means we need to apply the next healing stage) + + /// amount of damage the current wound type requires(less means we need to apply the next healing stage) var/min_damage = 0 - // is the wound bandaged? + /// is the wound bandaged? var/bandaged = 0 - // Similar to bandaged, but works differently + /// Similar to bandaged, but works differently var/clamped = 0 - // is the wound salved? + /// is the wound salved? var/salved = 0 - // is the wound disinfected? + /// is the wound disinfected? var/disinfected = 0 var/created = 0 - // number of wounds of this type + /// number of wounds of this type var/amount = 1 - // amount of germs in the wound + /// amount of germs in the wound var/germ_level = 0 /* These are defined by the wound type and should not be changed */ - // stages such as "cut", "deep cut", etc. + /// stages such as "cut", "deep cut", etc. var/list/stages - // maximum stage at which bleeding should still happen. Beyond this stage bleeding is prevented. + /// maximum stage at which bleeding should still happen. Beyond this stage bleeding is prevented. var/max_bleeding_stage = 0 - // one of CUT, BRUISE, PIERCE, BURN + /// one of CUT, BRUISE, PIERCE, BURN var/damage_type = CUT - // whether this wound needs a bandage/salve to heal at all - // the maximum amount of damage that this wound can have and still autoheal + /// whether this wound needs a bandage/salve to heal at all + /// the maximum amount of damage that this wound can have and still autoheal var/autoheal_cutoff = 15 @@ -112,6 +118,7 @@ src.damage += other.damage src.amount += other.amount src.bleed_timer += other.bleed_timer + src.bleed_timer_increment += other.bleed_timer_increment src.germ_level = (src.germ_level + other.germ_level)/2 src.created = max(src.created, other.created) //take the newer created time @@ -208,6 +215,20 @@ return 1 +/// Called in organ_external.dm update_damages, this will update the limb's status to bleeding, and lowers the bleed_timer if applicable +/datum/wound/proc/handle_bleeding(var/mob/victim, var/obj/item/organ/external/limb) + limb.status |= ORGAN_BLEEDING + + var/can_lower_bleed = TRUE + if(HAS_TRAIT(victim, TRAIT_DISABILITY_HEMOPHILIA_MAJOR)) // major will NEVER lower + can_lower_bleed = FALSE + else if(HAS_TRAIT(victim, TRAIT_DISABILITY_HEMOPHILIA) && bleed_timer_increment % 2 != 0) // basic will lower half as fast + can_lower_bleed = FALSE + + if(can_lower_bleed) + bleed_timer-- + bleed_timer_increment++ + /** WOUND DEFINITIONS **/ //Note that the MINIMUM damage before a wound can be applied should correspond to diff --git a/html/changelogs/geeves-hemophilia_disability.yml b/html/changelogs/geeves-hemophilia_disability.yml new file mode 100644 index 00000000000..15d3d5d741b --- /dev/null +++ b/html/changelogs/geeves-hemophilia_disability.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Added hemophilia and major hemophilia to the disabilities list. The former will cause wounds to bleed for twice as long, while the latter will cause wounds to bleed forever." \ No newline at end of file