Files
Paradise/code/modules/surgery/organs/augments_internal.dm
T
0f7a8707ef [Ready] Refactors stuns and status effects. (#17579)
* Fixes reviver runtime

* Confusion status effect

* Dizzy status effect

* Drowsiness status effect

* decaying -> transient

* Drunkenness status effect

* why use timer when SSfastprocessing work good

* stuns (mostly)

* weaken and immobalise

* stun/weaken times

* update_flags redundancies.

* Slowed()

* Silence + fixes transient decay

* Jittery

* sleeping

* Paralyze -> weaken

* Cult sluring

* paralyse

* Stammer

* slurring + projectile cleanups

* losebreath

* Hallucination

* forgor this

* eyeblurry

* eye blind

* Druggy

* affected didn't like my spacing

* review pass

* second review pass

* some cleanups

* documentation and signal framework

* confusion fix

* Fixes spec_stun

* rejuv fix

* removes a TODO

* conflicted myself

* fixes

* self review

* review

* removes TODOs

* adminfreeze

* TM fixes

* hallucination fix + others

* tones down alchol and runtime fixes

* confusion overlay suggestion

* more fixes

* runtime fix

* losebreath fix

* clamp => directional bounded sum

* steel review

* oops

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* reduces the dizziness cycle rate

* borg hotfix

* sanctified decursening

Co-authored-by: mochi <1496804+dearmochi@users.noreply.github.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
2022-05-24 16:35:26 +01:00

455 lines
16 KiB
Plaintext

/obj/item/organ/internal/cyberimp
name = "cybernetic implant"
desc = "a state-of-the-art implant that improves a baseline's functionality"
status = ORGAN_ROBOT
var/implant_color = "#FFFFFF"
var/implant_overlay
var/crit_fail = FALSE //Used by certain implants to disable them.
tough = TRUE // Immune to damage
/obj/item/organ/internal/cyberimp/New(mob/M = null)
. = ..()
if(implant_overlay)
var/mutable_appearance/overlay = mutable_appearance(icon, implant_overlay)
overlay.color = implant_color
add_overlay(overlay)
/obj/item/organ/internal/cyberimp/emp_act()
return // These shouldn't be hurt by EMPs in the standard way
//[[[[BRAIN]]]]
/obj/item/organ/internal/cyberimp/brain
name = "cybernetic brain implant"
desc = "injectors of extra sub-routines for the brain"
icon_state = "brain_implant"
implant_overlay = "brain_implant_overlay"
parent_organ = "head"
/obj/item/organ/internal/cyberimp/brain/emp_act(severity)
if(!owner || emp_proof)
return
var/stun_amount = (5 + (severity-1 ? 0 : 5)) STATUS_EFFECT_CONSTANT
owner.Stun(stun_amount)
to_chat(owner, "<span class='warning'>Your body seizes up!</span>")
return stun_amount
/obj/item/organ/internal/cyberimp/brain/anti_drop
name = "Anti-drop implant"
desc = "This cybernetic brain implant will allow you to force your hand muscles to contract, preventing item dropping. Twitch ear to toggle."
var/active = FALSE
var/l_hand_ignore = FALSE
var/r_hand_ignore = FALSE
var/obj/item/l_hand_obj = null
var/obj/item/r_hand_obj = null
implant_color = "#DE7E00"
slot = "brain_antidrop"
origin_tech = "materials=4;programming=5;biotech=4"
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/brain/anti_drop/ui_action_click()
active = !active
if(active)
l_hand_obj = owner.l_hand
r_hand_obj = owner.r_hand
if(l_hand_obj)
if(owner.l_hand.flags & NODROP)
l_hand_ignore = TRUE
else
owner.l_hand.flags |= NODROP
l_hand_ignore = FALSE
if(r_hand_obj)
if(owner.r_hand.flags & NODROP)
r_hand_ignore = TRUE
else
owner.r_hand.flags |= NODROP
r_hand_ignore = FALSE
if(!l_hand_obj && !r_hand_obj)
to_chat(owner, "<span class='notice'>You are not holding any items, your hands relax...</span>")
active = 0
else
var/msg = 0
msg += !l_hand_ignore && l_hand_obj ? 1 : 0
msg += !r_hand_ignore && r_hand_obj ? 2 : 0
switch(msg)
if(1)
to_chat(owner, "<span class='notice'>Your left hand's grip tightens.</span>")
if(2)
to_chat(owner, "<span class='notice'>Your right hand's grip tightens.</span>")
if(3)
to_chat(owner, "<span class='notice'>Both of your hand's grips tighten.</span>")
else
release_items()
to_chat(owner, "<span class='notice'>Your hands relax...</span>")
l_hand_obj = null
r_hand_obj = null
/obj/item/organ/internal/cyberimp/brain/anti_drop/emp_act(severity)
if(!owner || emp_proof)
return
var/range = severity ? 10 : 5
var/atom/A
var/obj/item/L_item = owner.l_hand
var/obj/item/R_item = owner.r_hand
release_items()
..()
if(L_item)
A = pick(oview(range))
L_item.throw_at(A, range, 2)
to_chat(owner, "<span class='notice'>Your left arm spasms and throws [L_item]!</span>")
l_hand_obj = null
if(R_item)
A = pick(oview(range))
R_item.throw_at(A, range, 2)
to_chat(owner, "<span class='notice'>Your right arm spasms and throws [R_item]!</span>")
r_hand_obj = null
/obj/item/organ/internal/cyberimp/brain/anti_drop/proc/release_items()
active = FALSE
if(!l_hand_ignore && (l_hand_obj in owner.contents))
l_hand_obj.flags ^= NODROP
if(!r_hand_ignore && (r_hand_obj in owner.contents))
r_hand_obj.flags ^= NODROP
/obj/item/organ/internal/cyberimp/brain/anti_drop/remove(mob/living/carbon/M, special = 0)
if(active)
ui_action_click()
return ..()
/obj/item/organ/internal/cyberimp/brain/anti_stun
name = "CNS Rebooter implant"
desc = "This implant will automatically give you back control over your central nervous system, reducing downtime when stunned. Incompatible with the Neural Jumpstarter."
implant_color = "#FFFF00"
slot = "brain_antistun"
origin_tech = "materials=5;programming=4;biotech=5"
var/stun_max_amount = 4 SECONDS
/obj/item/organ/internal/cyberimp/brain/anti_stun/hardened
name = "Hardened CNS Rebooter implant"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/brain/anti_stun/hardened/Initialize(mapload)
. = ..()
desc += " The implant has been hardened. It is invulnerable to EMPs."
/obj/item/organ/internal/cyberimp/brain/anti_stun/on_life()
..()
if(crit_fail)
return
if(owner.AmountStun() > stun_max_amount)
owner.SetStunned(stun_max_amount)
if(owner.AmountWeakened() > stun_max_amount)
owner.SetWeakened(stun_max_amount)
/obj/item/organ/internal/cyberimp/brain/anti_stun/emp_act(severity)
..()
if(crit_fail || emp_proof)
return
crit_fail = TRUE
addtimer(CALLBACK(src, .proc/reboot), 90 / severity)
/obj/item/organ/internal/cyberimp/brain/anti_stun/proc/reboot()
crit_fail = FALSE
/obj/item/organ/internal/cyberimp/brain/anti_stun/hardened
name = "Hardened CNS Rebooter implant"
desc = "A military-grade version of the standard implant, for NT's more elite forces."
origin_tech = "materials=6;programming=5;biotech=5"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/brain/anti_sleep
name = "Neural Jumpstarter implant"
desc = "This implant will automatically attempt to jolt you awake when it detects you have fallen unconscious. Has a short cooldown, incompatible with the CNS Rebooter."
implant_color = "#0356fc"
slot = "brain_antistun" //one or the other not both.
origin_tech = "materials=5;programming=4;biotech=5"
var/cooldown = FALSE
/obj/item/organ/internal/cyberimp/brain/anti_sleep/on_life()
..()
if(crit_fail)
return
if(owner.stat == UNCONSCIOUS && cooldown == FALSE)
owner.AdjustSleeping(-200 SECONDS)
owner.AdjustParalysis(-200 SECONDS)
to_chat(owner, "<span class='notice'>You feel a rush of energy course through your body!</span>")
cooldown = TRUE
addtimer(CALLBACK(src, .proc/sleepy_timer_end), 50)
/obj/item/organ/internal/cyberimp/brain/anti_sleep/proc/sleepy_timer_end()
cooldown = FALSE
to_chat(owner, "<span class='notice'>You hear a small beep in your head as your Neural Jumpstarter finishes recharging.</span>")
/obj/item/organ/internal/cyberimp/brain/anti_sleep/emp_act(severity)
. = ..()
if(crit_fail || emp_proof)
return
crit_fail = TRUE
owner.AdjustSleeping(400 SECONDS)
cooldown = TRUE
addtimer(CALLBACK(src, .proc/reboot), 90 / severity)
/obj/item/organ/internal/cyberimp/brain/anti_sleep/proc/reboot()
crit_fail = FALSE
cooldown = FALSE
/obj/item/organ/internal/cyberimp/brain/anti_sleep/hardened
name = "Hardened Neural Jumpstarter implant"
desc = "A military-grade version of the standard implant, for NT's more elite forces."
origin_tech = "materials=6;programming=5;biotech=5"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/brain/anti_sleep/hardened/compatible
name = "Hardened Neural Jumpstarter implant"
desc = "A military-grade version of the standard implant, for NT's more elite forces. This one is compatible with the CNS Rebooter implant"
slot = "brain_antisleep"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/brain/clown_voice
name = "Comical implant"
desc = "<span class='sans'>Uh oh.</span>"
implant_color = "#DEDE00"
slot = "brain_clownvoice"
origin_tech = "materials=2;biotech=2"
/obj/item/organ/internal/cyberimp/brain/clown_voice/insert(mob/living/carbon/M, special = FALSE)
..()
ADD_TRAIT(M, TRAIT_COMIC_SANS, "augment")
/obj/item/organ/internal/cyberimp/brain/clown_voice/remove(mob/living/carbon/M, special = FALSE)
REMOVE_TRAIT(M, TRAIT_COMIC_SANS, "augment")
return ..()
/obj/item/organ/internal/cyberimp/brain/speech_translator //actual translating done in human/handle_speech_problems
name = "Speech translator implant"
desc = "While known as a translator, this implant actually generates speech based on the user's thoughts when activated, completely bypassing the need to speak."
implant_color = "#C0C0C0"
slot = "brain_speechtranslator"
w_class = WEIGHT_CLASS_TINY
origin_tech = "materials=4;biotech=6"
actions_types = list(/datum/action/item_action/organ_action/toggle)
var/active = TRUE
var/speech_span = ""
var/speech_verb = "states"
/obj/item/organ/internal/cyberimp/brain/speech_translator/clown
name = "Comical speech translator implant"
implant_color = "#DEDE00"
speech_span = "sans"
/obj/item/organ/internal/cyberimp/brain/speech_translator/emp_act(severity)
if(emp_proof)
return
if(owner && active && !crit_fail)
to_chat(owner, "<span class='danger'>Your translator implant shuts down with a harsh buzz.</span>")
addtimer(CALLBACK(src, .proc/reboot), 60 SECONDS)
crit_fail = TRUE
active = FALSE
/obj/item/organ/internal/cyberimp/brain/speech_translator/proc/reboot()
crit_fail = FALSE
if(owner)
to_chat(owner, "<span class='notice'>Your translator implant beeps.</span>")
SEND_SOUND(owner, sound('sound/machines/twobeep.ogg'))
/obj/item/organ/internal/cyberimp/brain/speech_translator/ui_action_click()
if(owner && crit_fail)
to_chat(owner, "<span class='warning'>The implant is still rebooting.</span>")
else if(owner && !active)
to_chat(owner, "<span class='notice'>You turn on your translator implant.</span>")
active = TRUE
else if(owner && active)
to_chat(owner, "<span class='notice'>You turn off your translator implant.</span>")
active = FALSE
//[[[[MOUTH]]]]
/obj/item/organ/internal/cyberimp/mouth
parent_organ = "mouth"
/obj/item/organ/internal/cyberimp/mouth/breathing_tube
name = "breathing tube implant"
desc = "This simple implant adds an internals connector to your back, allowing you to use internals without a mask and protecting you from being choked."
icon_state = "implant_mask"
slot = "breathing_tube"
w_class = WEIGHT_CLASS_TINY
origin_tech = "materials=2;biotech=3"
/obj/item/organ/internal/cyberimp/mouth/breathing_tube/emp_act(severity)
if(emp_proof)
return
if(prob(60/severity) && owner)
to_chat(owner, "<span class='warning'>Your breathing tube suddenly closes!</span>")
owner.AdjustLoseBreath(4 SECONDS)
//[[[[CHEST]]]]
/obj/item/organ/internal/cyberimp/chest
name = "cybernetic torso implant"
desc = "implants for the organs in your torso"
icon_state = "chest_implant"
implant_overlay = "chest_implant_overlay"
parent_organ = "chest"
/obj/item/organ/internal/cyberimp/chest/nutriment
name = "Nutriment pump implant"
desc = "This implant with synthesize and pump into your bloodstream a small amount of nutriment when you are starving."
icon_state = "chest_implant"
implant_color = "#00AA00"
var/hunger_threshold = NUTRITION_LEVEL_STARVING
var/synthesizing = 0
var/poison_amount = 5
var/disabled_by_emp = FALSE
slot = "stomach"
origin_tech = "materials=2;powerstorage=2;biotech=2"
/obj/item/organ/internal/cyberimp/chest/nutriment/examine(mob/user)
. = ..()
if(emp_proof)
. += " The implant has been hardened. It is invulnerable to EMPs."
/obj/item/organ/internal/cyberimp/chest/nutriment/on_life()
if(!owner)
return
if(synthesizing)
return
if(disabled_by_emp)
return
if(owner.stat == DEAD)
return
if(owner.nutrition <= hunger_threshold)
synthesizing = TRUE
to_chat(owner, "<span class='notice'>You feel less hungry...</span>")
owner.adjust_nutrition(50)
addtimer(CALLBACK(src, .proc/synth_cool), 50)
/obj/item/organ/internal/cyberimp/chest/nutriment/proc/synth_cool()
synthesizing = FALSE
/obj/item/organ/internal/cyberimp/chest/nutriment/proc/emp_cool()
disabled_by_emp = FALSE
/obj/item/organ/internal/cyberimp/chest/nutriment/emp_act(severity)
if(!owner || emp_proof)
return
owner.vomit(100, FALSE, TRUE, 3, FALSE) // because when else do we ever use projectile vomiting
owner.visible_message("<span class='warning'>The contents of [owner]'s stomach erupt violently from [owner.p_their()] mouth!</span>",
"<span class='warning'>You feel like your insides are burning as you vomit profusely!</span>",
"<span class='warning'>You hear vomiting and a sickening splattering against the floor!</span>")
owner.reagents.add_reagent("????",poison_amount / severity) //food poisoning
disabled_by_emp = TRUE // Disable the implant for a little bit so this effect actually matters
synthesizing = FALSE
addtimer(CALLBACK(src, .proc/emp_cool), 60 SECONDS)
/obj/item/organ/internal/cyberimp/chest/nutriment/plus
name = "Nutriment pump implant PLUS"
desc = "This implant will synthesize and pump into your bloodstream a small amount of nutriment when you are hungry."
icon_state = "chest_implant"
implant_color = "#006607"
hunger_threshold = NUTRITION_LEVEL_HUNGRY
poison_amount = 10
origin_tech = "materials=4;powerstorage=3;biotech=3"
/obj/item/organ/internal/cyberimp/chest/nutriment/hardened
name = "hardened nutrient pump implant"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/chest/nutriment/plus/hardened
name = "hardened nutrient pump implant PLUS"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/chest/reviver
name = "Reviver implant"
desc = "This implant will attempt to heal you out of critical condition. For the faint of heart!"
icon_state = "chest_implant"
implant_color = "#AD0000"
origin_tech = "materials=5;programming=4;biotech=4"
slot = "heartdrive"
var/revive_cost = 0
var/reviving = FALSE
var/cooldown = 0
/obj/item/organ/internal/cyberimp/chest/reviver/hardened
name = "Hardened reviver implant"
emp_proof = TRUE
/obj/item/organ/internal/cyberimp/chest/reviver/hardened/Initialize(mapload)
. = ..()
desc += " The implant has been hardened. It is invulnerable to EMPs."
/obj/item/organ/internal/cyberimp/chest/reviver/on_life()
if(cooldown > world.time || owner.suiciding) // don't heal while you're in cooldown!
return
if(reviving)
if(owner.health <= HEALTH_THRESHOLD_CRIT)
addtimer(CALLBACK(src, .proc/heal), 30)
else
reviving = FALSE
if(owner.HasDisease(new /datum/disease/critical/shock(0)) && prob(15)) //If they are no longer in crit, but have shock, and pass a 15% chance:
for(var/datum/disease/critical/shock/S in owner.viruses)
S.cure()
revive_cost += 150
to_chat(owner, "<span class='notice'>You feel better.</span>")
return
cooldown = revive_cost + world.time
revive_cost = 0
reviving = TRUE
/obj/item/organ/internal/cyberimp/chest/reviver/proc/heal()
if(QDELETED(owner))
return
if(prob(90) && owner.getOxyLoss())
owner.adjustOxyLoss(-3)
revive_cost += 5
if(prob(75) && owner.getBruteLoss())
owner.adjustBruteLoss(-1)
revive_cost += 20
if(prob(75) && owner.getFireLoss())
owner.adjustFireLoss(-1)
revive_cost += 20
if(prob(40) && owner.getToxLoss())
owner.adjustToxLoss(-1)
revive_cost += 50
/obj/item/organ/internal/cyberimp/chest/reviver/emp_act(severity)
if(!owner || emp_proof)
return
if(reviving)
revive_cost += 200
else
cooldown += 200
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
if(H.stat != DEAD && prob(50 / severity))
H.set_heartattack(TRUE)
addtimer(CALLBACK(src, .proc/undo_heart_attack), 600 / severity)
/obj/item/organ/internal/cyberimp/chest/reviver/proc/undo_heart_attack()
var/mob/living/carbon/human/H = owner
if(!istype(H))
return
H.set_heartattack(FALSE)
if(H.stat == CONSCIOUS)
to_chat(H, "<span class='notice'>You feel your heart beating again!</span>")
//BOX O' IMPLANTS
/obj/item/storage/box/cyber_implants
name = "boxed cybernetic implants"
desc = "A sleek, sturdy box."
icon_state = "cyber_implants"
var/list/boxed = list(
/obj/item/autosurgeon/organ/syndicate/thermal_eyes,
/obj/item/autosurgeon/organ/syndicate/xray_eyes,
/obj/item/autosurgeon/organ/syndicate/anti_stun,
/obj/item/autosurgeon/organ/syndicate/reviver)
var/amount = 5
/obj/item/storage/box/cyber_implants/populate_contents()
var/implant
while(length(contents) <= amount)
implant = pick(boxed)
new implant(src)