Revert "PLASE"

This reverts commit 8af225e6e3.
This commit is contained in:
Fermi
2019-11-24 03:06:08 +00:00
parent aeb8606ce0
commit ba4fa1ef67
2145 changed files with 1387321 additions and 5257 deletions
@@ -0,0 +1,14 @@
/datum/surgery/advanced/bioware
name = "enhancement surgery"
var/bioware_target = BIOWARE_GENERIC
/datum/surgery/advanced/bioware/can_start(mob/user, mob/living/carbon/human/target)
if(!..())
return FALSE
if(!istype(target))
return FALSE
for(var/X in target.bioware)
var/datum/bioware/B = X
if(B.mod_type == bioware_target)
return FALSE
return TRUE
@@ -0,0 +1,63 @@
/obj/item/disk/surgery/brainwashing
name = "Brainwashing Surgery Disk"
desc = "The disk provides instructions on how to impress an order on a brain, making it the primary objective of the patient."
surgeries = list(/datum/surgery/advanced/brainwashing)
/datum/surgery/advanced/brainwashing
name = "Brainwashing"
desc = "A surgical procedure which directly implants a directive into the patient's brain, making it their absolute priority. It can be cleared using a mindshield implant."
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/brainwash,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human)
possible_locs = list(BODY_ZONE_HEAD)
/datum/surgery/advanced/brainwashing/can_start(mob/user, mob/living/carbon/target)
if(!..())
return FALSE
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
return FALSE
return TRUE
/datum/surgery_step/brainwash
name = "brainwash"
implements = list(TOOL_HEMOSTAT = 85, TOOL_WIRECUTTER = 50, /obj/item/stack/packageWrap = 35, /obj/item/stack/cable_coil = 15)
time = 200
var/objective
/datum/surgery_step/brainwash/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
objective = stripped_input(user, "Choose the objective to imprint on your victim's brain.", "Brainwashing", null, MAX_MESSAGE_LEN)
if(!objective)
return -1
display_results(user, target, "<span class='notice'>You begin to brainwash [target]...</span>",
"[user] begins to fix [target]'s brain.",
"[user] begins to perform surgery on [target]'s brain.")
/datum/surgery_step/brainwash/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(!target.mind)
to_chat(user, "<span class='warning'>[target] doesn't respond to the brainwashing, as if [target.p_they()] lacked a mind...</span>")
return FALSE
if(HAS_TRAIT(target, TRAIT_MINDSHIELD))
to_chat(user, "<span class='warning'>You hear a faint buzzing from a device inside [target]'s brain, and the brainwashing is erased.</span>")
return FALSE
display_results(user, target, "<span class='notice'>You succeed in brainwashing [target].</span>",
"[user] successfully fixes [target]'s brain!",
"[user] completes the surgery on [target]'s brain.")
to_chat(target, "<span class='userdanger'>A new compulsion fills your mind... you feel forced to obey it!</span>")
brainwash(target, objective)
message_admins("[ADMIN_LOOKUPFLW(user)] surgically brainwashed [ADMIN_LOOKUPFLW(target)] with the objective '[objective]'.")
log_game("[key_name(user)] surgically brainwashed [key_name(target)] with the objective '[objective]'.")
return TRUE
/datum/surgery_step/brainwash/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.getorganslot(ORGAN_SLOT_BRAIN))
display_results(user, target, "<span class='warning'>You screw up, bruising the brain tissue!</span>",
"<span class='warning'>[user] screws up, causing brain damage!</span>",
"[user] completes the surgery on [target]'s brain.")
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 40)
else
user.visible_message("<span class='warning'>[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore.", "<span class='warning'>You suddenly notice that the brain you were working on is not there anymore.</span>")
return FALSE
+69
View File
@@ -0,0 +1,69 @@
/datum/surgery/advanced/lobotomy
name = "Lobotomy"
desc = "An invasive surgical procedure which guarantees removal of almost all brain traumas, but might cause another permanent trauma in return."
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/lobotomize,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery/advanced/lobotomy/can_start(mob/user, mob/living/carbon/target)
if(!..())
return FALSE
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
return FALSE
return TRUE
/datum/surgery_step/lobotomize
name = "perform lobotomy"
implements = list(TOOL_SCALPEL = 85, /obj/item/melee/transforming/energy/sword = 55, /obj/item/kitchen/knife = 35,
/obj/item/shard = 25, /obj/item = 20)
time = 100
/datum/surgery_step/lobotomize/tool_check(mob/user, obj/item/tool)
if(implement_type == /obj/item && !tool.get_sharpness())
return FALSE
return TRUE
/datum/surgery_step/lobotomize/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to perform a lobotomy on [target]'s brain...</span>",
"[user] begins to perform a lobotomy on [target]'s brain.",
"[user] begins to perform surgery on [target]'s brain.")
/datum/surgery_step/lobotomize/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You succeed in lobotomizing [target].</span>",
"[user] successfully lobotomizes [target]!",
"[user] completes the surgery on [target]'s brain.")
target.cure_all_traumas(TRAUMA_RESILIENCE_LOBOTOMY)
if(target.mind && target.mind.has_antag_datum(/datum/antagonist/brainwashed))
target.mind.remove_antag_datum(/datum/antagonist/brainwashed)
switch(rand(1,4))//Now let's see what hopefully-not-important part of the brain we cut off
if(1)
target.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_MAGIC)
if(2)
target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_MAGIC)
if(3)
target.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, TRAUMA_RESILIENCE_MAGIC)
return TRUE
/datum/surgery_step/lobotomize/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(B)
display_results(user, target, "<span class='warning'>You remove the wrong part, causing more damage!</span>",
"[user] successfully lobotomizes [target]!",
"[user] completes the surgery on [target]'s brain.")
B.applyOrganDamage(80)
switch(rand(1,3))
if(1)
target.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_MAGIC)
if(2)
target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_MAGIC)
if(3)
target.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, TRAUMA_RESILIENCE_MAGIC)
else
user.visible_message("<span class='warning'>[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore.", "<span class='warning'>You suddenly notice that the brain you were working on is not there anymore.</span>")
return FALSE
@@ -0,0 +1,41 @@
/datum/surgery/advanced/pacify
name = "Pacification"
desc = "A surgical procedure which permanently inhibits the aggression center of the brain, making the patient unwilling to cause direct harm."
steps = list(/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/pacify,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery/advanced/pacify/can_start(mob/user, mob/living/carbon/target)
. = ..()
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
return FALSE
/datum/surgery_step/pacify
name = "rewire brain"
implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
time = 40
/datum/surgery_step/pacify/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to pacify [target]...</span>",
"[user] begins to fix [target]'s brain.",
"[user] begins to perform surgery on [target]'s brain.")
/datum/surgery_step/pacify/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You succeed in neurologically pacifying [target].</span>",
"[user] successfully fixes [target]'s brain!",
"[user] completes the surgery on [target]'s brain.")
target.gain_trauma(/datum/brain_trauma/severe/pacifism, TRAUMA_RESILIENCE_LOBOTOMY)
return TRUE
/datum/surgery_step/pacify/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You screw up, rewiring [target]'s brain the wrong way around...</span>",
"<span class='warning'>[user] screws up, causing brain damage!</span>",
"[user] completes the surgery on [target]'s brain.")
target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
return FALSE
+80
View File
@@ -0,0 +1,80 @@
/datum/surgery/advanced/revival
name = "Revival"
desc = "An experimental surgical procedure which involves reconstruction and reactivation of the patient's brain even long after death. The body must still be able to sustain life."
steps = list(/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/revive,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery/advanced/revival/can_start(mob/user, mob/living/carbon/target)
if(!..())
return FALSE
if(target.stat != DEAD)
return FALSE
if(target.suiciding || HAS_TRAIT(target, TRAIT_NOCLONE) || target.hellbound)
return FALSE
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
return FALSE
return TRUE
/datum/surgery_step/revive
name = "electrically stimulate brain"
implements = list(/obj/item/twohanded/shockpaddles = 100, /obj/item/abductor/gizmo = 100, /obj/item/melee/baton = 75, /obj/item/organ/cyberimp/arm/baton = 75, /obj/item/organ/cyberimp/arm/gun/taser = 60, /obj/item/gun/energy/e_gun/advtaser = 60, /obj/item/gun/energy/taser = 60)
time = 120
/datum/surgery_step/revive/tool_check(mob/user, obj/item/tool)
. = TRUE
if(istype(tool, /obj/item/twohanded/shockpaddles))
var/obj/item/twohanded/shockpaddles/S = tool
if((S.req_defib && !S.defib.powered) || !S.wielded || S.cooldown || S.busy)
to_chat(user, "<span class='warning'>You need to wield both paddles, and [S.defib] must be powered!</span>")
return FALSE
if(istype(tool, /obj/item/melee/baton))
var/obj/item/melee/baton/B = tool
if(!B.status)
to_chat(user, "<span class='warning'>[B] needs to be active!</span>")
return FALSE
if(istype(tool, /obj/item/gun/energy))
var/obj/item/gun/energy/E = tool
if(E.chambered && istype(E.chambered, /obj/item/ammo_casing/energy/electrode))
return TRUE
else
to_chat(user, "<span class='warning'>You need an electrode for this!</span>")
return FALSE
/datum/surgery_step/revive/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You prepare to give [target]'s brain the spark of life with [tool].</span>",
"[user] prepares to shock [target]'s brain with [tool].",
"[user] prepares to shock [target]'s brain with [tool].")
target.notify_ghost_cloning("Someone is trying to zap your brain. Re-enter your corpse if you want to be revived!", source = target)
/datum/surgery_step/revive/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You successfully shock [target]'s brain with [tool]...</span>",
"[user] send a powerful shock to [target]'s brain with [tool]...",
"[user] send a powerful shock to [target]'s brain with [tool]...")
playsound(get_turf(target), 'sound/magic/lightningbolt.ogg', 50, 1)
target.adjustOxyLoss(-50, 0)
target.updatehealth()
if(target.revive())
user.visible_message("...[target] wakes up, alive and aware!", "<span class='notice'><b>IT'S ALIVE!</b></span>")
target.visible_message("...[target] wakes up, alive and aware!")
target.emote("gasp")
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 50, 199) //MAD SCIENCE
return TRUE
else
user.visible_message("...[target.p_they()] convulses, then lies still.")
target.visible_message("...[target.p_they()] convulses, then lies still.")
return FALSE
/datum/surgery_step/revive/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You shock [target]'s brain with [tool], but [target.p_they()] doesn't react.</span>",
"[user] send a powerful shock to [target]'s brain with [tool], but [target.p_they()] doesn't react.",
"[user] send a powerful shock to [target]'s brain with [tool], but [target.p_they()] doesn't react.")
playsound(get_turf(target), 'sound/magic/lightningbolt.ogg', 50, 1)
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 15, 199)
return FALSE
@@ -0,0 +1,37 @@
/datum/surgery/advanced/toxichealing
name = "Body Rejuvenation"
desc = "A surgical procedure that helps deal with oxygen deprivation, and treats parts damaged due to toxic compounds. Works on corpses and alive alike without chemicals."
steps = list(/datum/surgery_step/incise,
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/incise,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/toxichealing,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
requires_bodypart_type = 0
/datum/surgery_step/toxichealing
name = "rejuvenate body"
implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
repeatable = TRUE
time = 25
/datum/surgery_step/toxichealing/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] starts rejuvenating some of [target]'s flesh back to life.", "<span class='notice'>You start knitting some of [target]'s flesh back to life.</span>")
/datum/surgery_step/toxichealing/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] fixes some of [target]'s wounds.", "<span class='notice'>You succeed in fixing some of [target]'s wounds.</span>")
target.heal_bodypart_damage(0,0,30) //Heals stam
target.adjustToxLoss(-15, 0, TRUE)
target.adjustOxyLoss(-20, 0)
return TRUE
/datum/surgery_step/toxichealing/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] screws up!", "<span class='warning'>You screwed up!</span>")
target.take_bodypart_damage(25,0)
return FALSE
@@ -0,0 +1,42 @@
/datum/surgery/advanced/viral_bonding
name = "Viral Bonding"
desc = "A surgical procedure that forces a symbiotic relationship between a virus and its host. The patient must be dosed with spaceacillin, virus food, and formaldehyde."
steps = list(/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/viral_bond,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
/datum/surgery/advanced/viral_bonding/can_start(mob/user, mob/living/carbon/target)
if(!..())
return FALSE
if(!LAZYLEN(target.diseases))
return FALSE
return TRUE
/datum/surgery_step/viral_bond
name = "viral bond"
implements = list(TOOL_CAUTERY = 100, TOOL_WELDER = 50, /obj/item = 30) // 30% success with any hot item.
time = 100
chems_needed = list("spaceacillin","virusfood","formaldehyde")
/datum/surgery_step/viral_bond/tool_check(mob/user, obj/item/tool)
if(implement_type == TOOL_WELDER || implement_type == /obj/item)
return tool.get_temperature()
return TRUE
/datum/surgery_step/viral_bond/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You start heating [target]'s bone marrow with [tool]...</span>",
"[user] starts heating [target]'s bone marrow with [tool]...",
"[user] starts heating something in [target]'s chest with [tool]...")
/datum/surgery_step/viral_bond/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>[target]'s bone marrow begins pulsing slowly. The viral bonding is complete.</span>",
"[target]'s bone marrow begins pulsing slowly.",
"[user] finishes the operation.")
for(var/X in target.diseases)
var/datum/disease/D = X
D.carrier = TRUE
return TRUE
+25
View File
@@ -0,0 +1,25 @@
/datum/surgery/amputation
name = "Amputation"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/saw, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/sever_limb)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery_step/sever_limb
name = "sever limb"
implements = list(TOOL_SCALPEL = 100, TOOL_SAW = 100, /obj/item/melee/transforming/energy/sword/cyborg/saw = 100, /obj/item/melee/arm_blade = 80, /obj/item/twohanded/required/chainsaw = 80, /obj/item/mounted_chainsaw = 80, /obj/item/twohanded/fireaxe = 50, /obj/item/hatchet = 40, /obj/item/kitchen/knife/butcher = 25)
time = 64
/datum/surgery_step/sever_limb/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to sever [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to sever [target]'s [parse_zone(target_zone)]!",
"[user] begins to sever [target]'s [parse_zone(target_zone)]!")
/datum/surgery_step/sever_limb/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/mob/living/carbon/human/L = target
display_results(user, target, "<span class='notice'>You sever [L]'s [parse_zone(target_zone)].</span>",
"[user] severs [L]'s [parse_zone(target_zone)]!",
"[user] severs [L]'s [parse_zone(target_zone)]!")
if(surgery.operated_bodypart)
var/obj/item/bodypart/target_limb = surgery.operated_bodypart
target_limb.drop_limb()
return 1
+881
View File
@@ -0,0 +1,881 @@
/obj/item/bodypart
name = "limb"
desc = "Why is it detached..."
force = 3
throwforce = 3
icon = 'icons/mob/human_parts.dmi'
icon_state = ""
layer = BELOW_MOB_LAYER //so it isn't hidden behind objects when on the floor
var/mob/living/carbon/owner = null
var/mob/living/carbon/original_owner = null
var/status = BODYPART_ORGANIC
var/needs_processing = FALSE
var/body_zone //BODY_ZONE_CHEST, BODY_ZONE_L_ARM, etc , used for def_zone
var/list/aux_icons // associative list, currently used for hands
var/body_part = null //bitflag used to check which clothes cover this bodypart
var/use_digitigrade = NOT_DIGITIGRADE //Used for alternate legs, useless elsewhere
var/list/embedded_objects = list()
var/held_index = 0 //are we a hand? if so, which one!
var/is_pseudopart = FALSE //For limbs that don't really exist, eg chainsaws
var/disabled = BODYPART_NOT_DISABLED //If disabled, limb is as good as missing
var/body_damage_coeff = 1 //Multiplier of the limb's damage that gets applied to the mob
var/stam_damage_coeff = 0.5
var/brutestate = 0
var/burnstate = 0
var/brute_dam = 0
var/burn_dam = 0
var/stamina_dam = 0
var/max_stamina_damage = 0
var/max_damage = 0
var/stam_heal_tick = 0 //per Life(). Defaults to 0 due to citadel changes
var/brute_reduction = 0 //Subtracted to brute damage taken
var/burn_reduction = 0 //Subtracted to burn damage taken
//Coloring and proper item icon update
var/skin_tone = ""
var/body_gender = ""
var/species_id = ""
var/should_draw_citadel = FALSE
var/should_draw_gender = FALSE
var/should_draw_greyscale = FALSE
var/species_color = ""
var/mutation_color = ""
var/no_update = 0
var/body_markings = "" //for bodypart markings
var/body_markings_icon = 'modular_citadel/icons/mob/mam_markings.dmi'
var/list/markings_color = list()
var/aux_marking
var/digitigrade_type
var/animal_origin = null //for nonhuman bodypart (e.g. monkey)
var/dismemberable = 1 //whether it can be dismembered with a weapon.
var/px_x = 0
var/px_y = 0
var/species_flags_list = list()
var/dmg_overlay_type //the type of damage overlay (if any) to use when this bodypart is bruised/burned.
//Damage messages used by help_shake_act()
var/light_brute_msg = "bruised"
var/medium_brute_msg = "battered"
var/heavy_brute_msg = "mangled"
var/light_burn_msg = "numb"
var/medium_burn_msg = "blistered"
var/heavy_burn_msg = "peeling away"
/obj/item/bodypart/examine(mob/user)
..()
if(brute_dam > DAMAGE_PRECISION)
to_chat(user, "<span class='warning'>This limb has [brute_dam > 30 ? "severe" : "minor"] bruising.</span>")
if(burn_dam > DAMAGE_PRECISION)
to_chat(user, "<span class='warning'>This limb has [burn_dam > 30 ? "severe" : "minor"] burns.</span>")
/obj/item/bodypart/blob_act()
take_damage(max_damage)
/obj/item/bodypart/Destroy()
if(owner)
owner.bodyparts -= src
owner = null
return ..()
/obj/item/bodypart/attack(mob/living/carbon/C, mob/user)
if(ishuman(C))
var/mob/living/carbon/human/H = C
if(HAS_TRAIT(C, TRAIT_LIMBATTACHMENT))
if(!H.get_bodypart(body_zone) && !animal_origin)
if(H == user)
H.visible_message("<span class='warning'>[H] jams [src] into [H.p_their()] empty socket!</span>",\
"<span class='notice'>You force [src] into your empty socket, and it locks into place!</span>")
else
H.visible_message("<span class='warning'>[user] jams [src] into [H]'s empty socket!</span>",\
"<span class='notice'>[user] forces [src] into your empty socket, and it locks into place!</span>")
user.temporarilyRemoveItemFromInventory(src, TRUE)
attach_limb(C)
return
..()
/obj/item/bodypart/attackby(obj/item/W, mob/user, params)
if(W.sharpness)
add_fingerprint(user)
if(!contents.len)
to_chat(user, "<span class='warning'>There is nothing left inside [src]!</span>")
return
playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1)
user.visible_message("<span class='warning'>[user] begins to cut open [src].</span>",\
"<span class='notice'>You begin to cut open [src]...</span>")
if(do_after(user, 54, target = src))
drop_organs(user)
else
return ..()
/obj/item/bodypart/throw_impact(atom/hit_atom)
..()
if(status != BODYPART_ROBOTIC)
playsound(get_turf(src), 'sound/misc/splort.ogg', 50, 1, -1)
pixel_x = rand(-3, 3)
pixel_y = rand(-3, 3)
//empties the bodypart from its organs and other things inside it
/obj/item/bodypart/proc/drop_organs(mob/user)
var/turf/T = get_turf(src)
if(status != BODYPART_ROBOTIC)
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
for(var/obj/item/I in src)
I.forceMove(T)
/obj/item/bodypart/proc/consider_processing()
if(stamina_dam > DAMAGE_PRECISION)
. = TRUE
//else if.. else if.. so on.
else
. = FALSE
needs_processing = .
//Return TRUE to get whatever mob this is in to update health.
/obj/item/bodypart/proc/on_life()
if(stam_heal_tick && stamina_dam > DAMAGE_PRECISION) //DO NOT update health here, it'll be done in the carbon's life.
if(heal_damage(brute = 0, burn = 0, stamina = stam_heal_tick, only_robotic = FALSE, only_organic = FALSE, updating_health = FALSE))
. |= BODYPART_LIFE_UPDATE_HEALTH
//Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all.
//Damage will not exceed max_damage using this proc
//Cannot apply negative damage
/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
if(owner && (owner.status_flags & GODMODE))
return FALSE //godmode
var/dmg_mlt = CONFIG_GET(number/damage_multiplier)
brute = round(max(brute * dmg_mlt, 0),DAMAGE_PRECISION)
burn = round(max(burn * dmg_mlt, 0),DAMAGE_PRECISION)
stamina = round(max(stamina * dmg_mlt, 0),DAMAGE_PRECISION)
brute = max(0, brute - brute_reduction)
burn = max(0, burn - burn_reduction)
//No stamina scaling.. for now..
if(!brute && !burn && !stamina)
return FALSE
switch(animal_origin)
if(ALIEN_BODYPART,LARVA_BODYPART) //aliens take double burn //nothing can burn with so much snowflake code around
burn *= 2
var/can_inflict = max_damage - get_damage()
if(can_inflict <= 0)
return FALSE
var/total_damage = brute + burn
if(total_damage > can_inflict)
var/excess = total_damage - can_inflict
brute = round(brute * (excess / total_damage),DAMAGE_PRECISION)
burn = round(burn * (excess / total_damage),DAMAGE_PRECISION)
brute_dam += brute
burn_dam += burn
//We've dealt the physical damages, if there's room lets apply the stamina damage.
var/current_damage = get_damage(TRUE) //This time around, count stamina loss too.
var/available_damage = max_damage - current_damage
stamina_dam += round(CLAMP(stamina, 0, min(max_stamina_damage - stamina_dam, available_damage)), DAMAGE_PRECISION)
if(owner && updating_health)
owner.updatehealth()
if(stamina > DAMAGE_PRECISION)
owner.update_stamina()
consider_processing()
update_disabled()
return update_bodypart_damage_state()
//Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all.
//Damage cannot go below zero.
//Cannot remove negative damage (i.e. apply damage)
/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
if(only_robotic && status != BODYPART_ROBOTIC) //This makes organic limbs not heal when the proc is in Robotic mode.
return
if(only_organic && status != BODYPART_ORGANIC) //This makes robolimbs not healable by chems.
return
brute_dam = round(max(brute_dam - brute, 0), DAMAGE_PRECISION)
burn_dam = round(max(burn_dam - burn, 0), DAMAGE_PRECISION)
stamina_dam = round(max(stamina_dam - stamina, 0), DAMAGE_PRECISION)
if(owner && updating_health)
owner.updatehealth()
consider_processing()
update_disabled()
return update_bodypart_damage_state()
//Returns total damage.
/obj/item/bodypart/proc/get_damage(include_stamina = FALSE)
var/total = brute_dam + burn_dam
if(include_stamina)
total += stamina_dam
return total
//Checks disabled status thresholds
//Checks disabled status thresholds
/obj/item/bodypart/proc/update_disabled()
set_disabled(is_disabled())
/obj/item/bodypart/proc/is_disabled()
if(HAS_TRAIT(owner, TRAIT_PARALYSIS))
return BODYPART_DISABLED_PARALYSIS
if(can_dismember() && !HAS_TRAIT(owner, TRAIT_NODISMEMBER))
. = disabled //inertia, to avoid limbs healing 0.1 damage and being re-enabled
if((get_damage(TRUE) >= max_damage) || (HAS_TRAIT(owner, TRAIT_EASYLIMBDISABLE) && (get_damage(TRUE) >= (max_damage * 0.6)))) //Easy limb disable disables the limb at 40% health instead of 0%
return BODYPART_DISABLED_DAMAGE
if(disabled && (get_damage(TRUE) <= (max_damage * 0.5)))
return BODYPART_NOT_DISABLED
else
return BODYPART_NOT_DISABLED
/obj/item/bodypart/proc/check_disabled() //This might be depreciated and should be safe to remove.
if(!can_dismember() || HAS_TRAIT(owner, TRAIT_NODISMEMBER))
return
if(!disabled && (get_damage(TRUE) >= max_damage))
set_disabled(TRUE)
else if(disabled && (get_damage(TRUE) <= (max_damage * 0.5)))
set_disabled(FALSE)
/obj/item/bodypart/proc/set_disabled(new_disabled)
if(disabled == new_disabled)
return
disabled = new_disabled
owner.update_health_hud() //update the healthdoll
owner.update_body()
owner.update_canmove()
//Updates an organ's brute/burn states for use by update_damage_overlays()
//Returns 1 if we need to update overlays. 0 otherwise.
/obj/item/bodypart/proc/update_bodypart_damage_state()
var/tbrute = round( (brute_dam/max_damage)*3, 1 )
var/tburn = round( (burn_dam/max_damage)*3, 1 )
if((tbrute != brutestate) || (tburn != burnstate))
brutestate = tbrute
burnstate = tburn
return TRUE
return FALSE
//Change organ status
/obj/item/bodypart/proc/change_bodypart_status(new_limb_status, heal_limb, change_icon_to_default)
status = new_limb_status
if(heal_limb)
burn_dam = 0
brute_dam = 0
brutestate = 0
burnstate = 0
if(change_icon_to_default)
if(status == BODYPART_ORGANIC)
icon = DEFAULT_BODYPART_ICON_ORGANIC
else if(status == BODYPART_ROBOTIC)
icon = DEFAULT_BODYPART_ICON_ROBOTIC
if(owner)
owner.updatehealth()
owner.update_body() //if our head becomes robotic, we remove the lizard horns and human hair.
owner.update_hair()
owner.update_damage_overlays()
/obj/item/bodypart/proc/is_organic_limb()
return (status == BODYPART_ORGANIC)
//we inform the bodypart of the changes that happened to the owner, or give it the informations from a source mob.
/obj/item/bodypart/proc/update_limb(dropping_limb, mob/living/carbon/source)
var/mob/living/carbon/C
if(source)
C = source
if(!original_owner)
original_owner = source
else if(original_owner && owner != original_owner) //Foreign limb
no_update = TRUE
else
C = owner
no_update = FALSE
if(HAS_TRAIT(C, TRAIT_HUSK) && is_organic_limb())
species_id = "husk" //overrides species_id
dmg_overlay_type = "" //no damage overlay shown when husked
should_draw_gender = FALSE
should_draw_greyscale = FALSE
no_update = TRUE
body_markings = "husk" // reeee
aux_marking = "husk"
if(no_update)
return
if(!animal_origin)
var/mob/living/carbon/human/H = C
should_draw_greyscale = FALSE
var/datum/species/S = H.dna.species
species_id = S.limbs_id
should_draw_citadel = S.should_draw_citadel // Citadel Addition
species_flags_list = H.dna.species.species_traits
//body marking memes
var/list/colorlist = list()
colorlist.Cut()
colorlist += ReadRGB("[H.dna.features["mcolor"]]0")
colorlist += ReadRGB("[H.dna.features["mcolor2"]]0")
colorlist += ReadRGB("[H.dna.features["mcolor3"]]0")
colorlist += list(0,0,0, S.hair_alpha)
for(var/index=1, index<=colorlist.len, index++)
colorlist[index] = colorlist[index]/255
if(S.use_skintones)
skin_tone = H.skin_tone
should_draw_greyscale = TRUE
else
skin_tone = ""
body_gender = H.gender
should_draw_gender = S.sexes
if(MUTCOLORS in S.species_traits)
if(S.fixed_mut_color)
species_color = S.fixed_mut_color
else
species_color = H.dna.features["mcolor"]
should_draw_greyscale = TRUE
else
species_color = ""
if("legs" in S.default_features)
if(body_zone == BODY_ZONE_L_LEG || body_zone == BODY_ZONE_R_LEG)
if(DIGITIGRADE in S.species_traits)
digitigrade_type = lowertext(H.dna.features.["legs"])
else
digitigrade_type = null
if("mam_body_markings" in S.default_features)
var/datum/sprite_accessory/Smark
Smark = GLOB.mam_body_markings_list[H.dna.features["mam_body_markings"]]
if(Smark)
body_markings_icon = Smark.icon
if(H.dna.features.["mam_body_markings"] != "None")
body_markings = lowertext(H.dna.features.["mam_body_markings"])
aux_marking = lowertext(H.dna.features.["mam_body_markings"])
else
body_markings = "plain"
aux_marking = "plain"
markings_color = list(colorlist)
else
body_markings = null
aux_marking = null
if(!dropping_limb && H.dna.check_mutation(HULK))
mutation_color = "00aa00"
else
mutation_color = ""
dmg_overlay_type = S.damage_overlay_type
else if(animal_origin == MONKEY_BODYPART) //currently monkeys are the only non human mob to have damage overlays.
dmg_overlay_type = animal_origin
if(status == BODYPART_ROBOTIC)
dmg_overlay_type = "robotic"
body_markings = null
aux_marking = null
if(dropping_limb)
no_update = TRUE //when attached, the limb won't be affected by the appearance changes of its mob owner.
//to update the bodypart's icon when not attached to a mob
/obj/item/bodypart/proc/update_icon_dropped()
cut_overlays()
var/list/standing = get_limb_icon(1)
if(!standing.len)
icon_state = initial(icon_state)//no overlays found, we default back to initial icon.
return
for(var/image/I in standing)
I.pixel_x = px_x
I.pixel_y = px_y
add_overlay(standing)
//Gives you a proper icon appearance for the dismembered limb
/obj/item/bodypart/proc/get_limb_icon(dropped)
cut_overlays()
icon_state = "" //to erase the default sprite, we're building the visual aspects of the bodypart through overlays alone.
. = list()
var/image_dir = 0
var/icon_gender = (body_gender == FEMALE) ? "f" : "m" //gender of the icon, if applicable
if(dropped)
image_dir = SOUTH
if(dmg_overlay_type)
if(brutestate)
. += image('icons/mob/dam_mob.dmi', "[dmg_overlay_type]_[body_zone]_[brutestate]0", -DAMAGE_LAYER, image_dir)
if(burnstate)
. += image('icons/mob/dam_mob.dmi', "[dmg_overlay_type]_[body_zone]_0[burnstate]", -DAMAGE_LAYER, image_dir)
if(!isnull(body_markings) && status == BODYPART_ORGANIC)
if(!use_digitigrade)
if(BODY_ZONE_CHEST)
. += image(body_markings_icon, "[body_markings]_[body_zone]_[icon_gender]", -MARKING_LAYER, image_dir)
else
. += image(body_markings_icon, "[body_markings]_[body_zone]", -MARKING_LAYER, image_dir)
else
. += image(body_markings_icon, "[body_markings]_[digitigrade_type]_[use_digitigrade]_[body_zone]", -MARKING_LAYER, image_dir)
var/image/limb = image(layer = -BODYPARTS_LAYER, dir = image_dir)
var/list/aux = list()
var/image/marking
var/list/auxmarking = list()
. += limb
if(animal_origin)
if(is_organic_limb())
limb.icon = 'icons/mob/animal_parts.dmi'
if(species_id == "husk")
limb.icon_state = "[animal_origin]_husk_[body_zone]"
else
limb.icon_state = "[animal_origin]_[body_zone]"
else
limb.icon = 'icons/mob/augmentation/augments.dmi'
limb.icon_state = "[animal_origin]_[body_zone]"
return
if((body_zone != BODY_ZONE_HEAD && body_zone != BODY_ZONE_CHEST))
should_draw_gender = FALSE
if(is_organic_limb())
if(should_draw_greyscale)
limb.icon = 'icons/mob/human_parts_greyscale.dmi'
if(should_draw_gender)
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
else if(use_digitigrade)
limb.icon_state = "[digitigrade_type]_[use_digitigrade]_[body_zone]"
else
limb.icon_state = "[species_id]_[body_zone]"
else
limb.icon = 'icons/mob/human_parts.dmi'
if(should_draw_gender)
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
else if(use_digitigrade)
limb.icon_state = "[species_id]_[digitigrade_type]_[use_digitigrade]_[body_zone]"
else
limb.icon_state = "[species_id]_[body_zone]"
// Citadel Start
if(should_draw_citadel)
limb.icon = 'modular_citadel/icons/mob/mutant_bodyparts.dmi'
if(should_draw_gender)
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
else if(use_digitigrade)
limb.icon_state = "[species_id]_[digitigrade_type]_[use_digitigrade]_[body_zone]"
else
limb.icon_state = "[species_id]_[body_zone]"
// Body markings
if(!isnull(body_markings))
if(species_id == "husk")
marking = image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_[body_zone]", -MARKING_LAYER, image_dir)
else if(species_id == "husk" && use_digitigrade)
marking = image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_[digitigrade_type]_[use_digitigrade]_[body_zone]", -MARKING_LAYER, image_dir)
else if(!use_digitigrade)
if(body_zone == BODY_ZONE_CHEST)
marking = image(body_markings_icon, "[body_markings]_[body_zone]_[icon_gender]", -MARKING_LAYER, image_dir)
else
marking = image(body_markings_icon, "[body_markings]_[body_zone]", -MARKING_LAYER, image_dir)
else
marking = image(body_markings_icon, "[body_markings]_[digitigrade_type]_[use_digitigrade]_[body_zone]", -MARKING_LAYER, image_dir)
. += marking
// Citadel End
if(aux_icons)
for(var/I in aux_icons)
var/aux_layer = aux_icons[I]
aux += image(limb.icon, "[species_id]_[I]", -aux_layer, image_dir)
if(!isnull(aux_marking))
if(species_id == "husk")
auxmarking += image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_[I]", -aux_layer, image_dir)
else
auxmarking += image(body_markings_icon, "[body_markings]_[I]", -aux_layer, image_dir)
. += aux
. += auxmarking
else
limb.icon = icon
if(should_draw_gender)
limb.icon_state = "[body_zone]_[icon_gender]"
else
limb.icon_state = "[body_zone]"
if(aux_icons)
for(var/I in aux_icons)
var/aux_layer = aux_icons[I]
aux += image(limb.icon, "[I]", -aux_layer, image_dir)
if(!isnull(aux_marking))
if(species_id == "husk")
auxmarking += image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_[I]", -aux_layer, image_dir)
else
auxmarking += image(body_markings_icon, "[body_markings]_[I]", -aux_layer, image_dir)
. += auxmarking
. += aux
if(!isnull(body_markings))
if(species_id == "husk")
marking = image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_[body_zone]", -MARKING_LAYER, image_dir)
else if(species_id == "husk" && use_digitigrade)
marking = image('modular_citadel/icons/mob/markings_notmammals.dmi', "husk_digitigrade_[use_digitigrade]_[body_zone]", -MARKING_LAYER, image_dir)
else if(!use_digitigrade)
if(body_zone == BODY_ZONE_CHEST)
marking = image(body_markings_icon, "[body_markings]_[body_zone]_[icon_gender]", -MARKING_LAYER, image_dir)
else
marking = image(body_markings_icon, "[body_markings]_[body_zone]", -MARKING_LAYER, image_dir)
else
marking = image(body_markings_icon, "[body_markings]_[digitigrade_type]_[use_digitigrade]_[body_zone]", -MARKING_LAYER, image_dir)
. += marking
return
if(should_draw_greyscale)
var/draw_color = mutation_color || species_color || (skin_tone && skintone2hex(skin_tone))
if(draw_color)
limb.color = "#[draw_color]"
if(aux_icons)
for(var/a in aux)
var/image/I = a
I.color = "#[draw_color]"
if(!isnull(aux_marking))
for(var/a in auxmarking)
var/image/I = a
if(species_id == "husk")
I.color = "#141414"
else
I.color = list(markings_color)
if(!isnull(body_markings))
if(species_id == "husk")
marking.color = "#141414"
else
marking.color = list(markings_color)
/obj/item/bodypart/deconstruct(disassembled = TRUE)
drop_organs()
qdel(src)
/obj/item/bodypart/chest
name = BODY_ZONE_CHEST
desc = "It's impolite to stare at a person's chest."
icon_state = "default_human_chest"
max_damage = 200
body_zone = BODY_ZONE_CHEST
body_part = CHEST
px_x = 0
px_y = 0
stam_damage_coeff = 1
max_stamina_damage = 200
var/obj/item/cavity_item
/obj/item/bodypart/chest/can_dismember(obj/item/I)
if(!((owner.stat == DEAD) || owner.InFullCritical()))
return FALSE
return ..()
/obj/item/bodypart/chest/Destroy()
if(cavity_item)
qdel(cavity_item)
return ..()
/obj/item/bodypart/chest/drop_organs(mob/user)
if(cavity_item)
cavity_item.forceMove(user.loc)
cavity_item = null
..()
/obj/item/bodypart/chest/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_chest"
animal_origin = MONKEY_BODYPART
/obj/item/bodypart/chest/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_chest"
dismemberable = 0
max_damage = 500
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/chest/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
/obj/item/bodypart/chest/larva
icon = 'icons/mob/animal_parts.dmi'
icon_state = "larva_chest"
dismemberable = 0
max_damage = 50
animal_origin = LARVA_BODYPART
/obj/item/bodypart/l_arm
name = "left arm"
desc = "Did you know that the word 'sinister' stems originally from the \
Latin 'sinestra' (left hand), because the left hand was supposed to \
be possessed by the devil? This arm appears to be possessed by no \
one though."
icon_state = "default_human_l_arm"
attack_verb = list("slapped", "punched")
max_damage = 50
max_stamina_damage = 50
body_zone = BODY_ZONE_L_ARM
body_part = ARM_LEFT
aux_icons = list(BODY_ZONE_PRECISE_L_HAND = HANDS_PART_LAYER, "l_hand_behind" = BODY_BEHIND_LAYER)
body_damage_coeff = 0.75
held_index = 1
px_x = -6
px_y = 0
stam_heal_tick = 2
/obj/item/bodypart/l_arm/is_disabled()
if(HAS_TRAIT(owner, TRAIT_PARALYSIS_L_ARM))
return BODYPART_DISABLED_PARALYSIS
return ..()
/obj/item/bodypart/l_arm/set_disabled(new_disabled)
. = ..()
if(disabled == new_disabled)
return
if(disabled == BODYPART_DISABLED_DAMAGE)
if(owner.stat > UNCONSCIOUS)
owner.emote("scream")
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>Your [name] is too damaged to function!</span>")
if(held_index)
owner.dropItemToGround(owner.get_item_for_held_index(held_index))
else if(disabled == BODYPART_DISABLED_PARALYSIS)
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>You can't feel your [name]!</span>")
if(held_index)
owner.dropItemToGround(owner.get_item_for_held_index(held_index))
if(owner.hud_used)
var/obj/screen/inventory/hand/L = owner.hud_used.hand_slots["[held_index]"]
if(L)
L.update_icon()
/obj/item/bodypart/l_arm/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_l_arm"
animal_origin = MONKEY_BODYPART
px_x = -5
px_y = -3
/obj/item/bodypart/l_arm/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_l_arm"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 100
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/l_arm/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
/obj/item/bodypart/r_arm
name = "right arm"
desc = "Over 87% of humans are right handed. That figure is much lower \
among humans missing their right arm."
icon_state = "default_human_r_arm"
attack_verb = list("slapped", "punched")
max_damage = 50
body_zone = BODY_ZONE_R_ARM
body_part = ARM_RIGHT
aux_icons = list(BODY_ZONE_PRECISE_R_HAND = HANDS_PART_LAYER, "r_hand_behind" = BODY_BEHIND_LAYER)
body_damage_coeff = 0.75
held_index = 2
px_x = 6
px_y = 0
stam_heal_tick = 2
max_stamina_damage = 50
/obj/item/bodypart/r_arm/is_disabled()
if(HAS_TRAIT(owner, TRAIT_PARALYSIS_R_ARM))
return BODYPART_DISABLED_PARALYSIS
return ..()
/obj/item/bodypart/r_arm/set_disabled(new_disabled)
. = ..()
if(disabled == new_disabled)
return
if(disabled == BODYPART_DISABLED_DAMAGE)
if(owner.stat > UNCONSCIOUS)
owner.emote("scream")
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>Your [name] is too damaged to function!</span>")
if(held_index)
owner.dropItemToGround(owner.get_item_for_held_index(held_index))
else if(disabled == BODYPART_DISABLED_PARALYSIS)
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>You can't feel your [name]!</span>")
if(held_index)
owner.dropItemToGround(owner.get_item_for_held_index(held_index))
if(owner.hud_used)
var/obj/screen/inventory/hand/R = owner.hud_used.hand_slots["[held_index]"]
if(R)
R.update_icon()
/obj/item/bodypart/r_arm/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_r_arm"
animal_origin = MONKEY_BODYPART
px_x = 5
px_y = -3
/obj/item/bodypart/r_arm/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_r_arm"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 100
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/r_arm/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
/obj/item/bodypart/l_leg
name = "left leg"
desc = "Some athletes prefer to tie their left shoelaces first for good \
luck. In this instance, it probably would not have helped."
icon_state = "default_human_l_leg"
attack_verb = list("kicked", "stomped")
max_damage = 50
body_zone = BODY_ZONE_L_LEG
body_part = LEG_LEFT
body_damage_coeff = 0.75
px_x = -2
px_y = 12
stam_heal_tick = 2
max_stamina_damage = 50
var/blood_state = BLOOD_STATE_NOT_BLOODY
var/list/bloody_legs = list(BLOOD_STATE_BLOOD = 0, BLOOD_STATE_OIL = 0, BLOOD_STATE_NOT_BLOODY = 0)
/obj/item/bodypart/l_leg/is_disabled()
if(HAS_TRAIT(owner, TRAIT_PARALYSIS_L_LEG))
return BODYPART_DISABLED_PARALYSIS
return ..()
/obj/item/bodypart/l_leg/set_disabled(new_disabled)
. = ..()
if(disabled == new_disabled)
return
if(disabled == BODYPART_DISABLED_DAMAGE)
if(owner.stat > UNCONSCIOUS)
owner.emote("scream")
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>Your [name] is too damaged to function!</span>")
else if(disabled == BODYPART_DISABLED_PARALYSIS)
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>You can't feel your [name]!</span>")
/obj/item/bodypart/l_leg/digitigrade
name = "left digitigrade leg"
use_digitigrade = FULL_DIGITIGRADE
/obj/item/bodypart/l_leg/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_l_leg"
animal_origin = MONKEY_BODYPART
px_y = 4
/obj/item/bodypart/l_leg/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_l_leg"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 100
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/l_leg/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
/obj/item/bodypart/r_leg
name = "right leg"
desc = "You put your right leg in, your right leg out. In, out, in, out, \
shake it all about. And apparently then it detaches.\n\
The hokey pokey has certainly changed a lot since space colonisation."
// alternative spellings of 'pokey' are availible
icon_state = "default_human_r_leg"
attack_verb = list("kicked", "stomped")
max_damage = 50
body_zone = BODY_ZONE_R_LEG
body_part = LEG_RIGHT
body_damage_coeff = 0.75
px_x = 2
px_y = 12
max_stamina_damage = 50
stam_heal_tick = 2
var/blood_state = BLOOD_STATE_NOT_BLOODY
var/list/bloody_legs = list(BLOOD_STATE_BLOOD = 0, BLOOD_STATE_OIL = 0, BLOOD_STATE_NOT_BLOODY = 0)
/obj/item/bodypart/r_leg/is_disabled()
if(HAS_TRAIT(owner, TRAIT_PARALYSIS_R_LEG))
return BODYPART_DISABLED_PARALYSIS
return ..()
/obj/item/bodypart/r_leg/set_disabled(new_disabled)
. = ..()
if(disabled == new_disabled)
return
if(disabled == BODYPART_DISABLED_DAMAGE)
if(owner.stat > UNCONSCIOUS)
owner.emote("scream")
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>Your [name] is too damaged to function!</span>")
else if(disabled == BODYPART_DISABLED_PARALYSIS)
if(. && (owner.stat > DEAD))
to_chat(owner, "<span class='userdanger'>You can't feel your [name]!</span>")
/obj/item/bodypart/r_leg/digitigrade
name = "right digitigrade leg"
use_digitigrade = FULL_DIGITIGRADE
/obj/item/bodypart/r_leg/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_r_leg"
animal_origin = MONKEY_BODYPART
px_y = 4
/obj/item/bodypart/r_leg/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_r_leg"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 100
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/r_leg/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
@@ -0,0 +1,364 @@
/obj/item/bodypart/proc/can_dismember(obj/item/I)
if(dismemberable)
return TRUE
//Dismember a limb
/obj/item/bodypart/proc/dismember(dam_type = BRUTE)
if(!owner)
return FALSE
var/mob/living/carbon/C = owner
if(!dismemberable)
return FALSE
if(C.status_flags & GODMODE)
return FALSE
if(HAS_TRAIT(C, TRAIT_NODISMEMBER))
return FALSE
var/obj/item/bodypart/affecting = C.get_bodypart(BODY_ZONE_CHEST)
affecting.receive_damage(CLAMP(brute_dam/2 * affecting.body_damage_coeff, 15, 50), CLAMP(burn_dam/2 * affecting.body_damage_coeff, 0, 50)) //Damage the chest based on limb's existing damage
C.visible_message("<span class='danger'><B>[C]'s [src.name] has been violently dismembered!</B></span>")
C.emote("scream")
SEND_SIGNAL(C, COMSIG_ADD_MOOD_EVENT, "dismembered", /datum/mood_event/dismembered)
drop_limb()
if(dam_type == BURN)
burn()
return 1
add_mob_blood(C)
C.bleed(40)
var/direction = pick(GLOB.cardinals)
var/t_range = rand(2,max(throw_range/2, 2))
var/turf/target_turf = get_turf(src)
for(var/i in 1 to t_range-1)
var/turf/new_turf = get_step(target_turf, direction)
if(!new_turf)
break
target_turf = new_turf
if(new_turf.density)
break
throw_at(target_turf, throw_range, throw_speed)
return 1
/obj/item/bodypart/chest/dismember()
if(!owner)
return FALSE
var/mob/living/carbon/C = owner
if(!dismemberable)
return FALSE
if(HAS_TRAIT(C, TRAIT_NODISMEMBER))
return FALSE
. = list()
var/organ_spilled = 0
var/turf/T = get_turf(C)
C.bleed(50)
playsound(get_turf(C), 'sound/misc/splort.ogg', 80, 1)
for(var/X in C.internal_organs)
var/obj/item/organ/O = X
var/org_zone = check_zone(O.zone)
if(org_zone != BODY_ZONE_CHEST)
continue
O.Remove(C)
O.forceMove(T)
organ_spilled = 1
. += X
if(cavity_item)
cavity_item.forceMove(T)
. += cavity_item
cavity_item = null
organ_spilled = 1
if(organ_spilled)
C.visible_message("<span class='danger'><B>[C]'s internal organs spill out onto the floor!</B></span>")
//limb removal. The "special" argument is used for swapping a limb with a new one without the effects of losing a limb kicking in.
/obj/item/bodypart/proc/drop_limb(special)
if(!owner)
return
var/atom/Tsec = owner.drop_location()
var/mob/living/carbon/C = owner
update_limb(1)
C.bodyparts -= src
if(held_index)
C.dropItemToGround(owner.get_item_for_held_index(held_index), 1)
C.hand_bodyparts[held_index] = null
owner = null
for(var/X in C.surgeries) //if we had an ongoing surgery on that limb, we stop it.
var/datum/surgery/S = X
if(S.operated_bodypart == src)
C.surgeries -= S
qdel(S)
break
for(var/obj/item/I in embedded_objects)
embedded_objects -= I
I.forceMove(src)
if(!C.has_embedded_objects())
C.clear_alert("embeddedobject")
SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "embedded")
if(!special)
if(C.dna)
for(var/X in C.dna.mutations) //some mutations require having specific limbs to be kept.
var/datum/mutation/human/MT = X
if(MT.limb_req && MT.limb_req == body_zone)
MT.force_lose(C)
for(var/X in C.internal_organs) //internal organs inside the dismembered limb are dropped.
var/obj/item/organ/O = X
var/org_zone = check_zone(O.zone)
if(org_zone != body_zone)
continue
O.transfer_to_limb(src, C)
update_icon_dropped()
C.update_health_hud() //update the healthdoll
C.update_body()
C.update_hair()
C.update_canmove()
if(!Tsec) // Tsec = null happens when a "dummy human" used for rendering icons on prefs screen gets its limbs replaced.
qdel(src)
return
if(is_pseudopart)
drop_organs(C) //Psuedoparts shouldn't have organs, but just in case
qdel(src)
return
forceMove(Tsec)
//when a limb is dropped, the internal organs are removed from the mob and put into the limb
/obj/item/organ/proc/transfer_to_limb(obj/item/bodypart/LB, mob/living/carbon/C)
Remove(C)
forceMove(LB)
/obj/item/organ/brain/transfer_to_limb(obj/item/bodypart/head/LB, mob/living/carbon/human/C)
Remove(C) //Changeling brain concerns are now handled in Remove
forceMove(LB)
LB.brain = src
if(brainmob)
LB.brainmob = brainmob
brainmob = null
LB.brainmob.forceMove(LB)
LB.brainmob.container = LB
LB.brainmob.stat = DEAD
/obj/item/organ/eyes/transfer_to_limb(obj/item/bodypart/head/LB, mob/living/carbon/human/C)
LB.eyes = src
..()
/obj/item/bodypart/chest/drop_limb(special)
if(special)
..()
/obj/item/bodypart/r_arm/drop_limb(special)
var/mob/living/carbon/C = owner
..()
if(C && !special)
if(C.handcuffed)
C.handcuffed.forceMove(drop_location())
C.handcuffed.dropped(C)
C.handcuffed = null
C.update_handcuffed()
if(C.hud_used)
var/obj/screen/inventory/hand/R = C.hud_used.hand_slots["[held_index]"]
if(R)
R.update_icon()
if(C.gloves)
C.dropItemToGround(C.gloves, TRUE)
C.update_inv_gloves() //to remove the bloody hands overlay
/obj/item/bodypart/l_arm/drop_limb(special)
var/mob/living/carbon/C = owner
..()
if(C && !special)
if(C.handcuffed)
C.handcuffed.forceMove(drop_location())
C.handcuffed.dropped(C)
C.handcuffed = null
C.update_handcuffed()
if(C.hud_used)
var/obj/screen/inventory/hand/L = C.hud_used.hand_slots["[held_index]"]
if(L)
L.update_icon()
if(C.gloves)
C.dropItemToGround(C.gloves, TRUE)
C.update_inv_gloves() //to remove the bloody hands overlay
/obj/item/bodypart/r_leg/drop_limb(special)
if(owner && !special)
if(owner.legcuffed)
owner.legcuffed.forceMove(owner.drop_location()) //At this point bodypart is still in nullspace
owner.legcuffed.dropped(owner)
owner.legcuffed = null
owner.update_inv_legcuffed()
if(owner.shoes)
owner.dropItemToGround(owner.shoes, TRUE)
..()
/obj/item/bodypart/l_leg/drop_limb(special) //copypasta
if(owner && !special)
if(owner.legcuffed)
owner.legcuffed.forceMove(owner.drop_location())
owner.legcuffed.dropped(owner)
owner.legcuffed = null
owner.update_inv_legcuffed()
if(owner.shoes)
owner.dropItemToGround(owner.shoes, TRUE)
..()
/obj/item/bodypart/head/drop_limb(special)
if(!special)
//Drop all worn head items
for(var/X in list(owner.glasses, owner.ears, owner.wear_mask, owner.head))
var/obj/item/I = X
owner.dropItemToGround(I, TRUE)
owner.wash_cream() //clean creampie overlay
//Handle dental implants
for(var/datum/action/item_action/hands_free/activate_pill/AP in owner.actions)
AP.Remove(owner)
var/obj/pill = AP.target
if(pill)
pill.forceMove(src)
//Make sure de-zombification happens before organ removal instead of during it
var/obj/item/organ/zombie_infection/ooze = owner.getorganslot(ORGAN_SLOT_ZOMBIE)
if(istype(ooze))
ooze.transfer_to_limb(src, owner)
name = "[owner.real_name]'s head"
..()
//Attach a limb to a human and drop any existing limb of that type.
/obj/item/bodypart/proc/replace_limb(mob/living/carbon/C, special)
if(!istype(C))
return
var/obj/item/bodypart/O = C.get_bodypart(body_zone)
if(O)
O.drop_limb(1)
attach_limb(C, special)
/obj/item/bodypart/head/replace_limb(mob/living/carbon/C, special)
if(!istype(C))
return
var/obj/item/bodypart/head/O = C.get_bodypart(body_zone)
if(O)
if(!special)
return
else
O.drop_limb(1)
attach_limb(C, special)
/obj/item/bodypart/proc/attach_limb(mob/living/carbon/C, special)
moveToNullspace()
owner = C
C.bodyparts += src
if(held_index)
if(held_index > C.hand_bodyparts.len)
C.hand_bodyparts.len = held_index
C.hand_bodyparts[held_index] = src
if(C.dna.species.mutanthands && !is_pseudopart)
C.put_in_hand(new C.dna.species.mutanthands(), held_index)
if(C.hud_used)
var/obj/screen/inventory/hand/hand = C.hud_used.hand_slots["[held_index]"]
if(hand)
hand.update_icon()
C.update_inv_gloves()
if(special) //non conventional limb attachment
for(var/X in C.surgeries) //if we had an ongoing surgery to attach a new limb, we stop it.
var/datum/surgery/S = X
var/surgery_zone = check_zone(S.location)
if(surgery_zone == body_zone)
C.surgeries -= S
qdel(S)
break
for(var/obj/item/organ/O in contents)
O.Insert(C)
update_bodypart_damage_state()
C.updatehealth()
C.update_body()
C.update_hair()
C.update_damage_overlays()
C.update_canmove()
/obj/item/bodypart/head/attach_limb(mob/living/carbon/C, special)
//Transfer some head appearance vars over
if(brain)
if(brainmob)
brainmob.container = null //Reset brainmob head var.
brainmob.forceMove(brain) //Throw mob into brain.
brain.brainmob = brainmob //Set the brain to use the brainmob
brainmob = null //Set head brainmob var to null
brain.Insert(C) //Now insert the brain proper
brain = null //No more brain in the head
if(ishuman(C))
var/mob/living/carbon/human/H = C
H.hair_color = hair_color
H.hair_style = hair_style
H.facial_hair_color = facial_hair_color
H.facial_hair_style = facial_hair_style
H.lip_style = lip_style
H.lip_color = lip_color
if(real_name)
C.real_name = real_name
real_name = ""
name = initial(name)
//Handle dental implants
for(var/obj/item/reagent_containers/pill/P in src)
for(var/datum/action/item_action/hands_free/activate_pill/AP in P.actions)
P.forceMove(C)
AP.Grant(C)
break
..()
//Regenerates all limbs. Returns amount of limbs regenerated
/mob/living/proc/regenerate_limbs(noheal = FALSE, list/excluded_limbs = list())
SEND_SIGNAL(src, COMSIG_LIVING_REGENERATE_LIMBS, noheal, excluded_limbs)
/mob/living/carbon/regenerate_limbs(noheal = FALSE, list/excluded_limbs = list())
. = ..()
var/list/limb_list = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)
if(excluded_limbs.len)
limb_list -= excluded_limbs
for(var/Z in limb_list)
. += regenerate_limb(Z, noheal)
/mob/living/proc/regenerate_limb(limb_zone, noheal)
return
/mob/living/carbon/regenerate_limb(limb_zone, noheal)
var/obj/item/bodypart/L
if(get_bodypart(limb_zone))
return 0
L = newBodyPart(limb_zone, 0, 0)
if(L)
if(!noheal)
L.brute_dam = 0
L.burn_dam = 0
L.brutestate = 0
L.burnstate = 0
L.attach_limb(src, 1)
return 1
+214
View File
@@ -0,0 +1,214 @@
/obj/item/bodypart/head
name = BODY_ZONE_HEAD
desc = "Didn't make sense not to live for fun, your brain gets smart but your head gets dumb."
icon = 'icons/mob/human_parts.dmi'
icon_state = "default_human_head"
max_damage = 200
body_zone = BODY_ZONE_HEAD
body_part = HEAD
w_class = WEIGHT_CLASS_BULKY //Quite a hefty load
slowdown = 1 //Balancing measure
throw_range = 2 //No head bowling
px_x = 0
px_y = -8
stam_damage_coeff = 1
max_stamina_damage = 0 //Setting this to 0 since this has the same exact effects as the chest when disabled
var/mob/living/brain/brainmob = null //The current occupant.
var/obj/item/organ/brain/brain = null //The brain organ
//Limb appearance info:
var/real_name = "" //Replacement name
//Hair colour and style
var/hair_color = "000"
var/hair_style = "Bald"
var/hair_alpha = 255
//Facial hair colour and style
var/facial_hair_color = "000"
var/facial_hair_style = "Shaved"
//Eye Colouring
var/obj/item/organ/eyes/eyes = null
var/lip_style = null
var/lip_color = "white"
//If the head is a special sprite
var/custom_head
/obj/item/bodypart/head/can_dismember(obj/item/I)
if(!((owner.stat == DEAD) || owner.InFullCritical()))
return FALSE
return ..()
/obj/item/bodypart/head/drop_organs(mob/user)
var/turf/T = get_turf(src)
if(status != BODYPART_ROBOTIC)
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
for(var/obj/item/I in src)
if(I == brain)
if(user)
user.visible_message("<span class='warning'>[user] saws [src] open and pulls out a brain!</span>", "<span class='notice'>You saw [src] open and pull out a brain.</span>")
if(brainmob)
brainmob.container = null
brainmob.forceMove(brain)
brain.brainmob = brainmob
brainmob = null
brain.forceMove(T)
brain = null
update_icon_dropped()
else
if(istype(I, /obj/item/reagent_containers/pill))
for(var/datum/action/item_action/hands_free/activate_pill/AP in I.actions)
qdel(AP)
I.forceMove(T)
/obj/item/bodypart/head/update_limb(dropping_limb, mob/living/carbon/source)
var/mob/living/carbon/C
if(source)
C = source
else
C = owner
real_name = C.real_name
if(HAS_TRAIT(C, TRAIT_HUSK))
real_name = "Unknown"
hair_style = "Bald"
facial_hair_style = "Shaved"
lip_style = null
else if(!animal_origin)
var/mob/living/carbon/human/H = C
var/datum/species/S = H.dna.species
//Facial hair
if(H.facial_hair_style && (FACEHAIR in S.species_traits))
facial_hair_style = H.facial_hair_style
if(S.hair_color)
if(S.hair_color == "mutcolor")
facial_hair_color = H.dna.features["mcolor"]
else
facial_hair_color = S.hair_color
else
facial_hair_color = H.facial_hair_color
hair_alpha = S.hair_alpha
else
facial_hair_style = "Shaved"
facial_hair_color = "000"
hair_alpha = 255
//Hair
if(H.hair_style && (HAIR in S.species_traits))
hair_style = H.hair_style
if(S.hair_color)
if(S.hair_color == "mutcolor")
hair_color = H.dna.features["mcolor"]
else
hair_color = S.hair_color
else
hair_color = H.hair_color
hair_alpha = S.hair_alpha
else
hair_style = "Bald"
hair_color = "000"
hair_alpha = initial(hair_alpha)
// lipstick
if(H.lip_style && (LIPS in S.species_traits))
lip_style = H.lip_style
lip_color = H.lip_color
else
lip_style = null
lip_color = "white"
..()
/obj/item/bodypart/head/update_icon_dropped()
if(custom_head)
return
var/list/standing = get_limb_icon(1)
if(!standing.len)
icon_state = initial(icon_state)//no overlays found, we default back to initial icon.
return
for(var/image/I in standing)
I.pixel_x = px_x
I.pixel_y = px_y
add_overlay(standing)
/obj/item/bodypart/head/get_limb_icon(dropped)
if(custom_head)
return
cut_overlays()
. = ..()
if(dropped) //certain overlays only appear when the limb is being detached from its owner.
if(status != BODYPART_ROBOTIC) //having a robotic head hides certain features.
//facial hair
if(facial_hair_style)
var/datum/sprite_accessory/S = GLOB.facial_hair_styles_list[facial_hair_style]
if(S)
var/image/facial_overlay = image(S.icon, "[S.icon_state]", -HAIR_LAYER, SOUTH)
facial_overlay.color = "#" + facial_hair_color
facial_overlay.alpha = hair_alpha
. += facial_overlay
//Applies the debrained overlay if there is no brain
if(!brain)
var/image/debrain_overlay = image(layer = -HAIR_LAYER, dir = SOUTH)
if(animal_origin == ALIEN_BODYPART)
debrain_overlay.icon = 'icons/mob/animal_parts.dmi'
debrain_overlay.icon_state = "debrained_alien"
else if(animal_origin == LARVA_BODYPART)
debrain_overlay.icon = 'icons/mob/animal_parts.dmi'
debrain_overlay.icon_state = "debrained_larva"
else if(!(NOBLOOD in species_flags_list))
debrain_overlay.icon = 'icons/mob/human_face.dmi'
debrain_overlay.icon_state = "debrained"
. += debrain_overlay
else
var/datum/sprite_accessory/S2 = GLOB.hair_styles_list[hair_style]
if(S2)
var/image/hair_overlay = image(S2.icon, "[S2.icon_state]", -HAIR_LAYER, SOUTH)
hair_overlay.color = "#" + hair_color
hair_overlay.alpha = hair_alpha
. += hair_overlay
// lipstick
if(lip_style)
var/image/lips_overlay = image('icons/mob/human_face.dmi', "lips_[lip_style]", -BODY_LAYER, SOUTH)
lips_overlay.color = lip_color
. += lips_overlay
// eyes
var/image/eyes_overlay = image('icons/mob/human_face.dmi', "eyes", -BODY_LAYER, SOUTH)
. += eyes_overlay
if(!eyes)
eyes_overlay.icon_state = "eyes_missing"
else if(eyes.eye_color)
eyes_overlay.color = "#" + eyes.eye_color
/obj/item/bodypart/head/monkey
icon = 'icons/mob/animal_parts.dmi'
icon_state = "default_monkey_head"
animal_origin = MONKEY_BODYPART
/obj/item/bodypart/head/alien
icon = 'icons/mob/animal_parts.dmi'
icon_state = "alien_head"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 500
animal_origin = ALIEN_BODYPART
/obj/item/bodypart/head/devil
dismemberable = 0
max_damage = 5000
animal_origin = DEVIL_BODYPART
/obj/item/bodypart/head/larva
icon = 'icons/mob/animal_parts.dmi'
icon_state = "larva_head"
px_x = 0
px_y = 0
dismemberable = 0
max_damage = 50
animal_origin = LARVA_BODYPART
+351
View File
@@ -0,0 +1,351 @@
/mob/living/proc/get_bodypart(zone)
return
/mob/living/carbon/get_bodypart(zone)
if(!zone)
zone = BODY_ZONE_CHEST
for(var/X in bodyparts)
var/obj/item/bodypart/L = X
if(L.body_zone == zone)
return L
/mob/living/carbon/has_hand_for_held_index(i)
if(i)
var/obj/item/bodypart/L = hand_bodyparts[i]
if(L && !L.disabled)
return L
return FALSE
/mob/proc/has_left_hand(check_disabled = TRUE)
return TRUE
/mob/living/carbon/has_left_hand(check_disabled = TRUE)
for(var/obj/item/bodypart/L in hand_bodyparts)
if(L.held_index % 2)
if(!check_disabled || !L.disabled)
return TRUE
return FALSE
/mob/living/carbon/alien/larva/has_left_hand()
return 1
/mob/proc/has_right_hand(check_disabled = TRUE)
return TRUE
/mob/living/carbon/has_right_hand(check_disabled = TRUE)
for(var/obj/item/bodypart/L in hand_bodyparts)
if(!(L.held_index % 2))
if(!check_disabled || !L.disabled)
return TRUE
return FALSE
/mob/living/carbon/alien/larva/has_right_hand()
return 1
/mob/proc/has_left_leg()
return TRUE
/mob/living/carbon/has_left_leg()
var/obj/item/bodypart/l_leg = get_bodypart(BODY_ZONE_L_LEG)
if(l_leg)
return TRUE
else
return FALSE
/mob/proc/has_right_leg()
return TRUE
/mob/living/carbon/has_right_leg()
var/obj/item/bodypart/r_leg = get_bodypart(BODY_ZONE_R_LEG)
if(r_leg)
return TRUE
else
return FALSE
//Limb numbers
/mob/proc/get_num_arms(check_disabled = TRUE)
return 2
/mob/living/carbon/get_num_arms(check_disabled = TRUE)
. = 0
for(var/X in bodyparts)
var/obj/item/bodypart/affecting = X
if(affecting.body_part == ARM_RIGHT)
if(!check_disabled || !affecting.disabled)
.++
if(affecting.body_part == ARM_LEFT)
if(!check_disabled || !affecting.disabled)
.++
//sometimes we want to ignore that we don't have the required amount of arms.
/mob/proc/get_arm_ignore()
return 0
/mob/living/carbon/alien/larva/get_arm_ignore()
return 1 //so we can still handcuff larvas.
/mob/proc/get_num_legs(check_disabled = TRUE)
return 2
/mob/living/carbon/get_num_legs(check_disabled = TRUE)
. = 0
for(var/X in bodyparts)
var/obj/item/bodypart/affecting = X
if(affecting.body_part == LEG_RIGHT)
if(!check_disabled || !affecting.disabled)
.++
if(affecting.body_part == LEG_LEFT)
if(!check_disabled || !affecting.disabled)
.++
//sometimes we want to ignore that we don't have the required amount of legs.
/mob/proc/get_leg_ignore()
return FALSE
/mob/living/carbon/get_leg_ignore()
if(movement_type & (FLYING|FLOATING))
return TRUE
return FALSE
/mob/living/carbon/alien/larva/get_leg_ignore()
return TRUE
/mob/living/proc/get_missing_limbs()
return list()
/mob/living/carbon/get_missing_limbs()
var/list/full = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)
for(var/zone in full)
if(get_bodypart(zone))
full -= zone
return full
/mob/living/carbon/alien/larva/get_missing_limbs()
var/list/full = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST)
for(var/zone in full)
if(get_bodypart(zone))
full -= zone
return full
/mob/living/proc/get_disabled_limbs()
return list()
/mob/living/carbon/get_disabled_limbs()
var/list/full = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)
var/list/disabled = list()
for(var/zone in full)
var/obj/item/bodypart/affecting = get_bodypart(zone)
if(affecting && affecting.disabled)
disabled += zone
return disabled
/mob/living/carbon/alien/larva/get_disabled_limbs()
var/list/full = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST)
var/list/disabled = list()
for(var/zone in full)
var/obj/item/bodypart/affecting = get_bodypart(zone)
if(affecting && affecting.disabled)
disabled += zone
return disabled
//Remove all embedded objects from all limbs on the carbon mob
/mob/living/carbon/proc/remove_all_embedded_objects()
var/turf/T = get_turf(src)
for(var/X in bodyparts)
var/obj/item/bodypart/L = X
for(var/obj/item/I in L.embedded_objects)
L.embedded_objects -= I
I.forceMove(T)
clear_alert("embeddedobject")
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "embedded")
/mob/living/carbon/proc/has_embedded_objects()
. = 0
for(var/X in bodyparts)
var/obj/item/bodypart/L = X
for(var/obj/item/I in L.embedded_objects)
return 1
//Helper for quickly creating a new limb - used by augment code in species.dm spec_attacked_by
/mob/living/carbon/proc/newBodyPart(zone, robotic, fixed_icon)
var/obj/item/bodypart/L
switch(zone)
if(BODY_ZONE_L_ARM)
L = new /obj/item/bodypart/l_arm()
if(BODY_ZONE_R_ARM)
L = new /obj/item/bodypart/r_arm()
if(BODY_ZONE_HEAD)
L = new /obj/item/bodypart/head()
if(BODY_ZONE_L_LEG)
L = new /obj/item/bodypart/l_leg()
if(BODY_ZONE_R_LEG)
L = new /obj/item/bodypart/r_leg()
if(BODY_ZONE_CHEST)
L = new /obj/item/bodypart/chest()
if(L)
L.update_limb(fixed_icon, src)
if(robotic)
L.change_bodypart_status(BODYPART_ROBOTIC)
L.body_markings = null
. = L
/mob/living/carbon/monkey/newBodyPart(zone, robotic, fixed_icon)
var/obj/item/bodypart/L
switch(zone)
if(BODY_ZONE_L_ARM)
L = new /obj/item/bodypart/l_arm/monkey()
if(BODY_ZONE_R_ARM)
L = new /obj/item/bodypart/r_arm/monkey()
if(BODY_ZONE_HEAD)
L = new /obj/item/bodypart/head/monkey()
if(BODY_ZONE_L_LEG)
L = new /obj/item/bodypart/l_leg/monkey()
if(BODY_ZONE_R_LEG)
L = new /obj/item/bodypart/r_leg/monkey()
if(BODY_ZONE_CHEST)
L = new /obj/item/bodypart/chest/monkey()
if(L)
L.update_limb(fixed_icon, src)
if(robotic)
L.change_bodypart_status(BODYPART_ROBOTIC)
. = L
/mob/living/carbon/alien/larva/newBodyPart(zone, robotic, fixed_icon)
var/obj/item/bodypart/L
switch(zone)
if(BODY_ZONE_HEAD)
L = new /obj/item/bodypart/head/larva()
if(BODY_ZONE_CHEST)
L = new /obj/item/bodypart/chest/larva()
if(L)
L.update_limb(fixed_icon, src)
if(robotic)
L.change_bodypart_status(BODYPART_ROBOTIC)
. = L
/mob/living/carbon/alien/humanoid/newBodyPart(zone, robotic, fixed_icon)
var/obj/item/bodypart/L
switch(zone)
if(BODY_ZONE_L_ARM)
L = new /obj/item/bodypart/l_arm/alien()
if(BODY_ZONE_R_ARM)
L = new /obj/item/bodypart/r_arm/alien()
if(BODY_ZONE_HEAD)
L = new /obj/item/bodypart/head/alien()
if(BODY_ZONE_L_LEG)
L = new /obj/item/bodypart/l_leg/alien()
if(BODY_ZONE_R_LEG)
L = new /obj/item/bodypart/r_leg/alien()
if(BODY_ZONE_CHEST)
L = new /obj/item/bodypart/chest/alien()
if(L)
L.update_limb(fixed_icon, src)
if(robotic)
L.change_bodypart_status(BODYPART_ROBOTIC)
. = L
/proc/skintone2hex(skin_tone)
. = 0
switch(skin_tone)
if("caucasian1")
. = "ffe0d1"
if("caucasian2")
. = "fcccb3"
if("caucasian3")
. = "e8b59b"
if("latino")
. = "d9ae96"
if("mediterranean")
. = "c79b8b"
if("asian1")
. = "ffdeb3"
if("asian2")
. = "e3ba84"
if("arab")
. = "c4915e"
if("indian")
. = "b87840"
if("african1")
. = "754523"
if("african2")
. = "471c18"
if("albino")
. = "fff4e6"
if("orange")
. = "ffc905"
/mob/living/carbon/proc/Digitigrade_Leg_Swap(swap_back)
var/body_plan_changed = FALSE
for(var/X in bodyparts)
var/obj/item/bodypart/O = X
var/obj/item/bodypart/N
if((!O.use_digitigrade && swap_back == FALSE) || (O.use_digitigrade && swap_back == TRUE))
if(O.body_part == LEG_LEFT)
if(swap_back == TRUE)
N = new /obj/item/bodypart/l_leg
else
N = new /obj/item/bodypart/l_leg/digitigrade
else if(O.body_part == LEG_RIGHT)
if(swap_back == TRUE)
N = new /obj/item/bodypart/r_leg
else
N = new /obj/item/bodypart/r_leg/digitigrade
if(!N)
continue
body_plan_changed = TRUE
O.drop_limb(1)
qdel(O)
N.attach_limb(src)
if(body_plan_changed && ishuman(src))
var/mob/living/carbon/human/H = src
if(H.w_uniform)
var/obj/item/clothing/under/U = H.w_uniform
if(U.mutantrace_variation)
if(swap_back)
U.suit_style = NORMAL_SUIT_STYLE
else
U.suit_style = DIGITIGRADE_SUIT_STYLE
H.update_inv_w_uniform()
if(H.shoes)
var/obj/item/clothing/shoes/S = H.shoes
if(swap_back)
S.adjusted = NORMAL_STYLE
else
S.adjusted = ALT_STYLE
H.update_inv_shoes()
if(H.wear_suit)
var/obj/item/clothing/suit/S = H.wear_suit
if(swap_back)
S.adjusted = NORMAL_STYLE
else
S.adjusted = ALT_STYLE
H.update_inv_wear_suit()
/mob/living/carbon/proc/get_body_parts_flags()
for(var/X in bodyparts)
var/obj/item/bodypart/L = X
switch(L.body_part)
if(CHEST)
. |= GROIN
if(LEG_LEFT)
. |= FOOT_LEFT
if(LEG_RIGHT)
. |= FOOT_RIGHT
if(ARM_LEFT)
. |= HAND_LEFT
if(ARM_RIGHT)
. |= HAND_RIGHT
. |= L.body_part
+48
View File
@@ -0,0 +1,48 @@
/datum/surgery/brain_surgery
name = "Brain surgery"
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/fix_brain,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery_step/fix_brain
name = "fix brain"
implements = list(TOOL_HEMOSTAT = 85, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15) //don't worry, pouring some alcohol on their open brain will get that chance to 100
time = 120 //long and complicated
/datum/surgery/brain_surgery/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
return FALSE
return TRUE
/datum/surgery_step/fix_brain/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to fix [target]'s brain...</span>",
"[user] begins to fix [target]'s brain.",
"[user] begins to perform surgery on [target]'s brain.")
/datum/surgery_step/fix_brain/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You succeed in fixing [target]'s brain.</span>",
"[user] successfully fixes [target]'s brain!",
"[user] completes the surgery on [target]'s brain.")
if(target.mind && target.mind.has_antag_datum(/datum/antagonist/brainwashed))
target.mind.remove_antag_datum(/datum/antagonist/brainwashed)
target.setOrganLoss(ORGAN_SLOT_BRAIN, target.getOrganLoss(ORGAN_SLOT_BRAIN) - 60) //we set damage in this case in order to clear the "failing" flag
target.cure_all_traumas(TRAUMA_RESILIENCE_SURGERY)
return TRUE
/datum/surgery_step/fix_brain/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.getorganslot(ORGAN_SLOT_BRAIN))
display_results(user, target, "<span class='warning'>You screw up, causing more damage!</span>",
"<span class='warning'>[user] screws up, causing brain damage!</span>",
"[user] completes the surgery on [target]'s brain.")
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 60)
target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
else
user.visible_message("<span class='warning'>[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore.", "<span class='warning'>You suddenly notice that the brain you were working on is not there anymore.</span>")
return FALSE
+54
View File
@@ -0,0 +1,54 @@
/datum/surgery/cavity_implant
name = "Cavity implant"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/incise, /datum/surgery_step/handle_cavity, /datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
//handle cavity
/datum/surgery_step/handle_cavity
name = "implant item"
accept_hand = 1
accept_any_item = 1
implements = list(/obj/item = 100)
repeatable = TRUE
time = 32
var/obj/item/IC = null
/datum/surgery_step/handle_cavity/tool_check(mob/user, obj/item/tool)
if(istype(tool, /obj/item/cautery) || istype(tool, /obj/item/gun/energy/laser))
return FALSE
return !tool.get_temperature()
/datum/surgery_step/handle_cavity/preop(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/bodypart/chest/CH = target.get_bodypart(BODY_ZONE_CHEST)
IC = CH.cavity_item
if(tool)
display_results(user, target, "<span class='notice'>You begin to insert [tool] into [target]'s [target_zone]...</span>",
"[user] begins to insert [tool] into [target]'s [target_zone].",
"[user] begins to insert [tool.w_class > WEIGHT_CLASS_SMALL ? tool : "something"] into [target]'s [target_zone].")
else
display_results(user, target, "<span class='notice'>You check for items in [target]'s [target_zone]...</span>",
"[user] checks for items in [target]'s [target_zone].",
"[user] looks for something in [target]'s [target_zone].")
/datum/surgery_step/handle_cavity/success(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/bodypart/chest/CH = target.get_bodypart(BODY_ZONE_CHEST)
if(tool)
if(IC || tool.w_class > WEIGHT_CLASS_NORMAL || HAS_TRAIT(tool, TRAIT_NODROP) || istype(tool, /obj/item/organ))
to_chat(user, "<span class='warning'>You can't seem to fit [tool] in [target]'s [target_zone]!</span>")
return 0
else
display_results(user, target, "<span class='notice'>You stuff [tool] into [target]'s [target_zone].</span>",
"[user] stuffs [tool] into [target]'s [target_zone]!",
"[user] stuffs [tool.w_class > WEIGHT_CLASS_SMALL ? tool : "something"] into [target]'s [target_zone].")
user.transferItemToLoc(tool, target, TRUE)
CH.cavity_item = tool
return 1
else
if(IC)
display_results(user, target, "<span class='notice'>You pull [IC] out of [target]'s [target_zone].</span>",
"[user] pulls [IC] out of [target]'s [target_zone]!",
"[user] pulls [IC.w_class > WEIGHT_CLASS_SMALL ? IC : "something"] out of [target]'s [target_zone].")
user.put_in_hands(IC)
CH.cavity_item = null
return 1
else
to_chat(user, "<span class='warning'>You don't find anything in [target]'s [target_zone].</span>")
return 0
+41
View File
@@ -0,0 +1,41 @@
/datum/surgery/core_removal
name = "Core removal"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/extract_core)
target_mobtypes = list(/mob/living/simple_animal/slime)
possible_locs = list(BODY_ZONE_R_ARM,BODY_ZONE_L_ARM,BODY_ZONE_R_LEG,BODY_ZONE_L_LEG,BODY_ZONE_CHEST,BODY_ZONE_HEAD)
lying_required = FALSE
ignore_clothes = TRUE
/datum/surgery/core_removal/can_start(mob/user, mob/living/target)
if(target.stat == DEAD)
return 1
return 0
//extract brain
/datum/surgery_step/extract_core
name = "extract core"
implements = list(TOOL_HEMOSTAT = 100, TOOL_CROWBAR = 100)
time = 16
/datum/surgery_step/extract_core/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to extract a core from [target]...</span>",
"[user] begins to extract a core from [target].",
"[user] begins to extract a core from [target].")
/datum/surgery_step/extract_core/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/mob/living/simple_animal/slime/slime = target
if(slime.cores > 0)
slime.cores--
display_results(user, target, "<span class='notice'>You successfully extract a core from [target]. [slime.cores] core\s remaining.</span>",
"[user] successfully extracts a core from [target]!",
"[user] successfully extracts a core from [target]!")
new slime.coretype(slime.loc)
if(slime.cores <= 0)
slime.icon_state = "[slime.colour] baby slime dead-nocore"
return 1
else
return 0
else
to_chat(user, "<span class='warning'>There aren't any cores left in [target]!</span>")
return 1
+77
View File
@@ -0,0 +1,77 @@
/datum/surgery/coronary_bypass
name = "Coronary Bypass"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/retract_skin, /datum/surgery_step/saw, /datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise_heart, /datum/surgery_step/coronary_bypass, /datum/surgery_step/close)
possible_locs = list(BODY_ZONE_CHEST)
/datum/surgery/coronary_bypass/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/heart/H = target.getorganslot(ORGAN_SLOT_HEART)
if(H)
if(H.damage > 60 && !H.operated)
return TRUE
return FALSE
//an incision but with greater bleed, and a 90% base success chance
/datum/surgery_step/incise_heart
name = "incise heart"
implements = list(TOOL_SCALPEL = 90, /obj/item/melee/transforming/energy/sword = 45, /obj/item/kitchen/knife = 45,
/obj/item/shard = 25)
time = 16
/datum/surgery_step/incise_heart/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to make an incision in [target]'s heart...</span>",
"[user] begins to make an incision in [target]'s heart.",
"[user] begins to make an incision in [target]'s heart.")
/datum/surgery_step/incise_heart/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(ishuman(target))
var/mob/living/carbon/human/H = target
if (!(NOBLOOD in H.dna.species.species_traits))
display_results(user, target, "<span class='notice'>Blood pools around the incision in [H]'s heart.</span>",
"Blood pools around the incision in [H]'s heart.",
"")
H.bleed_rate += 10
H.adjustBruteLoss(10)
return TRUE
/datum/surgery_step/incise_heart/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(ishuman(target))
var/mob/living/carbon/human/H = target
display_results(user, target, "<span class='warning'>You screw up, cutting too deeply into the heart!</span>",
"<span class='warning'>[user] screws up, causing blood to spurt out of [H]'s chest!</span>",
"<span class='warning'>[user] screws up, causing blood to spurt out of [H]'s chest!</span>")
H.bleed_rate += 20
H.adjustOrganLoss(ORGAN_SLOT_HEART, 10)
H.adjustBruteLoss(10)
//grafts a coronary bypass onto the individual's heart, success chance is 90% base again
/datum/surgery_step/coronary_bypass
name = "graft coronary bypass"
implements = list(TOOL_HEMOSTAT = 90, TOOL_WIRECUTTER = 35, /obj/item/stack/packageWrap = 15, /obj/item/stack/cable_coil = 5)
time = 90
/datum/surgery_step/coronary_bypass/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to graft a bypass onto [target]'s heart...</span>",
"[user] begins to graft something onto [target]'s heart!",
"[user] begins to graft something onto [target]'s heart!")
/datum/surgery_step/coronary_bypass/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
target.setOrganLoss(ORGAN_SLOT_HEART, 60)
var/obj/item/organ/heart/heart = target.getorganslot(ORGAN_SLOT_HEART)
if(heart) //slightly worrying if we lost our heart mid-operation, but that's life
heart.operated = TRUE
display_results(user, target, "<span class='notice'>You successfully graft a bypass onto [target]'s heart.</span>",
"[user] finishes grafting something onto [target]'s heart.",
"[user] finishes grafting something onto [target]'s heart.")
return TRUE
/datum/surgery_step/coronary_bypass/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(ishuman(target))
var/mob/living/carbon/human/H = target
display_results(user, target, "<span class='warning'>You screw up in attaching the graft, and it tears off, tearing part of the heart!</span>",
"<span class='warning'>[user] screws up, causing blood to spurt out of [H]'s chest profusely!</span>",
"<span class='warning'>[user] screws up, causing blood to spurt out of [H]'s chest profusely!</span>")
H.adjustOrganLoss(ORGAN_SLOT_HEART, 20)
H.bleed_rate += 30
return FALSE
+29
View File
@@ -0,0 +1,29 @@
/datum/surgery/embalming //Fast and easy way to husk bodys
name = "Embalming"
desc = "A surgical procedure that prevents a corpse from producing miasma."
steps = list(/datum/surgery_step/incise,
/datum/surgery_step/embalming,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
requires_bodypart_type = 0
/datum/surgery_step/embalming
name = "embalming body"
implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 35)
chems_needed = list("drying_agent", "sterilizine")
require_all_chems = FALSE
/datum/surgery_step/embalming/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] starts to embalm [target]'s body.", "<span class='notice'>You start embalming [target]'s body.</span>")
/datum/surgery_step/embalming/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] embalms [target]'s body.", "<span class='notice'>You succeed in embalming [target]'s body.</span>")
ADD_TRAIT(target, TRAIT_HUSK, MAGIC_TRAIT) //Husk's prevent body smell
return TRUE
/datum/surgery_step/embalming/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] screws up!", "<span class='warning'>You screwed up!</span>")
ADD_TRAIT(target, TRAIT_NOCLONE, MAGIC_TRAIT) //That body is ruined, but still gives miasma
return FALSE
@@ -110,4 +110,4 @@
requires_tech = TRUE
replaced_by = null
#undef BASE_HUMAN_REWARD
#undef EXPDIS_FAIL_MSG
+45
View File
@@ -0,0 +1,45 @@
/datum/surgery/eye_surgery
name = "Eye surgery"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/retract_skin, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/fix_eyes, /datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_PRECISE_EYES)
requires_bodypart_type = 0
//fix eyes
/datum/surgery_step/fix_eyes
name = "fix eyes"
implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 45, /obj/item/pen = 25)
time = 64
/datum/surgery/eye_surgery/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/eyes/E = target.getorganslot(ORGAN_SLOT_EYES)
if(!E)
to_chat(user, "It's hard to do surgery on someone's eyes when [target.p_they()] [target.p_do()]n't have any.")
return FALSE
return TRUE
/datum/surgery_step/fix_eyes/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to fix [target]'s eyes...</span>",
"[user] begins to fix [target]'s eyes.",
"[user] begins to perform surgery on [target]'s eyes.")
/datum/surgery_step/fix_eyes/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You succeed in fixing [target]'s eyes.</span>",
"[user] successfully fixes [target]'s eyes!",
"[user] completes the surgery on [target]'s eyes.")
target.cure_blind(list(EYE_DAMAGE))
target.set_blindness(0)
target.cure_nearsighted(list(EYE_DAMAGE))
target.blur_eyes(35) //this will fix itself slowly.
target.set_eye_damage(0)
return TRUE
/datum/surgery_step/fix_eyes/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.getorgan(/obj/item/organ/brain))
display_results(user, target, "<span class='warning'>You accidentally stab [target] right in the brain!</span>",
"<span class='warning'>[user] accidentally stabs [target] right in the brain!</span>",
"<span class='warning'>[user] accidentally stabs [target] right in the brain!</span>")
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 70)
else
display_results(user, target, "<span class='warning'>You accidentally stab [target] right in the brain! Or would have, if [target] had a brain.</span>",
"<span class='warning'>[user] accidentally stabs [target] right in the brain! Or would have, if [target] had a brain.</span>",
"<span class='warning'>[user] accidentally stabs [target] right in the brain!</span>")
return FALSE
+71
View File
@@ -0,0 +1,71 @@
//Organ reconstruction, limited to the chest region as most organs in the head have their own repair method (eyes/brain). We require synthflesh for these
//steps since fixing internal organs aren't as simple as mending exterior flesh, though in the future it would be neat to add more chems to the viable list.
//TBD: Add heart damage, have heart reconstruction seperate from organ reconstruction, and find a better name for this. I can imagine people getting it confused with manipulation.
/datum/surgery/graft_synthtissue
name = "Graft synthtissue"
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_GROIN, BODY_ZONE_PRECISE_EYES)
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/graft_synthtissue,
/datum/surgery_step/close
)
//repair organs
/datum/surgery_step/graft_synthtissue
name = "graft synthtissue"
implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
repeatable = TRUE
time = 75
chems_needed = list("synthtissue")
var/obj/item/organ/chosen_organ
var/health_restored = 10
/datum/surgery_step/graft_synthtissue/preop(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(implement_type in implements)
var/list/organs = target.getorganszone(target_zone)
if(!organs.len)
to_chat(user, "<span class='notice'>There are no targetable organs in [target]'s [parse_zone(target_zone)]!</span>")
return -1
else
for(var/obj/item/organ/O in organs)
O.on_find(user)
organs -= O
organs[O.name] = O
chosen_organ = input("Target which organ?", "Surgery", null, null) as null|anything in organs
chosen_organ = organs[chosen_organ]
if(!chosen_organ)
return -1
if(!target.reagents.has_reagent("synthtissue"))
to_chat(user, "<span class='notice'>There's no synthtissue available for use on [chosen_organ]</span>")
return -1
var/datum/reagent/synthtissue/Sf = locate(/datum/reagent/synthtissue) in target.reagents.reagent_list
if(Sf.volume < 10)
to_chat(user, "<span class='notice'>There's not enough synthtissue to perform the operation! There needs to be at least 10u.</span>")
return -1
if((chosen_organ.organ_flags & ORGAN_FAILING) && !(Sf.data["grown_volume"] >= 115))
to_chat(user, "<span class='notice'>[chosen_organ] is too damaged to graft onto!</span>")
return -1
if(health_restored != 10)
health_restored = 10
health_restored += (Sf.data["grown_volume"]/10)
user.visible_message("[user] begins to graft synthtissue onto [chosen_organ].</span>")
target.reagents.remove_reagent("synthtissue", 10)
/datum/surgery_step/graft_synthtissue/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] successfully grafts synthtissue to [chosen_organ].", "<span class='notice'>You succeed in grafting 10u of the synthflesh to the [chosen_organ].</span>")
chosen_organ.applyOrganDamage(-health_restored)
return TRUE
/datum/surgery_step/graft_synthtissue/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("<span class='warning'>[user] accidentally damages part of [chosen_organ]!</span>", "<span class='warning'>You damage [chosen_organ]! Apply more synthtissue if it's run out.</span>")
chosen_organ.applyOrganDamage(10)
return FALSE
+175
View File
@@ -0,0 +1,175 @@
/proc/attempt_initiate_surgery(obj/item/I, mob/living/M, mob/user)
if(!istype(M))
return
var/mob/living/carbon/C
var/obj/item/bodypart/affecting
var/selected_zone = user.zone_selected
if(iscarbon(M))
C = M
affecting = C.get_bodypart(check_zone(selected_zone))
var/datum/surgery/current_surgery
for(var/datum/surgery/S in M.surgeries)
if(S.location == selected_zone)
current_surgery = S
if(!current_surgery)
var/list/all_surgeries = GLOB.surgeries_list.Copy()
var/list/available_surgeries = list()
for(var/datum/surgery/S in all_surgeries)
if(!S.possible_locs.Find(selected_zone))
continue
if(affecting)
if(!S.requires_bodypart)
continue
if(S.requires_bodypart_type && affecting.status != S.requires_bodypart_type)
continue
if(S.requires_real_bodypart && affecting.is_pseudopart)
continue
else if(C && S.requires_bodypart) //mob with no limb in surgery zone when we need a limb
continue
if(S.lying_required && !(M.lying))
continue
if(!S.can_start(user, M))
continue
for(var/path in S.target_mobtypes)
if(istype(M, path))
available_surgeries[S.name] = S
break
if(!available_surgeries.len)
return
var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries
if(P && user && user.Adjacent(M) && (I in user))
var/datum/surgery/S = available_surgeries[P]
for(var/datum/surgery/other in M.surgeries)
if(other.location == S.location)
return //during the input() another surgery was started at the same location.
//we check that the surgery is still doable after the input() wait.
if(C)
affecting = C.get_bodypart(check_zone(selected_zone))
if(affecting)
if(!S.requires_bodypart)
return
if(S.requires_bodypart_type && affecting.status != S.requires_bodypart_type)
return
else if(C && S.requires_bodypart)
return
if(S.lying_required && !(M.lying))
return
if(!S.can_start(user, M))
return
if(S.ignore_clothes || get_location_accessible(M, selected_zone))
var/datum/surgery/procedure = new S.type(M, selected_zone, affecting)
user.visible_message("[user] drapes [I] over [M]'s [parse_zone(selected_zone)] to prepare for surgery.", \
"<span class='notice'>You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].</span>")
log_combat(user, M, "operated on", null, "(OPERATION TYPE: [procedure.name]) (TARGET AREA: [selected_zone])")
else
to_chat(user, "<span class='warning'>You need to expose [M]'s [parse_zone(selected_zone)] first!</span>")
else if(!current_surgery.step_in_progress)
attempt_cancel_surgery(current_surgery, I, M, user)
return 1
/proc/attempt_cancel_surgery(datum/surgery/S, obj/item/I, mob/living/M, mob/user)
var/selected_zone = user.zone_selected
if(S.status == 1)
M.surgeries -= S
user.visible_message("[user] removes [I] from [M]'s [parse_zone(selected_zone)].", \
"<span class='notice'>You remove [I] from [M]'s [parse_zone(selected_zone)].</span>")
qdel(S)
else if(S.can_cancel)
var/close_tool_type = /obj/item/cautery
var/obj/item/close_tool = user.get_inactive_held_item()
var/is_robotic = S.requires_bodypart_type == BODYPART_ROBOTIC
if(is_robotic)
close_tool_type = /obj/item/screwdriver
if(istype(close_tool, close_tool_type) || iscyborg(user))
M.surgeries -= S
user.visible_message("[user] closes [M]'s [parse_zone(selected_zone)] with [close_tool] and removes [I].", \
"<span class='notice'>You close [M]'s [parse_zone(selected_zone)] with [close_tool] and remove [I].</span>")
qdel(S)
else
to_chat(user, "<span class='warning'>You need to hold a [is_robotic ? "screwdriver" : "cautery"] in your inactive hand to stop [M]'s surgery!</span>")
/proc/get_location_modifier(mob/M)
var/turf/T = get_turf(M)
if(locate(/obj/structure/table/optable, T))
return 1
else if(locate(/obj/structure/table, T))
return 0.8
else if(locate(/obj/structure/bed, T))
return 0.7
else
return 0.5
/proc/get_location_accessible(mob/M, location)
var/covered_locations = 0 //based on body_parts_covered
var/face_covered = 0 //based on flags_inv
var/eyesmouth_covered = 0 //based on flags_cover
if(iscarbon(M))
var/mob/living/carbon/C = M
for(var/obj/item/clothing/I in list(C.back, C.wear_mask, C.head))
covered_locations |= I.body_parts_covered
face_covered |= I.flags_inv
eyesmouth_covered |= I.flags_cover
if(ishuman(C))
var/mob/living/carbon/human/H = C
for(var/obj/item/I in list(H.wear_suit, H.w_uniform, H.shoes, H.belt, H.gloves, H.glasses, H.ears))
covered_locations |= I.body_parts_covered
face_covered |= I.flags_inv
eyesmouth_covered |= I.flags_cover
switch(location)
if(BODY_ZONE_HEAD)
if(covered_locations & HEAD)
return 0
if(BODY_ZONE_PRECISE_EYES)
if(covered_locations & HEAD || face_covered & HIDEEYES || eyesmouth_covered & GLASSESCOVERSEYES)
return 0
if(BODY_ZONE_PRECISE_MOUTH)
if(covered_locations & HEAD || face_covered & HIDEFACE || eyesmouth_covered & MASKCOVERSMOUTH || eyesmouth_covered & HEADCOVERSMOUTH)
return 0
if(BODY_ZONE_CHEST)
if(covered_locations & CHEST)
return 0
if(BODY_ZONE_PRECISE_GROIN)
if(covered_locations & GROIN)
return 0
if(BODY_ZONE_L_ARM)
if(covered_locations & ARM_LEFT)
return 0
if(BODY_ZONE_R_ARM)
if(covered_locations & ARM_RIGHT)
return 0
if(BODY_ZONE_L_LEG)
if(covered_locations & LEG_LEFT)
return 0
if(BODY_ZONE_R_LEG)
if(covered_locations & LEG_RIGHT)
return 0
if(BODY_ZONE_PRECISE_L_HAND)
if(covered_locations & HAND_LEFT)
return 0
if(BODY_ZONE_PRECISE_R_HAND)
if(covered_locations & HAND_RIGHT)
return 0
if(BODY_ZONE_PRECISE_L_FOOT)
if(covered_locations & FOOT_LEFT)
return 0
if(BODY_ZONE_PRECISE_R_FOOT)
if(covered_locations & FOOT_RIGHT)
return 0
return 1
+60
View File
@@ -0,0 +1,60 @@
/datum/surgery/implant_removal
name = "implant removal"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/extract_implant, /datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
//extract implant
/datum/surgery_step/extract_implant
name = "extract implant"
implements = list(TOOL_HEMOSTAT = 100, TOOL_CROWBAR = 65)
time = 64
var/obj/item/implant/I = null
/datum/surgery_step/extract_implant/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
for(var/obj/item/O in target.implants)
I = O
break
if(I)
display_results(user, target, "<span class='notice'>You begin to extract [I] from [target]'s [target_zone]...</span>",
"[user] begins to extract [I] from [target]'s [target_zone].",
"[user] begins to extract something from [target]'s [target_zone].")
else
display_results(user, target, "<span class='notice'>You look for an implant in [target]'s [target_zone]...</span>",
"[user] looks for an implant in [target]'s [target_zone].",
"[user] looks for something in [target]'s [target_zone].")
/datum/surgery_step/extract_implant/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(I)
display_results(user, target, "<span class='notice'>You successfully remove [I] from [target]'s [target_zone].</span>",
"[user] successfully removes [I] from [target]'s [target_zone]!",
"[user] successfully removes something from [target]'s [target_zone]!")
I.removed(target)
var/obj/item/implantcase/case
for(var/obj/item/implantcase/ic in user.held_items)
case = ic
break
if(!case)
case = locate(/obj/item/implantcase) in get_turf(target)
if(case && !case.imp)
case.imp = I
I.forceMove(case)
case.update_icon()
display_results(user, target, "<span class='notice'>You place [I] into [case].</span>",
"[user] places [I] into [case]!",
"[user] places it into [case]!")
else
qdel(I)
else
to_chat(user, "<span class='warning'>You can't find anything in [target]'s [target_zone]!</span>")
return 1
/datum/surgery/implant_removal/mechanic
name = "implant removal"
requires_bodypart_type = BODYPART_ROBOTIC
steps = list(
/datum/surgery_step/mechanic_open,
/datum/surgery_step/open_hatch,
/datum/surgery_step/mechanic_unwrench,
/datum/surgery_step/extract_implant,
/datum/surgery_step/mechanic_wrench,
/datum/surgery_step/mechanic_close)
+60
View File
@@ -0,0 +1,60 @@
/////AUGMENTATION SURGERIES//////
//SURGERY STEPS
/datum/surgery_step/replace
name = "sever muscles"
implements = list(TOOL_SCALPEL = 100, TOOL_WIRECUTTER = 55)
time = 32
/datum/surgery_step/replace/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class ='notice'>You begin to sever the muscles on [target]'s [parse_zone(user.zone_selected)]...</span>",
"[user] begins to sever the muscles on [target]'s [parse_zone(user.zone_selected)].",
"[user] begins an incision on [target]'s [parse_zone(user.zone_selected)].")
/datum/surgery_step/replace_limb
name = "replace limb"
implements = list(/obj/item/bodypart = 100, /obj/item/organ_storage = 100)
time = 32
var/obj/item/bodypart/L = null // L because "limb"
/datum/surgery_step/replace_limb/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(istype(tool, /obj/item/organ_storage) && istype(tool.contents[1], /obj/item/bodypart))
tool = tool.contents[1]
var/obj/item/bodypart/aug = tool
if(aug.status != BODYPART_ROBOTIC)
to_chat(user, "<span class='warning'>That's not an augment, silly!</span>")
return -1
if(aug.body_zone != target_zone)
to_chat(user, "<span class='warning'>[tool] isn't the right type for [parse_zone(target_zone)].</span>")
return -1
L = surgery.operated_bodypart
if(L)
display_results(user, target, "<span class ='notice'>You begin to augment [target]'s [parse_zone(user.zone_selected)]...</span>",
"[user] begins to augment [target]'s [parse_zone(user.zone_selected)] with [aug].",
"[user] begins to augment [target]'s [parse_zone(user.zone_selected)].")
else
user.visible_message("[user] looks for [target]'s [parse_zone(user.zone_selected)].", "<span class ='notice'>You look for [target]'s [parse_zone(user.zone_selected)]...</span>")
//ACTUAL SURGERIES
/datum/surgery/augmentation
name = "Augmentation"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/replace, /datum/surgery_step/saw, /datum/surgery_step/replace_limb)
target_mobtypes = list(/mob/living/carbon/human)
possible_locs = list(BODY_ZONE_R_ARM,BODY_ZONE_L_ARM,BODY_ZONE_R_LEG,BODY_ZONE_L_LEG,BODY_ZONE_CHEST,BODY_ZONE_HEAD)
requires_real_bodypart = TRUE
//SURGERY STEP SUCCESSES
/datum/surgery_step/replace_limb/success(mob/user, mob/living/carbon/target, target_zone, obj/item/bodypart/tool, datum/surgery/surgery)
if(L)
if(istype(tool, /obj/item/organ_storage))
tool.icon_state = initial(tool.icon_state)
tool.desc = initial(tool.desc)
tool.cut_overlays()
tool = tool.contents[1]
if(istype(tool) && user.temporarilyRemoveItemFromInventory(tool))
tool.replace_limb(target, TRUE)
display_results(user, target, "<span class='notice'>You successfully augment [target]'s [parse_zone(target_zone)].</span>",
"[user] successfully augments [target]'s [parse_zone(target_zone)] with [tool]!",
"[user] successfully augments [target]'s [parse_zone(target_zone)]!")
log_combat(user, target, "augmented", addition="by giving him new [parse_zone(target_zone)] INTENT: [uppertext(user.a_intent)]")
else
to_chat(user, "<span class='warning'>[target] has no organic [parse_zone(target_zone)] there!</span>")
return TRUE
+46
View File
@@ -0,0 +1,46 @@
/datum/surgery/lobectomy
name = "Lobectomy" //not to be confused with lobotomy
steps = list(/datum/surgery_step/incise, /datum/surgery_step/retract_skin, /datum/surgery_step/saw, /datum/surgery_step/clamp_bleeders,
/datum/surgery_step/lobectomy, /datum/surgery_step/close)
possible_locs = list(BODY_ZONE_CHEST)
/datum/surgery/lobectomy/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/lungs/L = target.getorganslot(ORGAN_SLOT_LUNGS)
if(L)
if(L.damage > 60 && !L.operated)
return TRUE
return FALSE
//lobectomy, removes the most damaged lung lobe with a 95% base success chance
/datum/surgery_step/lobectomy
name = "excise damaged lung node"
implements = list(TOOL_SCALPEL = 95, /obj/item/melee/transforming/energy/sword = 65, /obj/item/kitchen/knife = 45,
/obj/item/shard = 35)
time = 42
/datum/surgery_step/lobectomy/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to make an incision in [target]'s lungs...</span>",
"[user] begins to make an incision in [target].",
"[user] begins to make an incision in [target].")
/datum/surgery_step/lobectomy/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/organ/lungs/L = H.getorganslot(ORGAN_SLOT_LUNGS)
L.operated = TRUE
H.setOrganLoss(ORGAN_SLOT_LUNGS, 60)
display_results(user, target, "<span class='notice'>You successfully excise [H]'s most damaged lobe.</span>",
"Successfully removes a piece of [H]'s lungs.",
"")
return TRUE
/datum/surgery_step/lobectomy/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(ishuman(target))
var/mob/living/carbon/human/H = target
display_results(user, target, "<span class='warning'>You screw up, failing to excise [H]'s damaged lobe!</span>",
"<span class='warning'>[user] screws up!</span>",
"<span class='warning'>[user] screws up!</span>")
H.losebreath += 4
H.adjustOrganLoss(ORGAN_SLOT_LUNGS, 10)
return FALSE
+87
View File
@@ -0,0 +1,87 @@
//open shell
/datum/surgery_step/mechanic_open
name = "unscrew shell"
implements = list(
TOOL_SCREWDRIVER = 100,
TOOL_SCALPEL = 75, // med borgs could try to unskrew shell with scalpel
/obj/item/kitchen/knife = 50,
/obj/item = 10) // 10% success with any sharp item.
time = 24
/datum/surgery_step/mechanic_open/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to unscrew the shell of [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to unscrew the shell of [target]'s [parse_zone(target_zone)].",
"[user] begins to unscrew the shell of [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/mechanic_incise/tool_check(mob/user, obj/item/tool)
if(implement_type == /obj/item && !tool.get_sharpness())
return FALSE
return TRUE
//close shell
/datum/surgery_step/mechanic_close
name = "screw shell"
implements = list(
TOOL_SCREWDRIVER = 100,
TOOL_SCALPELl = 75,
/obj/item/kitchen/knife = 50,
/obj/item = 10) // 10% success with any sharp item.
time = 24
/datum/surgery_step/mechanic_close/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to screw the shell of [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to screw the shell of [target]'s [parse_zone(target_zone)].",
"[user] begins to screw the shell of [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/mechanic_close/tool_check(mob/user, obj/item/tool)
if(implement_type == /obj/item && !tool.get_sharpness())
return FALSE
return TRUE
//prepare electronics
/datum/surgery_step/prepare_electronics
name = "prepare electronics"
implements = list(
TOOL_MULTITOOL = 100,
TOOL_HEMOSTAT = 10) // try to reboot internal controllers via short circuit with some conductor
time = 24
/datum/surgery_step/prepare_electronics/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to prepare electronics in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to prepare electronics in [target]'s [parse_zone(target_zone)].",
"[user] begins to prepare electronics in [target]'s [parse_zone(target_zone)].")
//unwrench
/datum/surgery_step/mechanic_unwrench
name = "unwrench bolts"
implements = list(
TOOL_WRENCH = 100,
TOOL_RETRACTOR = 10)
time = 24
/datum/surgery_step/mechanic_unwrench/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to unwrench some bolts in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to unwrench some bolts in [target]'s [parse_zone(target_zone)].",
"[user] begins to unwrench some bolts in [target]'s [parse_zone(target_zone)].")
//wrench
/datum/surgery_step/mechanic_wrench
name = "wrench bolts"
implements = list(
TOOL_WRENCH = 100,
TOOL_RETRACTOR = 10)
time = 24
/datum/surgery_step/mechanic_wrench/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to wrench some bolts in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to wrench some bolts in [target]'s [parse_zone(target_zone)].",
"[user] begins to wrench some bolts in [target]'s [parse_zone(target_zone)].")
//open hatch
/datum/surgery_step/open_hatch
name = "open the hatch"
accept_hand = 1
time = 10
/datum/surgery_step/open_hatch/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to open the hatch holders in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to open the hatch holders in [target]'s [parse_zone(target_zone)].",
"[user] begins to open the hatch holders in [target]'s [parse_zone(target_zone)].")
+145
View File
@@ -0,0 +1,145 @@
/datum/surgery/organ_manipulation
name = "organ manipulation"
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST, BODY_ZONE_HEAD)
requires_real_bodypart = 1
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/manipulate_organs,
//there should be bone fixing
/datum/surgery_step/close
)
/datum/surgery/organ_manipulation/soft
possible_locs = list(BODY_ZONE_PRECISE_GROIN, BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/close
)
/datum/surgery/organ_manipulation/alien
name = "Alien organ manipulation"
possible_locs = list(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_PRECISE_GROIN, BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
target_mobtypes = list(/mob/living/carbon/alien/humanoid)
steps = list(
/datum/surgery_step/saw,
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/close
)
/datum/surgery/organ_manipulation/mechanic
name = "Prosthesis organ manipulation"
possible_locs = list(BODY_ZONE_CHEST, BODY_ZONE_HEAD)
requires_bodypart_type = BODYPART_ROBOTIC
steps = list(
/datum/surgery_step/mechanic_open,
/datum/surgery_step/open_hatch,
/datum/surgery_step/mechanic_unwrench,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/mechanic_wrench,
/datum/surgery_step/mechanic_close
)
/datum/surgery/organ_manipulation/mechanic/soft
possible_locs = list(BODY_ZONE_PRECISE_GROIN, BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
steps = list(
/datum/surgery_step/mechanic_open,
/datum/surgery_step/open_hatch,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/mechanic_close
)
/datum/surgery_step/manipulate_organs
time = 64
name = "manipulate organs"
repeatable = 1
implements = list(/obj/item/organ = 100, /obj/item/reagent_containers/food/snacks/organ = 0, /obj/item/organ_storage = 100)
var/implements_extract = list(TOOL_HEMOSTAT = 100, TOOL_CROWBAR = 55)
var/current_type
var/obj/item/organ/I = null
/datum/surgery_step/manipulate_organs/New()
..()
implements = implements + implements_extract
/datum/surgery_step/manipulate_organs/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
I = null
if(istype(tool, /obj/item/organ_storage))
if(!tool.contents.len)
to_chat(user, "<span class='notice'>There is nothing inside [tool]!</span>")
return -1
I = tool.contents[1]
if(!isorgan(I))
to_chat(user, "<span class='notice'>You cannot put [I] into [target]'s [parse_zone(target_zone)]!</span>")
return -1
tool = I
if(isorgan(tool))
current_type = "insert"
I = tool
if(target_zone != I.zone || target.getorganslot(I.slot))
to_chat(user, "<span class='notice'>There is no room for [I] in [target]'s [parse_zone(target_zone)]!</span>")
return -1
display_results(user, target, "<span class='notice'>You begin to insert [tool] into [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to insert [tool] into [target]'s [parse_zone(target_zone)].",
"[user] begins to insert something into [target]'s [parse_zone(target_zone)].")
else if(implement_type in implements_extract)
current_type = "extract"
var/list/organs = target.getorganszone(target_zone)
if(!organs.len)
to_chat(user, "<span class='notice'>There are no removable organs in [target]'s [parse_zone(target_zone)]!</span>")
return -1
else
for(var/obj/item/organ/O in organs)
O.on_find(user)
organs -= O
organs[O.name] = O
I = input("Remove which organ?", "Surgery", null, null) as null|anything in organs
if(I && user && target && user.Adjacent(target) && user.get_active_held_item() == tool)
I = organs[I]
if(!I)
return -1
display_results(user, target, "<span class='notice'>You begin to extract [I] from [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to extract [I] from [target]'s [parse_zone(target_zone)].",
"[user] begins to extract something from [target]'s [parse_zone(target_zone)].")
else
return -1
else if(istype(tool, /obj/item/reagent_containers/food/snacks/organ))
to_chat(user, "<span class='warning'>[tool] was bitten by someone! It's too damaged to use!</span>")
return -1
/datum/surgery_step/manipulate_organs/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(current_type == "insert")
if(istype(tool, /obj/item/organ_storage))
I = tool.contents[1]
tool.icon_state = initial(tool.icon_state)
tool.desc = initial(tool.desc)
tool.cut_overlays()
tool = I
else
I = tool
user.temporarilyRemoveItemFromInventory(I, TRUE)
I.Insert(target)
display_results(user, target, "<span class='notice'>You insert [tool] into [target]'s [parse_zone(target_zone)].</span>",
"[user] inserts [tool] into [target]'s [parse_zone(target_zone)]!",
"[user] inserts something into [target]'s [parse_zone(target_zone)]!")
else if(current_type == "extract")
if(I && I.owner == target)
display_results(user, target, "<span class='notice'>You successfully extract [I] from [target]'s [parse_zone(target_zone)].</span>",
"[user] successfully extracts [I] from [target]'s [parse_zone(target_zone)]!",
"[user] successfully extracts something from [target]'s [parse_zone(target_zone)]!")
log_combat(user, target, "surgically removed [I.name] from", addition="INTENT: [uppertext(user.a_intent)]")
I.Remove(target)
I.forceMove(get_turf(target))
else
display_results(user, target, "<span class='notice'>You can't extract anything from [target]'s [parse_zone(target_zone)]!</span>",
"[user] can't seem to extract anything from [target]'s [parse_zone(target_zone)]!",
"[user] can't seem to extract anything from [target]'s [parse_zone(target_zone)]!")
return 0
+124
View File
@@ -0,0 +1,124 @@
//make incision
/datum/surgery_step/incise
name = "make incision"
implements = list(TOOL_SCALPEL = 100, /obj/item/melee/transforming/energy/sword = 75, /obj/item/kitchen/knife = 65,
/obj/item/shard = 45, /obj/item = 30) // 30% success with any sharp item.
time = 16
/datum/surgery_step/incise/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to make an incision in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to make an incision in [target]'s [parse_zone(target_zone)].",
"[user] begins to make an incision in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/incise/tool_check(mob/user, obj/item/tool)
if(implement_type == /obj/item && !tool.get_sharpness())
return FALSE
return TRUE
/datum/surgery_step/incise/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if ishuman(target)
var/mob/living/carbon/human/H = target
if (!(NOBLOOD in H.dna.species.species_traits))
display_results(user, target, "<span class='notice'>Blood pools around the incision in [H]'s [parse_zone(target_zone)].</span>",
"Blood pools around the incision in [H]'s [parse_zone(target_zone)].",
"")
H.bleed_rate += 3
return TRUE
/datum/surgery_step/incise/nobleed //silly friendly!
/datum/surgery_step/incise/nobleed/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to <i>carefully</i> make an incision in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to <i>carefully</i> make an incision in [target]'s [parse_zone(target_zone)].",
"[user] begins to <i>carefully</i> make an incision in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/incise/nobleed/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
return TRUE
//clamp bleeders
/datum/surgery_step/clamp_bleeders
name = "clamp bleeders"
implements = list(TOOL_HEMOSTAT = 100, TOOL_WIRECUTTER = 60, /obj/item/stack/packageWrap = 35, /obj/item/stack/cable_coil = 15)
time = 24
/datum/surgery_step/clamp_bleeders/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to clamp bleeders in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to clamp bleeders in [target]'s [parse_zone(target_zone)].",
"[user] begins to clamp bleeders in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/clamp_bleeders/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(locate(/datum/surgery_step/saw) in surgery.steps)
target.heal_bodypart_damage(20,0)
if (ishuman(target))
var/mob/living/carbon/human/H = target
H.bleed_rate = max( (H.bleed_rate - 3), 0)
return ..()
//retract skin
/datum/surgery_step/retract_skin
name = "retract skin"
implements = list(TOOL_RETRACTOR = 100, TOOL_SCREWDRIVER = 45, TOOL_WIRECUTTER = 35)
time = 24
/datum/surgery_step/retract_skin/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to retract the skin in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to retract the skin in [target]'s [parse_zone(target_zone)].",
"[user] begins to retract the skin in [target]'s [parse_zone(target_zone)].")
//close incision
/datum/surgery_step/close
name = "mend incision"
implements = list(TOOL_CAUTERY = 100, /obj/item/gun/energy/laser = 90, TOOL_WELDER = 70,
/obj/item = 30) // 30% success with any hot item.
time = 24
/datum/surgery_step/close/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to mend the incision in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to mend the incision in [target]'s [parse_zone(target_zone)].",
"[user] begins to mend the incision in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/close/tool_check(mob/user, obj/item/tool)
if(implement_type == TOOL_WELDER || implement_type == /obj/item)
return tool.get_temperature()
return TRUE
/datum/surgery_step/close/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(locate(/datum/surgery_step/saw) in surgery.steps)
target.heal_bodypart_damage(45,0)
if (ishuman(target))
var/mob/living/carbon/human/H = target
H.bleed_rate = max( (H.bleed_rate - 3), 0)
return ..()
//saw bone
/datum/surgery_step/saw
name = "saw bone"
implements = list(TOOL_SAW = 100, /obj/item/melee/arm_blade = 75, /obj/item/twohanded/fireaxe = 50, /obj/item/hatchet = 35, /obj/item/kitchen/knife/butcher = 25)
time = 54
/datum/surgery_step/saw/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to saw through the bone in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to saw through the bone in [target]'s [parse_zone(target_zone)].",
"[user] begins to saw through the bone in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/saw/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
target.apply_damage(50, BRUTE, "[target_zone]")
display_results(user, target, "<span class='notice'>You saw [target]'s [parse_zone(target_zone)] open.</span>",
"[user] saws [target]'s [parse_zone(target_zone)] open!",
"[user] saws [target]'s [parse_zone(target_zone)] open!")
return 1
//drill bone
/datum/surgery_step/drill
name = "drill bone"
implements = list(TOOL_DRILL = 100, /obj/item/screwdriver/power = 80, /obj/item/pickaxe/drill = 60, TOOL_SCREWDRIVER = 20)
time = 30
/datum/surgery_step/drill/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to drill into the bone in [target]'s [parse_zone(target_zone)]...</span>",
"[user] begins to drill into the bone in [target]'s [parse_zone(target_zone)].",
"[user] begins to drill into the bone in [target]'s [parse_zone(target_zone)].")
/datum/surgery_step/drill/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You drill into [target]'s [parse_zone(target_zone)].</span>",
"[user] drills into [target]'s [parse_zone(target_zone)]!",
"[user] drills into [target]'s [parse_zone(target_zone)]!")
return 1
+46
View File
@@ -0,0 +1,46 @@
/obj/item/organ/appendix
name = "appendix"
icon_state = "appendix"
zone = BODY_ZONE_PRECISE_GROIN
slot = ORGAN_SLOT_APPENDIX
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/inflamed
/obj/item/organ/appendix/on_life()
..()
if(!(organ_flags & ORGAN_FAILING))
return
var/mob/living/carbon/M = owner
if(M)
M.adjustToxLoss(4, TRUE, TRUE) //forced to ensure people don't use it to gain tox as slime person
/obj/item/organ/appendix/update_icon()
if(inflamed)
icon_state = "appendixinflamed"
name = "inflamed appendix"
else
icon_state = "appendix"
name = "appendix"
/obj/item/organ/appendix/Remove(mob/living/carbon/M, special = 0)
for(var/datum/disease/appendicitis/A in M.diseases)
A.cure()
inflamed = TRUE
update_icon()
..()
/obj/item/organ/appendix/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
..()
if(inflamed)
M.ForceContractDisease(new /datum/disease/appendicitis(), FALSE, TRUE)
/obj/item/organ/appendix/prepare_eat()
var/obj/S = ..()
if(inflamed)
S.reagents.add_reagent("bad_food", 5)
return S
@@ -0,0 +1,209 @@
/obj/item/organ/cyberimp/chest
name = "cybernetic torso implant"
desc = "Implants for the organs in your torso."
icon_state = "chest_implant"
implant_overlay = "chest_implant_overlay"
zone = BODY_ZONE_CHEST
/obj/item/organ/cyberimp/chest/nutriment
name = "Nutriment pump implant"
desc = "This implant will 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
slot = ORGAN_SLOT_STOMACH_AID
/obj/item/organ/cyberimp/chest/nutriment/on_life()
if(synthesizing)
return
if(owner.nutrition <= hunger_threshold)
synthesizing = TRUE
to_chat(owner, "<span class='notice'>You feel less hungry...</span>")
owner.nutrition += 50
addtimer(CALLBACK(src, .proc/synth_cool), 50)
/obj/item/organ/cyberimp/chest/nutriment/proc/synth_cool()
synthesizing = FALSE
/obj/item/organ/cyberimp/chest/nutriment/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
owner.reagents.add_reagent("bad_food", poison_amount / severity)
to_chat(owner, "<span class='warning'>You feel like your insides are burning.</span>")
/obj/item/organ/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
/obj/item/organ/cyberimp/chest/reviver
name = "Reviver implant"
desc = "This implant will attempt to revive and heal you if you lose consciousness. For the faint of heart!"
icon_state = "chest_implant"
implant_color = "#AD0000"
slot = ORGAN_SLOT_HEART_AID
var/revive_cost = 0
var/reviving = 0
var/cooldown = 0
/obj/item/organ/cyberimp/chest/reviver/on_life()
if(reviving)
if(owner.stat == UNCONSCIOUS)
addtimer(CALLBACK(src, .proc/heal), 30)
else
cooldown = revive_cost + world.time
reviving = FALSE
to_chat(owner, "<span class='notice'>Your reviver implant shuts down and starts recharging. It will be ready again in [DisplayTimeText(revive_cost)].</span>")
return
if(cooldown > world.time)
return
if(owner.stat != UNCONSCIOUS)
return
if(owner.suiciding)
return
revive_cost = 0
reviving = TRUE
to_chat(owner, "<span class='notice'>You feel a faint buzzing as your reviver implant starts patching your wounds...</span>")
/obj/item/organ/cyberimp/chest/reviver/proc/heal()
if(owner.getOxyLoss())
owner.adjustOxyLoss(-5)
revive_cost += 5
if(owner.getBruteLoss())
owner.adjustBruteLoss(-2)
revive_cost += 40
if(owner.getFireLoss())
owner.adjustFireLoss(-2)
revive_cost += 40
if(owner.getToxLoss())
owner.adjustToxLoss(-1)
revive_cost += 40
/obj/item/organ/cyberimp/chest/reviver/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
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.can_heartattack())
H.set_heartattack(TRUE)
to_chat(H, "<span class='userdanger'>You feel a horrible agony in your chest!</span>")
addtimer(CALLBACK(src, .proc/undo_heart_attack), 600 / severity)
/obj/item/organ/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>")
/obj/item/organ/cyberimp/chest/thrusters
name = "implantable thrusters set"
desc = "An implantable set of thruster ports. They use the gas from environment or subject's internals for propulsion in zero-gravity areas. \
Unlike regular jetpacks, this device has no stabilization system."
slot = ORGAN_SLOT_THRUSTERS
icon_state = "imp_jetpack"
implant_overlay = null
implant_color = null
actions_types = list(/datum/action/item_action/organ_action/toggle)
w_class = WEIGHT_CLASS_NORMAL
var/on = FALSE
var/datum/effect_system/trail_follow/ion/ion_trail
/obj/item/organ/cyberimp/chest/thrusters/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
. = ..()
if(!ion_trail)
ion_trail = new
ion_trail.set_up(M)
/obj/item/organ/cyberimp/chest/thrusters/Remove(mob/living/carbon/M, special = 0)
if(on)
toggle(silent = TRUE)
..()
/obj/item/organ/cyberimp/chest/thrusters/ui_action_click()
toggle()
/obj/item/organ/cyberimp/chest/thrusters/proc/toggle(silent = FALSE)
if(!on)
if(crit_fail || (organ_flags & ORGAN_FAILING))
if(!silent)
to_chat(owner, "<span class='warning'>Your thrusters set seems to be broken!</span>")
return 0
on = TRUE
if(allow_thrust(0.01))
ion_trail.start()
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, .proc/move_react)
owner.add_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER, priority=100, multiplicative_slowdown=-2, movetypes=FLOATING, conflict=MOVE_CONFLICT_JETPACK)
if(!silent)
to_chat(owner, "<span class='notice'>You turn your thrusters set on.</span>")
else
ion_trail.stop()
UnregisterSignal(owner, COMSIG_MOVABLE_MOVED)
owner.remove_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER)
if(!silent)
to_chat(owner, "<span class='notice'>You turn your thrusters set off.</span>")
on = FALSE
update_icon()
/obj/item/organ/cyberimp/chest/thrusters/update_icon()
if(on)
icon_state = "imp_jetpack-on"
else
icon_state = "imp_jetpack"
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/organ/cyberimp/chest/thrusters/proc/move_react()
allow_thrust(0.01)
/obj/item/organ/cyberimp/chest/thrusters/proc/allow_thrust(num)
if(!on || !owner)
return 0
var/turf/T = get_turf(owner)
if(!T) // No more runtimes from being stuck in nullspace.
return 0
// Priority 1: use air from environment.
var/datum/gas_mixture/environment = T.return_air()
if(environment && environment.return_pressure() > 30)
return 1
// Priority 2: use plasma from internal plasma storage.
// (just in case someone would ever use this implant system to make cyber-alien ops with jetpacks and taser arms)
if(owner.getPlasma() >= num*100)
owner.adjustPlasma(-num*100)
return 1
// Priority 3: use internals tank.
var/obj/item/tank/I = owner.internal
if(I && I.air_contents && I.air_contents.total_moles() > num)
var/datum/gas_mixture/removed = I.air_contents.remove(num)
if(removed.total_moles() > 0.005)
T.assume_air(removed)
return 1
else
T.assume_air(removed)
toggle(silent = TRUE)
return 0
@@ -0,0 +1,144 @@
#define STUN_SET_AMOUNT 40
/obj/item/organ/cyberimp
name = "cybernetic implant"
desc = "A state-of-the-art implant that improves a baseline's functionality."
status = ORGAN_ROBOTIC
organ_flags = ORGAN_SYNTHETIC
var/implant_color = "#FFFFFF"
var/implant_overlay
var/syndicate_implant = FALSE //Makes the implant invisible to health analyzers and medical HUDs.
/obj/item/organ/cyberimp/New(var/mob/M = null)
if(iscarbon(M))
src.Insert(M)
if(implant_overlay)
var/mutable_appearance/overlay = mutable_appearance(icon, implant_overlay)
overlay.color = implant_color
add_overlay(overlay)
return ..()
//[[[[BRAIN]]]]
/obj/item/organ/cyberimp/brain
name = "cybernetic brain implant"
desc = "Injectors of extra sub-routines for the brain."
icon_state = "brain_implant"
implant_overlay = "brain_implant_overlay"
zone = BODY_ZONE_HEAD
w_class = WEIGHT_CLASS_TINY
/obj/item/organ/cyberimp/brain/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
var/stun_amount = 200/severity
owner.Stun(stun_amount)
to_chat(owner, "<span class='warning'>Your body seizes up!</span>")
/obj/item/organ/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 = 0
var/list/stored_items = list()
implant_color = "#DE7E00"
slot = ORGAN_SLOT_BRAIN_ANTIDROP
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/cyberimp/brain/anti_drop/ui_action_click()
active = !active
if(active)
for(var/obj/item/I in owner.held_items)
stored_items += I
var/list/L = owner.get_empty_held_indexes()
if(LAZYLEN(L) == owner.held_items.len)
to_chat(owner, "<span class='notice'>You are not holding any items, your hands relax...</span>")
active = 0
stored_items = list()
else
for(var/obj/item/I in stored_items)
to_chat(owner, "<span class='notice'>Your [owner.get_held_index_name(owner.get_held_index_of_item(I))]'s grip tightens.</span>")
ADD_TRAIT(I, TRAIT_NODROP, ANTI_DROP_IMPLANT_TRAIT)
else
release_items()
to_chat(owner, "<span class='notice'>Your hands relax...</span>")
/obj/item/organ/cyberimp/brain/anti_drop/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
var/range = severity ? 10 : 5
var/atom/A
if(active)
release_items()
for(var/obj/item/I in stored_items)
A = pick(oview(range))
I.throw_at(A, range, 2)
to_chat(owner, "<span class='warning'>Your [owner.get_held_index_name(owner.get_held_index_of_item(I))] spasms and throws the [I.name]!</span>")
stored_items = list()
/obj/item/organ/cyberimp/brain/anti_drop/proc/release_items()
for(var/obj/item/I in stored_items)
REMOVE_TRAIT(I, TRAIT_NODROP, ANTI_DROP_IMPLANT_TRAIT)
stored_items = list()
/obj/item/organ/cyberimp/brain/anti_drop/Remove(var/mob/living/carbon/M, special = 0)
if(active)
ui_action_click()
..()
/obj/item/organ/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."
implant_color = "#FFFF00"
slot = ORGAN_SLOT_BRAIN_ANTISTUN
/obj/item/organ/cyberimp/brain/anti_stun/on_life()
..()
if(crit_fail || !(organ_flags & ORGAN_FAILING))
return
owner.adjustStaminaLoss(-3.5) //Citadel edit, makes it more useful in Stamina based combat
if(owner.AmountStun() > STUN_SET_AMOUNT)
owner.SetStun(STUN_SET_AMOUNT)
if(owner.AmountKnockdown() > STUN_SET_AMOUNT)
owner.SetKnockdown(STUN_SET_AMOUNT)
/obj/item/organ/cyberimp/brain/anti_stun/emp_act(severity)
. = ..()
if(crit_fail || (organ_flags & ORGAN_FAILING) || . & EMP_PROTECT_SELF)
return
crit_fail = TRUE
organ_flags |= ORGAN_FAILING
addtimer(CALLBACK(src, .proc/reboot), 90 / severity)
/obj/item/organ/cyberimp/brain/anti_stun/proc/reboot()
crit_fail = FALSE
organ_flags &= ~ORGAN_FAILING
//[[[[MOUTH]]]]
/obj/item/organ/cyberimp/mouth
zone = BODY_ZONE_PRECISE_MOUTH
/obj/item/organ/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 = ORGAN_SLOT_BREATHING_TUBE
w_class = WEIGHT_CLASS_TINY
/obj/item/organ/cyberimp/mouth/breathing_tube/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
if(prob(60/severity))
to_chat(owner, "<span class='warning'>Your breathing tube suddenly closes!</span>")
owner.losebreath += 2
+149
View File
@@ -0,0 +1,149 @@
#define INFINITE -1
/obj/item/autosurgeon
name = "autosurgeon"
desc = "A device that automatically inserts an implant or organ into the user without the hassle of extensive surgery. It has a slot to insert implants/organs and a screwdriver slot for removing accidentally added items."
icon = 'icons/obj/device.dmi'
icon_state = "autoimplanter"
item_state = "nothing"
w_class = WEIGHT_CLASS_SMALL
var/obj/item/organ/storedorgan
var/organ_type = /obj/item/organ
var/uses = INFINITE
var/starting_organ
/obj/item/autosurgeon/Initialize(mapload)
. = ..()
if(starting_organ)
insert_organ(new starting_organ(src))
/obj/item/autosurgeon/proc/insert_organ(var/obj/item/organ/I)
storedorgan = I
I.forceMove(src)
I.organ_flags |= ORGAN_FROZEN //Stops decay
name = "[initial(name)] ([storedorgan.name])"
/obj/item/autosurgeon/attack_self(mob/user)//when the object it used...
if(!uses)
to_chat(user, "<span class='warning'>[src] has already been used. The tools are dull and won't reactivate.</span>")
return
else if(!storedorgan)
to_chat(user, "<span class='notice'>[src] currently has no implant stored.</span>")
return
storedorgan.Insert(user)//insert stored organ into the user
user.visible_message("<span class='notice'>[user] presses a button on [src], and you hear a short mechanical noise.</span>", "<span class='notice'>You feel a sharp sting as [src] plunges into your body.</span>")
playsound(get_turf(user), 'sound/weapons/circsawhit.ogg', 50, 1)
storedorgan = null
name = initial(name)
if(uses != INFINITE)
uses--
if(!uses)
desc = "[initial(desc)] Looks like it's been used up."
/obj/item/autosurgeon/attack_self_tk(mob/user)
return //stops TK fuckery
/obj/item/autosurgeon/attackby(obj/item/I, mob/user, params)
if(istype(I, organ_type))
if(storedorgan)
to_chat(user, "<span class='notice'>[src] already has an implant stored.</span>")
return
else if(!uses)
to_chat(user, "<span class='notice'>[src] has already been used up.</span>")
return
if(!user.transferItemToLoc(I, src))
return
storedorgan = I
to_chat(user, "<span class='notice'>You insert the [I] into [src].</span>")
else
return ..()
/obj/item/autosurgeon/screwdriver_act(mob/living/user, obj/item/I)
if(..())
return TRUE
if(!storedorgan)
to_chat(user, "<span class='notice'>There's no implant in [src] for you to remove.</span>")
else
var/atom/drop_loc = user.drop_location()
for(var/J in src)
var/atom/movable/AM = J
AM.forceMove(drop_loc)
to_chat(user, "<span class='notice'>You remove the [storedorgan] from [src].</span>")
I.play_tool_sound(src)
storedorgan = null
if(uses != INFINITE)
uses--
if(!uses)
desc = "[initial(desc)] Looks like it's been used up."
return TRUE
/obj/item/autosurgeon/cmo
desc = "A single use autosurgeon that contains a medical heads-up display augment. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/cyberimp/eyes/hud/medical
/obj/item/autosurgeon/gloweyes
desc = "A single use autosurgeon that contains a set of Luminescent Eyes augments. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/eyes/robotic/glow
/obj/item/autosurgeon/thermal_eyes
starting_organ = /obj/item/organ/eyes/robotic/thermals
/obj/item/autosurgeon/xray_eyes
starting_organ = /obj/item/organ/eyes/robotic/xray
/obj/item/autosurgeon/anti_stun
starting_organ = /obj/item/organ/cyberimp/brain/anti_stun
/obj/item/autosurgeon/reviver
starting_organ = /obj/item/organ/cyberimp/chest/reviver
/obj/item/autosurgeon/anti_drop
starting_organ = /obj/item/organ/cyberimp/brain/anti_drop
//BOX O' IMPLANTS
/obj/item/storage/box/cyber_implants
name = "boxed cybernetic implants"
desc = "A sleek, sturdy box."
icon_state = "syndiebox"
illustration = "cyber_implants"
var/list/boxed = list(
/obj/item/autosurgeon/thermal_eyes,
/obj/item/autosurgeon/xray_eyes,
/obj/item/autosurgeon/anti_stun,
/obj/item/autosurgeon/reviver)
var/amount = 5
/obj/item/storage/box/cyber_implants/PopulateContents()
var/implant
while(contents.len <= amount)
implant = pick(boxed)
new implant(src)
/obj/item/autosurgeon/penis
desc = "A single use autosurgeon that contains a penis. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/genital/penis
/obj/item/autosurgeon/testicles
desc = "A single use autosurgeon that contains a set of testicles. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/genital/testicles
/obj/item/autosurgeon/vagina
desc = "A single use autosurgeon that contains a vagina. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/genital/vagina
/obj/item/autosurgeon/breasts
desc = "A single use autosurgeon that contains a set of breasts. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/genital/breasts
/obj/item/autosurgeon/womb
desc = "A single use autosurgeon that contains a womb. A screwdriver can be used to remove it, but implants can't be placed back in."
uses = 1
starting_organ = /obj/item/organ/genital/womb
+376
View File
@@ -0,0 +1,376 @@
/obj/item/organ/eyes
name = BODY_ZONE_PRECISE_EYES
icon_state = "eyeballs"
desc = "I see you!"
zone = BODY_ZONE_PRECISE_EYES
slot = ORGAN_SLOT_EYES
gender = PLURAL
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = STANDARD_ORGAN_DECAY
maxHealth = 0.5 * STANDARD_ORGAN_THRESHOLD //half the normal health max since we go blind at 30, a permanent blindness at 50 therefore makes sense unless medicine is administered
high_threshold = 0.3 * STANDARD_ORGAN_THRESHOLD //threshold at 30
low_threshold = 0.15 * STANDARD_ORGAN_THRESHOLD //threshold at 15
low_threshold_passed = "<span class='info'>Distant objects become somewhat less tangible.</span>"
high_threshold_passed = "<span class='info'>Everything starts to look a lot less clear.</span>"
now_failing = "<span class='warning'>Darkness envelopes you, as your eyes go blind!</span>"
now_fixed = "<span class='info'>Color and shapes are once again perceivable.</span>"
high_threshold_cleared = "<span class='info'>Your vision functions passably once more.</span>"
low_threshold_cleared = "<span class='info'>Your vision is cleared of any ailment.</span>"
var/sight_flags = 0
var/see_in_dark = 2
var/eye_damage = 0
var/tint = 0
var/eye_color = "" //set to a hex code to override a mob's eye color
var/old_eye_color = "fff"
var/flash_protect = 0
var/see_invisible = SEE_INVISIBLE_LIVING
var/lighting_alpha
var/damaged = FALSE //damaged indicates that our eyes are undergoing some level of negative effect
/obj/item/organ/eyes/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = FALSE)
..()
if(damage == initial(damage))
clear_eye_trauma()
if(ishuman(owner))
var/mob/living/carbon/human/HMN = owner
old_eye_color = HMN.eye_color
if(eye_color)
HMN.eye_color = eye_color
HMN.regenerate_icons()
else
eye_color = HMN.eye_color
if(HAS_TRAIT(HMN, TRAIT_NIGHT_VISION) && !lighting_alpha)
lighting_alpha = LIGHTING_PLANE_ALPHA_NV_TRAIT
see_in_dark = 8
M.update_tint()
owner.update_sight()
/obj/item/organ/eyes/Remove(mob/living/carbon/M, special = 0)
clear_eye_trauma()
..()
if(ishuman(M) && eye_color)
var/mob/living/carbon/human/HMN = M
HMN.eye_color = old_eye_color
HMN.regenerate_icons()
M.update_tint()
M.update_sight()
/obj/item/organ/eyes/on_life()
..()
var/mob/living/carbon/C = owner
//since we can repair fully damaged eyes, check if healing has occurred
if((organ_flags & ORGAN_FAILING) && (damage < maxHealth))
organ_flags &= ~ORGAN_FAILING
C.cure_blind(EYE_DAMAGE)
//various degrees of "oh fuck my eyes", from "point a laser at your eye" to "staring at the Sun" intensities
if(damage > 20)
damaged = TRUE
if(organ_flags & ORGAN_FAILING)
C.become_blind(EYE_DAMAGE)
else if(damage > 30)
C.overlay_fullscreen("eye_damage", /obj/screen/fullscreen/impaired, 2)
else
C.overlay_fullscreen("eye_damage", /obj/screen/fullscreen/impaired, 1)
//called once since we don't want to keep clearing the screen of eye damage for people who are below 20 damage
else if(damaged)
damaged = FALSE
C.clear_fullscreen("eye_damage")
return
/obj/item/organ/eyes/proc/clear_eye_trauma()
var/mob/living/carbon/C = owner
C.clear_fullscreen("eye_damage")
C.cure_blind(EYE_DAMAGE)
damaged = FALSE
/obj/item/organ/eyes/night_vision
name = "shadow eyes"
desc = "A spooky set of eyes that can see in the dark."
see_in_dark = 8
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
actions_types = list(/datum/action/item_action/organ_action/use)
var/night_vision = TRUE
/obj/item/organ/eyes/night_vision/ui_action_click()
sight_flags = initial(sight_flags)
switch(lighting_alpha)
if (LIGHTING_PLANE_ALPHA_VISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE)
lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE
else
lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
sight_flags &= ~SEE_BLACKNESS
owner.update_sight()
/obj/item/organ/eyes/night_vision/alien
name = "alien eyes"
desc = "It turned out they had them after all!"
sight_flags = SEE_MOBS
/obj/item/organ/eyes/night_vision/zombie
name = "undead eyes"
desc = "Somewhat counterintuitively, these half-rotten eyes actually have superior vision to those of a living human."
sight_flags = SEE_MOBS
/obj/item/organ/eyes/night_vision/nightmare
name = "burning red eyes"
desc = "Even without their shadowy owner, looking at these eyes gives you a sense of dread."
icon_state = "burning_eyes"
/obj/item/organ/eyes/night_vision/mushroom
name = "fung-eye"
desc = "While on the outside they look inert and dead, the eyes of mushroom people are actually very advanced."
///Robotic
/obj/item/organ/eyes/robotic
name = "robotic eyes"
icon_state = "cybernetic_eyeballs"
desc = "Your vision is augmented."
status = ORGAN_ROBOTIC
organ_flags = ORGAN_SYNTHETIC
/obj/item/organ/eyes/robotic/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
to_chat(owner, "<span class='warning'>Static obfuscates your vision!</span>")
owner.flash_act(visual = 1)
if(severity == EMP_HEAVY)
owner.adjustOrganLoss(ORGAN_SLOT_EYES, 20)
/obj/item/organ/eyes/robotic/xray
name = "\improper X-ray eyes"
desc = "These cybernetic eyes will give you X-ray vision. Blinking is futile."
eye_color = "000"
see_in_dark = 8
sight_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS
/obj/item/organ/eyes/robotic/thermals
name = "thermal eyes"
desc = "These cybernetic eye implants will give you thermal vision. Vertical slit pupil included."
eye_color = "FC0"
sight_flags = SEE_MOBS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
flash_protect = -1
see_in_dark = 8
/obj/item/organ/eyes/robotic/flashlight
name = "flashlight eyes"
desc = "It's two flashlights rigged together with some wire. Why would you put these in someone's head?"
eye_color ="fee5a3"
icon = 'icons/obj/lighting.dmi'
icon_state = "flashlight_eyes"
flash_protect = 2
tint = INFINITY
var/obj/item/flashlight/eyelight/eye
/obj/item/organ/eyes/robotic/flashlight/emp_act(severity)
return
/obj/item/organ/eyes/robotic/flashlight/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = FALSE)
..()
if(!eye)
eye = new /obj/item/flashlight/eyelight()
eye.on = TRUE
eye.forceMove(M)
eye.update_brightness(M)
M.become_blind("flashlight_eyes")
/obj/item/organ/eyes/robotic/flashlight/Remove(var/mob/living/carbon/M, special = FALSE)
eye.on = FALSE
eye.update_brightness(M)
eye.forceMove(src)
M.cure_blind("flashlight_eyes")
..()
// Welding shield implant
/obj/item/organ/eyes/robotic/shield
name = "shielded robotic eyes"
desc = "These reactive micro-shields will protect you from welders and flashes without obscuring your vision."
flash_protect = 2
/obj/item/organ/eyes/robotic/shield/emp_act(severity)
return
#define RGB2EYECOLORSTRING(definitionvar) ("[copytext(definitionvar,2,3)][copytext(definitionvar,4,5)][copytext(definitionvar,6,7)]")
/obj/item/organ/eyes/robotic/glow
name = "High Luminosity Eyes"
desc = "Special glowing eyes, used by snowflakes who want to be special."
eye_color = "000"
actions_types = list(/datum/action/item_action/organ_action/use, /datum/action/item_action/organ_action/toggle)
var/current_color_string = "#ffffff"
var/active = FALSE
var/max_light_beam_distance = 5
var/light_beam_distance = 5
var/light_object_range = 1
var/light_object_power = 2
var/list/obj/effect/abstract/eye_lighting/eye_lighting
var/obj/effect/abstract/eye_lighting/on_mob
var/image/mob_overlay
/obj/item/organ/eyes/robotic/glow/Initialize()
. = ..()
mob_overlay = image('icons/mob/human_face.dmi', "eyes_glow_gs")
/obj/item/organ/eyes/robotic/glow/Destroy()
terminate_effects()
. = ..()
/obj/item/organ/eyes/robotic/glow/Remove(mob/living/carbon/M, special = FALSE)
terminate_effects()
. = ..()
/obj/item/organ/eyes/robotic/glow/proc/terminate_effects()
if(owner && active)
deactivate(TRUE)
active = FALSE
clear_visuals(TRUE)
STOP_PROCESSING(SSfastprocess, src)
/obj/item/organ/eyes/robotic/glow/ui_action_click(owner, action)
if(istype(action, /datum/action/item_action/organ_action/toggle))
toggle_active()
else if(istype(action, /datum/action/item_action/organ_action/use))
prompt_for_controls(owner)
/obj/item/organ/eyes/robotic/glow/proc/toggle_active()
if(active)
deactivate()
else
activate()
/obj/item/organ/eyes/robotic/glow/proc/prompt_for_controls(mob/user)
var/C = input(owner, "Select Color", "Select color", "#ffffff") as color|null
if(!C || QDELETED(src) || QDELETED(user) || QDELETED(owner) || owner != user)
return
var/range = input(user, "Enter range (0 - [max_light_beam_distance])", "Range Select", 0) as null|num
set_distance(CLAMP(range, 0, max_light_beam_distance))
assume_rgb(C)
/obj/item/organ/eyes/robotic/glow/proc/assume_rgb(newcolor)
current_color_string = newcolor
eye_color = RGB2EYECOLORSTRING(current_color_string)
sync_light_effects()
cycle_mob_overlay()
if(!QDELETED(owner) && ishuman(owner)) //Other carbon mobs don't have eye color.
owner.dna.species.handle_body(owner)
/obj/item/organ/eyes/robotic/glow/proc/cycle_mob_overlay()
remove_mob_overlay()
mob_overlay.color = current_color_string
add_mob_overlay()
/obj/item/organ/eyes/robotic/glow/proc/add_mob_overlay()
if(!QDELETED(owner))
owner.add_overlay(mob_overlay)
/obj/item/organ/eyes/robotic/glow/proc/remove_mob_overlay()
if(!QDELETED(owner))
owner.cut_overlay(mob_overlay)
/obj/item/organ/eyes/robotic/glow/emp_act()
. = ..()
if(!active || . & EMP_PROTECT_SELF)
return
deactivate(silent = TRUE)
/obj/item/organ/eyes/robotic/glow/proc/activate(silent = FALSE)
start_visuals()
if(!silent)
to_chat(owner, "<span class='warning'>Your [src] clicks and makes a whining noise, before shooting out a beam of light!</span>")
active = TRUE
RegisterSignal(owner, COMSIG_ATOM_DIR_CHANGE, .proc/update_visuals)
cycle_mob_overlay()
/obj/item/organ/eyes/robotic/glow/proc/deactivate(silent = FALSE)
clear_visuals()
if(!silent)
to_chat(owner, "<span class='warning'>Your [src] shuts off!</span>")
active = FALSE
UnregisterSignal(owner, COMSIG_ATOM_DIR_CHANGE)
remove_mob_overlay()
/obj/item/organ/eyes/robotic/glow/proc/update_visuals(datum/source, olddir, newdir)
if((LAZYLEN(eye_lighting) < light_beam_distance) || !on_mob)
regenerate_light_effects()
var/turf/scanfrom = get_turf(owner)
var/scandir = owner.dir
if (newdir && scandir != newdir) // COMSIG_ATOM_DIR_CHANGE happens before the dir change, but with a reference to the new direction.
scandir = newdir
if(!istype(scanfrom))
clear_visuals()
var/turf/scanning = scanfrom
var/stop = FALSE
on_mob.forceMove(scanning)
for(var/i in 1 to light_beam_distance)
scanning = get_step(scanning, scandir)
if(scanning.opacity || scanning.has_opaque_atom)
stop = TRUE
var/obj/effect/abstract/eye_lighting/L = LAZYACCESS(eye_lighting, i)
if(stop)
L.forceMove(src)
else
L.forceMove(scanning)
/obj/item/organ/eyes/robotic/glow/proc/clear_visuals(delete_everything = FALSE)
if(delete_everything)
QDEL_LIST(eye_lighting)
QDEL_NULL(on_mob)
else
for(var/i in eye_lighting)
var/obj/effect/abstract/eye_lighting/L = i
L.forceMove(src)
if(!QDELETED(on_mob))
on_mob.forceMove(src)
/obj/item/organ/eyes/robotic/glow/proc/start_visuals()
if(!islist(eye_lighting))
regenerate_light_effects()
if((LAZYLEN(eye_lighting) < light_beam_distance) || !on_mob)
regenerate_light_effects()
sync_light_effects()
update_visuals()
/obj/item/organ/eyes/robotic/glow/proc/set_distance(dist)
light_beam_distance = dist
regenerate_light_effects()
/obj/item/organ/eyes/robotic/glow/proc/regenerate_light_effects()
clear_visuals(TRUE)
on_mob = new(src)
for(var/i in 1 to light_beam_distance)
LAZYADD(eye_lighting,new /obj/effect/abstract/eye_lighting(src))
sync_light_effects()
/obj/item/organ/eyes/robotic/glow/proc/sync_light_effects()
for(var/I in eye_lighting)
var/obj/effect/abstract/eye_lighting/L = I
L.set_light(light_object_range, light_object_power, current_color_string)
if(on_mob)
on_mob.set_light(1, 1, current_color_string)
/obj/effect/abstract/eye_lighting
var/obj/item/organ/eyes/robotic/glow/parent
/obj/effect/abstract/eye_lighting/Initialize()
. = ..()
parent = loc
if(!istype(parent))
return INITIALIZE_HINT_QDEL
/obj/item/organ/eyes/insect
name = "insect eyes"
desc = "These eyes seem to have increased sensitivity to bright light, with no improvement to low light vision."
flash_protect = -1
+247
View File
@@ -0,0 +1,247 @@
/obj/item/organ/heart
name = "heart"
desc = "I feel bad for the heartless bastard who lost this."
icon_state = "heart-on"
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_HEART
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = 3 * STANDARD_ORGAN_DECAY //designed to fail about 5 minutes after death
low_threshold_passed = "<span class='info'>Prickles of pain appear then die out from within your chest...</span>"
high_threshold_passed = "<span class='warning'>Something inside your chest hurts, and the pain isn't subsiding. You notice yourself breathing far faster than before.</span>"
now_fixed = "<span class='info'>Your heart begins to beat again.</span>"
high_threshold_cleared = "<span class='info'>The pain in your chest has died down, and your breathing becomes more relaxed.</span>"
// Heart attack code is in code/modules/mob/living/carbon/human/life.dm
var/beating = 1
var/icon_base = "heart"
attack_verb = list("beat", "thumped")
var/beat = BEAT_NONE//is this mob having a heatbeat sound played? if so, which?
var/failed = FALSE //to prevent constantly running failing code
var/operated = FALSE //whether the heart's been operated on to fix some of its damages
/obj/item/organ/heart/update_icon()
if(beating)
icon_state = "[icon_base]-on"
else
icon_state = "[icon_base]-off"
/obj/item/organ/heart/Remove(mob/living/carbon/M, special = 0)
..()
if(!special)
addtimer(CALLBACK(src, .proc/stop_if_unowned), 120)
/obj/item/organ/heart/proc/stop_if_unowned()
if(!owner)
Stop()
/obj/item/organ/heart/attack_self(mob/user)
..()
if(!beating)
user.visible_message("<span class='notice'>[user] squeezes [src] to \
make it beat again!</span>","<span class='notice'>You squeeze [src] to make it beat again!</span>")
Restart()
addtimer(CALLBACK(src, .proc/stop_if_unowned), 80)
/obj/item/organ/heart/proc/Stop()
beating = 0
update_icon()
return 1
/obj/item/organ/heart/proc/Restart()
beating = 1
update_icon()
return 1
/obj/item/organ/heart/prepare_eat()
var/obj/S = ..()
S.icon_state = "[icon_base]-off"
return S
/obj/item/organ/heart/on_life()
..()
if(owner.client && beating)
failed = FALSE
var/sound/slowbeat = sound('sound/health/slowbeat.ogg', repeat = TRUE)
var/sound/fastbeat = sound('sound/health/fastbeat.ogg', repeat = TRUE)
var/mob/living/carbon/H = owner
if(H.health <= H.crit_threshold && beat != BEAT_SLOW)
beat = BEAT_SLOW
H.playsound_local(get_turf(H), slowbeat,40,0, channel = CHANNEL_HEARTBEAT)
to_chat(owner, "<span class = 'notice'>You feel your heart slow down...</span>")
if(beat == BEAT_SLOW && H.health > H.crit_threshold)
H.stop_sound_channel(CHANNEL_HEARTBEAT)
beat = BEAT_NONE
if(H.jitteriness)
if(H.health > HEALTH_THRESHOLD_FULLCRIT && (!beat || beat == BEAT_SLOW))
H.playsound_local(get_turf(H),fastbeat,40,0, channel = CHANNEL_HEARTBEAT)
beat = BEAT_FAST
else if(beat == BEAT_FAST)
H.stop_sound_channel(CHANNEL_HEARTBEAT)
beat = BEAT_NONE
if(organ_flags & ORGAN_FAILING) //heart broke, stopped beating, death imminent
if(owner.stat == CONSCIOUS)
owner.visible_message("<span class='userdanger'>[owner] clutches at [owner.p_their()] chest as if [owner.p_their()] heart is stopping!</span>")
owner.set_heartattack(TRUE)
failed = TRUE
obj/item/organ/heart/slime
name = "slime heart"
desc = "It seems we've gotten to the slimy core of the matter."
icon_state = "heart-s-on"
icon_base = "heart-s"
/obj/item/organ/heart/cursed
name = "cursed heart"
desc = "A heart that, when inserted, will force you to pump it manually."
icon_state = "cursedheart-off"
icon_base = "cursedheart"
decay_factor = 0
actions_types = list(/datum/action/item_action/organ_action/cursed_heart)
var/last_pump = 0
var/add_colour = TRUE //So we're not constantly recreating colour datums
var/pump_delay = 30 //you can pump 1 second early, for lag, but no more (otherwise you could spam heal)
var/blood_loss = 100 //600 blood is human default, so 5 failures (below 122 blood is where humans die because reasons?)
//How much to heal per pump, negative numbers would HURT the player
var/heal_brute = 0
var/heal_burn = 0
var/heal_oxy = 0
/obj/item/organ/heart/cursed/attack(mob/living/carbon/human/H, mob/living/carbon/human/user, obj/target)
if(H == user && istype(H))
playsound(user,'sound/effects/singlebeat.ogg',40,1)
user.temporarilyRemoveItemFromInventory(src, TRUE)
Insert(user)
else
return ..()
/obj/item/organ/heart/cursed/on_life()
if(world.time > (last_pump + pump_delay))
if(ishuman(owner) && owner.client) //While this entire item exists to make people suffer, they can't control disconnects.
var/mob/living/carbon/human/H = owner
if(H.dna && !(NOBLOOD in H.dna.species.species_traits))
H.blood_volume = max(H.blood_volume - blood_loss, 0)
to_chat(H, "<span class = 'userdanger'>You have to keep pumping your blood!</span>")
if(add_colour)
H.add_client_colour(/datum/client_colour/cursed_heart_blood) //bloody screen so real
add_colour = FALSE
else
last_pump = world.time //lets be extra fair *sigh*
/obj/item/organ/heart/cursed/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
..()
if(owner)
to_chat(owner, "<span class ='userdanger'>Your heart has been replaced with a cursed one, you have to pump this one manually otherwise you'll die!</span>")
/obj/item/organ/heart/cursed/Remove(mob/living/carbon/M, special = 0)
..()
M.remove_client_colour(/datum/client_colour/cursed_heart_blood)
/datum/action/item_action/organ_action/cursed_heart
name = "Pump your blood"
//You are now brea- pumping blood manually
/datum/action/item_action/organ_action/cursed_heart/Trigger()
. = ..()
if(. && istype(target, /obj/item/organ/heart/cursed))
var/obj/item/organ/heart/cursed/cursed_heart = target
if(world.time < (cursed_heart.last_pump + (cursed_heart.pump_delay-10))) //no spam
to_chat(owner, "<span class='userdanger'>Too soon!</span>")
return
cursed_heart.last_pump = world.time
playsound(owner,'sound/effects/singlebeat.ogg',40,1)
to_chat(owner, "<span class = 'notice'>Your heart beats.</span>")
var/mob/living/carbon/human/H = owner
if(istype(H))
if(H.dna && !(NOBLOOD in H.dna.species.species_traits))
H.blood_volume = min(H.blood_volume + cursed_heart.blood_loss*0.5, BLOOD_VOLUME_MAXIMUM)
H.remove_client_colour(/datum/client_colour/cursed_heart_blood)
cursed_heart.add_colour = TRUE
H.adjustBruteLoss(-cursed_heart.heal_brute)
H.adjustFireLoss(-cursed_heart.heal_burn)
H.adjustOxyLoss(-cursed_heart.heal_oxy)
/datum/client_colour/cursed_heart_blood
priority = 100 //it's an indicator you're dieing, so it's very high priority
colour = "red"
/obj/item/organ/heart/cybernetic
name = "cybernetic heart"
desc = "An electronic device designed to mimic the functions of an organic human heart. Offers no benefit over an organic heart other than being easy to make."
icon_state = "heart-c"
organ_flags = ORGAN_SYNTHETIC
/obj/item/organ/heart/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
Stop()
addtimer(CALLBACK(src, .proc/Restart), 20/severity SECONDS)
damage += 100/severity
/obj/item/organ/heart/cybernetic/upgraded
name = "upgraded cybernetic heart"
desc = "An electronic device designed to mimic the functions of an organic human heart. Also holds an emergency dose of epinephrine, used automatically after facing severe trauma. This upgraded model can regenerate its dose after use."
icon_state = "heart-c-u"
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
//I put it on upgraded for now.
var/dose_available = TRUE
var/rid = /datum/reagent/medicine/epinephrine
var/ramount = 10
obj/item/organ/heart/cybernetic/upgraded/on_life()
. = ..()
if(dose_available && owner.health <= owner.crit_threshold && !owner.reagents.has_reagent(rid))
owner.reagents.add_reagent(rid, ramount)
used_dose()
if(ramount < 10) //eats your nutrition to regen epinephrine
var/regen_amount = owner.nutrition/2000
owner.nutrition -= regen_amount
ramount += regen_amount
/obj/item/organ/heart/cybernetic/upgraded/proc/used_dose()
. = ..()
addtimer(VARSET_CALLBACK(src, dose_available, TRUE), 5 MINUTES)
ramount = 0
/obj/item/organ/heart/ipc
name = "IPC heart"
desc = "An electronic pump that regulates hydraulic functions, they have an auto-restart after EMPs."
icon_state = "heart-c"
organ_flags = ORGAN_SYNTHETIC
/obj/item/organ/heart/ipc/emp_act()
. = ..()
if(. & EMP_PROTECT_SELF)
return
Stop()
addtimer(CALLBACK(src, .proc/Restart), 10)
/obj/item/organ/heart/freedom
name = "heart of freedom"
desc = "This heart pumps with the passion to give... something freedom."
organ_flags = ORGAN_SYNTHETIC //the power of freedom prevents heart attacks
var/min_next_adrenaline = 0
/obj/item/organ/heart/freedom/on_life()
. = ..()
if(owner.health < 5 && world.time > min_next_adrenaline)
min_next_adrenaline = world.time + rand(250, 600) //anywhere from 4.5 to 10 minutes
to_chat(owner, "<span class='userdanger'>You feel yourself dying, but you refuse to give up!</span>")
owner.heal_overall_damage(15, 15)
if(owner.reagents.get_reagent_amount("ephedrine") < 20)
owner.reagents.add_reagent("ephedrine", 10)
@@ -0,0 +1,367 @@
#define STANDARD_ORGAN_THRESHOLD 100
#define STANDARD_ORGAN_HEALING 0.001
/obj/item/organ
name = "organ"
icon = 'icons/obj/surgery.dmi'
var/mob/living/carbon/owner = null
var/status = ORGAN_ORGANIC
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
var/zone = BODY_ZONE_CHEST
var/slot
// DO NOT add slots with matching names to different zones - it will break internal_organs_slot list!
var/organ_flags = 0
var/maxHealth = STANDARD_ORGAN_THRESHOLD
var/damage = 0 //total damage this organ has sustained
///Healing factor and decay factor function on % of maxhealth, and do not work by applying a static number per tick
var/healing_factor = 0 //fraction of maxhealth healed per on_life(), set to 0 for generic organs
var/decay_factor = 0 //same as above but when without a living owner, set to 0 for generic organs
var/high_threshold = STANDARD_ORGAN_THRESHOLD * 0.45 //when severe organ damage occurs
var/low_threshold = STANDARD_ORGAN_THRESHOLD * 0.1 //when minor organ damage occurs
///Organ variables for determining what we alert the owner with when they pass/clear the damage thresholds
var/prev_damage = 0
var/low_threshold_passed
var/high_threshold_passed
var/now_failing
var/now_fixed
var/high_threshold_cleared
var/low_threshold_cleared
/obj/item/organ/proc/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
if(!iscarbon(M) || owner == M)
return FALSE
var/obj/item/organ/replaced = M.getorganslot(slot)
if(replaced)
replaced.Remove(M, special = 1)
if(drop_if_replaced)
replaced.forceMove(get_turf(M))
else
qdel(replaced)
//Hopefully this doesn't cause problems
organ_flags &= ~ORGAN_FROZEN
owner = M
M.internal_organs |= src
M.internal_organs_slot[slot] = src
moveToNullspace()
for(var/X in actions)
var/datum/action/A = X
A.Grant(M)
STOP_PROCESSING(SSobj, src)
return TRUE
//Special is for instant replacement like autosurgeons
/obj/item/organ/proc/Remove(mob/living/carbon/M, special = FALSE)
owner = null
if(M)
M.internal_organs -= src
if(M.internal_organs_slot[slot] == src)
M.internal_organs_slot.Remove(slot)
if((organ_flags & ORGAN_VITAL) && !special && !(M.status_flags & GODMODE))
M.death()
for(var/X in actions)
var/datum/action/A = X
A.Remove(M)
START_PROCESSING(SSobj, src)
return TRUE
/obj/item/organ/proc/on_find(mob/living/finder)
return
/obj/item/organ/process() //runs decay when outside of a person AND ONLY WHEN OUTSIDE (i.e. long obj).
on_death() //Kinda hate doing it like this, but I really don't want to call process directly.
//Sources; life.dm process_organs
/obj/item/organ/proc/on_death() //Runs when outside AND inside.
decay()
//Applys the slow damage over time decay
/obj/item/organ/proc/decay()
if(!can_decay())
STOP_PROCESSING(SSobj, src)
return
is_cold()
if(organ_flags & ORGAN_FROZEN)
return
applyOrganDamage(maxHealth * decay_factor)
/obj/item/organ/proc/can_decay()
if(CHECK_BITFIELD(organ_flags, ORGAN_NO_SPOIL | ORGAN_SYNTHETIC | ORGAN_FAILING))
return FALSE
return TRUE
//Checks to see if the organ is frozen from temperature
/obj/item/organ/proc/is_cold()
var/freezing_objects = list(/obj/structure/closet/crate/freezer, /obj/structure/closet/secure_closet/freezer, /obj/structure/bodycontainer, /obj/item/autosurgeon)
if(istype(loc, /obj/))//Freezer of some kind, I hope.
if(is_type_in_list(loc, freezing_objects))
if(!(organ_flags & ORGAN_FROZEN))//Incase someone puts them in when cold, but they warm up inside of the thing. (i.e. they have the flag, the thing turns it off, this rights it.)
organ_flags |= ORGAN_FROZEN
return TRUE
return
var/local_temp
if(istype(loc, /turf/))//Only concern is adding an organ to a freezer when the area around it is cold.
var/turf/T = loc
var/datum/gas_mixture/enviro = T.return_air()
local_temp = enviro.temperature
else if(istype(loc, /mob/) && !owner)
var/mob/M = loc
if(is_type_in_list(M.loc, freezing_objects))
if(!(organ_flags & ORGAN_FROZEN))
organ_flags |= ORGAN_FROZEN
return TRUE
var/turf/T = M.loc
var/datum/gas_mixture/enviro = T.return_air()
local_temp = enviro.temperature
if(owner)
//Don't interfere with bodies frozen by structures.
if(is_type_in_list(owner.loc, freezing_objects))
if(!(organ_flags & ORGAN_FROZEN))
organ_flags |= ORGAN_FROZEN
return TRUE
local_temp = owner.bodytemperature
if(!local_temp)//Shouldn't happen but in case
return
if(local_temp < 154)//I have a pretty shaky citation that states -120 allows indefinite cyrostorage
organ_flags |= ORGAN_FROZEN
return TRUE
organ_flags &= ~ORGAN_FROZEN
return FALSE
/obj/item/organ/proc/on_life() //repair organ damage if the organ is not failing
if(organ_flags & ORGAN_FAILING)
return
if(is_cold())
return
///Damage decrements by a percent of its maxhealth
var/healing_amount = -(maxHealth * healing_factor)
///Damage decrements again by a percent of its maxhealth, up to a total of 4 extra times depending on the owner's health
healing_amount -= owner.satiety > 0 ? 4 * healing_factor * owner.satiety / MAX_SATIETY : 0
applyOrganDamage(healing_amount) //to FERMI_TWEAK
//Make it so each threshold is stuck.
/obj/item/organ/examine(mob/user)
. = ..()
if(organ_flags & ORGAN_FAILING)
if(status == ORGAN_ROBOTIC)
. += "<span class='warning'>[src] seems to be broken!</span>"
return
. += "<span class='warning'>[src] has decayed for too long, and has turned a sickly color! It doesn't look like it will work anymore!</span>"
return
if(damage > high_threshold)
. += "<span class='warning'>[src] is starting to look discolored.</span>"
/obj/item/organ/proc/prepare_eat()
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.w_class = w_class
return S
/obj/item/reagent_containers/food/snacks/organ
name = "appendix"
icon_state = "appendix"
icon = 'icons/obj/surgery.dmi'
list_reagents = list("nutriment" = 5)
foodtype = RAW | MEAT | GROSS
/obj/item/organ/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
/obj/item/organ/Destroy()
if(owner)
// The special flag is important, because otherwise mobs can die
// while undergoing transformation into different mobs.
Remove(owner, TRUE)
return ..()
/obj/item/organ/attack(mob/living/carbon/M, mob/user)
if(M == user && ishuman(user))
var/mob/living/carbon/human/H = user
if(status == ORGAN_ORGANIC)
var/obj/item/reagent_containers/food/snacks/S = prepare_eat()
if(S)
qdel(src)
if(H.put_in_active_hand(S))
S.attack(H, H)
else
..()
/obj/item/organ/item_action_slot_check(slot,mob/user)
return //so we don't grant the organ's action to mobs who pick up the organ.
///Adjusts an organ's damage by the amount "d", up to a maximum amount, which is by default max damage
/obj/item/organ/proc/applyOrganDamage(var/d, var/maximum = maxHealth) //use for damaging effects
if(!d) //Micro-optimization.
return
if(maximum < damage)
return
damage = CLAMP(damage + d, 0, maximum)
var/mess = check_damage_thresholds(owner)
prev_damage = damage
if(mess && owner)
to_chat(owner, mess)
///SETS an organ's damage to the amount "d", and in doing so clears or sets the failing flag, good for when you have an effect that should fix an organ if broken
/obj/item/organ/proc/setOrganDamage(var/d) //use mostly for admin heals
applyOrganDamage(d - damage)
/** check_damage_thresholds
* input: M (a mob, the owner of the organ we call the proc on)
* output: returns a message should get displayed.
* description: By checking our current damage against our previous damage, we can decide whether we've passed an organ threshold.
* If we have, send the corresponding threshold message to the owner, if such a message exists.
*/
/obj/item/organ/proc/check_damage_thresholds(var/M)
if(damage == prev_damage)
return
var/delta = damage - prev_damage
if(delta > 0)
if(damage >= maxHealth)
organ_flags |= ORGAN_FAILING
return now_failing
if(damage > high_threshold && prev_damage <= high_threshold)
return high_threshold_passed
if(damage > low_threshold && prev_damage <= low_threshold)
return low_threshold_passed
else
organ_flags &= ~ORGAN_FAILING
if(!owner)//Processing is stopped when the organ is dead and outside of someone. This hopefully should restart it if a removed organ is repaired outside of a body.
START_PROCESSING(SSobj, src)
if(prev_damage > low_threshold && damage <= low_threshold)
return low_threshold_cleared
if(prev_damage > high_threshold && damage <= high_threshold)
return high_threshold_cleared
if(prev_damage == maxHealth)
return now_fixed
//Runs some code on the organ when damage is taken/healed
/obj/item/organ/proc/onDamage(var/d, var/maximum = maxHealth)
return
//Runs some code on the organ when damage is taken/healed
/obj/item/organ/proc/onSetDamage(var/d, var/maximum = maxHealth)
return
//Looking for brains?
//Try code/modules/mob/living/carbon/brain/brain_item.dm
/mob/living/proc/regenerate_organs()
return 0
/mob/living/carbon/regenerate_organs(only_one = FALSE)
var/breathes = TRUE
var/blooded = TRUE
if(dna && dna.species)
if(HAS_TRAIT_FROM(src, TRAIT_NOBREATH, SPECIES_TRAIT))
breathes = FALSE
if(NOBLOOD in dna.species.species_traits)
blooded = FALSE
var/has_liver = (!(NOLIVER in dna.species.species_traits))
var/has_stomach = (!(NOSTOMACH in dna.species.species_traits))
if(has_liver && !getorganslot(ORGAN_SLOT_LIVER))
var/obj/item/organ/liver/LI
if(dna.species.mutantliver)
LI = new dna.species.mutantliver()
else
LI = new()
LI.Insert(src)
if(only_one)
return TRUE
if(has_stomach && !getorganslot(ORGAN_SLOT_STOMACH))
var/obj/item/organ/stomach/S
if(dna.species.mutantstomach)
S = new dna.species.mutantstomach()
else
S = new()
S.Insert(src)
if(only_one)
return TRUE
if(breathes && !getorganslot(ORGAN_SLOT_LUNGS))
var/obj/item/organ/lungs/L = new()
L.Insert(src)
if(only_one)
return TRUE
if(blooded && !getorganslot(ORGAN_SLOT_HEART))
var/obj/item/organ/heart/H = new()
H.Insert(src)
if(only_one)
return TRUE
if(!getorganslot(ORGAN_SLOT_TONGUE))
var/obj/item/organ/tongue/T
if(dna && dna.species && dna.species.mutanttongue)
T = new dna.species.mutanttongue()
else
T = new()
// if they have no mutant tongues, give them a regular one
T.Insert(src)
if(only_one)
return TRUE
else if (!only_one)
var/obj/item/organ/tongue/oT = getorganslot(ORGAN_SLOT_TONGUE)
if(oT.name == "fluffy tongue")
var/obj/item/organ/tongue/T
if(dna && dna.species && dna.species.mutanttongue)
T = new dna.species.mutanttongue()
else
T = new()
oT.Remove(src)
qdel(oT)
T.Insert(src)
if(!getorganslot(ORGAN_SLOT_EYES))
var/obj/item/organ/eyes/E
if(dna && dna.species && dna.species.mutanteyes)
E = new dna.species.mutanteyes()
else
E = new()
E.Insert(src)
if(only_one)
return TRUE
if(!getorganslot(ORGAN_SLOT_EARS))
var/obj/item/organ/ears/ears
if(dna && dna.species && dna.species.mutantears)
ears = new dna.species.mutantears
else
ears = new
ears.Insert(src)
if(only_one)
return TRUE
if(!getorganslot(ORGAN_SLOT_TAIL))
var/obj/item/organ/tail/tail
if(dna && dna.species && dna.species.mutanttail)
tail = new dna.species.mutanttail
tail.Insert(src)
if(only_one)
return TRUE
+293
View File
@@ -0,0 +1,293 @@
#define TONGUE_MAX_HEALTH 60
/obj/item/organ/tongue
name = "tongue"
desc = "A fleshy muscle mostly used for lying."
icon_state = "tonguenormal"
zone = BODY_ZONE_PRECISE_MOUTH
slot = ORGAN_SLOT_TONGUE
attack_verb = list("licked", "slobbered", "slapped", "frenched", "tongued")
var/list/languages_possible
var/say_mod = null
var/taste_sensitivity = 15 // lower is more sensitive.
maxHealth = TONGUE_MAX_HEALTH
var/modifies_speech = FALSE
var/static/list/languages_possible_base = typecacheof(list(
/datum/language/common,
/datum/language/draconic,
/datum/language/codespeak,
/datum/language/monkey,
/datum/language/narsie,
/datum/language/beachbum,
/datum/language/ratvar,
/datum/language/aphasia,
/datum/language/slime,
))
healing_factor = STANDARD_ORGAN_HEALING*5 //Fast!!
decay_factor = STANDARD_ORGAN_DECAY/2
/obj/item/organ/tongue/Initialize(mapload)
. = ..()
languages_possible = languages_possible_base
/obj/item/organ/tongue/proc/handle_speech(datum/source, list/speech_args)
/obj/item/organ/tongue/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
if(organ_flags & ORGAN_SYNTHETIC)
var/errormessage = list("Runtime in tongue.dm, line 39: Undefined operation \"zapzap ow my tongue\"", "afhsjifksahgjkaslfhashfjsak", "-1.#IND", "Graham's number", "inside you all along", "awaiting at least 1 approving review before merging this taste request")
owner.say("The pH is appropriately [pick(errormessage)].")
/obj/item/organ/tongue/applyOrganDamage(var/d, var/maximum = maxHealth)
if(!d) //Micro-optimization.
return
if(maximum < damage)
return
damage = CLAMP(damage + d, 0, maximum)
var/mess = check_damage_thresholds(owner)
prev_damage = damage
if(mess && owner)
to_chat(owner, mess)
if ((damage / maxHealth) > 1)
to_chat(owner, "<span class='userdanger'>Your tongue is singed beyond recognition, and disintegrates!</span>")
SSblackbox.record_feedback("tally", "fermi_chem", 1, "Tongues lost to Fermi")
qdel(src)
else if ((damage / maxHealth) > 0.85)
to_chat(owner, "<span class='warning'>Your tongue feels like it's about to fall out!.</span>")
else if ((damage / maxHealth) > 0.5)
to_chat(owner, "<span class='notice'>Your tongue is really starting to hurt.</span>")
/obj/item/organ/tongue/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
..()
if(say_mod && M.dna && M.dna.species)
M.dna.species.say_mod = say_mod
if (modifies_speech)
RegisterSignal(M, COMSIG_MOB_SAY, .proc/handle_speech)
M.UnregisterSignal(M, COMSIG_MOB_SAY)
/obj/item/organ/tongue/Remove(mob/living/carbon/M, special = 0)
..()
if(say_mod && M.dna && M.dna.species)
M.dna.species.say_mod = initial(M.dna.species.say_mod)
UnregisterSignal(M, COMSIG_MOB_SAY, .proc/handle_speech)
M.RegisterSignal(M, COMSIG_MOB_SAY, /mob/living/carbon/.proc/handle_tongueless_speech)
/obj/item/organ/tongue/could_speak_in_language(datum/language/dt)
return is_type_in_typecache(dt, languages_possible)
/obj/item/organ/tongue/lizard
name = "forked tongue"
desc = "A thin and long muscle typically found in reptilian races, apparently moonlights as a nose."
icon_state = "tonguelizard"
say_mod = "hisses"
taste_sensitivity = 10 // combined nose + tongue, extra sensitive
maxHealth = 40 //extra sensitivity means tongue is more susceptible to damage
modifies_speech = TRUE
/obj/item/organ/tongue/lizard/handle_speech(datum/source, list/speech_args)
var/static/regex/lizard_hiss = new("s+", "g")
var/static/regex/lizard_hiSS = new("S+", "g")
var/message = speech_args[SPEECH_MESSAGE]
if(message[1] != "*")
message = lizard_hiss.Replace(message, "sss")
message = lizard_hiSS.Replace(message, "SSS")
speech_args[SPEECH_MESSAGE] = message
/obj/item/organ/tongue/fly
name = "proboscis"
desc = "A freakish looking meat tube that apparently can take in liquids."
icon_state = "tonguefly"
say_mod = "buzzes"
taste_sensitivity = 25 // you eat vomit, this is a mercy
maxHealth = 80 //years of eatting trash has made your tongue strong
modifies_speech = TRUE
/obj/item/organ/tongue/fly/handle_speech(datum/source, list/speech_args)
var/static/regex/fly_buzz = new("z+", "g")
var/static/regex/fly_buZZ = new("Z+", "g")
var/message = speech_args[SPEECH_MESSAGE]
if(message[1] != "*")
message = fly_buzz.Replace(message, "zzz")
message = fly_buZZ.Replace(message, "ZZZ")
speech_args[SPEECH_MESSAGE] = message
/obj/item/organ/tongue/abductor
name = "superlingual matrix"
desc = "A mysterious structure that allows for instant communication between users. Pretty impressive until you need to eat something."
icon_state = "tongueayylmao"
say_mod = "gibbers"
taste_sensitivity = 101 // ayys cannot taste anything.
maxHealth = 120 //Ayys probe a lot
modifies_speech = TRUE
/obj/item/organ/tongue/abductor/handle_speech(datum/source, list/speech_args)
//Hacks
var/message = speech_args[SPEECH_MESSAGE]
var/mob/living/carbon/human/user = usr
var/rendered = "<span class='abductor'><b>[user.name]:</b> [message]</span>"
user.log_talk(message, LOG_SAY, tag="abductor")
for(var/mob/living/carbon/human/H in GLOB.alive_mob_list)
var/obj/item/organ/tongue/T = H.getorganslot(ORGAN_SLOT_TONGUE)
if(!T || T.type != type)
continue
if(H.dna && H.dna.species.id == "abductor" && user.dna && user.dna.species.id == "abductor")
var/datum/antagonist/abductor/A = user.mind.has_antag_datum(/datum/antagonist/abductor)
if(!A || !(H.mind in A.team.members))
continue
to_chat(H, rendered)
for(var/mob/M in GLOB.dead_mob_list)
var/link = FOLLOW_LINK(M, user)
to_chat(M, "[link] [rendered]")
speech_args[SPEECH_MESSAGE] = ""
/obj/item/organ/tongue/zombie
name = "rotting tongue"
desc = "Between the decay and the fact that it's just lying there you doubt a tongue has ever seemed less sexy."
icon_state = "tonguezombie"
say_mod = "moans"
taste_sensitivity = 32
maxHealth = 65 //Stop! It's already dead...!
modifies_speech = TRUE
/obj/item/organ/tongue/zombie/handle_speech(datum/source, list/speech_args)
var/list/message_list = splittext(speech_args[SPEECH_MESSAGE], " ")
var/maxchanges = max(round(message_list.len / 1.5), 2)
for(var/i = rand(maxchanges / 2, maxchanges), i > 0, i--)
var/insertpos = rand(1, message_list.len - 1)
var/inserttext = message_list[insertpos]
if(!(copytext(inserttext, length(inserttext) - 2) == "..."))
message_list[insertpos] = inserttext + "..."
if(prob(20) && message_list.len > 3)
message_list.Insert(insertpos, "[pick("BRAINS", "Brains", "Braaaiinnnsss", "BRAAAIIINNSSS")]...")
speech_args[SPEECH_MESSAGE] = jointext(message_list, " ")
/obj/item/organ/tongue/alien
name = "alien tongue"
desc = "According to leading xenobiologists the evolutionary benefit of having a second mouth in your mouth is \"that it looks badass\"."
icon_state = "tonguexeno"
say_mod = "hisses"
taste_sensitivity = 10 // LIZARDS ARE ALIENS CONFIRMED
maxHealth = 500 //They've a little mouth for a tongue, so it's pretty rhobust
modifies_speech = TRUE // not really, they just hiss
var/static/list/languages_possible_alien = typecacheof(list(
/datum/language/xenocommon,
/datum/language/common,
/datum/language/draconic,
/datum/language/ratvar,
/datum/language/monkey))
/obj/item/organ/tongue/alien/Initialize(mapload)
. = ..()
languages_possible = languages_possible_alien
/obj/item/organ/tongue/alien/handle_speech(datum/source, list/speech_args)
playsound(owner, "hiss", 25, 1, 1)
/obj/item/organ/tongue/bone
name = "bone \"tongue\""
desc = "Apparently skeletons alter the sounds they produce through oscillation of their teeth, hence their characteristic rattling."
icon_state = "tonguebone"
say_mod = "rattles"
organ_flags = ORGAN_NO_SPOIL
attack_verb = list("bitten", "chattered", "chomped", "enamelled", "boned")
taste_sensitivity = 101 // skeletons cannot taste anything
maxHealth = 75 //Take brute damage instead
modifies_speech = TRUE
var/chattering = FALSE
var/phomeme_type = "sans"
var/list/phomeme_types = list("sans", "papyrus")
/obj/item/organ/tongue/bone/Initialize()
. = ..()
phomeme_type = pick(phomeme_types)
/obj/item/organ/tongue/bone/applyOrganDamage(var/d, var/maximum = maxHealth)
if(d < 0)
return
if(!owner)
return
var/target = owner.get_bodypart(BODY_ZONE_HEAD)
owner.apply_damage(d, BURN, target)
to_chat(owner, "<span class='userdanger'>You feel your skull burning! Oof, your bones!</span>")
return
/obj/item/organ/tongue/bone/handle_speech(datum/source, list/speech_args)
if (chattering)
chatter(speech_args[SPEECH_MESSAGE], phomeme_type, source)
switch(phomeme_type)
if("sans")
speech_args[SPEECH_SPANS] |= SPAN_SANS
if("papyrus")
speech_args[SPEECH_SPANS] |= SPAN_PAPYRUS
/obj/item/organ/tongue/bone/plasmaman
name = "plasma bone \"tongue\""
desc = "Like animated skeletons, Plasmamen vibrate their teeth in order to produce speech."
icon_state = "tongueplasma"
modifies_speech = FALSE
/obj/item/organ/tongue/robot
name = "robotic voicebox"
desc = "A voice synthesizer that can interface with organic lifeforms."
status = ORGAN_ROBOTIC
icon_state = "tonguerobot"
say_mod = "states"
attack_verb = list("beeped", "booped")
modifies_speech = TRUE
taste_sensitivity = 25 // not as good as an organic tongue
maxHealth = 100 //RoboTongue!
var/electronics_magic = TRUE
/obj/item/organ/tongue/robot/can_speak_in_language(datum/language/dt)
return ..() || electronics_magic
/obj/item/organ/tongue/robot/handle_speech(datum/source, list/speech_args)
speech_args[SPEECH_SPANS] |= SPAN_ROBOT
/obj/item/organ/tongue/fluffy
name = "fluffy tongue"
desc = "OwO what's this?"
icon_state = "tonguefluffy"
taste_sensitivity = 10 // extra sensitive and inquisitive uwu
maxHealth = 35 //Sensitive tongue!
modifies_speech = TRUE
/obj/item/organ/tongue/fluffy/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(copytext(message, 1, 2) != "*")
message = replacetext(message, "ne", "nye")
message = replacetext(message, "nu", "nyu")
message = replacetext(message, "na", "nya")
message = replacetext(message, "no", "nyo")
message = replacetext(message, "ove", "uv")
message = replacetext(message, "l", "w")
message = replacetext(message, "r", "w")
message = lowertext(message)
speech_args[SPEECH_MESSAGE] = message
/obj/item/organ/tongue/cybernetic
name = "cybernetic tongue"
desc = "A state of the art robotic tongue that can detect the pH of anything drank."
icon_state = "tonguecybernetic"
taste_sensitivity = 10
maxHealth = 60 //It's robotic!
organ_flags = ORGAN_SYNTHETIC
/obj/item/organ/tongue/cybernetic/handle_speech(datum/source, list/speech_args)
speech_args[SPEECH_SPANS] |= SPAN_ROBOT
/obj/item/organ/tongue/robot/ipc
name = "positronic voicebox"
say_mod = "beeps"
desc = "A voice synthesizer used by IPCs to smoothly interface with organic lifeforms."
electronics_magic = FALSE
organ_flags = ORGAN_SYNTHETIC
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,89 @@
/datum/surgery/prosthetic_replacement
name = "Prosthetic replacement"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/add_prosthetic)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
requires_bodypart = FALSE //need a missing limb
requires_bodypart_type = 0
/datum/surgery/prosthetic_replacement/can_start(mob/user, mob/living/carbon/target)
if(!iscarbon(target))
return 0
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //can only start if limb is missing
return 1
/datum/surgery_step/add_prosthetic
name = "add prosthetic"
implements = list(/obj/item/bodypart = 100, /obj/item/organ_storage = 100, /obj/item/twohanded/required/chainsaw = 100, /obj/item/melee/synthetic_arm_blade = 100)
time = 32
var/organ_rejection_dam = 0
/datum/surgery_step/add_prosthetic/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(istype(tool, /obj/item/organ_storage))
if(!tool.contents.len)
to_chat(user, "<span class='notice'>There is nothing inside [tool]!</span>")
return -1
var/obj/item/I = tool.contents[1]
if(!isbodypart(I))
to_chat(user, "<span class='notice'>[I] cannot be attached!</span>")
return -1
tool = I
if(istype(tool, /obj/item/bodypart))
var/obj/item/bodypart/BP = tool
if(ismonkey(target))// monkey patient only accept organic monkey limbs
if(BP.status == BODYPART_ROBOTIC || BP.animal_origin != MONKEY_BODYPART)
to_chat(user, "<span class='warning'>[BP] doesn't match the patient's morphology.</span>")
return -1
if(BP.status != BODYPART_ROBOTIC)
organ_rejection_dam = 10
if(ishuman(target))
if(BP.animal_origin)
to_chat(user, "<span class='warning'>[BP] doesn't match the patient's morphology.</span>")
return -1
var/mob/living/carbon/human/H = target
if(H.dna.species.id != BP.species_id)
organ_rejection_dam = 30
if(target_zone == BP.body_zone) //so we can't replace a leg with an arm, or a human arm with a monkey arm.
display_results(user, target, "<span class ='notice'>You begin to replace [target]'s [parse_zone(target_zone)] with [tool]...</span>",
"[user] begins to replace [target]'s [parse_zone(target_zone)] with [tool].",
"[user] begins to replace [target]'s [parse_zone(target_zone)].")
else
to_chat(user, "<span class='warning'>[tool] isn't the right type for [parse_zone(target_zone)].</span>")
return -1
else if(target_zone == BODY_ZONE_L_ARM || target_zone == BODY_ZONE_R_ARM)
display_results(user, target, "<span class='notice'>You begin to attach [tool] onto [target]...</span>",
"[user] begins to attach [tool] onto [target]'s [parse_zone(target_zone)].",
"[user] begins to attach something onto [target]'s [parse_zone(target_zone)].")
else
to_chat(user, "<span class='warning'>[tool] must be installed onto an arm.</span>")
return -1
/datum/surgery_step/add_prosthetic/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(istype(tool, /obj/item/organ_storage))
tool.icon_state = initial(tool.icon_state)
tool.desc = initial(tool.desc)
tool.cut_overlays()
tool = tool.contents[1]
if(istype(tool, /obj/item/bodypart) && user.temporarilyRemoveItemFromInventory(tool))
var/obj/item/bodypart/L = tool
L.attach_limb(target)
if(organ_rejection_dam)
target.adjustToxLoss(organ_rejection_dam)
display_results(user, target, "<span class='notice'>You succeed in replacing [target]'s [parse_zone(target_zone)].</span>",
"[user] successfully replaces [target]'s [parse_zone(target_zone)] with [tool]!",
"[user] successfully replaces [target]'s [parse_zone(target_zone)]!")
return 1
else
var/obj/item/bodypart/L = target.newBodyPart(target_zone, FALSE, FALSE)
L.is_pseudopart = TRUE
L.attach_limb(target)
display_results(user, target, "<span class='notice'>You attach [tool].</span>",
"[user] finishes attaching [tool]!",
"[user] finishes the attachment procedure!")
qdel(tool)
if(istype(tool, /obj/item/twohanded/required/chainsaw))
var/obj/item/mounted_chainsaw/new_arm = new(target)
target_zone == BODY_ZONE_R_ARM ? target.put_in_r_hand(new_arm) : target.put_in_l_hand(new_arm)
return 1
else if(istype(tool, /obj/item/melee/synthetic_arm_blade))
var/obj/item/melee/arm_blade/new_arm = new(target,TRUE,TRUE)
target_zone == BODY_ZONE_R_ARM ? target.put_in_r_hand(new_arm) : target.put_in_l_hand(new_arm)
return 1
+172
View File
@@ -0,0 +1,172 @@
/datum/surgery
var/name = "surgery"
var/desc = "surgery description"
var/status = 1
var/list/steps = list() //Steps in a surgery
var/step_in_progress = 0 //Actively performing a Surgery
var/can_cancel = 1 //Can cancel this surgery after step 1 with cautery
var/list/target_mobtypes = list(/mob/living/carbon/human) //Acceptable Species
var/location = BODY_ZONE_CHEST //Surgery location
var/requires_bodypart_type = BODYPART_ORGANIC //Prevents you from performing an operation on incorrect limbs. 0 for any limb type
var/list/possible_locs = list() //Multiple locations
var/ignore_clothes = 0 //This surgery ignores clothes
var/mob/living/carbon/target //Operation target mob
var/obj/item/bodypart/operated_bodypart //Operable body part
var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing.
var/success_multiplier = 0 //Step success propability multiplier
var/requires_real_bodypart = 0 //Some surgeries don't work on limbs that don't really exist
var/lying_required = TRUE //Does the vicitm needs to be lying down.
var/requires_tech = FALSE
var/replaced_by
/datum/surgery/New(surgery_target, surgery_location, surgery_bodypart)
..()
if(surgery_target)
target = surgery_target
target.surgeries += src
if(surgery_location)
location = surgery_location
if(surgery_bodypart)
operated_bodypart = surgery_bodypart
/datum/surgery/Destroy()
if(target)
target.surgeries -= src
target = null
operated_bodypart = null
return ..()
/datum/surgery/proc/can_start(mob/user, mob/living/patient) //FALSE to not show in list
. = TRUE
if(replaced_by == /datum/surgery)
return FALSE
if(HAS_TRAIT(user, TRAIT_SURGEON) || HAS_TRAIT(user.mind, TRAIT_SURGEON))
if(replaced_by)
return FALSE
else
return TRUE
if(!requires_tech && !replaced_by)
return TRUE
// True surgeons (like abductor scientists) need no instructions
if(requires_tech)
. = FALSE
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
var/obj/item/surgical_processor/SP = locate() in R.module.modules
if(SP)
if (replaced_by in SP.advanced_surgeries)
return .
if(type in SP.advanced_surgeries)
return TRUE
var/turf/T = get_turf(patient)
var/obj/structure/table/optable/table = locate(/obj/structure/table/optable, T)
if(table)
if(!table.computer)
return .
if(table.computer.stat & (NOPOWER|BROKEN))
return .
if(replaced_by in table.computer.advanced_surgeries)
return FALSE
if(type in table.computer.advanced_surgeries)
return TRUE
/datum/surgery/proc/next_step(mob/user, intent)
if(step_in_progress)
return 1
var/try_to_fail = FALSE
if(intent == INTENT_DISARM)
try_to_fail = TRUE
var/datum/surgery_step/S = get_surgery_step()
if(S)
var/obj/item/tool = user.get_active_held_item()
if(S.try_op(user, target, user.zone_selected, tool, src, try_to_fail))
return TRUE
if(iscyborg(user) && user.a_intent != INTENT_HARM) //to save asimov borgs a LOT of heartache
return TRUE
if(tool && tool.item_flags & SURGICAL_TOOL) //Just because you used the wrong tool it doesn't mean you meant to whack the patient with it
to_chat(user, "<span class='warning'>This step requires a different tool!</span>")
return TRUE
/datum/surgery/proc/get_surgery_step()
var/step_type = steps[status]
return new step_type
/datum/surgery/proc/get_surgery_next_step()
if(status < steps.len)
var/step_type = steps[status + 1]
return new step_type
else
return null
/datum/surgery/proc/complete()
SSblackbox.record_feedback("tally", "surgeries_completed", 1, type)
qdel(src)
/datum/surgery/proc/get_propability_multiplier()
var/propability = 0.5
var/turf/T = get_turf(target)
if(locate(/obj/structure/table/optable, T))
propability = 1
else if(locate(/obj/structure/table, T))
propability = 0.8
else if(locate(/obj/structure/bed, T))
propability = 0.7
return propability + success_multiplier
/datum/surgery/advanced
name = "advanced surgery"
requires_tech = TRUE
/obj/item/disk/surgery
name = "Surgery Procedure Disk"
desc = "A disk that contains advanced surgery procedures, must be loaded into an Operating Console."
icon_state = "datadisk1"
materials = list(MAT_METAL=300, MAT_GLASS=100)
var/list/surgeries
/obj/item/disk/surgery/debug
name = "Debug Surgery Disk"
desc = "A disk that contains all existing surgery procedures."
icon_state = "datadisk1"
materials = list(MAT_METAL=300, MAT_GLASS=100)
/obj/item/disk/surgery/debug/Initialize()
. = ..()
surgeries = list()
var/list/req_tech_surgeries = subtypesof(/datum/surgery)
for(var/i in req_tech_surgeries)
var/datum/surgery/beep = i
if(initial(beep.requires_tech))
surgeries += beep
//INFO
//Check /mob/living/carbon/attackby for how surgery progresses, and also /mob/living/carbon/attack_hand.
//As of Feb 21 2013 they are in code/modules/mob/living/carbon/carbon.dm, lines 459 and 51 respectively.
//Other important variables are var/list/surgeries (/mob/living) and var/list/internal_organs (/mob/living/carbon)
// var/list/bodyparts (/mob/living/carbon/human) is the LIMBS of a Mob.
//Surgical procedures are initiated by attempt_initiate_surgery(), which is called by surgical drapes and bedsheets.
//TODO
//specific steps for some surgeries (fluff text)
//more interesting failure options
//randomised complications
//more surgeries!
//add a probability modifier for the state of the surgeon- health, twitching, etc. blindness, god forbid.
//helper for converting a zone_sel.selecting to body part (for damage)
//RESOLVED ISSUES //"Todo" jobs that have been completed
//combine hands/feet into the arms - Hands/feet were removed - RR
//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see possible_locs var - c0
+130
View File
@@ -0,0 +1,130 @@
/datum/surgery_step
var/name
var/list/implements = list() //format is path = probability of success. alternatively
var/implement_type = null //the current type of implement used. This has to be stored, as the actual typepath of the tool may not match the list type.
var/accept_hand = FALSE //does the surgery step require an open hand? If true, ignores implements. Compatible with accept_any_item.
var/accept_any_item = FALSE //does the surgery step accept any item? If true, ignores implements. Compatible with require_hand.
var/time = 10 //how long does the step take?
var/repeatable = FALSE //can this step be repeated? Make shure it isn't last step, or it used in surgery with `can_cancel = 1`. Or surgion will be stuck in the loop
var/list/chems_needed = list() //list of chems needed to complete the step. Even on success, the step will have no effect if there aren't the chems required in the mob.
var/require_all_chems = TRUE //any on the list or all on the list?
var/silicons_obey_prob = FALSE
/datum/surgery_step/proc/try_op(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery, try_to_fail = FALSE)
var/success = FALSE
if(accept_hand)
if(!tool)
success = TRUE
if(iscyborg(user))
success = TRUE
if(accept_any_item)
if(tool && tool_check(user, tool))
success = TRUE
else if(tool)
for(var/key in implements)
var/match = FALSE
if(ispath(key) && istype(tool, key))
match = TRUE
else if(tool.tool_behaviour == key)
match = TRUE
if(match)
implement_type = key
if(tool_check(user, tool))
success = TRUE
break
if(success)
if(target_zone == surgery.location)
if(get_location_accessible(target, target_zone) || surgery.ignore_clothes)
return initiate(user, target, target_zone, tool, surgery, try_to_fail)
else
to_chat(user, "<span class='warning'>You need to expose [target]'s [parse_zone(target_zone)] to perform surgery on it!</span>")
return TRUE //returns TRUE so we don't stab the guy in the dick or wherever.
if(repeatable)
var/datum/surgery_step/next_step = surgery.get_surgery_next_step()
if(next_step)
surgery.status++
if(next_step.try_op(user, target, user.zone_selected, user.get_active_held_item(), surgery))
return TRUE
else
surgery.status--
return FALSE
/datum/surgery_step/proc/initiate(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery, try_to_fail = FALSE)
surgery.step_in_progress = TRUE
var/speed_mod = 1
var/advance = FALSE
if(preop(user, target, target_zone, tool, surgery) == -1)
surgery.step_in_progress = FALSE
return FALSE
if(tool)
speed_mod = tool.toolspeed
if(do_after(user, time * speed_mod, target = target))
var/prob_chance = 100
if(implement_type) //this means it isn't a require hand or any item step.
prob_chance = implements[implement_type]
prob_chance *= surgery.get_propability_multiplier()
if((prob(prob_chance) || (iscyborg(user) && !silicons_obey_prob)) && chem_check(target) && !try_to_fail)
if(success(user, target, target_zone, tool, surgery))
advance = TRUE
else
if(failure(user, target, target_zone, tool, surgery))
advance = TRUE
if(advance && !repeatable)
surgery.status++
if(surgery.status > surgery.steps.len)
surgery.complete()
surgery.step_in_progress = FALSE
return advance
/datum/surgery_step/proc/preop(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to perform surgery on [target]...</span>",
"[user] begins to perform surgery on [target].",
"[user] begins to perform surgery on [target].")
/datum/surgery_step/proc/success(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You succeed.</span>",
"[user] succeeds!",
"[user] finishes.")
return TRUE
/datum/surgery_step/proc/failure(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='warning'>You screw up!</span>",
"<span class='warning'>[user] screws up!</span>",
"[user] finishes.", TRUE) //By default the patient will notice if the wrong thing has been cut
return FALSE
/datum/surgery_step/proc/tool_check(mob/user, obj/item/tool)
return TRUE
/datum/surgery_step/proc/chem_check(mob/living/target)
if(!LAZYLEN(chems_needed))
return TRUE
if(require_all_chems)
. = TRUE
for(var/R in chems_needed)
if(!target.reagents.has_reagent(R))
return FALSE
else
. = FALSE
for(var/R in chems_needed)
if(target.reagents.has_reagent(R))
return TRUE
/datum/surgery_step/proc/get_chem_list()
if(!LAZYLEN(chems_needed))
return
var/list/chems = list()
for(var/R in chems_needed)
var/datum/reagent/temp = GLOB.chemical_reagents_list[R]
if(temp)
var/chemname = temp.name
chems += chemname
return english_list(chems, and_text = require_all_chems ? " and " : " or ")
//Replaces visible_message during operations so only people looking over the surgeon can tell what they're doing, allowing for shenanigans.
/datum/surgery_step/proc/display_results(mob/user, mob/living/carbon/target, self_message, detailed_message, vague_message, target_detailed = FALSE)
var/list/detailed_mobs = get_hearers_in_view(1, user) //Only the surgeon and people looking over his shoulder can see the operation clearly
if(!target_detailed)
detailed_mobs -= target //The patient can't see well what's going on, unless it's something like getting cut
user.visible_message(detailed_message, self_message, vision_distance = 1, ignored_mobs = target_detailed ? null : target)
user.visible_message(vague_message, "", ignored_mobs = detailed_mobs)