SPECIES NUKING 2023: Mein leber! Allows livers to handle reagents in special ways, instead of the species datum doing it (#76184)

## About The Pull Request

Refactors livers so special chemical handling can be done by them,
instead of the species datum.
Plasmamen, skeletons and golems all use the liver for all their species
specific chem handling now.

## Why It's Good For The Game

SPECIES DATUM I HATE YOU!
Also, being able to handle reagents like any species if you have their
liver is REALLY FREAKING COOL and allows for emergent gameplay by mixing
various organs from various sources.

## Changelog

🆑
refactor: Mutant livers can now handle chemicals in special ways.
Currently, only plasmaman, skeleton and golem livers do it. Every other
species is the same.
/🆑

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
This commit is contained in:
ChungusGamer666
2023-06-24 21:05:29 +02:00
committed by GitHub
co-authored by Time-Green
parent 7be4ab14d4
commit 6da96bef84
48 changed files with 270 additions and 229 deletions
@@ -0,0 +1,94 @@
// A 10% chance that out of a group of 25 people, one person will get appendicitis in 1 hour.
#define APPENDICITIS_PROB 100 * (0.1 * (1 / 25) / 3600)
#define INFLAMATION_ADVANCEMENT_PROB 2
/obj/item/organ/internal/appendix
name = "appendix"
icon_state = "appendix"
base_icon_state = "appendix"
visual = FALSE
zone = BODY_ZONE_PRECISE_GROIN
slot = ORGAN_SLOT_APPENDIX
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/toxin/bad_food = 5)
grind_results = list(/datum/reagent/toxin/bad_food = 5)
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = STANDARD_ORGAN_DECAY
now_failing = "<span class='warning'>An explosion of pain erupts in your lower right abdomen!</span>"
now_fixed = "<span class='info'>The pain in your abdomen has subsided.</span>"
var/inflamation_stage = 0
/obj/item/organ/internal/appendix/update_name()
. = ..()
name = "[inflamation_stage ? "inflamed " : null][initial(name)]"
/obj/item/organ/internal/appendix/update_icon_state()
icon_state = "[base_icon_state][inflamation_stage ? "inflamed" : ""]"
return ..()
/obj/item/organ/internal/appendix/on_life(seconds_per_tick, times_fired)
..()
var/mob/living/carbon/organ_owner = owner
if(!organ_owner)
return
if(organ_flags & ORGAN_FAILING)
// forced to ensure people don't use it to gain tox as slime person
organ_owner.adjustToxLoss(2 * seconds_per_tick, updating_health = TRUE, forced = TRUE)
else if(inflamation_stage)
inflamation(seconds_per_tick)
else if(SPT_PROB(APPENDICITIS_PROB, seconds_per_tick))
become_inflamed()
/obj/item/organ/internal/appendix/proc/become_inflamed()
inflamation_stage = 1
update_appearance()
if(owner)
ADD_TRAIT(owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
owner.med_hud_set_status()
notify_ghosts("[owner] has developed spontaneous appendicitis!", source = owner, action = NOTIFY_ORBIT, header = "Whoa, Sick!")
/obj/item/organ/internal/appendix/proc/inflamation(seconds_per_tick)
var/mob/living/carbon/organ_owner = owner
if(inflamation_stage < 3 && SPT_PROB(INFLAMATION_ADVANCEMENT_PROB, seconds_per_tick))
inflamation_stage += 1
switch(inflamation_stage)
if(1)
if(SPT_PROB(2.5, seconds_per_tick))
organ_owner.emote("cough")
if(2)
if(SPT_PROB(1.5, seconds_per_tick))
to_chat(organ_owner, span_warning("You feel a stabbing pain in your abdomen!"))
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 5)
organ_owner.Stun(rand(40, 60))
organ_owner.adjustToxLoss(1, updating_health = TRUE, forced = TRUE)
if(3)
if(SPT_PROB(0.5, seconds_per_tick))
organ_owner.vomit(95)
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 15)
/obj/item/organ/internal/appendix/get_availability(datum/species/owner_species, mob/living/owner_mob)
return owner_species.mutantappendix
/obj/item/organ/internal/appendix/on_remove(mob/living/carbon/organ_owner)
. = ..()
REMOVE_TRAIT(organ_owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
organ_owner.med_hud_set_status()
/obj/item/organ/internal/appendix/on_insert(mob/living/carbon/organ_owner)
. = ..()
if(inflamation_stage)
ADD_TRAIT(organ_owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
organ_owner.med_hud_set_status()
/obj/item/organ/internal/appendix/get_status_text()
if((!(organ_flags & ORGAN_FAILING)) && inflamation_stage)
return "<font color='#ff9933'>Inflamed</font>"
else
return ..()
#undef APPENDICITIS_PROB
#undef INFLAMATION_ADVANCEMENT_PROB
@@ -0,0 +1,82 @@
/obj/item/organ/internal/appendix/golem
name = "internal forge"
desc = "This expanded digestive chamber allows golems to smelt minerals, provided that they are immersed in lava."
icon_state = "ethereal_heart"
color = COLOR_GOLEM_GRAY
status = ORGAN_MINERAL
/// Action which performs smelting
var/datum/action/cooldown/internal_smelting/smelter
/obj/item/organ/internal/appendix/golem/Initialize(mapload)
. = ..()
smelter = new(src)
/obj/item/organ/internal/appendix/golem/on_insert(mob/living/carbon/organ_owner)
. = ..()
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(check_for_lava))
/// Give the action while in lava
/obj/item/organ/internal/appendix/golem/proc/check_for_lava(mob/living/owner)
SIGNAL_HANDLER
if (!islava(owner.loc))
smelter.Remove(owner)
return
if (smelter.owner != owner)
smelter.Grant(owner)
/obj/item/organ/internal/appendix/golem/on_remove(mob/living/carbon/organ_owner)
UnregisterSignal(organ_owner, COMSIG_MOVABLE_MOVED)
smelter?.Remove(organ_owner) // Might have been deleted by Destroy already
return ..()
/obj/item/organ/internal/appendix/golem/Destroy()
QDEL_NULL(smelter)
return ..()
/// Lets golems smelt ore with their organs
/datum/action/cooldown/internal_smelting
name = "Internal Forge"
desc = "While stood in lava you can use your internal forge to smelt ores into processed bars."
button_icon = 'icons/obj/stack_objects.dmi'
button_icon_state = "sheet-adamantine_2"
check_flags = AB_CHECK_HANDS_BLOCKED | AB_CHECK_LYING | AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED
/// Time it takes to smelt one ore into one result
var/smelt_speed = 2 SECONDS
/// Amount to speed up by every completion
var/speed_up_interval = 0.2 SECONDS
/// Minimum time to take to smelt one ore into one result
var/minimum_smelt_speed = 1 SECONDS
/datum/action/cooldown/internal_smelting/IsAvailable(feedback)
. = ..()
if (!.)
return FALSE
if (!islava(owner.loc))
if (feedback)
owner.balloon_alert(owner, "requires lava!")
return FALSE
return TRUE
/datum/action/cooldown/internal_smelting/Activate(mob/target)
. = ..()
smelt_speed = initial(smelt_speed)
smelt_held(target)
/// Smelt an item held in one hand and put the result in the other
/datum/action/cooldown/internal_smelting/proc/smelt_held(mob/target)
var/obj/item/stack/ore/held_ore = locate(/obj/item/stack/ore) in target.held_items
if (!held_ore?.refined_type)
target.balloon_alert(target, "nothing to smelt!")
return
target.balloon_alert(owner, "smelting...")
if (!do_after(target, smelt_speed, target = held_ore, timed_action_flags = IGNORE_USER_LOC_CHANGE, extra_checks = CALLBACK(src, PROC_REF(IsAvailable), FALSE), interaction_key = REF(src)))
return
var/obj/item/smelted = new held_ore.refined_type
held_ore.use(1)
target.put_in_hands(smelted)
if (!held_ore)
target.balloon_alert(target, "no ore left!")
return
smelt_speed = max(smelt_speed - speed_up_interval, minimum_smelt_speed)
smelt_held(target)