mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
172 lines
5.9 KiB
Plaintext
172 lines
5.9 KiB
Plaintext
/**
|
|
* organ set bonus element; which makes organs in the same set, all in one person, provide a unique bonus!
|
|
*
|
|
* Used for infused organs!
|
|
*/
|
|
/datum/element/organ_set_bonus
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// Status Effect typepath to instantiate and apply to the mob.
|
|
var/datum/status_effect/organ_set_bonus/bonus_type
|
|
|
|
/datum/element/organ_set_bonus/Attach(datum/target, bonus_type)
|
|
. = ..()
|
|
|
|
if(!isorgan(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
src.bonus_type = bonus_type
|
|
RegisterSignal(target, COMSIG_ORGAN_IMPLANTED, PROC_REF(on_implanted))
|
|
RegisterSignal(target, COMSIG_ORGAN_REMOVED, PROC_REF(on_removed))
|
|
|
|
/datum/element/organ_set_bonus/Detach(obj/item/organ/target)
|
|
UnregisterSignal(target, list(COMSIG_ORGAN_IMPLANTED, COMSIG_ORGAN_REMOVED))
|
|
if(target.owner)
|
|
UnregisterSignal(target.owner, COMSIG_ATOM_EXAMINE)
|
|
return ..()
|
|
|
|
/datum/element/organ_set_bonus/proc/on_implanted(obj/item/organ/target, mob/living/carbon/receiver)
|
|
SIGNAL_HANDLER
|
|
|
|
var/datum/status_effect/organ_set_bonus/set_bonus = receiver.has_status_effect(bonus_type)
|
|
if(!set_bonus)
|
|
set_bonus = receiver.apply_status_effect(bonus_type)
|
|
set_bonus.set_organs(set_bonus.organs + 1, target)
|
|
|
|
/datum/element/organ_set_bonus/proc/on_removed(obj/item/organ/target, mob/living/carbon/loser)
|
|
SIGNAL_HANDLER
|
|
|
|
//get status effect or remove it
|
|
var/datum/status_effect/organ_set_bonus/set_bonus = loser.has_status_effect(bonus_type)
|
|
if(set_bonus)
|
|
set_bonus.set_organs(set_bonus.organs - 1, target)
|
|
|
|
/datum/status_effect/organ_set_bonus
|
|
id = "organ_set_bonus"
|
|
duration = STATUS_EFFECT_PERMANENT
|
|
tick_interval = STATUS_EFFECT_NO_TICK
|
|
alert_type = null
|
|
///how many organs the carbon with this has in the set
|
|
var/organs = 0
|
|
///how many organs in the set you need to enable the bonus
|
|
var/organs_needed = 0
|
|
///if the bonus is active
|
|
var/bonus_active = FALSE
|
|
var/bonus_activate_text = span_notice("??? DNA is deeply infused with you! You've learned how to make error reports!")
|
|
var/bonus_deactivate_text = span_notice("Your DNA is no longer majority ???. You did make an issue report, right?")
|
|
/// Required mob bio-type. Also checks DNA validity it's set to MOB_ORGANIC.
|
|
var/required_biotype = MOB_ORGANIC
|
|
/// A list of traits added to the mob upon bonus activation, can be of any length.
|
|
var/list/bonus_traits = list()
|
|
/// Bonus biotype to add on bonus activation.
|
|
var/bonus_biotype
|
|
/// If the biotype was added - used to check if we should remove the biotype or not, on organ set loss.
|
|
var/biotype_added = FALSE
|
|
/// Limb overlay to apply upon activation
|
|
var/limb_overlay
|
|
/// Color priority for limb overlay
|
|
var/color_overlay_priority
|
|
|
|
/datum/status_effect/organ_set_bonus/proc/set_organs(new_value, obj/item/organ/organ)
|
|
organs = new_value
|
|
if(!organs) //initial value but won't kick in without calling the setter
|
|
qdel(src)
|
|
if(organs >= organs_needed)
|
|
if(!bonus_active)
|
|
INVOKE_ASYNC(src, PROC_REF(enable_bonus), organ)
|
|
else if(bonus_active)
|
|
INVOKE_ASYNC(src, PROC_REF(disable_bonus), organ)
|
|
|
|
/datum/status_effect/organ_set_bonus/proc/enable_bonus(obj/item/organ/inserted_organ)
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
if(required_biotype)
|
|
if(!(owner.mob_biotypes & required_biotype))
|
|
return FALSE
|
|
if((required_biotype == MOB_ORGANIC) && !owner.can_mutate())
|
|
return FALSE
|
|
bonus_active = TRUE
|
|
// Add traits
|
|
if(length(bonus_traits))
|
|
owner.add_traits(bonus_traits, TRAIT_STATUS_EFFECT(id))
|
|
|
|
// Add biotype
|
|
if(owner.mob_biotypes & bonus_biotype)
|
|
biotype_added = FALSE
|
|
owner.mob_biotypes |= bonus_biotype
|
|
biotype_added = TRUE
|
|
|
|
if(bonus_activate_text)
|
|
to_chat(owner, bonus_activate_text)
|
|
|
|
// Add limb overlay
|
|
if(!iscarbon(owner) || !limb_overlay)
|
|
return TRUE
|
|
|
|
var/mob/living/carbon/carbon_owner = owner
|
|
RegisterSignal(carbon_owner, COMSIG_CARBON_ATTACH_LIMB, PROC_REF(texture_limb))
|
|
RegisterSignal(carbon_owner, COMSIG_CARBON_REMOVE_LIMB, PROC_REF(untexture_limb))
|
|
|
|
for(var/obj/item/bodypart/limb as anything in carbon_owner.get_bodyparts())
|
|
if (!(limb.bodytype & BODYTYPE_ORGANIC))
|
|
continue
|
|
limb.add_bodypart_overlay(new limb_overlay(), update = FALSE)
|
|
if (color_overlay_priority)
|
|
limb.add_color_override(COLOR_WHITE, color_overlay_priority)
|
|
|
|
carbon_owner.update_body()
|
|
return TRUE
|
|
|
|
/datum/status_effect/organ_set_bonus/proc/disable_bonus(obj/item/organ/removed_organ)
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
bonus_active = FALSE
|
|
|
|
// Remove traits
|
|
if(length(bonus_traits))
|
|
owner.remove_traits(bonus_traits, TRAIT_STATUS_EFFECT(id))
|
|
// Remove biotype (if added)
|
|
if(biotype_added)
|
|
owner.mob_biotypes &= ~bonus_biotype
|
|
|
|
if(bonus_deactivate_text)
|
|
to_chat(owner, bonus_deactivate_text)
|
|
|
|
// Remove limb overlay
|
|
if(!iscarbon(owner) || !limb_overlay)
|
|
return
|
|
|
|
var/mob/living/carbon/carbon_owner = owner
|
|
UnregisterSignal(carbon_owner, list(COMSIG_CARBON_ATTACH_LIMB, COMSIG_CARBON_REMOVE_LIMB))
|
|
|
|
if(QDELETED(carbon_owner))
|
|
return
|
|
|
|
for(var/obj/item/bodypart/limb as anything in carbon_owner.get_bodyparts())
|
|
var/overlay = locate(limb_overlay) in limb.bodypart_overlays
|
|
if(!overlay)
|
|
continue
|
|
limb.remove_bodypart_overlay(overlay, update = FALSE)
|
|
if (color_overlay_priority)
|
|
limb.remove_color_override(color_overlay_priority)
|
|
|
|
carbon_owner.update_body()
|
|
|
|
/datum/status_effect/organ_set_bonus/proc/texture_limb(atom/source, obj/item/bodypart/limb)
|
|
SIGNAL_HANDLER
|
|
|
|
if (!(limb.bodytype & BODYTYPE_ORGANIC))
|
|
return
|
|
|
|
// Not updating because enable/disable_bonus(obj/item/organ/removed_organ) call it down the line, and calls coming from comsigs update the owner's body themselves
|
|
limb.add_bodypart_overlay(new limb_overlay(), update = FALSE)
|
|
if(color_overlay_priority)
|
|
limb.add_color_override(COLOR_WHITE, color_overlay_priority)
|
|
|
|
/datum/status_effect/organ_set_bonus/proc/untexture_limb(atom/source, obj/item/bodypart/limb)
|
|
SIGNAL_HANDLER
|
|
|
|
var/overlay = locate(limb_overlay) in limb.bodypart_overlays
|
|
if(!overlay)
|
|
return
|
|
limb.remove_bodypart_overlay(overlay, update = FALSE)
|
|
if(color_overlay_priority)
|
|
limb.remove_color_override(color_overlay_priority)
|