Revert "Revert "Synthetics revised""

This reverts commit df2980db46.
This commit is contained in:
jack-fractal
2015-07-10 20:38:24 -04:00
parent b33078ad0e
commit 8f76c3afae
29 changed files with 1756 additions and 1963 deletions
+96 -48
View File
@@ -43,6 +43,10 @@
// how often wounds should be updated, a higher number means less often
var/wound_update_accuracy = 1
var/datum/synthetic_limb_cover/covering = null // paint or synth skin
var/gendered = FALSE
/datum/organ/external/New(var/datum/organ/external/P)
@@ -513,17 +517,36 @@ Note that amputating the affected organ does in fact remove the infection from t
if (open && !clamped && (H && !(H.species.flags & NO_BLOOD))) //things tend to bleed if they are CUT OPEN
status |= ORGAN_BLEEDING
/datum/organ/external/proc/can_take_covering() // is this organ functional enough to take a covering
if (status&(ORGAN_DESTROYED|ORGAN_BROKEN|ORGAN_DEAD))
return
return (burn_dam + brute_dam) <= (max_damage * 0.1) // you get hurt you're going to lose your covering
// new damage icon system
// adjusted to set damage_state to brute/burn code only (without r_name0 as before)
/datum/organ/external/proc/update_icon()
var/n_is = damage_state_text()
if (n_is != damage_state)
damage_state = n_is
return 1
return 0
return TRUE
if (covering) // check to see if we lose the covering
if (covering.coverage==SYNTHETIC_COVERING_WORKING)
if (!can_take_covering()) // if your limbs get badly damaged you lose the covering
covering.coverage = SYNTHETIC_COVERING_DAMAGED
owner.update_body(TRUE)
return TRUE
return FALSE
/datum/organ/external/head/update_icon()
var/result = ..()
if (result)
owner.update_hair()
return result
// new damage icon system
// returns just the brute/burn damage code
/datum/organ/external/proc/damage_state_text()
@@ -550,6 +573,8 @@ Note that amputating the affected organ does in fact remove the infection from t
tbrute = 2
else
tbrute = 3
return "[tbrute][tburn]"
/****************************************************
@@ -804,14 +829,52 @@ Note that amputating the affected organ does in fact remove the infection from t
return 1
return 0
/datum/organ/external/get_icon(var/icon/race_icon, var/icon/deform_icon,gender="")
if (status & ORGAN_ROBOT && !(owner.species && owner.species.flags & IS_SYNTHETIC))
return new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]")
/datum/organ/external/proc/get_icon_key()
if (status & ORGAN_DESTROYED)
return "L" // l for lost
if (status & ORGAN_DEAD)
return "D" // d for dead
if (status & ORGAN_ROBOT)
return get_synthetic_icon_key()
return "G" // regular old limb
if (status & ORGAN_MUTATED)
return new /icon(deform_icon, "[icon_name][gender ? "_[gender]" : ""]")
return new /icon(race_icon, "[icon_name][gender ? "_[gender]" : ""]")
/datum/organ/external/proc/valid_covering()
if (status & ORGAN_ROBOT)
if (covering)
return (covering.coverage) // is our covering working?
return FALSE // if we have no covering at all
return TRUE // squishies always have skin
/datum/organ/external/proc/get_synthetic_icon_key()
if (!covering) // no covering at all, this should not happen
return "R" // regular old robot
return covering.get_icon_key()
/datum/organ/external/proc/get_synthetic_icon()
if (!covering) // no covering at all, this should not happen
return new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][get_gender_string()]")
return covering.get_icon()
/datum/organ/external/proc/get_gender_string()
if (!gendered) // most organs aren't gender specific
return ""
if (owner) // if we're a gender specific organ with an owner
return (owner.gender == FEMALE ? "_f" : "_m")
return "_f"
/datum/organ/external/get_icon(var/icon/race_icon, var/icon/deform_icon, var/list/skin_info)
if (status & ORGAN_ROBOT)
return get_synthetic_icon()
var/icon/result = new /icon((status & ORGAN_MUTATED) ? deform_icon : race_icon, "[icon_name][get_gender_string()]")
if (skin_info["blend"])
result.Blend(skin_info["rgb"],skin_info["mode"])
return result
/datum/organ/external/proc/is_usable()
@@ -867,6 +930,7 @@ Note that amputating the affected organ does in fact remove the infection from t
body_part = UPPER_TORSO
vital = 1
encased = "ribcage"
gendered = TRUE
/datum/organ/external/groin
name = "groin"
@@ -876,6 +940,7 @@ Note that amputating the affected organ does in fact remove the infection from t
min_broken_damage = 30
body_part = LOWER_TORSO
vital = 1
gendered = TRUE
/datum/organ/external/l_arm
name = "l_arm"
@@ -971,16 +1036,8 @@ Note that amputating the affected organ does in fact remove the infection from t
var/disfigured = 0
vital = 1
encased = "skull"
/datum/organ/external/head/get_icon(var/icon/race_icon, var/icon/deform_icon)
if (!owner)
return ..()
var/g = "m"
if(owner.gender == FEMALE) g = "f"
if (status & ORGAN_MUTATED)
. = new /icon(deform_icon, "[icon_name]_[g]")
else
. = new /icon(race_icon, "[icon_name]_[g]")
gendered = TRUE
/datum/organ/external/head/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list())
..(brute, burn, sharp, edge, used_weapon, forbidden_limbs)
@@ -1012,6 +1069,7 @@ obj/item/weapon/organ
icon = 'icons/mob/human_races/r_human.dmi'
var/op_stage = 0
var/list/organs_internal = list()
obj/item/weapon/organ/New(loc, mob/living/carbon/human/H)
..(loc)
@@ -1026,12 +1084,12 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H)
for(var/datum/organ/internal/I in H.internal_organs)
if(I.parent_organ != name)
continue
var/obj/item/organ/current_organ = I.remove()
current_organ.removed(H)
current_organ.loc = src
if(current_organ.organ_data)
organs_internal |= current_organ.organ_data
var/obj/item/organ/new_organ_object = I.remove()
if(new_organ_object && istype(new_organ_object))
new_organ_object.removed(H)
if(new_organ_object.organ_data)
organs_internal |= new_organ_object.organ_data
new_organ_object.loc = src // put the organ inside the severed external organ
// Forming icon for the limb
// Setting base icon for this mob's race
var/icon/base
@@ -1039,24 +1097,13 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H)
base = icon(H.species.icobase)
else
base = icon('icons/mob/human_races/r_human.dmi')
if(base)
//Changing limb's skin tone to match owner
if(!H.species || H.species.flags & HAS_SKIN_TONE)
if (H.s_tone >= 0)
base.Blend(rgb(H.s_tone, H.s_tone, H.s_tone), ICON_ADD)
else
base.Blend(rgb(-H.s_tone, -H.s_tone, -H.s_tone), ICON_SUBTRACT)
if(base)
//Changing limb's skin color to match owner
if(!H.species || H.species.flags & HAS_SKIN_COLOR)
base.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), ICON_ADD)
if(base) // handle skin colours
var/list/skin_info = H.skin_colour_info() // get the skin tone info
base.Blend(skin_info["rgb"],skin_info["mode"])
icon = base
set_dir(SOUTH)
src.transform = turn(src.transform, rand(70,130))
/****************************************************
EXTERNAL ORGAN ITEMS DEFINES
@@ -1090,8 +1137,7 @@ obj/item/weapon/organ/head
name = "head"
icon_state = "head_m"
var/mob/living/carbon/brain/brainmob
var/brain_op_stage = 0
/obj/item/weapon/organ/head/posi
name = "robotic head"
@@ -1136,13 +1182,15 @@ obj/item/weapon/organ/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(2)
if(istype(W,/obj/item/weapon/hemostat))
if(contents.len)
var/obj/item/removing = pick(contents)
var/obj/item/organ/removing = pick(contents)
var/exposed_result
removing.loc = get_turf(user.loc)
if(!(user.l_hand && user.r_hand))
user.put_in_hands(removing)
if(istype(removing,/obj/item/organ))
if(istype(removing))
var/obj/item/organ/removed_organ = removing
organs_internal -= removed_organ.organ_data
exposed_result = removing.exposed_to_the_world()
if(!(user.l_hand && user.r_hand))
user.put_in_hands((isnull(exposed_result)) ? removing : exposed_result)
user.visible_message("<span class='danger'><b>[user]</b> extracts [removing] from [src] with [W]!")
else
user.visible_message("<span class='danger'><b>[user]</b> fishes around fruitlessly in [src] with [W].")
+19
View File
@@ -249,6 +249,25 @@
parent_organ = "head"
removed_type = /obj/item/organ/brain
vital = 1
/datum/organ/internal/brain/robot // brains for shells
var/machine_brain_type=null
/datum/organ/internal/brain/robot/proc/create_robot_brain_replacement(var/target,var/new_location)
var/obj/item/device/mmi/new_mmi
if (machine_brain_type=="Posibrain")
new_mmi = new/obj/item/device/mmi/posibrain()
new_mmi.name = "positronic brain ([owner])"
new_mmi.brainmob.name = owner.real_name
new_mmi.brainmob.real_name = owner.real_name
else
new_mmi = new/obj/item/device/mmi()
new_mmi.transfer_identity(target)
new_mmi.loc = new_location
return new_mmi
/datum/organ/internal/brain/xeno
removed_type = /obj/item/organ/brain/xeno
+5
View File
@@ -180,6 +180,11 @@
msg_admin_attack("[user.name] ([user.ckey]) removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
target.death()
/obj/item/organ/proc/exposed_to_the_world() // this is only useful for organs that change when actually removed from the body
return
/obj/item/organ/appendix/removed(var/mob/living/target,var/mob/living/user)
..()
+362
View File
@@ -0,0 +1,362 @@
/*
We need to mix blending into limb object code, this will slow shit down a lot.
*/
var/SYNTHETIC_COVERING_WORKING=1
var/SYNTHETIC_COVERING_DAMAGED=0
datum/synthetic_limb_cover
var/coverage //
var/colour=null//
var/datum/organ/external/limb_datum // the limb in question
var/obj/item/robot_parts/limb_item // also the limb in question (if dismembered)
var/main_icon = 'icons/mob/human_races/robotic.dmi'
var/damage_icon = 'icons/mob/human_races/robotic.dmi'
var/icon_key_type="BAD"
var/hair_species=null
var/eyes_state = "blank_eyes"
var/tail = null
datum/synthetic_limb_cover/New( var/datum/organ/external/datum_target=null,var/input_colour=null)
limb_datum=datum_target
coverage=SYNTHETIC_COVERING_WORKING // start working
colour= (input_colour) ? input_colour : rgb(128,128,128)
datum/synthetic_limb_cover/proc/get_icon() // default mechanical limbs return robo versions
var/icon/temp = new /icon((coverage ? main_icon : damage_icon), "[limb_datum.icon_name][limb_datum.get_gender_string()]") // only add a gender if it's necessary
var/icon/result = icon(temp)
result.Blend(colour, ICON_ADD)
return result
datum/synthetic_limb_cover/proc/repair()
coverage = SYNTHETIC_COVERING_WORKING
update_icon()
datum/synthetic_limb_cover/proc/damage()
coverage = SYNTHETIC_COVERING_DAMAGED
update_icon()
datum/synthetic_limb_cover/proc/set_colour(input_colour)
colour=input_colour
datum/synthetic_limb_cover/proc/update_icon()
if (limb_datum)
if (limb_datum.owner)
limb_datum.owner.update_body()
datum/synthetic_limb_cover/proc/get_icon_key() // this is going to wreck the icon cache but to do custom colour per limb this is necessary
return "SYNTH:[icon_key_type]:[colour]:[coverage]"
datum/synthetic_limb_cover/paint
main_icon = 'icons/mob/human_races/r_machine.dmi'
icon_key_type = "Paint"
hair_species = "Machine"
datum/synthetic_limb_cover/skin
main_icon = 'icons/mob/human_races/r_human_grey.dmi'
icon_key_type = "Skin"
hair_species = "Human"
eyes_state="eyes_s"
datum/synthetic_limb_cover/fur
main_icon = 'icons/mob/human_races/r_tajaran.dmi'
icon_key_type = "Fur"
hair_species = "Tajaran"
eyes_state="eyes_s"
tail = "tajtail"
datum/synthetic_limb_cover/scales
main_icon = 'icons/mob/human_races/r_lizard.dmi'
icon_key_type = "Scales"
hair_species = "Unathi"
eyes_state="eyes_s"
tail = "sogtail"
var/list/limb_covering_references
/proc/get_limb_covering_references()
if (isnull(limb_covering_references))
limb_covering_references = list()
for(var/skin_type in typesof(/datum/synthetic_limb_cover)-/datum/synthetic_limb_cover)
var/datum/synthetic_limb_cover/temp_cover = new skin_type()
limb_covering_references[skin_type]=temp_cover
return limb_covering_references
var/list/limb_covering_names
/proc/get_limb_covering_names()
if (isnull(limb_covering_names))
limb_covering_names=list("None")
var/list/refs=get_limb_covering_references()
for(var/skin_type in refs)
var/datum/synthetic_limb_cover/temp=refs[skin_type]
limb_covering_names.Add(temp.icon_key_type)
return limb_covering_names
var/list/limb_covering_list
/proc/get_limb_covering_list()
if(isnull(limb_covering_list))
limb_covering_list=list("None"=null)
var/list/refs=get_limb_covering_references()
for(var/skin_type in refs)
var/datum/synthetic_limb_cover/temp=refs[skin_type]
limb_covering_list[temp.icon_key_type]=skin_type
return limb_covering_list
/obj/item/weapon/synth_skin_spray
name = "robot paint gun"
desc = "A compact hand-held spray gun for painting synthetics."
icon = 'icons/obj/synthskin.dmi'
icon_state = "spray_can_icon"
force = 5.0
throwforce = 7.0
w_class = 2.0
flags = FPRINT | TABLEPASS
slot_flags = SLOT_BELT
origin_tech = "materials=1;engineering=1"
attack_verb = list("bashed", "battered", "bludgeoned", "whacked")
var/icon/spray_can_icon = null
var/obj/item/weapon/synth_skin_cartridge/cartridge = null
var/construction_time = 20
var/list/construction_cost = list("metal"=400,"glass"=100)
New()
update_icon()
proc/create_tinted_icon(icon_name, icon_state_name, target_colour)
var/icon/result = new /icon(icon_name,icon_state_name)
result.Blend(target_colour, ICON_ADD) // if we have charges left, show the colour, otherwise grey
return result
/obj/item/weapon/synth_skin_spray/proc/paint_icon()
return create_tinted_icon(icon,"installed_paint_skin",cartridge.paint_colour)
/obj/item/weapon/synth_skin_spray/proc/hair_icon()
return create_tinted_icon(icon,"installed_paint_hair",cartridge.hair_colour)
/obj/item/weapon/synth_skin_spray/proc/cartridge_icon()
return new/icon(icon,"[cartridge.installed_icon]")
/obj/item/weapon/synth_skin_spray/proc/charges_icon()
return new/icon(icon,"charges_[cartridge.current_charges]")
/obj/item/weapon/synth_skin_spray/update_icon()
underlays.Cut()
overlays.Cut()
if (cartridge)
underlays += cartridge_icon()
underlays += paint_icon()
underlays += hair_icon()
overlays += charges_icon()
/obj/item/weapon/synth_skin_spray/attack(mob/M, mob/user)
switch (user.a_intent)
if ("hurt")
..(M,user)
playsound(loc, "swing_hit", 50, 1, -1)
if("help")
return try_to_paint(M,user)
/obj/item/weapon/synth_skin_spray/proc/allowed_to_paint(mob/living/carbon/human/human_target, mob/user, target)
if (!cartridge)
user << "<span class='notice'>You cannot paint anything with an empty spray gun.</span>"
if (human_target!=user)
human_target << "<span class='notice'>[user] waves the spray gun vaguely toward you but the gun is empty.</span>"
return
if (!cartridge.current_charges)
user << "<span class='notice'>You click the [src] but your [cartridge] is empty.</span>"
if (human_target!=user)
human_target << "<span class='notice'>[user] clicks the [src] at you but their [cartridge] is empty.</span>"
return
if(!istype(human_target,/mob/living/carbon/human))
user << "<span class='notice'>You can't figure out a way you could apply paint to [human_target].</span>"
if (human_target!=user)
human_target << "<span class='notice'>[user] stares at you and appears to decide that they're unable to paint you.</span>"
return
var/datum/organ/external/datum_target=human_target.get_organ(target)
if(!datum_target || (!datum_target.can_take_covering()))
user << "<span class='notice'>You cannot paint [human_target]'s [target] because it's too badly damaged.</span>"
if (human_target!=user)
human_target << "<span class='notice'>[user] goes to paint your [target] but it's too badly damaged.</span>"
return
if (!(datum_target.status && ORGAN_ROBOT))
if (human_target!=user)
user << "<span class='notice'>You go to paint [human_target]'s [target] but realize that it isn't robotic..</span>"
human_target << "<span class='notice'>[user] looks like they are about to try to paint your [target] before realizing that it isn't robotic.</span>"
else
user << "<span class='notice'>Your [target] isn't robotic, so you decide not to try to paint it.</span>"
return
return TRUE
/obj/item/weapon/synth_skin_spray/proc/try_to_paint(mob/living/carbon/human/human_target, mob/user)
var/target=user.zone_sel.selecting
if (target in list("mouth","eyes")) // we don't paint these individually
target="head"
if (allowed_to_paint(human_target,user,target))
paint_organ(human_target, user, human_target.get_organ(target))
/obj/item/weapon/synth_skin_spray/proc/paint_organ(mob/M, mob/user, datum/organ/external/datum_target)
if (datum_target.covering) // if we've already got a covering, remove it
del(datum_target.covering)
datum_target.covering = new cartridge.covering_path(datum_target,cartridge.paint_colour)
var/mob/living/carbon/human/human_target = M
if (istype(datum_target,/datum/organ/external/head))
var/list/hair_colour_as_list = htmlcolour_to_values(cartridge.hair_colour)
human_target.r_hair = hair_colour_as_list[1] // byond starts at 1! WHYYYYYYY?!!!! -jf
human_target.g_hair = hair_colour_as_list[2]
human_target.b_hair = hair_colour_as_list[3]
human_target.r_facial = hair_colour_as_list[1]
human_target.g_facial = hair_colour_as_list[2]
human_target.b_facial = hair_colour_as_list[3]
human_target.h_style=random_hair_style(human_target.gender,human_target.species)
human_target.update_hair()
if (istype(datum_target,/datum/organ/external/groin)) // this is a bit reductive, but whatever
var/gender_string = input(user,"What sex do you want this shell to appear as?") in list("Male","Female")
human_target.gender = (gender_string=="Male") ? MALE : FEMALE
human_target.update_body(TRUE)
cartridge.current_charges--
user.visible_message("<span class='notice'>[user] has covered [M]'s [datum_target.display_name] with [cartridge.covering_description].</span>")
update_icon()
/obj/item/weapon/synth_skin_spray/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/synth_skin_cartridge))
if (!cartridge)
user.drop_item()
W.loc = src
cartridge=W
user << "<span class='notice'>You insert \the [W] into [src].</span>"
update_icon()
else
user << "<span class='notice'>You will have to remove the other cartridge first."
/obj/item/weapon/synth_skin_spray/attack_hand(mob/user)
var/obj/item/inactive_item = user.get_inactive_hand()
if (src==inactive_item) // if we are clicking on this with our off hand
if(src.cartridge)
src.cartridge.add_fingerprint(user)
user.put_in_active_hand(src.cartridge)
user << "<span class='notice'>You remove \the [src.cartridge] from the [src]."
src.cartridge.update_icon()
src.cartridge = null
update_icon()
return
return ..()
/obj/item/weapon/synth_skin_cartridge
name = "ERROR"
desc = "You should not be reading this."
icon = 'icons/obj/synthskin.dmi'
icon_state = "bottle_paint"
var/installed_icon = "installed_paint"
flags = FPRINT | TABLEPASS
var/max_charges = 9
var/current_charges = 9
var/construction_time = 20
var/paint_colour = null
var/hair_colour = null
var/covering_description = "paint"
var/list/construction_cost = list("metal"=200,"glass"=50)
var/covering_path = "/datum/synthetic_limb_cover/paint"
origin_tech = "materials=1;engineering=1"
New()
paint_colour = rgb(128,128,128) // starts on red
hair_colour = rgb(128,128,128) // starts black
update_icon()
/obj/item/weapon/synth_skin_cartridge/proc/get_charges_string()
return " It looks like there are [current_charges] charges left."
/obj/item/weapon/synth_skin_cartridge/examine(mob/user)
user << src.desc + get_charges_string()
/obj/item/weapon/synth_skin_cartridge/attack_self(mob/user)
pick_colours(user)
/obj/item/weapon/synth_skin_cartridge/proc/pick_colours(mob/user)
var/new_paint = input(user, "Choose the primary colour you want to paint.", "Synthetic Painting") as color|null
if(new_paint)
paint_colour = new_paint
var/new_hair = input(user, "Choose the hair colour you want to paint.", "Synthetic Painting") as color|null
if(new_hair)
hair_colour = new_hair
update_icon()
/obj/item/weapon/synth_skin_cartridge/proc/paint_icon()
return create_tinted_icon(icon,"bottle_paint_skin",paint_colour)
/obj/item/weapon/synth_skin_cartridge/proc/hair_icon()
return create_tinted_icon(icon,"bottle_paint_hair",hair_colour)
/obj/item/weapon/synth_skin_cartridge/update_icon()
overlays.Cut()
if (current_charges > 0)
overlays += paint_icon()
overlays += hair_icon()
/obj/item/weapon/synth_skin_cartridge/paint
name = "synthetic paint cartridge"
desc = "A small cartridge for robotic paint."
/obj/item/weapon/synth_skin_cartridge/skin
name = "synthetic skin cartridge"
desc = "A small cartridge filled with pressurized synthetic skin. It's covered in thin grease."
icon_state = "bottle_skin"
installed_icon = "installed_skin"
covering_path = "/datum/synthetic_limb_cover/skin"
origin_tech = "materials=1;engineering=1;biotech=2"
covering_description = "synthetic skin"
/obj/item/weapon/synth_skin_cartridge/fur
name = "synthetic fur cartridge"
desc = "A small cartridge filled with pressurized synthetic fur. Dozens of fine hairs are stuck to it with static."
icon_state = "bottle_fur"
installed_icon = "installed_fur"
covering_path = "/datum/synthetic_limb_cover/fur"
origin_tech = "materials=1;engineering=1;biotech=3"
covering_description = "synthetic fur"
/obj/item/weapon/synth_skin_cartridge/scales
name = "synthetic scales cartridge"
desc = "A small cartridge filled with pressurized synthetic scales. It makes a dry crunching noise when you shake it."
icon_state = "bottle_scales"
installed_icon = "installed_scales"
covering_path = "/datum/synthetic_limb_cover/scales"
origin_tech = "materials=1;engineering=1;biotech=3"
covering_description = "synthetic scales"