From cccd2280a7c2d337b85c9149a36601dee4f4bd75 Mon Sep 17 00:00:00 2001 From: Cameron Lennox Date: Mon, 27 Oct 2025 01:51:35 -0400 Subject: [PATCH] Fixes a bug with species component application (#18696) * Update trait.dm Update trait.dm Fixes a bug and cleans up Omen dice application * small godmode fix * Proper * Fixes organ regen --- code/datums/components/traits/radiation_effects.dm | 3 +++ code/datums/components/traits/unlucky.dm | 7 ------- code/datums/elements/godmode.dm | 5 ++++- code/modules/games/dice.dm | 4 ++-- .../carbon/human/species/station/traits/positive.dm | 8 ++++++++ .../carbon/human/species/station/traits/trait.dm | 11 ++++++++++- code/modules/organs/internal/_organ_internal.dm | 3 ++- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/code/datums/components/traits/radiation_effects.dm b/code/datums/components/traits/radiation_effects.dm index f4dc440554..f61019dec1 100644 --- a/code/datums/components/traits/radiation_effects.dm +++ b/code/datums/components/traits/radiation_effects.dm @@ -36,6 +36,9 @@ ///If we dissipate radiation or keep it. var/radiation_dissipation = TRUE + dupe_mode = COMPONENT_DUPE_UNIQUE + dupe_type = /datum/component/radiation_effects + /datum/component/radiation_effects/Initialize(glows, radiation_glow_minor_threshold, contamination, contamination_strength, radiation_color, intensity_mod, range_mod, radiation_immunity, radiation_healing, radiation_dissipation) if(!isliving(parent)) diff --git a/code/datums/components/traits/unlucky.dm b/code/datums/components/traits/unlucky.dm index 91ccb253f3..b8453cbe9d 100644 --- a/code/datums/components/traits/unlucky.dm +++ b/code/datums/components/traits/unlucky.dm @@ -534,10 +534,3 @@ . = ..() var/mob/living/living_parent = parent living_parent.remove_filter("omen") - -/** - * The dice omen. - * Single use omen from rolling a nat 1 on a cursed d20. - */ -/datum/component/omen/dice - incidents_left = 1 diff --git a/code/datums/elements/godmode.dm b/code/datums/elements/godmode.dm index b83297b4b2..c1c7702cd3 100644 --- a/code/datums/elements/godmode.dm +++ b/code/datums/elements/godmode.dm @@ -14,7 +14,9 @@ if(our_target.status_flags & GODMODE) //Already have it. return ELEMENT_INCOMPATIBLE our_target.status_flags |= GODMODE - + our_target.status_flags &= ~CANSTUN + our_target.status_flags &= ~CANWEAKEN + our_target.status_flags &= ~CANPARALYSE if(ishuman(target)) RegisterSignal(target, COMSIG_EXTERNAL_ORGAN_PRE_DAMAGE_APPLICATION, PROC_REF(on_external_damaged)) RegisterSignal(target, COMSIG_INTERNAL_ORGAN_PRE_DAMAGE_APPLICATION, PROC_REF(on_internal_damaged)) @@ -65,6 +67,7 @@ //And finally, remove the fact we're in godmode. our_target.status_flags &= ~GODMODE + our_target.status_flags |= CANSTUN|CANWEAKEN|CANPARALYSE return ..() /datum/element/godmode/proc/on_external_damaged() diff --git a/code/modules/games/dice.dm b/code/modules/games/dice.dm index f1d5b37d33..7a9c792d49 100644 --- a/code/modules/games/dice.dm +++ b/code/modules/games/dice.dm @@ -251,7 +251,7 @@ to_chat(user, span_cult("You feel extraordinarily unlucky...")) if(evil) user.AddComponent( - /datum/component/omen/dice,\ + /datum/component/omen,\ incidents_left = 1,\ luck_mod = 1,\ damage_mod = 1,\ @@ -262,7 +262,7 @@ else user.AddComponent( - /datum/component/omen/dice,\ + /datum/component/omen,\ incidents_left = 1,\ luck_mod = 0.3,\ damage_mod = 1,\ diff --git a/code/modules/mob/living/carbon/human/species/station/traits/positive.dm b/code/modules/mob/living/carbon/human/species/station/traits/positive.dm index fb08941b7e..cb8d1921f7 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits/positive.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits/positive.dm @@ -562,3 +562,11 @@ G.radiation_color = trait_prefs["glow_color"] G.glows = trait_prefs["glow_enabled"] G.radiation_healing = TRUE + +/datum/trait/positive/radioactive_heal/unapply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs) + ..() //Does all the removal stuff + //We then check to see if we still have the radiation component (such as we have a species componennt of it) + //If so, we remove the healing effect. + var/datum/component/radiation_effects/G = H.GetComponent(added_component_path) + if(G) + G.radiation_healing = initial(G.radiation_healing) diff --git a/code/modules/mob/living/carbon/human/species/station/traits/trait.dm b/code/modules/mob/living/carbon/human/species/station/traits/trait.dm index 5dc0d42317..49a6330aee 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits/trait.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits/trait.dm @@ -73,7 +73,7 @@ add_verb(H, /mob/living/carbon/human/proc/trait_tutorial) if(special_env) S.env_traits += src - if(added_component_path) + if(added_component_path && !H.GetComponent(added_component_path)) H.AddComponent(added_component_path) return @@ -107,6 +107,15 @@ if(added_component_path) var/datum/component/C = H.GetComponent(added_component_path) if(C) + if(LAZYLEN(S.species_component)) + //Species_component is a list of paths. + for(var/checked_species_component in S.species_component) + //Ex: ACP = /datum/component/radioactive/type2 CSC = /datum/component/radioactive. This returns. + if(ispath(added_component_path, checked_species_component)) + return + //Ex: ACP = /datum/component/radioactive CSC = /datum/component/radioactive/shadekin. This passes. + if(ispath(checked_species_component, added_component_path)) + return qdel(C) return diff --git a/code/modules/organs/internal/_organ_internal.dm b/code/modules/organs/internal/_organ_internal.dm index 9756182e5e..8702d81de7 100644 --- a/code/modules/organs/internal/_organ_internal.dm +++ b/code/modules/organs/internal/_organ_internal.dm @@ -18,8 +18,9 @@ // Heals the internal organ passively as long as it's under the bruised threshold // Not a lot of MATH just yet, but nutrition or other factors could be taken into account +// Per the original PR: 'Allows internal organs to regenerate themselves passively, as long as they're not bruised.' /obj/item/organ/internal/proc/passive_heal() - if(!is_bruised() && !is_broken()) + if(is_bruised() || is_broken()) return var/heal_amt = healing_factor * CONFIG_GET(number/organ_regeneration_multiplier)