Files
Paradise/code/modules/surgery/organs/organ_internal.dm
T
BiancaWilksonandGitHub 978f43c5e9 Ear Organ Refactor + Deafness is a status effect (#21405)
* begone ear_damage

* pt 2

* this time actually begone

* ears no longer passively heal over time

* ears can die

* deafness is now a status effect

* Oh yeah ticks are every two seconds
2023-07-07 13:54:27 +01:00

331 lines
9.4 KiB
Plaintext

/obj/item/organ/internal
origin_tech = "biotech=3"
force = 1
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
var/slot
// DO NOT add slots with matching names to different zones - it will break internal_organs_slot list!
var/non_primary = 0
var/unremovable = FALSE //Whether it shows up as an option to remove during surgery.
/obj/item/organ/internal/New(mob/living/carbon/holder)
..()
if(istype(holder))
insert(holder)
/obj/item/organ/internal/proc/insert(mob/living/carbon/M, special = 0, dont_remove_slot = 0)
if(!iscarbon(M) || owner == M)
return
var/obj/item/organ/internal/replaced = M.get_organ_slot(slot)
if(replaced)
if(dont_remove_slot)
non_primary = 1
else
replaced.remove(M, special = 1)
owner = M
M.internal_organs |= src
M.internal_organs_slot[slot] = src
var/obj/item/organ/external/parent
if(ishuman(M))
var/mob/living/carbon/human/H = M
parent = H.get_organ(check_zone(parent_organ))
if(!istype(parent))
stack_trace("[src] attempted to insert into a [parent_organ], but [parent_organ] wasn't an organ! [atom_loc_line(M)]")
else
parent.internal_organs |= src
loc = null
for(var/X in actions)
var/datum/action/A = X
A.Grant(M)
if(vital)
M.update_stat("Vital organ inserted")
STOP_PROCESSING(SSobj, src)
// Removes the given organ from its owner.
// Returns the removed object, which is usually just itself
// However, you MUST set the object's positiion yourself when you call this!
/obj/item/organ/internal/remove(mob/living/carbon/M, special = 0)
if(!owner)
stack_trace("\'remove\' called on [src] without an owner! Mob: [M], [atom_loc_line(M)]")
owner = null
if(M)
M.internal_organs -= src
if(M.internal_organs_slot[slot] == src)
M.internal_organs_slot.Remove(slot)
if(vital && !special)
if(M.stat != DEAD)//safety check!
M.death()
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/parent = H.get_organ(check_zone(parent_organ))
if(!istype(parent))
stack_trace("[src] attempted to remove from a [parent_organ], but [parent_organ] didn't exist! [atom_loc_line(M)]")
else
parent.internal_organs -= src
H.update_int_organs()
for(var/X in actions)
var/datum/action/A = X
A.Remove(M)
START_PROCESSING(SSobj, src)
if(destroy_on_removal && !QDELETED(src))
qdel(src)
return
return src
/obj/item/organ/internal/emp_act(severity)
if(!is_robotic() || emp_proof)
return
switch(severity)
if(1)
receive_damage(20, 1)
if(2)
receive_damage(7, 1)
/obj/item/organ/internal/replaced(mob/living/carbon/human/target)
insert(target)
/obj/item/organ/internal/item_action_slot_check(slot, mob/user)
return
/obj/item/organ/internal/proc/on_find(mob/living/finder)
return
/obj/item/organ/internal/proc/on_life()
return
//abstract proc called by carbon/death()
/obj/item/organ/internal/proc/on_owner_death()
return
/obj/item/organ/internal/proc/prepare_eat()
if(is_robotic())
return //no eating cybernetic implants!
var/obj/item/reagent_containers/food/snacks/organ/S = new
S.name = name
S.desc = desc
S.icon = icon
S.icon_state = icon_state
S.origin_tech = origin_tech
S.w_class = w_class
return S
/obj/item/organ/internal/attempt_become_organ(obj/item/organ/external/parent,mob/living/carbon/human/H)
if(parent_organ != parent.limb_name)
return FALSE
insert(H)
return TRUE
// Rendering!
/obj/item/organ/internal/proc/render()
return
/obj/item/reagent_containers/food/snacks/organ
name = "appendix"
icon_state = "appendix"
icon = 'icons/obj/surgery.dmi'
/obj/item/reagent_containers/food/snacks/organ/Initialize(mapload)
. = ..()
reagents.add_reagent("nutriment", 5)
/obj/item/organ/internal/attack(mob/living/carbon/M, mob/user)
if(M == user && ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/reagent_containers/food/snacks/S = prepare_eat()
if(S)
H.drop_item()
H.put_in_active_hand(S)
S.attack(H, H)
qdel(src)
else
..()
/****************************************************
INTERNAL ORGANS DEFINES
****************************************************/
// Brain is defined in brain_item.dm.
/obj/item/organ/internal/robotize(make_tough)
if(!is_robotic())
var/list/states = icon_states('icons/obj/surgery.dmi') //Insensitive to specially-defined icon files for species like the Drask or whomever else. Everyone gets the same robotic heart.
if(slot == "heart" && ("[slot]-c-on" in states) && ("[slot]-c-off" in states)) //Give the robotic heart its robotic heart icons if they exist.
var/obj/item/organ/internal/heart/H = src
H.icon = icon('icons/obj/surgery.dmi')
H.icon_base = "[slot]-c"
H.dead_icon = "[slot]-c-off"
H.update_icon()
else if("[slot]-c" in states) //Give the robotic organ its robotic organ icons if they exist.
icon = icon('icons/obj/surgery.dmi')
icon_state = "[slot]-c"
name = "cybernetic [slot]"
..() //Go apply all the organ flags/robotic statuses.
/obj/item/organ/internal/appendix
name = "appendix"
icon_state = "appendix"
organ_tag = "appendix"
parent_organ = "groin"
slot = "appendix"
var/inflamed = 0
/obj/item/organ/internal/appendix/remove(mob/living/carbon/M, special = 0)
for(var/datum/disease/appendicitis/A in M.viruses)
A.cure()
inflamed = 1
update_icon()
. = ..()
/obj/item/organ/internal/appendix/insert(mob/living/carbon/M, special = 0)
..()
if(inflamed)
M.AddDisease(new /datum/disease/appendicitis)
/obj/item/organ/internal/appendix/prepare_eat()
var/obj/S = ..()
if(inflamed)
S.reagents.add_reagent("????", 5)
return S
//debug and adminbus....
/obj/item/organ/internal/honktumor
name = "banana tumor"
desc = "A tiny yellow mass shaped like..a banana?"
icon_state = "honktumor"
origin_tech = "biotech=1"
w_class = WEIGHT_CLASS_TINY
parent_organ = "head"
slot = "brain_tumor"
destroy_on_removal = TRUE
var/organhonked = 0
var/suffering_delay = 900
var/datum/component/squeak
/obj/item/organ/internal/honktumor/insert(mob/living/carbon/M, special = 0)
..()
M.dna.SetSEState(GLOB.clumsyblock, TRUE, TRUE)
M.dna.SetSEState(GLOB.comicblock, TRUE, TRUE)
singlemutcheck(M, GLOB.clumsyblock, MUTCHK_FORCED)
singlemutcheck(M, GLOB.comicblock, MUTCHK_FORCED)
organhonked = world.time
M.AddElement(/datum/element/waddling)
squeak = M.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg' = 1), 50, falloff_exponent = 20)
/obj/item/organ/internal/honktumor/remove(mob/living/carbon/M, special = 0)
M.dna.SetSEState(GLOB.clumsyblock, FALSE)
M.dna.SetSEState(GLOB.comicblock, FALSE)
singlemutcheck(M, GLOB.clumsyblock, MUTCHK_FORCED)
singlemutcheck(M, GLOB.comicblock, MUTCHK_FORCED)
M.RemoveElement(/datum/element/waddling)
QDEL_NULL(squeak)
return ..()
/obj/item/organ/internal/honktumor/on_life()
if(organhonked < world.time)
organhonked = world.time + suffering_delay
to_chat(owner, "<font color='red' size='7'>HONK</font>")
owner.SetSleeping(0)
owner.Stuttering(40 SECONDS)
owner.Deaf(30 SECONDS)
owner.Weaken(6 SECONDS)
SEND_SOUND(owner, sound('sound/items/airhorn.ogg'))
if(prob(30))
owner.Stun(20 SECONDS)
owner.Paralyse(8 SECONDS)
else
owner.Jitter(1000 SECONDS)
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
if(isobj(H.shoes))
var/thingy = H.shoes
if(H.unEquip(H.shoes))
walk_away(thingy,H,15,2)
spawn(20)
if(thingy)
walk(thingy,0)
/obj/item/organ/internal/honktumor/cursed
unremovable = TRUE
/obj/item/organ/internal/honktumor/cursed/on_life() //No matter what you do, no matter who you are, no matter where you go, you're always going to be a fat, stuttering dimwit.
..()
owner.setBrainLoss(80, use_brain_mod = FALSE)
owner.set_nutrition(9000)
owner.overeatduration = 9000
/obj/item/organ/internal/honkbladder
name = "honk bladder"
desc = "a air filled sac that produces honking noises."
icon_state = "honktumor"//Not making a new icon
origin_tech = "biotech=1"
w_class = WEIGHT_CLASS_TINY
parent_organ = "groin"
slot = "honk_bladder"
destroy_on_removal = TRUE
var/datum/component/squeak
/obj/item/organ/internal/honkbladder/insert(mob/living/carbon/M, special = 0)
squeak = M.AddComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, falloff_exponent = 20)
/obj/item/organ/internal/honkbladder/remove(mob/living/carbon/M, special = 0)
QDEL_NULL(squeak)
return ..()
/obj/item/organ/internal/beard
name = "beard organ"
desc = "Let they who is worthy wear the beard of Thorbjorndottir."
icon_state = "liver"
origin_tech = "biotech=1"
w_class = WEIGHT_CLASS_TINY
parent_organ = "head"
slot = "hair_organ"
/obj/item/organ/internal/beard/on_life()
if(!owner)
return
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
var/obj/item/organ/external/head/head_organ = H.get_organ("head") // damn well better have a head if you have a beard
if(!(head_organ.h_style == "Very Long Hair" || head_organ.h_style == "Mohawk"))
if(prob(10))
head_organ.h_style = "Mohawk"
else
head_organ.h_style = "Very Long Hair"
head_organ.hair_colour = "#D8C078"
H.update_hair()
if(!(head_organ.f_style == "Very Long Beard"))
head_organ.f_style = "Very Long Beard"
head_organ.facial_colour = "#D8C078"
H.update_fhair()
/obj/item/organ/internal/emp_act(severity)
if(!is_robotic() || emp_proof)
return
switch(severity)
if(1)
receive_damage(20, 1)
if(2)
receive_damage(7, 1)
/obj/item/organ/internal/handle_germs()
..()
if(germ_level >= INFECTION_LEVEL_TWO)
if(prob(3)) //about once every 30 seconds
receive_damage(1, silent = prob(30))