Files
Bubberstation/code/modules/surgery/organs/organ_external.dm
phil235 8b11d87b1d Merge branch 'master' of https://github.com/tgstation/-tg-station into VisionUpdateRefactor
Conflicts:
	code/ATMOSPHERICS/components/unary_devices/cryo.dm
	code/_onclick/hud/alert.dm
	code/_onclick/hud/hud.dm
	code/datums/mutations.dm
	code/datums/wires/robot.dm
	code/game/atoms.dm
	code/game/gamemodes/blob/overmind.dm
	code/game/machinery/alarm.dm
	code/game/machinery/machinery.dm
	code/game/machinery/suit_storage_unit.dm
	code/game/objects/items/weapons/tanks/tanks.dm
	code/game/objects/items/weapons/tools.dm
	code/game/objects/structures/morgue.dm
	code/modules/admin/verbs/adminjump.dm
	code/modules/atmospherics/machinery/atmosmachinery.dm
	code/modules/mob/inventory.dm
	code/modules/mob/living/carbon/alien/humanoid/death.dm
	code/modules/mob/living/carbon/alien/larva/death.dm
	code/modules/mob/living/carbon/brain/death.dm
	code/modules/mob/living/carbon/carbon.dm
	code/modules/mob/living/carbon/human/death.dm
	code/modules/mob/living/carbon/human/human.dm
	code/modules/mob/living/carbon/human/human_damage.dm
	code/modules/mob/living/carbon/human/life.dm
	code/modules/mob/living/carbon/human/species.dm
	code/modules/mob/living/carbon/human/species_types.dm
	code/modules/mob/living/carbon/life.dm
	code/modules/mob/living/carbon/monkey/death.dm
	code/modules/mob/living/life.dm
	code/modules/mob/living/living.dm
	code/modules/mob/living/silicon/ai/ai.dm
	code/modules/mob/living/silicon/ai/death.dm
	code/modules/mob/living/silicon/ai/life.dm
	code/modules/mob/living/silicon/pai/death.dm
	code/modules/mob/living/silicon/pai/pai.dm
	code/modules/mob/living/silicon/robot/death.dm
	code/modules/mob/living/silicon/robot/life.dm
	code/modules/mob/living/silicon/robot/robot.dm
	code/modules/mob/living/silicon/silicon.dm
	code/modules/mob/living/simple_animal/guardian/guardian.dm
	code/modules/mob/login.dm
	code/modules/mob/mob.dm
	code/modules/projectiles/gun.dm
	code/modules/reagents/chemistry/reagents/blob_reagents.dm
	tgstation.dme
2016-02-04 14:34:45 +01:00

189 lines
4.4 KiB
Plaintext

/obj/item/organ
name = "organ"
icon = 'icons/obj/surgery.dmi'
var/mob/living/carbon/owner = null
var/status = ORGAN_ORGANIC
//Old Datum Limbs:
// code/modules/unused/limbs.dm
/obj/item/organ/limb
name = "limb"
var/body_part = null
var/brutestate = 0
var/burnstate = 0
var/brute_dam = 0
var/burn_dam = 0
var/max_damage = 0
var/list/embedded_objects = list()
/obj/item/organ/limb/chest
name = "chest"
desc = "why is it detached..."
icon_state = "chest"
max_damage = 200
body_part = CHEST
/obj/item/organ/limb/head
name = "head"
desc = "what a way to get a head in life..."
icon_state = "head"
max_damage = 200
body_part = HEAD
/obj/item/organ/limb/l_arm
name = "l_arm"
desc = "why is it detached..."
icon_state = "l_arm"
max_damage = 75
body_part = ARM_LEFT
/obj/item/organ/limb/l_leg
name = "l_leg"
desc = "why is it detached..."
icon_state = "l_leg"
max_damage = 75
body_part = LEG_LEFT
/obj/item/organ/limb/r_arm
name = "r_arm"
desc = "why is it detached..."
icon_state = "r_arm"
max_damage = 75
body_part = ARM_RIGHT
/obj/item/organ/limb/r_leg
name = "r_leg"
desc = "why is it detached..."
icon_state = "r_leg"
max_damage = 75
body_part = LEG_RIGHT
/obj/item/organ/severedtail
name = "tail"
desc = "A severed tail."
icon_state = "severedtail"
color = "#161"
var/markings = "Smooth"
//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/organ/limb/proc/take_damage(brute, burn)
if(owner && (owner.status_flags & GODMODE))
return 0 //godmode
brute = max(brute,0)
burn = max(burn,0)
if(status == ORGAN_ROBOTIC) //This makes robolimbs not damageable by chems and makes it stronger
brute = max(0, brute - 5)
burn = max(0, burn - 4)
var/can_inflict = max_damage - (brute_dam + burn_dam)
if(!can_inflict)
return 0
if((brute + burn) < can_inflict)
brute_dam += brute
burn_dam += burn
else
if(brute > 0)
if(burn > 0)
brute = round( (brute/(brute+burn)) * can_inflict, 1 )
burn = can_inflict - brute //gets whatever damage is left over
brute_dam += brute
burn_dam += burn
else
brute_dam += can_inflict
else
if(burn > 0)
burn_dam += can_inflict
else
return 0
if(owner)
owner.updatehealth()
return update_organ_icon()
//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/organ/limb/proc/heal_damage(brute, burn, robotic)
if(robotic && status != ORGAN_ROBOTIC) // This makes organic limbs not heal when the proc is in Robotic mode.
brute = max(0, brute - 3)
burn = max(0, burn - 3)
if(!robotic && status == ORGAN_ROBOTIC) // This makes robolimbs not healable by chems.
brute = max(0, brute - 3)
burn = max(0, burn - 3)
brute_dam = max(brute_dam - brute, 0)
burn_dam = max(burn_dam - burn, 0)
if(owner)
owner.updatehealth()
return update_organ_icon()
//Returns total damage...kinda pointless really
/obj/item/organ/limb/proc/get_damage()
return brute_dam + burn_dam
//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/organ/limb/proc/update_organ_icon()
if(status == ORGAN_ORGANIC) //Robotic limbs show no damage - RR
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 1
return 0
//Returns a display name for the organ
/obj/item/organ/limb/proc/getDisplayName() //Added "Chest" and "Head" just in case, this may not be needed
switch(name)
if("l_leg")
return "left leg"
if("r_leg")
return "right leg"
if("l_arm")
return "left arm"
if("r_arm")
return "right arm"
if("chest")
return "chest"
if("head")
return "head"
else
return name
//Remove all embedded objects from all limbs on the human mob
/mob/living/carbon/human/proc/remove_all_embedded_objects()
var/turf/T = get_turf(src)
for(var/obj/item/organ/limb/L in organs)
for(var/obj/item/I in L.embedded_objects)
L.embedded_objects -= I
I.loc = T
clear_alert("embeddedobject")
/mob/living/carbon/human/proc/has_embedded_objects()
. = 0
for(var/obj/item/organ/limb/L in organs)
for(var/obj/item/I in L.embedded_objects)
return 1