Files
Bubberstation/code/datums/elements/organ_set_bonus.dm
T
fe7c8e1fde Adds some Fish Content (#88213)
## About The Pull Request

Adds a new biotype, MOB_AQUATIC, indicating the mob is water-themed
somehow. Given to carp, lobstrosities, frogs, axolotls, penguins, fire
sharks.

Aquatic mobs can be hooked by fishing rods, even without a jawed fishing
hook installed.

The carp and fish infusion sets now give the infusee the aquatic
biotype. Added support for infusions adding a biotype.

You can check for a fish's pulse with a stethoscope, which will tell you
its status even without fishing skill.

Refined fish health status checks to be more precise.

Added 'Fishy' Reagent, a version of strange reagent that only works for
fish or aquatic biotype mobs. It's made with omnizine, saltwater, and
carpotoxin or tetrodotoxin.

Added a lifish chemical reaction that creates fish.
## Why It's Good For The Game

Fish content fish content fish content

> Adds a new biotype, MOB_AQUATIC, indicating the mob is water-themed
somehow. Given to carp, lobstrosities, frogs, axolotls, penguins, fire
sharks.

We were really missing this one by now.

> Aquatic mobs can be hooked by fishing rods, even without a jawed
fishing hook installed.

> The carp and fish infusion sets now give the infusee the aquatic
biotype. Added support for infusions adding a biotype.

I want to reel in fish people. This is going to be hilarious.

> You can check for a fish's pulse with a stethoscope, which will tell
you its status even without fishing skill.

Fish doctor content - also lets you see the exact status of a fish's
health even if you haven't interacted w/ fishing that shift.

> Added 'Fishy' Reagent, a version of strange reagent that only works
for fish or aquatic biotype mobs. It's made with omnizine, saltwater,
and carpotoxin or tetrodotoxin.

A somewhat easier to get version of strange reagent, purely for fish, as
they die very easily and the road to making SR is a large diversion. I
might add this to cargo, maybe?

> Added a lifish chemical reaction that creates fish.

Fish. fish fish fish fish fish.

@Ghommie 
## Changelog
🆑
add: Adds a new biotype, MOB_AQUATIC, indicating the mob is water-themed
somehow. Given to carp, lobstrosities, frogs, axolotls, penguins, fire
sharks.
add: Aquatic mobs can be hooked by fishing rods, even without a jawed
fishing hook installed.
add: The carp and fish infusion sets now give the infusee the aquatic
biotype. Added support for infusions adding a biotype.
add: You can check for a fish's pulse with a stethoscope, which will
tell you its status even without fishing skill.
qol: Refined fish health status checks to be more precise.
add: Added 'Fishy' Reagent, a version of strange reagent that only works
for fish or aquatic biotype mobs. It's made with omnizine, saltwater,
and carpotoxin or tetrodotoxin.
add: Added a lifish chemical reaction that creates fish.
/🆑

---------

Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-11-29 00:42:04 +01:00

134 lines
4.5 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)
/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)
/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)
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))
else if(bonus_active)
INVOKE_ASYNC(src, PROC_REF(disable_bonus))
/datum/status_effect/organ_set_bonus/proc/enable_bonus()
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, REF(src))
// 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
for(var/obj/item/bodypart/limb in carbon_owner.bodyparts)
limb.add_bodypart_overlay(new limb_overlay())
limb.add_color_override(COLOR_WHITE, color_overlay_priority)
carbon_owner.update_body()
return TRUE
/datum/status_effect/organ_set_bonus/proc/disable_bonus()
SHOULD_CALL_PARENT(TRUE)
bonus_active = FALSE
// Remove traits
if(length(bonus_traits))
owner.remove_traits(bonus_traits, REF(src))
// 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) || QDELETED(owner) || !limb_overlay)
return
var/mob/living/carbon/carbon_owner = owner
for(var/obj/item/bodypart/limb in carbon_owner.bodyparts)
var/overlay = locate(limb_overlay) in limb.bodypart_overlays
if(overlay)
limb.remove_bodypart_overlay(overlay)
limb.remove_color_override(color_overlay_priority)
carbon_owner.update_body()