From a1aa3ddecfca20b99711821439825786a3318df3 Mon Sep 17 00:00:00 2001 From: cib Date: Wed, 17 Oct 2012 20:08:34 +0200 Subject: [PATCH] Ported limb selection. --- baystation12.dme | 1 + code/game/objects/items/stacks/medical.dm | 4 + .../game/objects/items/stacks/sheets/glass.dm | 7 +- .../items/weapons/surgery_limbattachment.dm | 2 +- code/game/objects/items/weapons/tools.dm | 22 ++++- code/modules/mob/new_player/preferences.dm | 94 +++++++++++++++++++ .../mob/new_player/preferences_setup.dm | 24 ++++- code/modules/mob/new_player/savefile.dm | 5 + code/modules/power/cable.dm | 21 +++++ 9 files changed, 175 insertions(+), 5 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index d2b7b61fcf..c434c87969 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -731,6 +731,7 @@ #include "code\game\objects\items\weapons\RSF.dm" #include "code\game\objects\items\weapons\scrolls.dm" #include "code\game\objects\items\weapons\stunbaton.dm" +#include "code\game\objects\items\weapons\surgery_limbattachment.dm" #include "code\game\objects\items\weapons\surgery_tools.dm" #include "code\game\objects\items\weapons\swords_axes_etc.dm" #include "code\game\objects\items\weapons\table_rack_parts.dm" diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index bf05bf0f9d..5df2b005bc 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -25,6 +25,10 @@ var/mob/living/carbon/human/H = M var/datum/organ/external/affecting = H.get_organ("chest") + if(affecting.status & ORGAN_ROBOT) + user << "\red This isn't useful at all on a robotic limb.." + return 1 + if(istype(user, /mob/living/carbon/human)) var/mob/living/carbon/human/user2 = user affecting = H.get_organ(check_zone(user2.zone_sel.selecting)) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 2f1242cb5d..ed72df614d 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -284,9 +284,12 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.shoes) - var/datum/organ/external/affecting = H.get_organ(pick("l_leg", "r_leg")) + var/datum/organ/external/affecting = H.get_organ(pick("l_foot", "r_foot")) + if(affecting.status & ORGAN_ROBOT) + return + H.Weaken(3) if(affecting.take_damage(5, 0)) H.UpdateDamageIcon() H.updatehealth() - ..() \ No newline at end of file + ..() diff --git a/code/game/objects/items/weapons/surgery_limbattachment.dm b/code/game/objects/items/weapons/surgery_limbattachment.dm index 6457baa9e6..04f0ac5db7 100644 --- a/code/game/objects/items/weapons/surgery_limbattachment.dm +++ b/code/game/objects/items/weapons/surgery_limbattachment.dm @@ -62,7 +62,7 @@ T.status &= ~ORGAN_ATTACHABLE T.status &= ~ORGAN_DESTROYED T.status |= ORGAN_ROBOT - M.update_body() + H.update_body() M.updatehealth() M.UpdateDamageIcon() del(src) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 867ba31053..901a7a270a 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -393,4 +393,24 @@ var/gen_amount = ((world.time-last_gen)/25) reagents += (gen_amount) if(reagents > max_fuel) - reagents = max_fuel \ No newline at end of file + reagents = max_fuel + +/obj/item/weapon/weldingtool/attack(mob/M as mob, mob/user as mob) + if(hasorgans(M)) + var/datum/organ/external/S = M:organs[user.zone_sel.selecting] + if(!(S.status & ORGAN_ROBOT) || user.a_intent != "help") + return ..() + if(S.brute_dam) + S.heal_damage(15,0,0,1) + if(user != M) + user.visible_message("\red You patch some dents on \the [M]'s [S.display_name]",\ + "\red \The [user] patches some dents on \the [M]'s [S.display_name] with \the [src]",\ + "You hear a welder.") + else + user.visible_message("\red You patch some dents on your [S.display_name]",\ + "\red \The [user] patches some dents on their [S.display_name] with \the [src]",\ + "You hear a welder.") + else + user << "Nothing to fix!" + else + return ..() diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index a36cb803d9..9a098946cf 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -296,6 +296,35 @@ datum/preferences dat += "Blood Type: [b_type]
" dat += "Skin Tone: [-s_tone + 35]/220
" + dat += "Limbs: Adjust Limbs
" + for(var/name in organ_data) + var/status = organ_data[name] + var/organ_name = null + switch(name) + if("l_arm") + organ_name = "left arm" + if("r_arm") + organ_name = "right arm" + if("l_leg") + organ_name = "left leg" + if("r_leg") + organ_name = "right leg" + if("l_foot") + organ_name = "left foot" + if("r_foot") + organ_name = "right foot" + if("l_hand") + organ_name = "left hand" + if("r_hand") + organ_name = "right hand" + + if(status == "cyborg") + dat += "\tRobotical [organ_name] prothesis
" + if(status == "amputated") + dat += "\tAmputated [organ_name]
" + dat+="
" + + if(gender == MALE) dat += "Underwear: [underwear_m[underwear]]
" else @@ -934,6 +963,57 @@ datum/preferences sec_record = secmsg SetRecords(user) + if("limbs") + var/limb_name = input(user, "Which limb do you want to change?") as null|anything in list("Left Leg","Right Leg","Left Arm","Right Arm","Left Foot","Right Foot","Left Hand","Right Hand") + if(!limb_name) return + + var/limb = null + var/second_limb = null // if you try to change the arm, the hand should also change + var/third_limb = null // if you try to unchange the hand, the arm should also change + switch(limb_name) + if("Left Leg") + limb = "l_leg" + second_limb = "l_foot" + if("Right Leg") + limb = "r_leg" + second_limb = "r_foot" + if("Left Arm") + limb = "l_arm" + second_limb = "l_hand" + if("Right Arm") + limb = "r_arm" + second_limb = "r_hand" + if("Left Foot") + limb = "l_foot" + third_limb = "l_leg" + if("Right Foot") + limb = "r_foot" + third_limb = "r_leg" + if("Left Hand") + limb = "l_hand" + third_limb = "l_arm" + if("Right Hand") + limb = "r_hand" + third_limb = "r_arm" + + var/new_state = input(user, "What state do you wish the limb to be in?") as null|anything in list("Normal","Amputated","Prothesis") + if(!new_state) return + + switch(new_state) + if("Normal") + organ_data[limb] = null + if(third_limb) + organ_data[third_limb] = null + if("Amputated") + organ_data[limb] = "amputated" + if(second_limb) + organ_data[second_limb] = "amputated" + if("Prothesis") + organ_data[limb] = "cyborg" + if(second_limb) + organ_data[second_limb] = "cyborg" + + else switch(href_list["preference"]) if("gender") @@ -1083,6 +1163,20 @@ datum/preferences character.h_style = h_style character.f_style = f_style + // Destroy/cyborgize organs + for(var/name in organ_data) + var/datum/organ/external/O = character.organs[name] + if(!O) continue + + var/status = organ_data[name] + if(status == "amputated") + O.amputated = 1 + O.status |= ORGAN_DESTROYED + O.destspawn = 1 + else if(status == "cyborg") + O.status |= ORGAN_ROBOT + + switch(UI_style) if("Orange") character.UI = 'icons/mob/screen1_Orange.dmi' diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 5d67b61795..d17daa84c5 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -215,7 +215,29 @@ datum/preferences else if(species == "Skrell") preview_icon = new /icon('icons/effects/species.dmi', "skrell_[g]_s") else - preview_icon = new /icon('icons/mob/human.dmi', "body_[g]_s") + preview_icon = new /icon('human.dmi', "torso_[g]_s") + + preview_icon.Blend(new /icon('human.dmi', "chest_[g]_s"), ICON_OVERLAY) + + if(organ_data["head"] != "amputated") + preview_icon.Blend(new /icon('human.dmi', "head_[g]_s"), ICON_OVERLAY) + + for(var/name in list("l_arm","r_arm","l_leg","r_leg","l_foot","r_foot","l_hand","r_hand")) + // make sure the organ is added to the list so it's drawn + if(organ_data[name] == null) + organ_data[name] = null + + for(var/name in organ_data) + if(organ_data[name] == "amputated") continue + + var/icon/temp = new /icon('human.dmi', "[name]_s") + if(organ_data[name] == "cyborg") + temp.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) + + preview_icon.Blend(temp, ICON_OVERLAY) + + preview_icon.Blend(new /icon('human.dmi', "groin_[g]_s"), ICON_OVERLAY) + // Skin tone if(species == "Human") diff --git a/code/modules/mob/new_player/savefile.dm b/code/modules/mob/new_player/savefile.dm index e63714935b..9f746554ca 100644 --- a/code/modules/mob/new_player/savefile.dm +++ b/code/modules/mob/new_player/savefile.dm @@ -127,6 +127,8 @@ datum/preferences/proc/savefile_save(mob/user) F["slotname"] << src.slot_name F["lobby_music"] << src.lobby_music + F["organ_data"] << src.organ_data + return 1 // loads the savefile corresponding to the mob's ckey @@ -260,6 +262,9 @@ datum/preferences/proc/savefile_load(mob/user) if(isnull(metadata)) metadata = "" + F["organ_data"] >> src.organ_data + if(!src.organ_data) src.organ_data = list() + //NOTE: Conversion things go inside this if statement //When updating the save file remember to add 1 to BOTH the savefile constants //Also take the old conversion things that no longer apply out of this if diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 55973a5e91..857139a694 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -523,3 +523,24 @@ obj/structure/cable/proc/cableColor(var/colorC) icon = 'icons/obj/power_cond_cyan.dmi' if("white") icon = 'icons/obj/power_cond_white.dmi' + + +/obj/item/weapon/cable_coil/attack(mob/M as mob, mob/user as mob) + if(hasorgans(M)) + var/datum/organ/external/S = M:organs[user.zone_sel.selecting] + if(!(S.status & ORGAN_ROBOT) || user.a_intent != "help") + return ..() + if(S.burn_dam > 0) + S.heal_damage(0,15,0,1) + if(user != M) + user.visible_message("\red \The [user] repairs some burn damage on their [S.display_name] with \the [src]",\ + "\red You repair some burn damage on your [S.display_name]",\ + "You hear wires being cut.") + else + user.visible_message("\red \The [user] repairs some burn damage on their [S.display_name] with \the [src]",\ + "\red You repair some burn damage on your [S.display_name]",\ + "You hear wires being cut.") + else + user << "Nothing to fix!" + else + return ..()