diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 2e488ab427..f30e4096ab 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -245,8 +245,10 @@ client body += "" body += "" body += "" + body += "" if(ishuman(D)) body += "" + body += "" body += "" body += "" body += "" @@ -731,6 +733,32 @@ client usr << "Mob doesn't exist anymore" return holder.Topic(href, list("makeai"=href_list["makeai"])) + else if (href_list["setmutantrace"]) + var/mob/living/carbon/human/H = locate(href_list["setmutantrace"]) + if(!istype(H)) + usr << "This can only be done to objects of type /mob/living/carbon/human" + return + if(!src.holder) + usr << "You are not an administrator." + return + var/new_mutantrace = input("Please choose a new mutantrace","Mutantrace",null) as null|anything in list("NONE","golem","lizard","metroid","plant") + switch(new_mutantrace) + if(null) return + if("NONE") new_mutantrace = "" + if(!H || !istype(H)) + usr << "Mob doesn't exist anymore" + return + H.mutantrace = new_mutantrace + H.update_mutantrace() + else if (href_list["regenerateicons"]) + var/mob/M = locate(href_list["regenerateicons"]) + if(!istype(M)) + usr << "This can only be done to objects of type /mob" + return + if(!src.holder) + usr << "You are not an administrator." + return + M.regenerate_icons() else if (href_list["adjustDamage"] && href_list["mobToDamage"]) var/mob/M = locate(href_list["mobToDamage"]) var/Text = locate(href_list["adjustDamage"]) diff --git a/code/datums/spells/genetic.dm b/code/datums/spells/genetic.dm index 804853e44f..dc71047abd 100644 --- a/code/datums/spells/genetic.dm +++ b/code/datums/spells/genetic.dm @@ -21,9 +21,11 @@ for(var/x in mutations) target.mutations.Add(x) target.disabilities |= disabilities + target.update_mutations() //update target's mutation overlays spawn(duration) for(var/x in mutations) target.mutations.Remove(x) target.disabilities &= ~disabilities + target.update_mutations() return \ No newline at end of file diff --git a/code/defines/mob/living/carbon/alien.dm b/code/defines/mob/living/carbon/alien.dm index 60b38a20c0..cf2fe173f5 100644 --- a/code/defines/mob/living/carbon/alien.dm +++ b/code/defines/mob/living/carbon/alien.dm @@ -7,7 +7,6 @@ gender = NEUTER var/storedPlasma = 250 - var/alien_invis = 0.0 var/max_plasma = 500 alien_talk_understand = 1 diff --git a/code/defines/mob/living/carbon/alien_humanoid.dm b/code/defines/mob/living/carbon/alien_humanoid.dm index af03496ff6..fa620bc19c 100644 --- a/code/defines/mob/living/carbon/alien_humanoid.dm +++ b/code/defines/mob/living/carbon/alien_humanoid.dm @@ -2,54 +2,45 @@ name = "alien" icon_state = "alien_s" - var/obj/item/clothing/suit/wear_suit = null - var/obj/item/clothing/head/head = null + var/obj/item/clothing/suit/wear_suit = null //TODO: necessary? Are they even used? ~Carn + var/obj/item/clothing/head/head = null // var/obj/item/weapon/r_store = null var/obj/item/weapon/l_store = null + var/alien_invis = 0 + var/caste = "" + update_icon = 1 - var/icon/stand_icon = null - var/icon/lying_icon = null - var/icon/resting_icon = null - var/icon/running_icon = null - - var/last_b_state = 1.0 - - var/image/face_standing = null - var/image/face_lying = null - - var/image/damageicon_standing = null - var/image/damageicon_lying = null /mob/living/carbon/alien/humanoid/hunter name = "alien hunter" - + caste = "h" health = 150 storedPlasma = 100 max_plasma = 150 - icon_state = "alien_s" + icon_state = "alienh_s" /mob/living/carbon/alien/humanoid/sentinel name = "alien sentinel" - + caste = "s" health = 125 storedPlasma = 100 max_plasma = 250 - icon_state = "alien_s" + icon_state = "aliens_s" /mob/living/carbon/alien/humanoid/drone name = "alien drone" - + caste = "d" health = 100 - icon_state = "alien_s" + icon_state = "aliend_s" /mob/living/carbon/alien/humanoid/queen name = "alien queen" - + caste = "q" health = 250 - icon_state = "queen_s" + icon_state = "alienq_s" nopush = 1 + /mob/living/carbon/alien/humanoid/rpbody update_icon = 0 - voice_message = "says" say_message = "says" \ No newline at end of file diff --git a/code/defines/mob/living/carbon/monkey.dm b/code/defines/mob/living/carbon/monkey.dm index 34e36db72e..1a2fe15a78 100644 --- a/code/defines/mob/living/carbon/monkey.dm +++ b/code/defines/mob/living/carbon/monkey.dm @@ -7,6 +7,7 @@ icon_state = "monkey1" gender = NEUTER pass_flags = PASSTABLE + update_icon = 0 ///no need to call regenerate_icon var/obj/item/weapon/card/id/wear_id = null // Fix for station bounced radios -- Skie diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 5d894c02e5..3525f9e34f 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -281,10 +281,6 @@ var/mob/mymob = null var/list/adding = null var/list/other = null - var/list/intents = null - var/list/mov_int = null - var/list/mon_blo = null - var/list/m_ints = null var/obj/screen/druggy = null var/vimpaired = null var/obj/screen/alien_view = null @@ -293,7 +289,6 @@ var/list/darkMask = null var/obj/screen/r_hand_hud_object = null var/obj/screen/l_hand_hud_object = null - var/list/obj/screen/intent_small_hud_objects = null var/show_intent_icons = 0 var/list/obj/screen/hotkeybuttons = null var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) diff --git a/code/defines/obj/toy.dm b/code/defines/obj/toy.dm index e5a7150672..9aff243978 100644 --- a/code/defines/obj/toy.dm +++ b/code/defines/obj/toy.dm @@ -370,11 +370,12 @@ var/obj/item/toy/snappop/M = new /obj/item/toy/snappop(src) if (user.hand) user.l_hand = M + user.update_inv_l_hand() else user.r_hand = M + user.update_inv_r_hand() M.loc = user M.layer = 20 - user.update_clothing() user << "You take a snap pop out of the box." amount-- else diff --git a/code/game/algorithm.dm b/code/game/algorithm.dm index 00feb69bdc..d4ad2261c4 100644 --- a/code/game/algorithm.dm +++ b/code/game/algorithm.dm @@ -51,24 +51,25 @@ proc/countJob(rank) jobCount++ return jobCount -/mob/living/carbon/human/var/const/slot_back = 1 -/mob/living/carbon/human/var/const/slot_wear_mask = 2 -/mob/living/carbon/human/var/const/slot_handcuffed = 3 -/mob/living/carbon/human/var/const/slot_l_hand = 4 -/mob/living/carbon/human/var/const/slot_r_hand = 5 -/mob/living/carbon/human/var/const/slot_belt = 6 -/mob/living/carbon/human/var/const/slot_wear_id = 7 -/mob/living/carbon/human/var/const/slot_ears = 8 -/mob/living/carbon/human/var/const/slot_glasses = 9 -/mob/living/carbon/human/var/const/slot_gloves = 10 -/mob/living/carbon/human/var/const/slot_head = 11 -/mob/living/carbon/human/var/const/slot_shoes = 12 -/mob/living/carbon/human/var/const/slot_wear_suit = 13 -/mob/living/carbon/human/var/const/slot_w_uniform = 14 -/mob/living/carbon/human/var/const/slot_l_store = 15 -/mob/living/carbon/human/var/const/slot_r_store = 16 -/mob/living/carbon/human/var/const/slot_s_store = 17 -/mob/living/carbon/human/var/const/slot_in_backpack = 18 +//TODO: these could be defines +/mob/living/carbon/human/var/const/slot_back = 1 +/mob/living/carbon/human/var/const/slot_wear_mask = 2 +/mob/living/carbon/human/var/const/slot_handcuffed = 3 +/mob/living/carbon/human/var/const/slot_l_hand = 4 +/mob/living/carbon/human/var/const/slot_r_hand = 5 +/mob/living/carbon/human/var/const/slot_belt = 6 +/mob/living/carbon/human/var/const/slot_wear_id = 7 +/mob/living/carbon/human/var/const/slot_ears = 8 +/mob/living/carbon/human/var/const/slot_glasses = 9 +/mob/living/carbon/human/var/const/slot_gloves = 10 +/mob/living/carbon/human/var/const/slot_head = 11 +/mob/living/carbon/human/var/const/slot_shoes = 12 +/mob/living/carbon/human/var/const/slot_wear_suit = 13 +/mob/living/carbon/human/var/const/slot_w_uniform = 14 +/mob/living/carbon/human/var/const/slot_l_store = 15 +/mob/living/carbon/human/var/const/slot_r_store = 16 +/mob/living/carbon/human/var/const/slot_s_store = 17 +/mob/living/carbon/human/var/const/slot_in_backpack = 18 /mob/living/carbon/human/proc/equip_in_one_of_slots(obj/item/W, list/slots, del_on_fail = 1) for (var/slot in slots) @@ -89,15 +90,15 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.back = W - update_clothing() + update_inv_back() return if(W.slot_flags & SLOT_ID) - if(!src.wear_id) + if(!src.wear_id && src.w_uniform) if( src.get_active_hand() == W ) src.u_equip(W) src.wear_id = W - update_clothing() + update_inv_wear_id() return if(W.slot_flags & SLOT_ICLOTHING) @@ -105,7 +106,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.w_uniform = W - update_clothing() + update_inv_w_uniform() return if(W.slot_flags & SLOT_OCLOTHING) @@ -113,7 +114,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.wear_suit = W - update_clothing() + update_inv_wear_suit() return if(W.slot_flags & SLOT_MASK) @@ -121,7 +122,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.wear_mask = W - update_clothing() + update_inv_wear_mask() return if(W.slot_flags & SLOT_HEAD) @@ -129,7 +130,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.head = W - update_clothing() + update_inv_head() return if(W.slot_flags & SLOT_FEET) @@ -137,7 +138,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.shoes = W - update_clothing() + update_inv_shoes() return if(W.slot_flags & SLOT_GLOVES) @@ -145,7 +146,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.gloves = W - update_clothing() + update_inv_gloves() return if(W.slot_flags & SLOT_EARS) @@ -153,7 +154,7 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.ears = W - update_clothing() + update_inv_ears() return if(W.slot_flags & SLOT_EYES) @@ -161,15 +162,15 @@ proc/countJob(rank) if( src.get_active_hand() == W ) src.u_equip(W) src.glasses = W - update_clothing() + update_inv_glasses() return if(W.slot_flags & SLOT_BELT) - if(!src.belt) + if(!src.belt && w_uniform) if( src.get_active_hand() == W ) src.u_equip(W) src.belt = W - update_clothing() + update_inv_belt() return //Suit storage @@ -183,7 +184,7 @@ proc/countJob(rank) if(confirm) src.u_equip(W) src.s_store = W - update_clothing() + update_inv_s_store() return //Pockets @@ -192,13 +193,13 @@ proc/countJob(rank) if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) u_equip(W) l_store = W - update_clothing() + update_inv_pockets() return if(!src.r_store) if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) u_equip(W) r_store = W - update_clothing() + update_inv_pockets() return @@ -215,70 +216,87 @@ proc/countJob(rank) if(slot_back) if(!src.back) src.back = W + update_inv_back(0) equipped = 1 if(slot_wear_mask) if(!src.wear_mask) src.wear_mask = W + update_inv_wear_mask(0) equipped = 1 if(slot_handcuffed) if(!src.handcuffed) src.handcuffed = W + update_inv_handcuffed(0) equipped = 1 if(slot_l_hand) if(!src.l_hand) src.l_hand = W + update_inv_l_hand(0) equipped = 1 if(slot_r_hand) if(!src.r_hand) src.r_hand = W + update_inv_r_hand(0) equipped = 1 if(slot_belt) if(!src.belt) src.belt = W + update_inv_belt(0) equipped = 1 if(slot_wear_id) if(!src.wear_id) src.wear_id = W + update_inv_wear_id(0) equipped = 1 if(slot_ears) if(!src.ears) src.ears = W + update_inv_ears(0) equipped = 1 if(slot_glasses) if(!src.glasses) src.glasses = W + update_inv_glasses(0) equipped = 1 if(slot_gloves) if(!src.gloves) src.gloves = W + update_inv_gloves(0) equipped = 1 if(slot_head) if(!src.head) src.head = W + update_inv_head(0) equipped = 1 if(slot_shoes) if(!src.shoes) src.shoes = W + update_inv_shoes(0) equipped = 1 if(slot_wear_suit) if(!src.wear_suit) src.wear_suit = W + update_inv_wear_suit(0) equipped = 1 if(slot_w_uniform) if(!src.w_uniform) src.w_uniform = W + update_inv_w_uniform(0) equipped = 1 if(slot_l_store) if(!src.l_store) src.l_store = W + update_inv_pockets(0) equipped = 1 if(slot_r_store) if(!src.r_store) src.r_store = W + update_inv_pockets(0) equipped = 1 if(slot_s_store) if(!src.s_store) src.s_store = W + update_inv_s_store(0) equipped = 1 if(slot_in_backpack) if (src.back && istype(src.back, /obj/item/weapon/storage/backpack)) diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index c40c72bd39..4a890eba3f 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -233,6 +233,7 @@ if(blood_DNA[H.dna.unique_enzymes]) return 0 //already bloodied with this blood. Cannot add more. blood_DNA[H.dna.unique_enzymes] = H.dna.b_type + H.update_inv_gloves() //handles bloody hands overlays and updating return 1 //we applied blood to the item return @@ -331,7 +332,7 @@ del(fingerprints) if(istype(src, /mob/living/carbon/human)) var/mob/living/carbon/human/M = src - M.update_clothing() + M.update_inv_gloves() //handles bloody hands too return /atom/MouseDrop(atom/over_object as mob|obj|turf|area) @@ -422,8 +423,8 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl //Attack self if (W == src && usr.stat == 0) - spawn (0) - W.attack_self(usr) +// spawn (0) //causes runtimes under heavy lag + W.attack_self(usr) return //Attackby, attack_hand, afterattack, etc. can only be done once every 1 second, unless an object has the NODELAY or USEDELAY flags set @@ -490,7 +491,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl var/in_range = in_range(src, human) || src.loc == human if (in_range) - if ( !human.restrained() ) + if (!( human.restrained() || human.lying )) if (W) attackby(W,human) if (W) @@ -761,8 +762,12 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // ------- ATTACK SELF ------- if (W == src && usr.stat == 0) - spawn (0) - W.attack_self(usr) +// spawn (0) //would cause a runtime if W was deconstructed during a lagspike + W.attack_self(usr) + if(usr.hand) + usr.update_inv_l_hand() //update in-hand overlays + else + usr.update_inv_r_hand() return // ------- PARALYSIS, STUN, WEAKENED, DEAD, (And not AI) ------- @@ -914,7 +919,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl // ------- TESTS ABOVE DETERMINED YOU CANNOT REACH THE TILE ------- return 0 - if (!( usr.restrained() )) + if (!( usr.restrained() || usr.lying )) // ------- YOU ARE NOT REASTRAINED ------- if (W) diff --git a/code/game/dna.dm b/code/game/dna.dm index febd4711a6..483d6b7254 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -362,8 +362,8 @@ H.h_style = hair.icon_state H.hair_style = hair - H.update_face() H.update_body() + H.update_hair() return 1 else @@ -459,7 +459,6 @@ if (W==H.w_uniform) // will be teared continue H.drop_from_slot(W) - M.update_clothing() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -514,6 +513,7 @@ for (var/obj/item/weapon/implant/I in implants) I.loc = O I.implanted = O +// O.update_icon = 1 //queue a full icon update at next life() call del(M) return @@ -528,7 +528,6 @@ if(!connected) for(var/obj/item/W in (Mo.contents-implants)) Mo.drop_from_slot(W) - M.update_clothing() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -595,11 +594,12 @@ for (var/obj/item/weapon/implant/I in implants) I.loc = O I.implanted = O +// O.update_icon = 1 //queue a full icon update at next life() call del(M) return //////////////////////////////////////////////////////////// Monkey Block - if (M) - M.update_clothing() + if(M) + M.update_icon = 1 //queue a full icon update at next life() call return null /////////////////////////// DNA MISC-PROCS diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 40f701d6b1..35937854c1 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -256,11 +256,10 @@ usr << "Our genes cry out!" var/list/implants = list() //Try to preserve implants. - for(var/obj/item/weapon/W in usr) - if (istype(W, /obj/item/weapon/implant)) - implants += W + for(var/obj/item/weapon/implant/W in usr) + implants += W - usr.update_clothing() + usr.regenerate_icons() usr.monkeyizing = 1 usr.canmove = 0 usr.icon = null @@ -346,7 +345,7 @@ for (var/obj/item/weapon/implant/I in usr) //Still preserving implants implants += I - usr.update_clothing() + usr.regenerate_icons() usr.monkeyizing = 1 usr.canmove = 0 usr.icon = null @@ -414,7 +413,7 @@ return for(var/obj/item/W in src) usr.drop_from_slot(W) - usr.update_clothing() + usr.regenerate_icons() usr.monkeyizing = 1 usr.canmove = 0 usr.icon = null diff --git a/code/game/gamemodes/events/ninja_equipment.dm b/code/game/gamemodes/events/ninja_equipment.dm index c1c2e31100..5c483c2c8d 100644 --- a/code/game/gamemodes/events/ninja_equipment.dm +++ b/code/game/gamemodes/events/ninja_equipment.dm @@ -1,3 +1,5 @@ +//For the love of god,space out your code! This is a nightmare to read. + //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 /* @@ -151,7 +153,7 @@ ________________________________________________________________________________ //=======//INITIALIZE//=======// /obj/item/clothing/suit/space/space_ninja/proc/ninitialize(delay = s_delay, mob/living/carbon/human/U = loc) - if(U.mind&&U.mind.assigned_role=="MODE"&&!s_initialized&&!s_busy)//Shouldn't be busy... but anything is possible I guess. + if(U.mind && U.mind.assigned_role=="MODE" && !s_initialized && !s_busy)//Shouldn't be busy... but anything is possible I guess. s_busy = 1 for(var/i,i<7,i++) switch(i) @@ -169,7 +171,7 @@ ________________________________________________________________________________ unlock_suit() break lock_suit(U,1)//Check for icons. - U.update_clothing() + U.regenerate_icons() U << "\blue Linking neural-net interface...\nPattern \green GREEN\blue, continuing operation." if(4) U << "\blue VOID-shift device status: ONLINE.\nCLOAK-tech device status: ONLINE." @@ -228,7 +230,7 @@ ________________________________________________________________________________ blade_check(U,2) remove_equip_verbs() unlock_suit() - U.update_clothing() + U.regenerate_icons() sleep(delay) s_busy = 0 return @@ -589,7 +591,7 @@ ________________________________________________________________________________ U << "\blue Power nodes re-routed. \nLimiter unlocked." if(3) grant_kamikaze(U)//Give them verbs and change variables as necessary. - U.update_clothing()//Update their clothing. + U.regenerate_icons()//Update their clothing. ninjablade()//Summon two energy blades. message_admins("\blue [U.key] used KAMIKAZE mode.", 1)//Let the admins know. s_busy = 0 @@ -869,6 +871,7 @@ ________________________________________________________________________________ spawn(0) anim(U.loc,U,'mob.dmi',,"cloak",,U.dir) s_active=!s_active + U.update_icons() //update their icons U << "\blue You are now invisible to normal detection." for(var/mob/O in oviewers(U)) O.show_message("[U.name] vanishes into thin air!",1) @@ -880,6 +883,7 @@ ________________________________________________________________________________ spawn(0) anim(U.loc,U,'mob.dmi',,"uncloak",,U.dir) s_active=!s_active + U.update_icons() //update their icons U << "\blue You are now visible." for(var/mob/O in oviewers(U)) O.show_message("[U.name] appears from thin air!",1) diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index b1d1fb1d86..56a3537239 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -368,9 +368,11 @@ if (usr.r_hand == R) usr.u_equip(R) usr.r_hand = T + usr.update_inv_r_hand() else usr.u_equip(R) usr.l_hand = T + usr.update_inv_l_hand() R.loc = T T.layer = 20 T.set_frequency(initial(T.frequency)) diff --git a/code/game/jobs/job/civilian_chaplain.dm b/code/game/jobs/job/civilian_chaplain.dm index be8c830895..b05a875fae 100644 --- a/code/game/jobs/job/civilian_chaplain.dm +++ b/code/game/jobs/job/civilian_chaplain.dm @@ -128,7 +128,7 @@ if(T.icon_state == "carpetsymbol") T.dir = 2 - H:update_clothing() // so that it updates the bible's item_state in his hand + H.update_inv_l_hand() // so that it updates the bible's item_state in his hand switch(input(H,"Look at your bible - is this what you want?") in list("Yes","No")) if("Yes") diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index da15764efe..6073200122 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -251,7 +251,7 @@ var/global/datum/controller/occupations/job_master new /obj/item/weapon/storage/box/survival(BPK) H.equip_if_possible(BPK, H.slot_back,1) - + H.regenerate_icons() return 1 diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 94067e9351..e8b7ed1091 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -376,9 +376,11 @@ if (user.r_hand == T) user.u_equip(T) user.r_hand = B + user.update_inv_r_hand() else user.u_equip(T) user.l_hand = B + user.update_inv_l_hand() B.layer = 20 user << "You add the tiles into the empty toolbox. They stick oddly out the top." del(T) @@ -392,9 +394,11 @@ if (user.r_hand == W) user.u_equip(W) user.r_hand = B + user.update_inv_r_hand() else user.u_equip(W) user.l_hand = B + user.update_inv_l_hand() B.created_name = src.created_name B.layer = 20 user << "You add the sensor to the toolbox and tiles!" @@ -416,6 +420,8 @@ var/obj/machinery/bot/floorbot/A = new /obj/machinery/bot/floorbot if(user.r_hand == src || user.l_hand == src) A.loc = user.loc + user.update_inv_l_hand(0) + user.update_inv_l_hand(1) else A.loc = src.loc A.name = src.created_name diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 7da6c575d0..b2fa15b646 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -557,9 +557,11 @@ if (user.r_hand == S) user.u_equip(S) user.r_hand = A + user.update_inv_r_hand() else user.u_equip(S) user.l_hand = A + user.update_inv_l_hand() A.layer = 20 user << "You add the robot arm to the first aid kit" del(S) diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm index 0eb925c467..d66d077b64 100644 --- a/code/game/machinery/bots/mulebot.dm +++ b/code/game/machinery/bots/mulebot.dm @@ -325,8 +325,10 @@ cell.layer = 20 if(usr.hand) usr.l_hand = cell + usr.update_inv_l_hand() else usr.r_hand = cell + usr.update_inv_r_hand() cell.add_fingerprint(usr) cell.updateicon() diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm index f4de191c57..be223776f7 100644 --- a/code/game/machinery/bots/secbot.dm +++ b/code/game/machinery/bots/secbot.dm @@ -719,9 +719,11 @@ Auto Patrol: []"}, if(user.r_hand == S) user.u_equip(S) user.r_hand = A + user.update_inv_r_hand() else user.u_equip(S) user.l_hand = A + user.update_inv_l_hand() A.layer = 20 user << "You add the signaler to the helmet." del(S) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 81dbf1144c..219eedc247 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -198,9 +198,8 @@ if(se) src.occupant.dna.struc_enzymes = se randmutb(src.occupant) //Sometimes the clones come out wrong. - src.occupant:update_face() - src.occupant:update_body() src.occupant:mutantrace = mrace + src.occupant:update_mutantrace() src.occupant:suiciding = 0 src.attempting = 0 return 1 diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 2cf9c04052..aed268e15c 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -792,10 +792,10 @@ About the new airlock wires panel: for(var/mob/M in viewers(src, null)) M << "\red [user] headbutts the airlock." var/datum/organ/external/affecting = H.get_organ("head") - affecting.take_damage(10, 0) H.Stun(8) H.Weaken(5) - H.UpdateDamageIcon() + if(affecting.take_damage(10, 0)) + H.UpdateDamageIcon() else for(var/mob/M in viewers(src, null)) M << "\red [user] headbutts the airlock. Good thing they're wearing a helmet." diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm index 696a1135f5..ee872939f1 100644 --- a/code/game/machinery/hydroponics.dm +++ b/code/game/machinery/hydroponics.dm @@ -934,11 +934,9 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) updateappearance(podman, ui) if (se) podman.dna.struc_enzymes = se - podman:update_face() - podman:update_body() - if(!prob(potency)) //if it fails, plantman! podman.mutantrace = "plant" + podman.update_mutantrace() else //else, one packet of seeds. maybe two var/seed_count = 1 diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 52b79c05f3..d218e76985 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -128,8 +128,10 @@ cell.layer = 20 if(usr.hand) usr.l_hand = cell + usr.update_inv_l_hand() else usr.r_hand = cell + usr.update_inv_r_hand() cell.add_fingerprint(usr) cell.updateicon() diff --git a/code/game/magic/cultist/runes.dm b/code/game/magic/cultist/runes.dm index 2acad64c7d..3e1b695970 100644 --- a/code/game/magic/cultist/runes.dm +++ b/code/game/magic/cultist/runes.dm @@ -784,7 +784,7 @@ var/list/sacrificed = list() return fizzle() cultist.loc = src.loc cultist.lying = 1 - cultist.update_clothing() + cultist.regenerate_icons() for(var/mob/living/carbon/human/C in orange(1,src)) if(iscultist(C)) C.say("N'ath reth sh'yro eth d'rekkathnor!") diff --git a/code/game/mecha/combat/combat.dm b/code/game/mecha/combat/combat.dm index 906b4a505d..901868c281 100644 --- a/code/game/mecha/combat/combat.dm +++ b/code/game/mecha/combat/combat.dm @@ -44,12 +44,13 @@ var/datum/organ/external/temp = H.get_organ(pick("chest", "chest", "chest", "head")) if(temp) + var/update = 0 switch(damtype) if("brute") H.Paralyse(1) - temp.take_damage(rand(force/2, force), 0) + update |= temp.take_damage(rand(force/2, force), 0) if("fire") - temp.take_damage(0, rand(force/2, force)) + update |= temp.take_damage(0, rand(force/2, force)) if("tox") if(H.reagents) if(H.reagents.get_reagent_amount("carpotoxin") + force < force*2) @@ -58,7 +59,7 @@ H.reagents.add_reagent("cryptobiolin", force) else return - H.UpdateDamageIcon() + if(update) H.UpdateDamageIcon() H.updatehealth() else diff --git a/code/game/objects/alien/facehugger.dm b/code/game/objects/alien/facehugger.dm index d2285f00b5..b38935224a 100644 --- a/code/game/objects/alien/facehugger.dm +++ b/code/game/objects/alien/facehugger.dm @@ -151,7 +151,7 @@ var/const/MAX_ACTIVE_TIME = 600 layer = 20 target.wear_mask = src - target.update_clothing() + target.update_inv_wear_mask() GoIdle() //so it doesn't jump the people that tear it off @@ -178,7 +178,7 @@ var/const/MAX_ACTIVE_TIME = 600 else for(var/mob/O in viewers(target,null)) O.show_message("\red \b [src] violates [target]'s face!", 1) - + target.update_inv_wear_mask() return proc/GoActive() diff --git a/code/game/objects/devices/shields.dm b/code/game/objects/devices/shields.dm index 050cf5f65c..7ec4906252 100644 --- a/code/game/objects/devices/shields.dm +++ b/code/game/objects/devices/shields.dm @@ -53,4 +53,6 @@ /obj/item/weapon/cloaking_device/emp_act(severity) active = 0 icon_state = "shield0" + if(ismob(loc)) + loc:update_icons() ..() diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index e0d64f9ede..86a3835121 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -122,8 +122,10 @@ var/obj/item/candle/W = new /obj/item/candle(user) if(user.hand) user.l_hand = W + user.update_inv_l_hand() else user.r_hand = W + user.update_inv_r_hand() W.layer = 20 else return ..() diff --git a/code/game/objects/items/clothing.dm b/code/game/objects/items/clothing.dm index 8e00c6c556..3343bf831c 100644 --- a/code/game/objects/items/clothing.dm +++ b/code/game/objects/items/clothing.dm @@ -96,9 +96,7 @@ THERMAL GLASSES src.force = 3 src.damtype = "fire" src.icon_state = "cake1" - processing_objects.Add(src) - else src.force = null src.damtype = "brute" @@ -176,6 +174,7 @@ THERMAL GLASSES icon_state = A.icon_state item_state = A.item_state color = A.color + usr.update_inv_w_uniform() //so our overlays update. /obj/item/clothing/under/chameleon/emp_act(severity) name = "psychedelic" @@ -208,6 +207,7 @@ THERMAL GLASSES /obj/item/clothing/under/verb/toggle() set name = "Toggle Suit Sensors" set category = "Object" + set src in usr var/mob/M = usr if (istype(M, /mob/dead/)) return if (usr.stat) return @@ -251,7 +251,9 @@ THERMAL GLASSES /obj/item/clothing/head/helmet/welding/verb/toggle() set category = "Object" set name = "Adjust welding mask" - if(usr.canmove && usr.stat != 2 && !usr.restrained()) + set src in usr + + if(usr.canmove && !usr.stat && !usr.restrained()) if(src.up) src.up = !src.up src.see_face = !src.see_face @@ -266,6 +268,7 @@ THERMAL GLASSES flags_inv &= ~(HIDEMASK|HIDEEARS|HIDEEYES) icon_state = "weldingup" usr << "You push the mask up out of your face." + usr.update_inv_head() //so our mob-overlays update /obj/item/clothing/head/cargosoft/dropped() src.icon_state = "cargosoft" @@ -275,18 +278,22 @@ THERMAL GLASSES /obj/item/clothing/head/cargosoft/verb/flip() set category = "Object" set name = "Flip cap" - src.flipped = !src.flipped - if(src.flipped) - icon_state = "cargosoft_flipped" - usr << "You flip the hat backwards." - else - icon_state = "cargosoft" - usr << "You flip the hat back in normal position." + set src in usr + if(usr.canmove && !usr.stat && !usr.restrained()) + src.flipped = !src.flipped + if(src.flipped) + icon_state = "cargosoft_flipped" + usr << "You flip the hat backwards." + else + icon_state = "cargosoft" + usr << "You flip the hat back in normal position." + usr.update_inv_head() //so our mob-overlays update /obj/item/clothing/shoes/magboots/verb/toggle() set name = "Toggle Magboots" set category = "Object" + set src in usr if(src.magpulse) src.flags &= ~NOSLIP src.slowdown = SHOES_SLOWDOWN @@ -299,6 +306,7 @@ THERMAL GLASSES src.magpulse = 1 icon_state = "magboots1" usr << "You enable the mag-pulse traction system." + usr.update_inv_shoes() //so our mob-overlays update /obj/item/clothing/shoes/magboots/examine() set src in view() @@ -311,6 +319,11 @@ THERMAL GLASSES /obj/item/clothing/suit/suit/verb/toggle() set name = "Toggle Jacket Buttons" set category = "Object" + set src in usr + + if(!usr.canmove || usr.stat || usr.restrained()) + return 0 + if(src.icon_state == "suitjacket_blue_open") src.icon_state = "suitjacket_blue" src.item_state = "suitjacket_blue" @@ -320,62 +333,65 @@ THERMAL GLASSES src.item_state = "suitjacket_blue_open" usr << "You unbutton the suit jacket." else - usr << "Sorry! The suit you're wearing doesn't have buttons!" + usr << "You button-up some imaginary buttons on your [src]." + return + usr.update_inv_wear_suit() /obj/item/clothing/suit/labcoat/verb/toggle() set name = "Toggle Labcoat Buttons" set category = "Object" + set src in usr if(!usr.canmove || usr.stat || usr.restrained()) return 0 - else - - if(src.icon_state == "labcoat_open") + switch(icon_state) + if("labcoat_open") src.icon_state = "labcoat" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat") + if("labcoat") src.icon_state = "labcoat_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labcoat_cmo_open") + if("labcoat_cmo_open") src.icon_state = "labcoat_cmo" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat_cmo") + if("labcoat_cmo") src.icon_state = "labcoat_cmo_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labcoat_gen_open") + if("labcoat_gen_open") src.icon_state = "labcoat_gen" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat_gen") + if("labcoat_gen") src.icon_state = "labcoat_gen_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labcoat_chem_open") + if("labcoat_chem_open") src.icon_state = "labcoat_chem" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat_chem") + if("labcoat_chem") src.icon_state = "labcoat_chem_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labcoat_vir_open") + if("labcoat_vir_open") src.icon_state = "labcoat_vir" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat_vir") + if("labcoat_vir") src.icon_state = "labcoat_vir_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labcoat_tox_open") + if("labcoat_tox_open") src.icon_state = "labcoat_tox" usr << "You button up the labcoat." - else if(src.icon_state == "labcoat_tox") + if("labcoat_tox") src.icon_state = "labcoat_tox_open" usr << "You unbutton the labcoat." - else if(src.icon_state == "labgreen_open") + if("labgreen_open") src.icon_state = "labgreen" usr << "You button up the labcoat." - else if(src.icon_state == "labgreen") + if("labgreen") src.icon_state = "labgreen_open" usr << "You unbutton the labcoat." - else - usr << "Sorry! The suit you're wearing doesn't have buttons!" + usr << "You attempt to button-up the velcro on your [src], before promptly realising how retarded you are." + return + usr.update_inv_wear_suit() //so our overlays update /obj/item/clothing/head/ushanka/attack_self(mob/user as mob) if(src.icon_state == "ushankadown") diff --git a/code/game/objects/items/food.dm b/code/game/objects/items/food.dm index cce942fa72..b6510892d1 100644 --- a/code/game/objects/items/food.dm +++ b/code/game/objects/items/food.dm @@ -62,14 +62,14 @@ MONKEY CUBE BOX P.loc = usr P.layer = 20 usr.l_hand = P - usr.update_clothing() + usr.update_inv_l_hand() usr << "You take a donut out of the box." break else if (!usr.r_hand) P.loc = usr P.layer = 20 usr.r_hand = P - usr.update_clothing() + usr.update_inv_r_hand() usr << "You take a donut out of the box." break else @@ -138,7 +138,7 @@ MONKEY CUBE BOX P.layer = 20 usr.l_hand = P P = null - usr.update_clothing() + usr.update_inv_l_hand() usr << "You take an egg out of the box." break else if (!usr.r_hand) @@ -146,7 +146,7 @@ MONKEY CUBE BOX P.layer = 20 usr.r_hand = P P = null - usr.update_clothing() + usr.update_inv_r_hand() usr << "You take an egg out of the box." break else @@ -189,11 +189,12 @@ MONKEY CUBE BOX var/obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/M = new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src) if (user.hand) user.l_hand = M + user.update_inv_l_hand() else user.r_hand = M + user.update_inv_r_hand() M.loc = user M.layer = 20 - user.update_clothing() user << "You take a monkey cube out of the box." amount-- else diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index 47b4555b20..3e3b8787df 100644 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -119,15 +119,15 @@ src.pickup(user) user.lastDblClick = world.time + 2 user.next_move = world.time + 2 - - if (user.hand) - user.l_hand = src - else - user.r_hand = src src.loc = user src.layer = 20 add_fingerprint(user) - user.update_clothing() + if (user.hand) + user.l_hand = src + user.update_inv_l_hand() + else + user.r_hand = src + user.update_inv_r_hand() return @@ -158,14 +158,14 @@ src.pickup(user) user.lastDblClick = world.time + 2 user.next_move = world.time + 2 - - if (user.hand) - user.l_hand = src - else - user.r_hand = src src.loc = user src.layer = 20 - user.update_clothing() + if (user.hand) + user.l_hand = src + user.update_inv_l_hand() + else + user.r_hand = src + user.update_inv_r_hand() return /obj/item/attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -361,7 +361,8 @@ ) if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(7) + if(affecting.take_damage(7)) + M:UpdateDamageIcon() else M.take_organ_damage(7) M.eye_blurry += rand(3,4) diff --git a/code/game/objects/items/tk_grab.dm b/code/game/objects/items/tk_grab.dm index 02e5c30730..aaeb21e821 100644 --- a/code/game/objects/items/tk_grab.dm +++ b/code/game/objects/items/tk_grab.dm @@ -33,10 +33,12 @@ user.l_hand = focus else user.r_hand = focus + focus.loc = user focus.layer = 20 add_fingerprint(user) - user.update_clothing() + user.update_inv_l_hand(0) + user.update_inv_r_hand() spawn(0) del(src) return diff --git a/code/game/objects/items/weapons/cameras.dm b/code/game/objects/items/weapons/cameras.dm index f5ed93ad71..df127565e1 100644 --- a/code/game/objects/items/weapons/cameras.dm +++ b/code/game/objects/items/weapons/cameras.dm @@ -17,12 +17,13 @@ if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 839af17d01..2b4d7d143d 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -96,13 +96,13 @@ FINGERPRINT CARD usr.l_hand = P P.loc = usr P.layer = 20 - usr.update_clothing() + usr.update_inv_l_hand() else if (!( usr.r_hand )) usr.r_hand = P P.loc = usr P.layer = 20 - usr.update_clothing() + usr.update_inv_r_hand() src.add_fingerprint(usr) P.add_fingerprint(usr) src.update() diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index ff0fd5fe5f..48671fe55a 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -74,8 +74,10 @@ ZIPPO var/obj/item/weapon/match/W = new /obj/item/weapon/match(user) if(user.hand) user.l_hand = W + user.update_inv_l_hand() else user.r_hand = W + user.update_inv_r_hand() W.layer = 20 else return ..() @@ -156,6 +158,11 @@ ZIPPO var/obj/item/weapon/match/M = W if(M.lit > 0) light("\red [user] lights their [name] with their [W].") + + //can't think of any other way to update the overlays :< + user.update_inv_wear_mask(0) + user.update_inv_l_hand(0) + user.update_inv_r_hand(1) return @@ -202,10 +209,12 @@ ZIPPO src.smoketime-- if(src.smoketime < 1) new type_butt(location) + processing_objects.Remove(src) if(ismob(src.loc)) var/mob/living/M = src.loc M << "\red Your [src.name] goes out." - processing_objects.Remove(src) + M.u_equip(src) //un-equip it so the overlays can update + M.update_icons() del(src) return if(location) @@ -423,8 +432,10 @@ ZIPPO reagents.trans_to(W, reagents.total_volume) if(user.hand) user.l_hand = W + user.update_inv_l_hand() else user.r_hand = W + user.update_inv_r_hand() W.layer = 20 else return ..() diff --git a/code/game/objects/items/weapons/grenades.dm b/code/game/objects/items/weapons/grenades.dm index 287ab8712e..6c46cfb7e7 100644 --- a/code/game/objects/items/weapons/grenades.dm +++ b/code/game/objects/items/weapons/grenades.dm @@ -227,6 +227,7 @@ CRITTER GRENADE else if (M.ear_damage >= 5) M << "\red Your ears start to ring!" + M.update_icons() prime() // Prime now just handles the two loops that query for people in lockers and people who can see it. var/turf/T = get_turf(src) diff --git a/code/game/objects/items/weapons/hydroponics.dm b/code/game/objects/items/weapons/hydroponics.dm index e88798c6df..81e95cd4f8 100644 --- a/code/game/objects/items/weapons/hydroponics.dm +++ b/code/game/objects/items/weapons/hydroponics.dm @@ -86,7 +86,8 @@ Craftables (Cob pipes, potato batteries, pumpkinheads) if(istype(user, /mob/living/carbon/human)) var/organ = ((user.hand ? "l_":"r_") + "arm") var/datum/organ/external/affecting = user.get_organ(organ) - affecting.take_damage(0,force) + if(affecting.take_damage(0,force)) + user.UpdateDamageIcon() else user.take_organ_damage(0,force) @@ -109,7 +110,8 @@ Craftables (Cob pipes, potato batteries, pumpkinheads) if(istype(user, /mob/living/carbon/human)) var/organ = ((user.hand ? "l_":"r_") + "arm") var/datum/organ/external/affecting = user.get_organ(organ) - affecting.take_damage(0,force) + if(affecting.take_damage(0,force)) + user.UpdateDamageIcon() else user.take_organ_damage(0,force) if(prob(50)) diff --git a/code/game/objects/items/weapons/implants/implantpad.dm b/code/game/objects/items/weapons/implants/implantpad.dm index 3c3e910c54..f8cf0ad0d7 100644 --- a/code/game/objects/items/weapons/implants/implantpad.dm +++ b/code/game/objects/items/weapons/implants/implantpad.dm @@ -28,13 +28,16 @@ if ((src.case && (user.l_hand == src || user.r_hand == src))) if (user.hand) user.l_hand = src.case + user.update_inv_l_hand() else user.r_hand = src.case + user.update_inv_r_hand() src.case.loc = user src.case.layer = 20 src.case.add_fingerprint(user) src.case = null - user.update_clothing() + user.update_inv_l_hand(0) + user.update_inv_r_hand() src.add_fingerprint(user) update() else diff --git a/code/game/objects/items/weapons/surgery_tools.dm b/code/game/objects/items/weapons/surgery_tools.dm index 23a30680f3..db7c226bc2 100644 --- a/code/game/objects/items/weapons/surgery_tools.dm +++ b/code/game/objects/items/weapons/surgery_tools.dm @@ -69,7 +69,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15) + if(affecting.take_damage(15)) + M:UpdateDamageIcon() M.updatehealth() else M.take_organ_damage(15) @@ -155,7 +156,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15) + if(affecting.take_damage(15)) + M:UpdateDamageIcon() M.updatehealth() else M.take_organ_damage(15) @@ -230,7 +232,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15) + if(affecting.take_damage(15)) + M:UpdateDamageIcon() M.updatehealth() else M.take_organ_damage(15) @@ -329,7 +332,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15) + if(affecting.take_damage(15)) + M:UpdateDamageIcon() else M.take_organ_damage(15) @@ -374,7 +378,8 @@ CIRCULAR SAW user << "\red You nick an artery!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(75) + if(affecting.take_damage(75)) + M:UpdateDamageIcon() else M.take_organ_damage(75) @@ -429,7 +434,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15) + if(affecting.take_damage(15)) + M:UpdateDamageIcon() else M.take_organ_damage(15) @@ -498,7 +504,8 @@ CIRCULAR SAW user << "\red You mess up!" if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(40) + if(affecting.take_damage(40)) + M:UpdateDamageIcon() M.updatehealth() else M.take_organ_damage(40) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index c49911dbf1..2db777649f 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -380,7 +380,7 @@ WELDINGTOOOL "You cut \the [M]'s restraints with \the [src]!",\ "You hear cable being cut.") M.handcuffed = null - M.update_clothing() + M.update_inv_handcuffed() return else ..() \ No newline at end of file diff --git a/code/game/objects/items/weapons/wrappingpaper.dm b/code/game/objects/items/weapons/wrappingpaper.dm index 7770ea23b6..c38797744f 100644 --- a/code/game/objects/items/weapons/wrappingpaper.dm +++ b/code/game/objects/items/weapons/wrappingpaper.dm @@ -84,8 +84,10 @@ PHOTOGRAPHS src.gift.loc = user if (user.hand) user.l_hand = src.gift + user.update_inv_l_hand() else user.r_hand = src.gift + user.update_inv_r_hand() src.gift.layer = 20 src.gift.add_fingerprint(user) del(src) @@ -125,8 +127,10 @@ PHOTOGRAPHS var/obj/item/device/flash/W = new /obj/item/device/flash( M ) if (M.hand) M.l_hand = W + M.update_inv_l_hand() else M.r_hand = W + M.update_inv_r_hand() W.layer = 20 W.add_fingerprint(M) //SN src = null @@ -136,8 +140,10 @@ PHOTOGRAPHS var/obj/item/weapon/gun/energy/laser/W = new /obj/item/weapon/gun/energy/laser( M ) if (M.hand) M.l_hand = W + M.update_inv_l_hand() else M.r_hand = W + M.update_inv_r_hand() W.layer = 20 W.add_fingerprint(M) //SN src = null @@ -147,8 +153,10 @@ PHOTOGRAPHS var/obj/item/weapon/gun/energy/taser/W = new /obj/item/weapon/gun/energy/taser( M ) if (M.hand) M.l_hand = W + M.update_inv_l_hand() else M.r_hand = W + M.update_inv_r_hand() W.layer = 20 W.add_fingerprint(M) //SN src = null @@ -158,8 +166,10 @@ PHOTOGRAPHS var/obj/item/weapon/melee/energy/sword/W = new /obj/item/weapon/melee/energy/sword( M ) if (M.hand) M.l_hand = W + M.update_inv_l_hand() else M.r_hand = W + M.update_inv_r_hand() W.layer = 20 W.add_fingerprint(M) //SN src = null @@ -169,8 +179,10 @@ PHOTOGRAPHS var/obj/item/weapon/melee/energy/axe/W = new /obj/item/weapon/melee/energy/axe( M ) if (M.hand) M.l_hand = W + M.update_inv_l_hand() else M.r_hand = W + M.update_inv_r_hand() W.layer = 20 W.add_fingerprint(M) //SN src = null diff --git a/code/game/objects/radio/electropack.dm b/code/game/objects/radio/electropack.dm index dd5462fbff..8a7ea4a4fc 100644 --- a/code/game/objects/radio/electropack.dm +++ b/code/game/objects/radio/electropack.dm @@ -58,9 +58,11 @@ if (user.r_hand == W) user.u_equip(W) user.r_hand = A + user.update_inv_r_hand() else user.u_equip(W) user.l_hand = A + user.update_inv_l_hand() W.master = A src.master = A src.layer = initial(src.layer) diff --git a/code/game/objects/radio/radio.dm b/code/game/objects/radio/radio.dm index 279004c271..a11e47f6a2 100644 --- a/code/game/objects/radio/radio.dm +++ b/code/game/objects/radio/radio.dm @@ -197,9 +197,11 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use if (usr.r_hand == R) usr.u_equip(R) usr.r_hand = T + usr.update_inv_r_hand() else usr.u_equip(R) usr.l_hand = T + usr.update_inv_l_hand() R.loc = T T.layer = 20 T.attack_self(usr) diff --git a/code/game/objects/stacks/glass.dm b/code/game/objects/stacks/glass.dm index 3a440828ab..d850bd8bce 100644 --- a/code/game/objects/stacks/glass.dm +++ b/code/game/objects/stacks/glass.dm @@ -266,7 +266,7 @@ SHARDS if(!H.shoes) var/datum/organ/external/affecting = H.get_organ(pick("l_leg", "r_leg")) H.Weaken(3) - affecting.take_damage(5, 0) - H.UpdateDamageIcon() + if(affecting.take_damage(5, 0)) + H.UpdateDamageIcon() H.updatehealth() ..() \ No newline at end of file diff --git a/code/game/objects/stool.dm b/code/game/objects/stool.dm index a0bf5a422b..937001471c 100644 --- a/code/game/objects/stool.dm +++ b/code/game/objects/stool.dm @@ -100,7 +100,8 @@ /obj/structure/stool/bed/MouseDrop_T(mob/M as mob, mob/user as mob) if(!istype(M)) return buckle_mob(M, user) - M.lying = 1 +// M.lying = 1 +// M.update_icons() //update our icons to reflect our lying/standing status return /obj/structure/stool/bed/attack_paw(mob/user as mob) @@ -136,6 +137,7 @@ /obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob) if(!istype(M)) return buckle_mob(M, user) +// M.update_icons() //update our icons to reflect our lying/standing status return //roller bed @@ -156,7 +158,6 @@ if ((!( istype(M, /mob) ) || get_dist(src, user) > 1 || M.loc != src.loc || user.restrained() || usr.stat || M.buckled || istype(usr, /mob/living/silicon/pai))) return M.pixel_y = 6 - M.update_clothing() density = 1 icon_state = "up" ..() diff --git a/code/game/objects/storage/backpack.dm b/code/game/objects/storage/backpack.dm index 2ca0a6e1c0..6774c5ef6e 100644 --- a/code/game/objects/storage/backpack.dm +++ b/code/game/objects/storage/backpack.dm @@ -9,12 +9,13 @@ if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/storage/belt.dm b/code/game/objects/storage/belt.dm index 03775bfafa..9e40edb46c 100644 --- a/code/game/objects/storage/belt.dm +++ b/code/game/objects/storage/belt.dm @@ -27,12 +27,13 @@ if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return diff --git a/code/game/objects/storage/bible.dm b/code/game/objects/storage/bible.dm index 608c5ecd95..078b918ed0 100644 --- a/code/game/objects/storage/bible.dm +++ b/code/game/objects/storage/bible.dm @@ -98,12 +98,13 @@ if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/storage/storage.dm b/code/game/objects/storage/storage.dm index c09a8b45e6..05fb1f7633 100644 --- a/code/game/objects/storage/storage.dm +++ b/code/game/objects/storage/storage.dm @@ -163,6 +163,7 @@ return //To prevent the stacking of the same sized items. user.u_equip(W) + user.update_icons() //update our overlays W.loc = src if ((user.client && user.s_active != src)) user.client.screen -= W @@ -377,12 +378,13 @@ if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/toys.dm b/code/game/objects/toys.dm index 1100fa13a1..bebb5262fd 100644 --- a/code/game/objects/toys.dm +++ b/code/game/objects/toys.dm @@ -45,12 +45,13 @@ CRAYONS if (!( M.r_hand )) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if (over_object.name == "l_hand") if (!( M.l_hand )) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/uplinks.dm b/code/game/objects/uplinks.dm index 8a75d362e8..1b4c88512e 100644 --- a/code/game/objects/uplinks.dm +++ b/code/game/objects/uplinks.dm @@ -335,13 +335,14 @@ A list of items and costs is stored under the datum of every game mode, alongsid item:loc = A A.r_hand = item item:layer = 20 + A.update_inv_r_hand() else if(!A.l_hand) item:loc = A A.l_hand = item item:layer = 20 + A.update_inv_l_hand() else item:loc = get_turf(A) - usr.update_clothing() // usr.client.onBought("[item:name]") When we have the stats again, uncomment. /* if(istype(item, /obj/spawner)) // Spawners need to have del called on them to avoid leaving a marker behind del item*/ @@ -441,10 +442,12 @@ A list of items and costs is stored under the datum of every game mode, alongsid if(!A.r_hand) item:loc = A A.r_hand = item + A.update_inv_r_hand() item:layer = 20 else if(!A.l_hand) item:loc = A A.l_hand = item + A.update_inv_l_hand() item:layer = 20 else item:loc = get_turf(A) @@ -469,10 +472,11 @@ A list of items and costs is stored under the datum of every game mode, alongsid if (usr.r_hand == R) usr.u_equip(R) usr.r_hand = T - +// usr.update_inv_r_hand() else usr.u_equip(R) usr.l_hand = T +// usr.update_inv_l_hand() R.loc = T T.layer = 20 T.set_frequency(initial(T.frequency)) @@ -532,9 +536,11 @@ A list of items and costs is stored under the datum of every game mode, alongsid if (L.r_hand == R) L.u_equip(R) L.r_hand = T + L.update_inv_r_hand() else L.u_equip(R) L.l_hand = T + L.update_inv_l_hand() T.layer = 20 T.set_frequency(initial(T.frequency)) return \ No newline at end of file diff --git a/code/game/objects/watercloset.dm b/code/game/objects/watercloset.dm index 1b11e2b6f0..7748732294 100644 --- a/code/game/objects/watercloset.dm +++ b/code/game/objects/watercloset.dm @@ -200,8 +200,6 @@ /obj/machinery/shower/proc/wash(atom/movable/O as obj|mob) if(!on) return - O.clean_blood() - if(istype(O, /mob/living/carbon)) var/mob/living/carbon/monkey = O //it's not necessarily a monkey, but >accurate varnames if(monkey.r_hand) @@ -210,21 +208,27 @@ monkey.l_hand.clean_blood() if(monkey.wear_mask) monkey.wear_mask.clean_blood() + monkey.update_inv_wear_mask(0) if(istype(O, /mob/living/carbon/human)) var/mob/living/carbon/human/washer = O if(washer.head) washer.head.clean_blood() + washer.update_inv_head(0) if(washer.wear_suit) washer.wear_suit.clean_blood() + washer.update_inv_wear_suit(0) else if(washer.w_uniform) washer.w_uniform.clean_blood() + washer.update_inv_w_uniform(0) if(washer.shoes) washer.shoes.clean_blood() + washer.update_inv_shoes(0) if(washer.gloves) washer.gloves.clean_blood() - if(washer.head) - washer.head.clean_blood() +// washer.update_inv_gloves(0) //no need for this one since it's located in clean_blood too. + + O.clean_blood() if(loc) var/turf/tile = get_turf(loc) @@ -299,8 +303,10 @@ var/mob/living/carbon/human/washer = C if(washer.gloves) //if they have gloves washer.gloves.clean_blood() //clean the gloves + washer.update_inv_gloves() //update our overlays else //and if they don't, washer.clean_blood() //wash their hands (a mob being bloody means they are 'red handed') + //overlays will be updated in clean_blood() else C.clean_blood() //other things that can't wear gloves should just wash the mob. for(var/mob/V in viewers(src, null)) diff --git a/code/game/objects/weapons.dm b/code/game/objects/weapons.dm index 3daa20d790..2162e646d3 100644 --- a/code/game/objects/weapons.dm +++ b/code/game/objects/weapons.dm @@ -138,8 +138,8 @@ affecting = H.get_organ(type) H.Stun(3) if(affecting) - affecting.take_damage(1, 0) - H.UpdateDamageIcon() + if(affecting.take_damage(1, 0)) + H.UpdateDamageIcon() H.updatehealth() playsound(target.loc, 'snap.ogg', 50, 1) icon_state = "mousetrap" diff --git a/code/game/throwing.dm b/code/game/throwing.dm index 6a19c4f046..6e1f312b3b 100644 --- a/code/game/throwing.dm +++ b/code/game/throwing.dm @@ -1,12 +1,22 @@ /mob/living/carbon/proc/toggle_throw_mode() - if(!equipped())//Not holding anything - if(TK in mutations) + var/W = equipped() + if( !W )//Not holding anything + if( client && (TK in mutations) ) if (hand) l_hand = new/obj/item/tk_grab(src) l_hand:host = src + l_hand.screen_loc = ui_lhand + client.screen += l_hand else r_hand = new/obj/item/tk_grab(src) r_hand:host = src + r_hand.screen_loc = ui_rhand + client.screen += r_hand + return + + if( istype(W,/obj/item/tk_grab) ) + if(hand) del(l_hand) + else del(r_hand) return if (src.in_throw_mode) @@ -33,9 +43,8 @@ if(!item) return - - u_equip(item) + update_icons() if(src.client) src.client.screen -= item item.loc = src.loc @@ -118,7 +127,6 @@ visible_message("\red [M] has been knocked down by the force of [src]!") M:apply_effect(rand(4,12), WEAKEN, armor_block) - M:UpdateDamageIcon() else M.take_organ_damage(rand(20,45)) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index fb2bd5a7a9..b46662c45b 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -2092,7 +2092,7 @@ var/global/BSACooldown = 0 feedback_add_details("admin_secrets_fun_used","DF") for(var/mob/living/carbon/human/B in world) B.face_icon_state = "facial_wise" - B.update_face() + B.update_hair() message_admins("[key_name_admin(usr)] activated dorf mode") else alert("You cannot perform this action. You must be of a higher administrative rank!") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index e2cad8676c..e7991d4da9 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -380,7 +380,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that id.assignment = "Captain" id.name = "[id.registered_name]'s ID Card ([id.assignment])" H.equip_if_possible(id, H.slot_wear_id) - H.update_clothing() + H.update_inv_wear_id() else alert("Invalid mob") feedback_add_details("admin_verb","GFA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -765,7 +765,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that W.registered_name = M.real_name M.equip_if_possible(W, M.slot_wear_id) - M.update_clothing() + M.regenerate_icons() log_admin("[key_name(usr)] changed the equipment of [key_name(M)] to [dresscode].") message_admins("\blue [key_name_admin(usr)] changed the equipment of [key_name_admin(M)] to [dresscode]..", 1) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 3df2618b0d..fcd611bd5a 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -269,7 +269,7 @@ var/list/forbidden_varedit_object_types = list( variable = holder.marked_datum /client/proc/modify_variables(var/atom/O, var/param_var_name = null, var/autodetect_class = 0) - var/list/locked = list("vars", "key", "ckey", "client", "firemut", "ishulk", "telekinesis", "xray", "virus", "cuffed", "ka", "last_eaten", "urine", "poo", "icon", "icon_state") + var/list/locked = list("vars", "key", "ckey", "client", "firemut", "ishulk", "telekinesis", "xray", "virus", "cuffed", "ka", "last_eaten", "icon", "icon_state", "mutantrace") if(!src.holder) src << "Only administrators may use this command." diff --git a/code/modules/admin/verbs/possess.dm b/code/modules/admin/verbs/possess.dm index ab5fcd970a..ea2cce7898 100644 --- a/code/modules/admin/verbs/possess.dm +++ b/code/modules/admin/verbs/possess.dm @@ -34,7 +34,10 @@ if(usr.control_object && usr.name_archive) //if you have a name archived and if you are actually relassing an object usr.real_name = usr.name_archive usr.name = usr.real_name - usr.update_clothing() //So the name is updated properly + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + H.name = H.get_visible_name() +// usr.regenerate_icons() //So the name is updated properly usr.loc = O.loc // Appear where the object you were controlling is -- TLE usr.client.eye = usr diff --git a/code/modules/chemical/Chemistry-Reagents.dm b/code/modules/chemical/Chemistry-Reagents.dm index 18a27941de..7458520906 100644 --- a/code/modules/chemical/Chemistry-Reagents.dm +++ b/code/modules/chemical/Chemistry-Reagents.dm @@ -658,8 +658,8 @@ datum var/datum/organ/external/affecting = M:get_organ("head") if(affecting) - affecting.take_damage(25, 0) - M:UpdateDamageIcon() + if(affecting.take_damage(25, 0)) + M:UpdateDamageIcon() M:emote("scream") else M.take_organ_damage(min(15, volume * 2)) // uses min() and volume to make sure they aren't being sprayed in trace amounts (1 unit != insta rape) -- Doohl @@ -708,8 +708,8 @@ datum if(!M.unacidable) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15, 0) - M:UpdateDamageIcon() + if(affecting.take_damage(15, 0)) + M:UpdateDamageIcon() M:emote("scream") else if(istype(M, /mob/living/carbon/monkey) && M:wear_mask) @@ -724,8 +724,8 @@ datum if(!M.unacidable) if(istype(M, /mob/living/carbon/human)) var/datum/organ/external/affecting = M:get_organ("head") - affecting.take_damage(15, 0) - M:UpdateDamageIcon() + if(affecting.take_damage(15, 0)) + M:UpdateDamageIcon() M:emote("scream") else M.take_organ_damage(min(15, volume * 4)) diff --git a/code/modules/chemical/Chemistry-Tools.dm b/code/modules/chemical/Chemistry-Tools.dm index df5ec26e59..4a1bbde7a2 100644 --- a/code/modules/chemical/Chemistry-Tools.dm +++ b/code/modules/chemical/Chemistry-Tools.dm @@ -1838,9 +1838,11 @@ if (user.r_hand == D) user.u_equip(D) user.r_hand = B + user.update_inv_r_hand() else user.u_equip(D) user.l_hand = B + user.update_inv_l_hand() B.layer = 20 user << "You add the sensor to the bucket" del(D) diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm index 64274d2191..8311617de7 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/drone.dm @@ -5,17 +5,8 @@ if(src.name == "alien drone") src.name = text("alien drone ([rand(1, 1000)])") src.real_name = src.name - spawn (1) - src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target - src.verbs -= /mob/living/carbon/alien/humanoid/verb/ActivateHuggers - src.stand_icon = new /icon('alien.dmi', "aliend_s") - src.lying_icon = new /icon('alien.dmi', "aliend_l") - src.resting_icon = new /icon('alien.dmi', "aliend_sleep") - src.running_icon = new /icon('alien.dmi', "aliend_running") - src.icon = src.stand_icon - update_clothing() - src << "\blue Your icons have been generated!" - + src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target + src.verbs -= /mob/living/carbon/alien/humanoid/verb/ActivateHuggers //Drones use the same base as generic humanoids. //Drone verbs diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index d1aced5c5f..4c35f9849d 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -5,16 +5,7 @@ if(src.name == "alien hunter") src.name = text("alien hunter ([rand(1, 1000)])") src.real_name = src.name - spawn (1) - src.verbs -= /mob/living/carbon/alien/humanoid/verb/corrode - src.stand_icon = new /icon('alien.dmi', "alienh_s") - src.lying_icon = new /icon('alien.dmi', "alienh_l") - src.resting_icon = new /icon('alien.dmi', "alienh_sleep") - src.running_icon = new /icon('alien.dmi', "alienh_running") - src.icon = src.stand_icon - update_clothing() - src << "\blue Your icons have been generated!" - + src.verbs -= /mob/living/carbon/alien/humanoid/verb/corrode /mob/living/carbon/alien/humanoid/hunter @@ -154,16 +145,21 @@ set desc = "Makes you invisible for 15 seconds" set category = "Alien" - if(powerc(50)) - adjustToxLoss(-50) - alien_invis = 1.0 - src << "\green You are now invisible." - for(var/mob/O in oviewers(src, null)) - O.show_message(text("\red [src] fades into the surroundings!"), 1) - spawn(150) - if(!isnull(src))//Don't want the game to runtime error when the mob no-longer exists. - alien_invis = 0.0 - src << "\green You are no longer invisible." + if(alien_invis) + update_icons() + else + if(powerc(50)) + adjustToxLoss(-50) + alien_invis = 1.0 + update_icons() + src << "\green You are now invisible." + for(var/mob/O in oviewers(src, null)) + O.show_message(text("\red [src] fades into the surroundings!"), 1) + spawn(250) + if(!isnull(src))//Don't want the game to runtime error when the mob no-longer exists. + alien_invis = 0.0 + update_icons() + src << "\green You are no longer invisible." return /mob/living/carbon/alien/humanoid/hunter/verb/regurgitate() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm index 3991d1f563..44b3af7917 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm @@ -5,16 +5,7 @@ if(src.name == "alien sentinel") src.name = text("alien sentinel ([rand(1, 1000)])") src.real_name = src.name - spawn (1) - src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target - src.stand_icon = new /icon('alien.dmi', "aliens_s") - src.lying_icon = new /icon('alien.dmi', "aliens_l") - src.resting_icon = new /icon('alien.dmi', "aliens_sleep") - src.running_icon = new /icon('alien.dmi', "aliens_running") - src.icon = src.stand_icon - update_clothing() - src << "\blue Your icons have been generated!" - + src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target /mob/living/carbon/alien/humanoid/sentinel diff --git a/code/modules/mob/living/carbon/alien/humanoid/hud.dm b/code/modules/mob/living/carbon/alien/humanoid/hud.dm index 0a0a2d247b..7a8679171a 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/hud.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/hud.dm @@ -2,13 +2,8 @@ src.adding = list( ) src.other = list( ) - src.intents = list( ) - src.mon_blo = list( ) - src.m_ints = list( ) - src.mov_int = list( ) src.vimpaired = list( ) src.darkMask = list( ) - src.intent_small_hud_objects = list( ) src.g_dither = new src.h_type( src ) src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" @@ -50,41 +45,6 @@ src.adding += using action_intent = using -//intent small hud objects - using = new src.h_type( src ) - using.name = "help" - using.icon = 'screen1_alien.dmi' - using.icon_state = "help_small" - using.screen_loc = ui_help_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "disarm" - using.icon = 'screen1_alien.dmi' - using.icon_state = "disarm_small" - using.screen_loc = ui_disarm_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "grab" - using.icon = 'screen1_alien.dmi' - using.icon_state = "grab_small" - using.screen_loc = ui_grab_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "harm" - using.icon = 'screen1_alien.dmi' - using.icon_state = "harm_small" - using.screen_loc = ui_harm_small - using.layer = 21 - src.intent_small_hud_objects += using - -//end intent small hud objects - using = new src.h_type( src ) using.name = "mov_intent" using.dir = SOUTHWEST diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 0bc302fc17..f61210ea30 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -6,15 +6,6 @@ if(name == "alien") name = text("alien ([rand(1, 1000)])") real_name = name - spawn (1) - if(!istype(src, /mob/living/carbon/alien/humanoid/queen)) - stand_icon = new /icon('alien.dmi', "alien_s") - lying_icon = new /icon('alien.dmi', "alien_l") - resting_icon = new /icon('alien.dmi', "alienh_sleep") - running_icon = new /icon('alien.dmi', "alienh_running") - icon = stand_icon - update_clothing() - src << "\blue Your icons have been generated!" ..() /mob/living/carbon/alien/humanoid/proc/mind_initialize(mob/G, alien_caste) @@ -152,16 +143,22 @@ /mob/living/carbon/alien/humanoid/u_equip(obj/item/W as obj) if (W == wear_suit) wear_suit = null + update_inv_wear_suit(0) else if (W == head) head = null + update_inv_head(0) else if (W == r_store) r_store = null + update_inv_pockets(0) else if (W == l_store) l_store = null + update_inv_pockets(0) else if (W == r_hand) r_hand = null + update_inv_r_hand(0) else if (W == l_hand) l_hand = null + update_inv_l_hand(0) /mob/living/carbon/alien/humanoid/db_click(text, t1) var/obj/item/W = equipped() @@ -179,6 +176,8 @@ if (wear_suit) if (emptyHand) wear_suit.DblClick() +// else +// update_inv_wear_suit() return /* if (!( istype(W, /obj/item/clothing/suit) )) return @@ -190,11 +189,10 @@ if (head) if (emptyHand) head.DblClick() - return - if (( istype(W, /obj/effect/alien/head) )) + else if (( istype(W, /obj/effect/alien/head) )) //TODO: figure out wtf this is about ~Carn u_equip(W) head = W - return + update_inv_head() return /* if (!( istype(W, /obj/item/clothing/head) )) return @@ -211,6 +209,7 @@ return u_equip(W) l_store = W + update_inv_pockets() if("storage2") if (r_store) if (emptyHand) @@ -220,7 +219,7 @@ return u_equip(W) r_store = W - else + update_inv_pockets() return /mob/living/carbon/alien/humanoid/meteorhit(O as obj) @@ -310,161 +309,6 @@ return -/mob/living/carbon/alien/humanoid/update_clothing() - ..() - - if (monkeyizing) - return - - overlays = null - - if(buckled) - if(istype(buckled, /obj/structure/stool/bed/chair)) - lying = 0 - else - lying = 1 - - // Automatically drop anything in store / id / belt if you're not wearing a uniform. - if (zone_sel) - zone_sel.overlays = null - zone_sel.overlays += damageicon_standing - zone_sel.overlays += image("icon" = 'zone_sel.dmi', "icon_state" = text("[]", zone_sel.selecting)) - - if (lying) - if(update_icon) - if(!resting) - icon = lying_icon - else - icon = resting_icon - - else if(!lying) - if(update_icon) - if(m_intent == "run") - icon = running_icon - else - icon = stand_icon - - overlays += damageicon_lying - - if (face_lying) - overlays += face_lying - else - if(update_icon) - icon = stand_icon - - overlays += damageicon_standing - - if (face_standing) - overlays += face_standing - - // Uniform - if (client) - client.screen -= hud_used.other - client.screen -= hud_used.intents - client.screen -= hud_used.mov_int - - // ??? - if (client && other) - client.screen += hud_used.other - - - if (client) - if (i_select) - if (intent) - client.screen += hud_used.intents - - var/list/L = dd_text2list(intent, ",") - L[1] += ":-11" - i_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - i_select.screen_loc = null - if (m_select) - if (m_int) - client.screen += hud_used.mov_int - - var/list/L = dd_text2list(m_int, ",") - L[1] += ":-11" - m_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - m_select.screen_loc = null - - if (wear_suit) - var/t1 = wear_suit.item_state - if (!t1) - t1 = wear_suit.icon_state - overlays += image("icon" = 'mob.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = SUIT_LAYER) - if (wear_suit.blood_DNA) - if (istype(wear_suit, /obj/item/clothing/suit/armor)) - overlays += image("icon" = 'blood.dmi', "icon_state" = "armorblood[!lying ? "" : "2"]", "layer" = B_SUIT_LAYER) - else - overlays += image("icon" = 'blood.dmi', "icon_state" = "suitblood[!lying ? "" : "2"]", "layer" = B_SUIT_LAYER) - wear_suit.screen_loc = ui_alien_oclothing - if (istype(wear_suit, /obj/item/clothing/suit/straight_jacket)) - if (handcuffed) - handcuffed.loc = loc - handcuffed.layer = initial(handcuffed.layer) - handcuffed = null - if ((l_hand || r_hand)) - var/h = hand - hand = 1 - drop_item() - hand = 0 - drop_item() - hand = h - - // Head - if (head) - var/t1 = head.item_state - if (!t1) - t1 = head.icon_state - overlays += image("icon" = 'mob.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = HEAD_LAYER) - if (head.blood_DNA) - overlays += image("icon" = 'blood.dmi', "icon_state" = "helmetblood[!lying ? "" : "2"]", "layer" = B_HEAD_LAYER) - head.screen_loc = ui_alien_head - - if (l_store) - l_store.screen_loc = ui_storage1 - - if (r_store) - r_store.screen_loc = ui_storage2 - - if (client) - client.screen -= contents - client.screen += contents - - if (r_hand) - overlays += image("icon" = 'items_righthand.dmi', "icon_state" = r_hand.item_state ? r_hand.item_state : r_hand.icon_state, "layer" = INHANDS_LAYER) - - r_hand.screen_loc = ui_rhand - - if (l_hand) - overlays += image("icon" = 'items_lefthand.dmi', "icon_state" = l_hand.item_state ? l_hand.item_state : l_hand.icon_state, "layer" = INHANDS_LAYER) - - l_hand.screen_loc = ui_lhand - - - - var/shielded = 0 - for (var/obj/item/weapon/cloaking_device/S in src) - if (S.active) - shielded = 2 - break - - if (shielded == 2 || alien_invis) - invisibility = 2 - //New stealth. Hopefully doesn't lag too much. /N - if(istype(loc, /turf))//If they are standing on a turf. - AddCamoOverlay(loc)//Overlay camo. - else - invisibility = 0 - - for (var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - spawn (0) - show_inv(M) - return - - last_b_state = stat /mob/living/carbon/alien/humanoid/hand_p(mob/M as mob) if (!ticker) @@ -641,8 +485,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index a44ab6ddcd..9d142e7d7f 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -62,15 +62,19 @@ //Status updates, death etc. handle_regular_status_updates() - // Update clothing - update_clothing() + //Being buckled to a chair or bed + check_if_buckled() + + //Temporary, whilst I finish the regenerate_icons changes ~Carn + if( update_icon ) //forces a full overlay update + update_icon = 0 + regenerate_icons() + else if( lying != lying_prev ) + update_icons() if(client) handle_regular_hud_updates() - //Being buckled to a chair or bed - check_if_buckled() - // Yup. update_canmove() @@ -408,8 +412,8 @@ //if (prob(10) && health) emote("snore") //Invalid emote for aliens, but it might be worth making sleep noticeable somehow -Yvarov src.sleeping-- - if(src.resting) - Weaken(5) +// if(src.resting) +// Weaken(5) if(move_delay_add > 0) move_delay_add = max(0, move_delay_add - rand(1, 2)) @@ -425,9 +429,11 @@ if(src.stat != 2) src.stat = 1 Paralyse(5) - if (src.stat != 2) //Alive. + if (src.stat != DEAD) //Alive. - if (src.paralysis || src.stunned || src.weakened) //Stunned etc. + if (resting || src.paralysis || src.stunned || src.weakened) //Stunned etc. + if (resting) + src.lying = 1 if (src.stunned > 0) AdjustStunned(-1) src.stat = 0 @@ -440,12 +446,10 @@ src.blinded = 1 src.lying = 1 src.stat = 1 - var/h = src.hand - src.hand = 0 drop_item() - src.hand = 1 + hand = !hand drop_item() - src.hand = h + hand = !hand else //Not stunned. src.lying = 0 diff --git a/code/modules/mob/living/carbon/alien/humanoid/login.dm b/code/modules/mob/living/carbon/alien/humanoid/login.dm index 52359b7e59..686f36c08d 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/login.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/login.dm @@ -1,12 +1,12 @@ /mob/living/carbon/alien/humanoid/Login() ..() - update_clothing() + update_hud() if (!isturf(src.loc)) src.client.eye = src.loc src.client.perspective = EYE_PERSPECTIVE - if (src.stat == 2) + if (src.stat == DEAD) src.verbs += /mob/proc/ghost return @@ -29,7 +29,7 @@ src.rest = new /obj/screen( null ) src.zone_sel = new /obj/screen/zone_sel( null ) - update_clothing() + regenerate_icons() src.mach.dir = NORTH diff --git a/code/modules/mob/living/carbon/alien/humanoid/queen.dm b/code/modules/mob/living/carbon/alien/humanoid/queen.dm index 5f06fb6bf1..29b8518e6e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/queen.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/queen.dm @@ -6,17 +6,9 @@ // if(src.name == "alien") // src.name = text("alien ([rand(1, 1000)])") src.real_name = src.name - spawn (1) - src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target - src.verbs += /mob/living/carbon/alien/humanoid/sentinel/verb/spit - src.verbs -= /mob/living/carbon/alien/humanoid/verb/ventcrawl - src.stand_icon = new /icon('alien.dmi', "queen_s") - src.lying_icon = new /icon('alien.dmi', "queen_l") - src.resting_icon = new /icon('alien.dmi', "queen_sleep") - src.running_icon = new /icon('alien.dmi', "queen_running") - src.icon = src.stand_icon - update_clothing() - src << "\blue Your icons have been generated!" + src.verbs += /mob/living/carbon/alien/humanoid/proc/corrode_target + src.verbs += /mob/living/carbon/alien/humanoid/sentinel/verb/spit + src.verbs -= /mob/living/carbon/alien/humanoid/verb/ventcrawl /mob/living/carbon/alien/humanoid/queen diff --git a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm new file mode 100644 index 0000000000..e2a9036dba --- /dev/null +++ b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm @@ -0,0 +1,124 @@ +/mob/living/carbon/alien/humanoid + var/list/overlays_lying[X_TOTAL_LAYERS] + var/list/overlays_standing[X_TOTAL_LAYERS] + +/mob/living/carbon/alien/humanoid/update_icons() + lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again + update_hud() //TODO: remove the need for this to be here + overlays = null + if(lying) + if(resting) icon_state = "alien[caste]_sleep" + else icon_state = "alien[caste]_l" + for(var/image/I in overlays_lying) + overlays += I + else + if(alien_invis) + icon_state = "alienh_cloak" //this is such a crude solution. I'm sorry. + //indstead of all that fancy icon processing, it just replaces our base icon + //Aliens can't wear much anyway :P ~Carn + else + if(m_intent == "run") icon_state = "alien[caste]_running" + else icon_state = "alien[caste]_s" + for(var/image/I in overlays_standing) + overlays += I + +/mob/living/carbon/alien/humanoid/regenerate_icons() + ..() + if (monkeyizing) return + + update_inv_head(0) + update_inv_wear_suit(0) + update_inv_r_hand(0) + update_inv_l_hand(0) + update_inv_pockets(0) + update_hud() + update_icons() + + +/mob/living/carbon/alien/humanoid/update_hud() + //TODO + if (client) +// if(other) client.screen |= hud_used.other //Not used +// else client.screen -= hud_used.other //Not used + client.screen |= contents + + + +/mob/living/carbon/alien/humanoid/update_inv_wear_suit(var/update_icons=1) + if(wear_suit) + var/t_state = wear_suit.item_state + if(!t_state) t_state = wear_suit.icon_state + var/image/lying = image("icon" = 'mob.dmi', "icon_state" = "[t_state]2") + var/image/standing = image("icon" = 'mob.dmi', "icon_state" = "[t_state]") + + if(wear_suit.blood_DNA) + var/t_suit = "suit" + if( istype(wear_suit, /obj/item/clothing/suit/armor) ) + t_suit = "armor" + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "[t_suit]blood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "[t_suit]blood") + + //TODO + wear_suit.screen_loc = ui_alien_oclothing + if (istype(wear_suit, /obj/item/clothing/suit/straight_jacket)) + if (handcuffed) + handcuffed.loc = loc + handcuffed.layer = initial(handcuffed.layer) + handcuffed = null + if ((l_hand || r_hand)) + drop_item() + hand = !hand + drop_item() + hand = !hand + + overlays_lying[X_SUIT_LAYER] = lying + overlays_standing[X_SUIT_LAYER] = standing + else + overlays_lying[X_SUIT_LAYER] = null + overlays_standing[X_SUIT_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/alien/humanoid/update_inv_head(var/update_icons=1) + if (head) + var/t_state = head.item_state + if(!t_state) t_state = head.icon_state + var/image/lying = image("icon" = 'mob.dmi', "icon_state" = "[t_state]2") + var/image/standing = image("icon" = 'mob.dmi', "icon_state" = "[t_state]") + if(head.blood_DNA) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "helmetblood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "helmetblood") + head.screen_loc = ui_alien_head + overlays_lying[X_HEAD_LAYER] = lying + overlays_standing[X_HEAD_LAYER] = standing + else + overlays_lying[X_HEAD_LAYER] = null + overlays_standing[X_HEAD_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/alien/humanoid/update_inv_pockets(var/update_icons=1) + if(l_store) l_store.screen_loc = ui_storage1 + if(r_store) r_store.screen_loc = ui_storage2 + if(update_icons) update_icons() + + +/mob/living/carbon/alien/humanoid/update_inv_r_hand(var/update_icons=1) + if(r_hand) + var/t_state = r_hand.item_state + if(!t_state) t_state = r_hand.icon_state + r_hand.screen_loc = ui_rhand + overlays_standing[X_R_HAND_LAYER] = image("icon" = 'items_righthand.dmi', "icon_state" = t_state) + else + overlays_standing[X_R_HAND_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/alien/humanoid/update_inv_l_hand(var/update_icons=1) + if(l_hand) + var/t_state = l_hand.item_state + if(!t_state) t_state = l_hand.icon_state + l_hand.screen_loc = ui_lhand + overlays_standing[X_L_HAND_LAYER] = image("icon" = 'items_lefthand.dmi', "icon_state" = t_state) + else + overlays_standing[X_L_HAND_LAYER] = null + if(update_icons) update_icons() diff --git a/code/modules/mob/living/carbon/alien/larva/hud.dm b/code/modules/mob/living/carbon/alien/larva/hud.dm index 6e16ea4d8d..e71820e1b1 100644 --- a/code/modules/mob/living/carbon/alien/larva/hud.dm +++ b/code/modules/mob/living/carbon/alien/larva/hud.dm @@ -4,13 +4,8 @@ src.adding = list( ) src.other = list( ) - src.intents = list( ) - src.mon_blo = list( ) - src.m_ints = list( ) - src.mov_int = list( ) src.vimpaired = list( ) src.darkMask = list( ) - src.intent_small_hud_objects = list( ) src.g_dither = new src.h_type( src ) src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" @@ -52,41 +47,6 @@ src.adding += using action_intent = using -//intent small hud objects - using = new src.h_type( src ) - using.name = "help" - using.icon = 'screen1_alien.dmi' - using.icon_state = "help_small" - using.screen_loc = ui_help_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "disarm" - using.icon = 'screen1_alien.dmi' - using.icon_state = "disarm_small" - using.screen_loc = ui_disarm_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "grab" - using.icon = 'screen1_alien.dmi' - using.icon_state = "grab_small" - using.screen_loc = ui_grab_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "harm" - using.icon = 'screen1_alien.dmi' - using.icon_state = "harm_small" - using.screen_loc = ui_harm_small - using.layer = 21 - src.intent_small_hud_objects += using - -//end intent small hud objects - using = new src.h_type( src ) using.name = "mov_intent" using.dir = SOUTHWEST diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 9bc84810d1..c80d4029bc 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -7,7 +7,7 @@ name = text("alien larva ([rand(1, 1000)])") real_name = name spawn (1) - update_clothing() + regenerate_icons() src << "\blue Your icons have been generated!" // spawn(1200) grow() Grow after 120 seconds -- TLE Commented out because life.dm has better version -- Urist ..() @@ -223,46 +223,6 @@ return -/mob/living/carbon/alien/larva/update_clothing() - ..() - - if (monkeyizing) - return - - - if (client) - if (i_select) - if (intent) - client.screen += hud_used.intents - - var/list/L = dd_text2list(intent, ",") - L[1] += ":-11" - i_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - i_select.screen_loc = null - if (m_select) - if (m_int) - client.screen += hud_used.mov_int - - var/list/L = dd_text2list(m_int, ",") - L[1] += ":-11" - m_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - m_select.screen_loc = null - - if (alien_invis) - invisibility = 2 - if(istype(loc, /turf))//If they are standing on a turf. - AddCamoOverlay(loc)//Overlay camo. - else - invisibility = 0 - - for (var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - spawn (0) - show_inv(M) - return - /mob/living/carbon/alien/larva/hand_p(mob/M as mob) if (!ticker) @@ -413,8 +373,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 3384b32bd9..64906879e9 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -59,7 +59,7 @@ handle_regular_status_updates() // Update clothing - update_clothing() +// regenerate_icons() if(client) handle_regular_hud_updates() diff --git a/code/modules/mob/living/carbon/alien/larva/login.dm b/code/modules/mob/living/carbon/alien/larva/login.dm index e23cb0c122..eeff902cce 100644 --- a/code/modules/mob/living/carbon/alien/larva/login.dm +++ b/code/modules/mob/living/carbon/alien/larva/login.dm @@ -1,8 +1,6 @@ /mob/living/carbon/alien/larva/Login() ..() - update_clothing() - if (!isturf(src.loc)) src.client.eye = src.loc src.client.perspective = EYE_PERSPECTIVE diff --git a/code/modules/mob/living/carbon/alien/larva/update_icons.dm b/code/modules/mob/living/carbon/alien/larva/update_icons.dm new file mode 100644 index 0000000000..00befb6379 --- /dev/null +++ b/code/modules/mob/living/carbon/alien/larva/update_icons.dm @@ -0,0 +1 @@ +//No special icons processing diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 8b6b787165..961b627018 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -22,8 +22,8 @@ var/organ = H.get_organ("chest") if (istype(organ, /datum/organ/external)) var/datum/organ/external/temp = organ - temp.take_damage(d, 0) - H.UpdateDamageIcon() + if(temp.take_damage(d, 0)) + H.UpdateDamageIcon() H.updatehealth() else src.take_organ_damage(d) diff --git a/code/modules/mob/living/carbon/human/hud.dm b/code/modules/mob/living/carbon/human/hud.dm index ae59f71ddd..befd1c7a7c 100644 --- a/code/modules/mob/living/carbon/human/hud.dm +++ b/code/modules/mob/living/carbon/human/hud.dm @@ -4,13 +4,8 @@ src.adding = list( ) src.other = list( ) - src.intents = list( ) - src.mon_blo = list( ) - src.m_ints = list( ) - src.mov_int = list( ) src.vimpaired = list( ) src.darkMask = list( ) - src.intent_small_hud_objects = list( ) src.hotkeybuttons = list( ) //These can be disabled for hotkey usersx src.g_dither = new src.h_type( src ) @@ -57,41 +52,6 @@ src.adding += using action_intent = using -//intent small hud objects - using = new src.h_type( src ) - using.name = "help" - using.icon = ui_style - using.icon_state = "help_small" - using.screen_loc = ui_help_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "disarm" - using.icon = ui_style - using.icon_state = "disarm_small" - using.screen_loc = ui_disarm_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "grab" - using.icon = ui_style - using.icon_state = "grab_small" - using.screen_loc = ui_grab_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "harm" - using.icon = ui_style - using.icon_state = "harm_small" - using.screen_loc = ui_harm_small - using.layer = 21 - src.intent_small_hud_objects += using - -//end intent small hud objects - using = new src.h_type( src ) using.name = "mov_intent" using.dir = SOUTHWEST diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 27b6bc4d0a..2c969f5c9c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1,9 +1,9 @@ /mob/living/carbon/human - name = "human" - real_name = "human" - voice_name = "human" - icon = 'mob.dmi' - icon_state = "m-none" + name = "unknown" + real_name = "unknown" + voice_name = "unknown" + icon = 'human.dmi' + icon_state = "body_m_s" var/r_hair = 0.0 @@ -39,16 +39,9 @@ var/icon/stand_icon = null var/icon/lying_icon = null - var/last_b_state = 1.0 - - var/image/face_standing = null - var/image/face_lying = null - var/hair_icon_state = "hair_a" var/face_icon_state = "bald" - var/image/damageicon_standing - var/image/damageicon_lying var/mutantrace = null @@ -62,8 +55,6 @@ /mob/living/carbon/human/New() - - var/datum/reagents/R = new/datum/reagents(1000) reagents = R R.my_atom = src @@ -71,47 +62,14 @@ if(!dna) dna = new /datum/dna(null) - var/datum/organ/external/chest/chest = new /datum/organ/external/chest(src) - var/datum/organ/external/head/head = new /datum/organ/external/head(src) - var/datum/organ/external/l_arm/l_arm = new /datum/organ/external/l_arm(src) - var/datum/organ/external/r_arm/r_arm = new /datum/organ/external/r_arm(src) - var/datum/organ/external/r_leg/r_leg = new /datum/organ/external/r_leg(src) - var/datum/organ/external/l_leg/l_leg = new /datum/organ/external/l_leg(src) - chest.owner = src - head.owner = src - r_arm.owner = src - l_arm.owner = src - r_leg.owner = src - l_leg.owner = src - organs += chest - organs += head - organs += r_arm - organs += l_arm - organs += r_leg - organs += l_leg - - var/g = "m" - if (gender == MALE) - g = "m" - else if (gender == FEMALE) - g = "f" - else - gender = MALE - g = "m" - - spawn(1) - if(!stand_icon) - stand_icon = new /icon('human.dmi', "body_[g]_s") - if(!lying_icon) - lying_icon = new /icon('human.dmi', "body_[g]_l") - icon = stand_icon - update_clothing() - - src << "\blue Your icons have been generated!" + //initialise organs + organs = newlist(/datum/organ/external/chest, /datum/organ/external/head, /datum/organ/external/l_arm, \ + /datum/organ/external/r_arm, /datum/organ/external/r_leg, /datum/organ/external/l_leg) + for(var/datum/organ/external/O in organs) + O.owner = src ..() -// organStructure = new /obj/effect/organstructure/human(src) /mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes) if ((!( yes ) || now_pushing)) @@ -299,21 +257,22 @@ if (prob(50) && !shielded) Paralyse(10) + var/update = 0 for(var/datum/organ/external/temp in organs) switch(temp.name) if("head") - temp.take_damage(b_loss * 0.2, f_loss * 0.2) + update |= temp.take_damage(b_loss * 0.2, f_loss * 0.2) if("chest") - temp.take_damage(b_loss * 0.4, f_loss * 0.4) + update |= temp.take_damage(b_loss * 0.4, f_loss * 0.4) if("l_arm") - temp.take_damage(b_loss * 0.05, f_loss * 0.05) + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) if("r_arm") - temp.take_damage(b_loss * 0.05, f_loss * 0.05) + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) if("l_leg") - temp.take_damage(b_loss * 0.05, f_loss * 0.05) + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) if("r_leg") - temp.take_damage(b_loss * 0.05, f_loss * 0.05) - UpdateDamageIcon() + update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05) + if(update) UpdateDamageIcon() /mob/living/carbon/human/blob_act() @@ -322,10 +281,11 @@ var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg") var/datum/organ/external/affecting = get_organ(ran_zone(dam_zone)) apply_damage(rand(30,40), BRUTE, affecting, run_armor_check(affecting, "melee")) - UpdateDamageIcon() return /mob/living/carbon/human/u_equip(obj/item/W as obj) + if(!W) return 0 + . = 1 if (W == wear_suit) W = s_store if (W) @@ -337,6 +297,7 @@ W.dropped(src) W.layer = initial(W.layer) wear_suit = null + update_inv_wear_suit(0) else if (W == w_uniform) W = r_store if (W) @@ -375,67 +336,76 @@ W.dropped(src) W.layer = initial(W.layer) w_uniform = null + update_inv_w_uniform(0) else if (W == gloves) gloves = null + update_inv_gloves(0) else if (W == glasses) glasses = null + update_inv_glasses(0) else if (W == head) - var/obj/item/prev_head = W head = null - if(prev_head && (prev_head.flags & BLOCKHAIR)) - // rebuild face - del(face_standing) - del(face_lying) - + if(W.flags & BLOCKHAIR) + update_hair(0) //rebuild hair + update_inv_head(0) else if (W == ears) ears = null + update_inv_ears(0) else if (W == shoes) shoes = null + update_inv_shoes(0) else if (W == belt) belt = null + update_inv_belt(0) else if (W == wear_mask) - var/obj/item/prev_mask = W + wear_mask = null + if(W.flags & BLOCKHAIR) + update_hair(0) //rebuild hair if(internal) - if (internals) + if(internals) internals.icon_state = "internal0" internal = null - wear_mask = null - if(prev_mask && (prev_mask.flags & BLOCKHAIR)) - // rebuild face - del(face_standing) - del(face_lying) - + update_inv_wear_mask(0) else if (W == wear_id) wear_id = null + update_inv_wear_id(0) else if (W == r_store) r_store = null + update_inv_pockets() else if (W == l_store) l_store = null + update_inv_pockets() else if (W == s_store) s_store = null + update_inv_s_store(0) else if (W == back) back = null + update_inv_back(0) else if (W == handcuffed) handcuffed = null + update_inv_handcuffed(0) else if (W == r_hand) r_hand = null + update_inv_r_hand(0) else if (W == l_hand) l_hand = null - - update_clothing() + update_inv_l_hand(0) + else + return 0 /mob/living/carbon/human/db_click(text, t1) var/obj/item/W = equipped() var/emptyHand = (W == null) - if ((!emptyHand) && (!istype(W, /obj/item))) - return - if (emptyHand) + if(emptyHand) usr.next_move = usr.prev_move usr:lastDblClick -= 3 //permit the double-click redirection to proceed. + else + if( !istype(W, /obj/item) ) return + switch(text) if("mask") - if (wear_mask) - if (emptyHand) + if(wear_mask) + if(emptyHand) wear_mask.DblClick() return if (!( W.slot_flags & SLOT_MASK )) @@ -443,10 +413,9 @@ u_equip(W) wear_mask = W if(wear_mask && (wear_mask.flags & BLOCKHAIR)) - del(face_standing) - del(face_lying) - + update_hair(0) //rebuild hair W.equipped(src, text) + update_inv_wear_mask() if("back") if (back) if (emptyHand) @@ -462,7 +431,7 @@ u_equip(W) back = W W.equipped(src, text) - + update_inv_back() /* if("headset") if (ears) if (emptyHand) @@ -480,7 +449,6 @@ return if (!istype(W, /obj/item)) return - if (!( W.slot_flags & SLOT_OCLOTHING )) return if ((FAT in src.mutations) && !(W.flags & ONESIZEFITSALL)) @@ -489,6 +457,7 @@ u_equip(W) wear_suit = W W.equipped(src, text) + update_inv_wear_suit() if("gloves") if (gloves) if (emptyHand) @@ -501,6 +470,7 @@ u_equip(W) gloves = W W.equipped(src, text) + update_inv_gloves() if("shoes") if (shoes) if (emptyHand) @@ -513,11 +483,14 @@ u_equip(W) shoes = W W.equipped(src, text) + update_inv_shoes() if("belt") if (belt) if (emptyHand) belt.DblClick() return + if (!w_uniform) + return if (!istype(W, /obj/item)) return if (!( W.slot_flags & SLOT_BELT )) @@ -525,6 +498,7 @@ u_equip(W) belt = W W.equipped(src, text) + update_inv_belt() if("eyes") if (glasses) if (emptyHand) @@ -537,6 +511,7 @@ u_equip(W) glasses = W W.equipped(src, text) + update_inv_glasses() if("head") if (head) if (emptyHand) @@ -548,13 +523,13 @@ return u_equip(W) head = W - if(head && (head.flags & BLOCKHAIR)) - del(face_standing) - del(face_lying) - + if(head.flags & BLOCKHAIR) + //rebuild hair + update_hair(0) if(istype(W,/obj/item/clothing/head/kitty)) W.update_icon(src) W.equipped(src, text) + update_inv_head() if("ears") if (ears) if (emptyHand) @@ -567,6 +542,7 @@ u_equip(W) ears = W W.equipped(src, text) + update_inv_ears() if("i_clothing") if (w_uniform) if (emptyHand) @@ -582,6 +558,7 @@ u_equip(W) w_uniform = W W.equipped(src, text) + update_inv_w_uniform() if("id") if (wear_id) if (emptyHand) @@ -596,11 +573,14 @@ u_equip(W) wear_id = W W.equipped(src, text) + update_inv_wear_id() if("storage1") if (l_store) if (emptyHand) l_store.DblClick() return + if (!w_uniform) + return if (!istype(W, /obj/item)) return if ( ( W.slot_flags & SLOT_DENYPOCKET ) ) @@ -608,11 +588,14 @@ if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) u_equip(W) l_store = W + update_inv_pockets() if("storage2") if (r_store) if (emptyHand) r_store.DblClick() return + if (!w_uniform) + return if (!istype(W, /obj/item)) return if ( ( W.slot_flags & SLOT_DENYPOCKET ) ) @@ -620,6 +603,7 @@ if ( W.w_class <= 2 || ( W.slot_flags & SLOT_POCKET ) ) u_equip(W) r_store = W + update_inv_pockets() if("suit storage") if (s_store) if (emptyHand) @@ -638,9 +622,7 @@ else u_equip(W) s_store = W - - update_clothing() - + update_inv_s_store() return /mob/living/carbon/human/meteorhit(O as obj) @@ -651,10 +633,11 @@ var/datum/organ/external/affecting = get_organ(pick("chest", "chest", "chest", "head")) if(!affecting) return if (istype(O, /obj/effect/immovablerod)) - affecting.take_damage(101, 0) + if(affecting.take_damage(101, 0)) + UpdateDamageIcon() else - affecting.take_damage((istype(O, /obj/effect/meteor/small) ? 10 : 25), 30) - UpdateDamageIcon() + if(affecting.take_damage((istype(O, /obj/effect/meteor/small) ? 10 : 25), 30)) + UpdateDamageIcon() updatehealth() return @@ -742,332 +725,6 @@ M.UpdateFeed(src) return -/mob/living/carbon/human/update_clothing() - ..() - - if (monkeyizing) - return - - overlays = null - - // lol - var/fat = "" - if (FAT in mutations) - fat = "fat" - - if (HULK in mutations) - overlays += image("icon" = 'genetics.dmi', "icon_state" = "hulk[fat][!lying ? "_s" : "_l"]") - - if (COLD_RESISTANCE in mutations) - overlays += image("icon" = 'genetics.dmi', "icon_state" = "fire[fat][!lying ? "_s" : "_l"]") - - if (TK in mutations) - overlays += image("icon" = 'genetics.dmi', "icon_state" = "telekinesishead[fat][!lying ? "_s" : "_l"]") - - if (LASER in mutations) - overlays += image("icon" = 'genetics.dmi', "icon_state" = "lasereyes[!lying ? "_s" : "_l"]") - - if (mutantrace) - switch(mutantrace) - if("lizard","golem","metroid") - overlays += image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat][!lying ? "_s" : "_l"]") - if(face_standing) - del(face_standing) - if(face_lying) - del(face_lying) - if(stand_icon) - del(stand_icon) - if(lying_icon) - del(lying_icon) - if("plant") - if(stat != 2) //if not dead, that is - overlays += image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat]_[gender][!lying ? "_s" : "_l"]") - else - overlays += image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace]_d") - if(face_standing) - del(face_standing) - if(face_lying) - del(face_lying) - if(stand_icon) - del(stand_icon) - if(lying_icon) - del(lying_icon) - else - if(!face_standing || !face_lying) - update_face() - if(!stand_icon || !lying_icon) - update_body() - - if(buckled) - if(istype(buckled, /obj/structure/stool/bed/chair)) - lying = 0 - else - lying = 1 - - // Automatically drop anything in store / id / belt if you're not wearing a uniform. - if (!w_uniform) - for (var/obj/item/thing in list(r_store, l_store, wear_id, belt)) - if (thing) - u_equip(thing) - if (client) - client.screen -= thing - - if (thing) - thing.loc = loc - thing.dropped(src) - thing.layer = initial(thing.layer) - - if (lying) - icon = lying_icon - if(damageicon_lying) - overlays += damageicon_lying - if (face_lying) - overlays += face_lying - else - icon = stand_icon - if(damageicon_lying) - overlays += damageicon_standing - if (face_standing) - overlays += face_standing - - // Uniform - if(w_uniform) - if ((FAT in src.mutations) && !(w_uniform.flags & ONESIZEFITSALL)) - src << "\red You burst out of the [w_uniform.name]!" - var/obj/item/clothing/c = w_uniform - u_equip(c) - if(client) - client.screen -= c - if(c) - c:loc = loc - c:dropped(src) - c:layer = initial(c:layer) - if(w_uniform)//I should really not need these - w_uniform.screen_loc = ui_iclothing - if(istype(w_uniform, /obj/item/clothing/under)) - var/t1 = w_uniform.color - if (!t1) - t1 = icon_state - if (FAT in src.mutations) - overlays += image("icon" = 'uniform_fat.dmi', "icon_state" = "[t1][!lying ? "_s" : "_l"]", "layer" = UNIFORM_LAYER) - else - overlays += image("icon" = 'uniform.dmi', "icon_state" = text("[][]",t1, (!(lying) ? "_s" : "_l")), "layer" = UNIFORM_LAYER) - if (w_uniform.blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "uniformblood[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_UNIFORM_LAYER) - - if (wear_id) - overlays += image("icon" = 'mob.dmi', "icon_state" = "id[!lying ? null : "2"]", "layer" = ID_LAYER) - - if (client) - client.screen -= hud_used.intents - client.screen -= hud_used.mov_int - - // Gloves - if (gloves) - var/t1 = gloves.item_state - if (!t1) - t1 = gloves.icon_state - overlays += image("icon" = 'hands.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = GLOVES_LAYER) - if (gloves.blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "bloodyhands[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_GLOVES_LAYER) - else if (blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "bloodyhands[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_GLOVES_LAYER) - // Glasses - if (glasses) - var/t1 = glasses.icon_state - overlays += image("icon" = 'eyes.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = GLASSES_LAYER) - // Ears - if (ears) - var/t1 = ears.icon_state - overlays += image("icon" = 'ears.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = EARS_LAYER) - // Shoes - if (shoes) - var/t1 = shoes.icon_state - overlays += image("icon" = 'feet.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = SHOES_LAYER) - if (shoes.blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "shoeblood[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_SHOES_LAYER) - - if (s_store) - var/t1 = s_store.item_state - if (!t1) - t1 = s_store.icon_state - overlays += image("icon" = 'belt_mirror.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = SUIT_STORE_LAYER) - s_store.screen_loc = ui_sstore1 - - if (client) - if (i_select) - if (intent) - client.screen += hud_used.intents - - var/list/L = dd_text2list(intent, ",") - L[1] += ":-11" - i_select.screen_loc = dd_list2text(L,",") //ICONS4 - else - i_select.screen_loc = null - if (m_select) - if (m_int) - client.screen += hud_used.mov_int - - var/list/L = dd_text2list(m_int, ",") - L[1] += ":-11" - m_select.screen_loc = dd_list2text(L,",") //ICONS4 - else - m_select.screen_loc = null - - if (lying) - if (face_lying) - overlays += face_lying - else - if (face_standing) - overlays += face_standing - - if (wear_mask) - if (istype(wear_mask, /obj/item/clothing/mask)) - var/t1 = wear_mask.icon_state - overlays += image("icon" = 'mask.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = FACEMASK_LAYER) - if (!istype(wear_mask, /obj/item/clothing/mask/cigarette)) - if (wear_mask.blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "maskblood[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_FACEMASK_LAYER) - wear_mask.screen_loc = ui_mask - - // Head - if (head) - var/t1 = head.icon_state - var/icon/head_icon = icon('head.dmi', text("[][]", t1, (!( lying ) ? null : "2"))) - if(istype(head,/obj/item/clothing/head/kitty)) - head_icon = (( lying ) ? head:mob2 : head:mob) - overlays += image("icon" = head_icon, "layer" = HEAD_LAYER) - if (head.blood_DNA) - var/icon/stain_icon = icon('blood.dmi', "helmetblood[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_HEAD_LAYER) - head.screen_loc = ui_head - - // Belt - if (belt) - var/t1 = belt.item_state - if (!t1) - t1 = belt.icon_state - overlays += image("icon" = 'belt.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = BELT_LAYER) - belt.screen_loc = ui_belt - - - name = get_visible_name() - - if (wear_id) - wear_id.screen_loc = ui_id - - if (l_store) - l_store.screen_loc = ui_storage1 - - if (r_store) - r_store.screen_loc = ui_storage2 - - if (back) - var/t1 = back.icon_state - overlays += image("icon" = 'back.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = BACK_LAYER) - back.screen_loc = ui_back - - if(client) - client.screen -= contents - client.screen += contents - //to hide / show them. - if (handcuffed) - pulling = null - if (!lying) - overlays += image("icon" = 'mob.dmi', "icon_state" = "handcuff1", "layer" = CUFFED_LAYER) - else - overlays += image("icon" = 'mob.dmi', "icon_state" = "handcuff2", "layer" = CUFFED_LAYER) - - if (r_hand) - overlays += image("icon" = 'items_righthand.dmi', "icon_state" = r_hand.item_state ? r_hand.item_state : r_hand.icon_state, "layer" = INHANDS_LAYER) - r_hand.screen_loc = ui_rhand - - if (l_hand) - overlays += image("icon" = 'items_lefthand.dmi', "icon_state" = l_hand.item_state ? l_hand.item_state : l_hand.icon_state, "layer" = INHANDS_LAYER) - l_hand.screen_loc = ui_lhand - - - var/shielded = 0 - for (var/obj/item/weapon/cloaking_device/S in src) - if (S.active) - shielded = 2 - break - - if (wear_suit) - if ((FAT in src.mutations) && !(wear_suit.flags & ONESIZEFITSALL)) - src << "\red You burst out of the [wear_suit.name]!" - var/obj/item/clothing/c = wear_suit - u_equip(c) - if(client) - client.screen -= c - if(c) - c:loc = loc - c:dropped(src) - c:layer = initial(c:layer) - if (wear_suit) - if (istype(wear_suit, /obj/item/clothing/suit)) - var/t1 = wear_suit.icon_state - overlays += image("icon" = 'suit.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = SUIT_LAYER) - if (istype(wear_suit, /obj/item/clothing/suit/straight_jacket)) - if (handcuffed) - handcuffed.loc = loc - handcuffed.layer = initial(handcuffed.layer) - handcuffed = null - if ((l_hand || r_hand)) - var/h = hand - hand = 1 - drop_item() - hand = 0 - drop_item() - hand = h - else if(istype(wear_suit, /obj/item/clothing/suit/space/space_ninja)&&wear_suit:s_active) - shielded = 3 - if (wear_suit.blood_DNA) - var/icon/stain_icon = null - if (istype(wear_suit, /obj/item/clothing/suit/armor/vest || /obj/item/clothing/suit/wcoat)) - stain_icon = icon('blood.dmi', "armorblood[!lying ? "" : "2"]") - else if (istype(wear_suit, /obj/item/clothing/suit/det_suit || /obj/item/clothing/suit/labcoat)) - stain_icon = icon('blood.dmi', "coatblood[!lying ? "" : "2"]") - else - stain_icon = icon('blood.dmi', "suitblood[!lying ? "" : "2"]") - overlays += image("icon" = stain_icon, "layer" = B_SUIT_LAYER) - wear_suit.screen_loc = ui_oclothing - - //Update_other() MUST be called after all the storage slots get updated. This is because all the storage slots assign their - //respective items a screen_loc, which other_update() will then override if needed. - if(client) - hud_used.other_update() //Update the screenloc of the items on the 'other' inventory bar - - switch(shielded) - if(1) - overlays += image("icon" = 'effects.dmi', "icon_state" = "shield", "layer" = SHIELD_LAYER) - if(2) - invisibility = 2 - //New stealth. Hopefully doesn't lag too much. /N - if(istype(loc, /turf))//If they are standing on a turf. - AddCamoOverlay(loc)//Overlay camo. - if(3) - if(istype(loc, /turf)) - //Ninjas may flick into view once in a while if they are stealthed. - if(prob(90)) - NinjaStealthActive(loc) - else - NinjaStealthMalf() - else - invisibility = 0 -/* - for (var/mob/M in viewers(1, src))//For the love of god DO NOT REFRESH EVERY SECOND - Mport - if ((M.client && M.machine == src)) - spawn (0) - show_inv(M) - return -*/ - last_b_state = stat /mob/living/carbon/human/hand_p(mob/M as mob) var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg") @@ -1122,7 +779,6 @@ var/datum/organ/external/affecting = get_organ(ran_zone(dam_zone)) var/armor_block = run_armor_check(affecting, "melee") apply_damage(damage, BRUTE, affecting, armor_block) - UpdateDamageIcon() if(M.powerlevel > 0) @@ -1171,104 +827,12 @@ return 1 return 0 -/mob/living/carbon/human/proc/update_body() - if(stand_icon) del(stand_icon) - if(lying_icon) del(lying_icon) - if(mutantrace) return - var/g = "m" - if(gender == FEMALE) g = "f" - var/husk = (HUSK in src.mutations) - var/obese = (FAT in src.mutations) - - //Base mob icon - if(husk) - stand_icon = new /icon('human.dmi', "husk_s") - lying_icon = new /icon('human.dmi', "husk_l") - else if(obese) - stand_icon = new /icon('human.dmi', "fatbody_s") - lying_icon = new /icon('human.dmi', "fatbody_l") - else - stand_icon = new /icon('human.dmi', "body_[g]_s") - lying_icon = new /icon('human.dmi', "body_[g]_l") - - //Skin tone - if(s_tone >= 0) - stand_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) - lying_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) - else - stand_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) - lying_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) - - //Underwear - if(underwear < 6 && underwear > 0) - if(!obese) - stand_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY) - lying_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_l"), ICON_OVERLAY) - - - -/mob/living/carbon/human/proc/update_face() - if(!facial_hair_style || !hair_style) return//Seems people like to lose their icons, this should stop the runtimes for now - if(face_standing) del(face_standing) - if(face_lying) del(face_lying) - if(mutantrace) return - - var/g = "m" - if (gender == FEMALE) g = "f" - - var/icon/eyes_s = new/icon("icon" = 'human_face.dmi', "icon_state" = "eyes_s") - var/icon/eyes_l = new/icon("icon" = 'human_face.dmi', "icon_state" = "eyes_l") - eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD) - eyes_l.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD) - - var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") - var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l") - hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) - hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) - - var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") - var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l") - facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) - facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) - - var/icon/mouth_s = new/icon("icon" = 'human_face.dmi', "icon_state" = "mouth_[g]_s") - var/icon/mouth_l = new/icon("icon" = 'human_face.dmi', "icon_state" = "mouth_[g]_l") - - // if the head or mask has the flag BLOCKHAIR (equal to 5), then do not apply hair - if((!(head && (head.flags & BLOCKHAIR))) && !(wear_mask && (wear_mask.flags & BLOCKHAIR))) - eyes_s.Blend(hair_s, ICON_OVERLAY) - eyes_l.Blend(hair_l, ICON_OVERLAY) - - eyes_s.Blend(mouth_s, ICON_OVERLAY) - eyes_l.Blend(mouth_l, ICON_OVERLAY) - - // if BLOCKHAIR, do not apply facial hair - if((!(head && (head.flags & BLOCKHAIR))) && !(wear_mask && (wear_mask.flags & BLOCKHAIR))) - eyes_s.Blend(facial_s, ICON_OVERLAY) - eyes_l.Blend(facial_l, ICON_OVERLAY) - - - face_standing = new /image() - face_lying = new /image() - face_standing.icon = eyes_s - face_standing.layer = FACE_LAYER - face_lying.icon = eyes_l - face_lying.layer = FACE_LAYER - - del(mouth_l) - del(mouth_s) - del(facial_l) - del(facial_s) - del(hair_l) - del(hair_s) - del(eyes_l) - del(eyes_s) /mob/living/carbon/human/var/co2overloadtime = null /mob/living/carbon/human/var/temperature_resistance = T0C+75 -/obj/effect/equip_e/human/process() +/obj/effect/equip_e/human/process() //TODO: Rewrite this steaming pile... ~Carn if (item) item.add_fingerprint(source) if (!item) @@ -1453,7 +1017,7 @@ The else statement is for equipping stuff to empty slots. !canremove refers to variable of /obj/item/clothing which either allows or disallows that item to be removed. It can still be worn/put on as normal. */ -/obj/effect/equip_e/human/done() +/obj/effect/equip_e/human/done() //TODO: And rewrite this :< ~Carn if(!source || !target) return if(source.loc != s_loc) return if(target.loc != t_loc) return @@ -1482,6 +1046,7 @@ It can still be worn/put on as normal. item.layer = 20 target.wear_mask = item item.loc = target + target.update_inv_wear_mask(0) /* if("headset") if (target.w_radio) var/obj/item/W = target.w_radio @@ -1519,6 +1084,7 @@ It can still be worn/put on as normal. item.layer = 20 target.gloves = item item.loc = target + target.update_inv_gloves(0) if("eyes") if (target.glasses) if(istype(target.glasses, /obj/item/clothing)&& !target.glasses:canremove) @@ -1539,6 +1105,7 @@ It can still be worn/put on as normal. item.layer = 20 target.glasses = item item.loc = target + target.update_inv_glasses(0) if("belt") if (target.belt) var/obj/item/W = target.belt @@ -1557,6 +1124,7 @@ It can still be worn/put on as normal. item.layer = 20 target.belt = item item.loc = target + target.update_inv_belt(0) if("s_store") if (target.s_store) var/obj/item/W = target.s_store @@ -1583,6 +1151,7 @@ It can still be worn/put on as normal. item.layer = 20 target.s_store = item item.loc = target + target.update_inv_s_store(0) if("head") if (target.head) if(istype(target.head, /obj/item/clothing)&& !target.head:canremove) @@ -1603,6 +1172,7 @@ It can still be worn/put on as normal. item.layer = 20 target.head = item item.loc = target + target.update_inv_head(0) if("ears") if (target.ears) if(istype(target.ears, /obj/item/clothing)&& !target.ears:canremove) @@ -1617,18 +1187,13 @@ It can still be worn/put on as normal. W.layer = initial(W.layer) W.add_fingerprint(source) else - if (istype(item, /obj/item/clothing/ears)) - source.drop_item() - loc = target - item.layer = 20 - target.ears = item - item.loc = target - else if (istype(item, /obj/item/device/radio/headset)) + if( istype(item, /obj/item/clothing/ears) || istype(item, /obj/item/device/radio/headset) ) source.drop_item() loc = target item.layer = 20 target.ears = item item.loc = target + target.update_inv_ears(0) if("shoes") if (target.shoes) if(istype(target.shoes, /obj/item/clothing)&& !target.shoes:canremove) @@ -1649,6 +1214,7 @@ It can still be worn/put on as normal. item.layer = 20 target.shoes = item item.loc = target + target.update_inv_shoes(0) if("l_hand") if (istype(target, /obj/item/clothing/suit/straight_jacket)) //SN src = null @@ -1673,6 +1239,7 @@ It can still be worn/put on as normal. target.l_hand = item item.loc = target item.add_fingerprint(target) + target.update_inv_l_hand(0) if("r_hand") if (istype(target, /obj/item/clothing/suit/straight_jacket)) //SN src = null @@ -1697,6 +1264,7 @@ It can still be worn/put on as normal. target.r_hand = item item.loc = target item.add_fingerprint(target) + target.update_inv_r_hand(0) if("uniform") if (target.w_uniform) if(istype(target.w_uniform, /obj/item/clothing)&& !target.w_uniform:canremove) @@ -1744,6 +1312,7 @@ It can still be worn/put on as normal. item.layer = 20 target.w_uniform = item item.loc = target + target.update_inv_w_uniform(0) if("suit") if(target.wear_suit) var/obj/item/W = target.wear_suit @@ -1762,6 +1331,7 @@ It can still be worn/put on as normal. item.layer = 20 target.wear_suit = item item.loc = target + target.update_inv_wear_suit(0) if("id") if (target.wear_id) var/obj/item/W = target.wear_id @@ -1780,6 +1350,7 @@ It can still be worn/put on as normal. item.layer = 20 target.wear_id = item item.loc = target + target.update_inv_wear_id(0) if("back") if (target.back) var/obj/item/W = target.back @@ -1798,6 +1369,7 @@ It can still be worn/put on as normal. item.layer = 20 target.back = item item.loc = target + target.update_inv_back(0) if("handcuff") if (target.handcuffed) var/obj/item/W = target.handcuffed @@ -1816,6 +1388,7 @@ It can still be worn/put on as normal. source.drop_item() target.handcuffed = item item.loc = target + target.update_inv_handcuffed(0) if("CPR") if (target.cpr_time >= world.time + 30) //SN src = null @@ -1830,7 +1403,7 @@ It can still be worn/put on as normal. O.show_message(text("\red [] performs CPR on []!", source, target), 1) target << "\blue You feel a breath of fresh air enter your lungs. It feels good." source << "\red Repeat every 7 seconds AT LEAST." - if("fuel") +/* if("fuel") var/obj/item/weapon/fuel/S = item if (!( istype(S, /obj/item/weapon/fuel) )) //SN src = null @@ -1844,7 +1417,7 @@ It can still be worn/put on as normal. var/a = S.content for(var/mob/O in viewers(source, null)) O.show_message(text("\red [source] forced [target] to eat the [a]!"), 1) - S.injest(target) + S.injest(target) */ if("dnainjector") var/obj/item/weapon/dnainjector/S = item if(item) @@ -1904,15 +1477,14 @@ It can still be worn/put on as normal. target.internal.add_fingerprint(source) if (target.internals) target.internals.icon_state = "internal1" - else - if(source) - source.update_clothing() - spawn(0) + //update overlays +// source.update_icons() + target.update_icons() + + spawn(0) // <-- not sure why this spawn is here + if(source) if(source.machine == target) target.show_inv(source) - if(target) - target.update_clothing() - //SN src = null del(src) return @@ -2053,9 +1625,9 @@ It can still be worn/put on as normal. if(!parts.len) return var/datum/organ/external/picked = pick(parts) - picked.heal_damage(brute,burn) + if(picked.heal_damage(brute,burn)) + UpdateDamageIcon() updatehealth() - UpdateDamageIcon() // damage ONE external organ, organ gets randomly selected from damaged ones. /mob/living/carbon/human/take_organ_damage(var/brute, var/burn) @@ -2063,47 +1635,49 @@ It can still be worn/put on as normal. if(!parts.len) return var/datum/organ/external/picked = pick(parts) - picked.take_damage(brute,burn) + if(picked.take_damage(brute,burn)) + UpdateDamageIcon() updatehealth() - UpdateDamageIcon() + // heal MANY external organs, in random order /mob/living/carbon/human/heal_overall_damage(var/brute, var/burn) var/list/datum/organ/external/parts = get_damaged_organs(brute,burn) + var/update = 0 while(parts.len && (brute>0 || burn>0) ) var/datum/organ/external/picked = pick(parts) var/brute_was = picked.brute_dam var/burn_was = picked.burn_dam - picked.heal_damage(brute,burn) + update |= picked.heal_damage(brute,burn) brute -= (brute_was-picked.brute_dam) burn -= (burn_was-picked.burn_dam) parts -= picked updatehealth() - UpdateDamageIcon() + if(update) UpdateDamageIcon() // damage MANY external organs, in random order /mob/living/carbon/human/take_overall_damage(var/brute, var/burn) var/list/datum/organ/external/parts = get_damageable_organs() - + var/update = 0 while(parts.len && (brute>0 || burn>0) ) var/datum/organ/external/picked = pick(parts) var/brute_was = picked.brute_dam var/burn_was = picked.burn_dam - picked.take_damage(brute,burn) + update |= picked.take_damage(brute,burn) brute -= (picked.brute_dam-brute_was) burn -= (picked.burn_dam-burn_was) parts -= picked updatehealth() - UpdateDamageIcon() + if(update) UpdateDamageIcon() /mob/living/carbon/human/Topic(href, href_list) if (href_list["refresh"]) diff --git a/code/modules/mob/living/carbon/human/human_attackalien.dm b/code/modules/mob/living/carbon/human/human_attackalien.dm index 09cb279b54..02192f2983 100644 --- a/code/modules/mob/living/carbon/human/human_attackalien.dm +++ b/code/modules/mob/living/carbon/human/human_attackalien.dm @@ -16,8 +16,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -47,7 +49,6 @@ if (damage >= 25) visible_message("\red [M] has wounded [src]!") apply_effect(4, WEAKEN, armor_block) - UpdateDamageIcon() updatehealth() if("disarm") diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 24ccc0e519..1d19b20a9a 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -53,7 +53,6 @@ if(damage >= 9) visible_message("\red [M] has weakened [src]!") apply_effect(4, WEAKEN, armor_block) - UpdateDamageIcon() return @@ -90,8 +89,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -169,7 +170,6 @@ if(damage >= 9) visible_message("\red [M] has weakened [src]!") apply_effect(4, WEAKEN, armor_block) - UpdateDamageIcon() if("disarm") M.attack_log += text("\[[time_stamp()]\] Disarmed [src.name] ([src.ckey])") diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 7afe02f5a7..3a4297581c 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -7,22 +7,6 @@ return 0 return -// new damage icon system -// now constructs damage icon for each organ from mask * damage field - -/mob/living/carbon/human/UpdateDamageIcon() - var/icon/standing = new /icon('dam_human.dmi', "00") - var/icon/lying = new /icon('dam_human.dmi', "00-2") - for(var/datum/organ/external/O in organs) - var/icon/DI = new /icon('dam_human.dmi', O.damage_state) // the damage icon for whole human - DI.Blend(new /icon('dam_mask.dmi', O.icon_name), ICON_MULTIPLY) // mask with this organ's pixels - standing.Blend(DI,ICON_OVERLAY) - DI = new /icon('dam_human.dmi', "[O.damage_state]-2") // repeat for lying icons - DI.Blend(new /icon('dam_mask.dmi', "[O.icon_name]2"), ICON_MULTIPLY) - lying.Blend(DI,ICON_OVERLAY) - damageicon_standing = new /image("icon" = standing, "layer" = DAMAGE_LAYER) - damageicon_lying = new /image("icon" = lying, "layer" = DAMAGE_LAYER) - /mob/living/carbon/human/proc/get_organ(var/zone) if(!zone) zone = "chest" @@ -54,9 +38,10 @@ switch(damagetype) if(BRUTE) - organ.take_damage(damage, 0) + if(organ.take_damage(damage, 0)) + UpdateDamageIcon() if(BURN) - organ.take_damage(0, damage) - UpdateDamageIcon() + if(organ.take_damage(0, damage)) + UpdateDamageIcon() updatehealth() - return 1 \ No newline at end of file + return 1 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index b0d13897c3..71ca669ddc 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -128,6 +128,8 @@ emp_act var/bloody = 0 if(((I.damtype == BRUTE) || (I.damtype == HALLOSS)) && prob(25 + (I.force * 2))) I.add_blood(src) //Make the weapon bloody, not the person. +// if(user.hand) user.update_inv_l_hand() //updates the attacker's overlay for the (now bloodied) weapon +// else user.update_inv_r_hand() //removed because weapons don't have on-mob blood overlays if(prob(33)) bloody = 1 var/turf/location = loc @@ -135,8 +137,12 @@ emp_act location.add_blood(src) if(ishuman(user)) var/mob/living/carbon/human/H = user - if(H.wear_suit) H.wear_suit.add_blood(src) - else if(H.w_uniform) H.w_uniform.add_blood(src) + if(H.wear_suit) + H.wear_suit.add_blood(src) + H.update_inv_wear_suit(0) //updates mob overlays to show the new blood (no refresh) + else if(H.w_uniform) + H.w_uniform.add_blood(src) + H.update_inv_w_uniform(0) //updates mob overlays to show the new blood (no refresh) if (H.gloves) H.gloves.add_blood(H) H.gloves:transfer_blood = 2 @@ -145,6 +151,7 @@ emp_act H.add_blood(H) H.bloody_hands = 2 H.bloody_hands_mob = H + H.update_inv_gloves() //updates on-mob overlays for bloody hands and/or bloody gloves switch(hit_area) if("head")//Harder to score a stun but if you do it lasts a bit longer @@ -155,9 +162,15 @@ emp_act ticker.mode.remove_revolutionary(mind) if(bloody)//Apply blood - if(wear_mask) wear_mask.add_blood(src) - if(head) head.add_blood(src) - if(glasses && prob(33)) glasses.add_blood(src) + if(wear_mask) + wear_mask.add_blood(src) + update_inv_wear_mask(0) + if(head) + head.add_blood(src) + update_inv_head(0) + if(glasses && prob(33)) + glasses.add_blood(src) + update_inv_glasses(0) if("chest")//Easier to score a stun but lasts less time if(prob((I.force + 10))) @@ -165,6 +178,10 @@ emp_act visible_message("\red [src] has been knocked down!") if(bloody) - if(src.wear_suit) src.wear_suit.add_blood(src) - if(src.w_uniform) src.w_uniform.add_blood(src) - src.UpdateDamageIcon() \ No newline at end of file + + if(wear_suit) + wear_suit.add_blood(src) + update_inv_wear_suit(0) + if(w_uniform) + w_uniform.add_blood(src) + update_inv_w_uniform(0) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 2a480317b6..10faa3a8bd 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -14,20 +14,15 @@ set invisibility = 0 set background = 1 - if (monkeyizing) - return - - if(!loc) // Fixing a null error that occurs when the mob isn't found in the world -- TLE - return + if (monkeyizing) return + if(!loc) return // Fixing a null error that occurs when the mob isn't found in the world -- TLE ..() + //TODO: seperate this out var/datum/gas_mixture/environment = loc.return_air() - - if (stat != 2) //still breathing - + if(stat != DEAD) //still breathing //First, resolve location and get a breath - if(air_master.current_cycle%4==2) //Only try to take a breath every 4 seconds, unless suffocating spawn(0) breathe() @@ -72,26 +67,33 @@ //Status updates, death etc. UpdateLuminosity() - handle_regular_status_updates() + handle_regular_status_updates() //TODO: optimise ~Carn - // Update clothing - update_clothing() + //Being buckled to chairs/beds/etc + check_if_buckled() + + //Temporary, whilst I finish the regenerate_icons changes ~Carn + if( update_icon ) //forces a full overlay update + update_icon = 0 + regenerate_icons() + else if( lying != lying_prev ) + update_icons() + + //Update our name based on whether our face is obscured/disfigured + name = get_visible_name() //TODO: this was broken by the dismemberment revert ~Carn if(client) handle_regular_hud_updates() - //Being buckled to a chair or bed - check_if_buckled() + update_canmove() //TODO: check ~Carn - // Yup. - update_canmove() - - clamp_values() + clamp_values() //TODO: check that dmage procs aren't outputing bad values outside clamp ranges ~Carn // Grabbing for(var/obj/item/weapon/grab/G in src) G.process() + //TODO: optimise this. if(isturf(loc) && rand(1,1000) == 1) //0.1% chance of playing a scary sound to someone who's in complete darkness var/turf/currentTurf = loc if(!currentTurf.sd_lumcount) @@ -99,17 +101,18 @@ /mob/living/carbon/human proc + //I've rewritten this to do what it was intended to do. + //This can probably be removed like Rockdtben suggested, but I'd like to go over the damage procs first just to be safe. + //Perhaps code view-vars to be unable to directly edit the damagevariables without using procs clamp_values() - - SetStunned(min(stunned, 20)) - SetParalysis(min(paralysis, 20)) - SetWeakened(min(weakened, 20)) - sleeping = max(min(sleeping, 20), 0) - adjustBruteLoss(0) - adjustToxLoss(0) - adjustOxyLoss(0) - adjustFireLoss(0) - + stunned = max( min(stunned,20), 0 ) // positive and under 20 + paralysis = max( min(paralysis,20), 0 ) // positive and under 20 + weakened = max( min(weakened,20), 0 ) // positive and under 20 + sleeping = max( min(sleeping, 20), 0 ) // positive and under 20 + oxyloss = max(oxyloss,0) // positive + toxloss = max(toxloss,0) // positive + bruteloss = max(bruteloss,0) // positive + fireloss = max(fireloss,0) // positive update_mind() if(!mind && client) @@ -233,6 +236,7 @@ if ((HULK in mutations) && health <= 25) mutations.Remove(HULK) + update_mutations() //update our mutation overlays src << "\red You suddenly feel very weak." Weaken(3) emote("collapse") @@ -700,14 +704,16 @@ adjustToxLoss(-1) adjustOxyLoss(-1) - if(overeatduration > 500 && !(FAT in mutations)) - src << "\red You suddenly feel blubbery!" - mutations.Add(FAT) - update_body() - if ((overeatduration < 100 && (FAT in mutations))) - src << "\blue You feel fit again!" - mutations.Remove(FAT) - update_body() + if(FAT in mutations) + if(overeatduration < 100) + src << "\blue You feel fit again!" + mutations.Remove(FAT) + update_body() + else + if(overeatduration > 500) + src << "\red You suddenly feel blubbery!" + mutations.Add(FAT) + update_body() // nutrition decrease if (nutrition > 0 && stat != 2) @@ -758,33 +764,33 @@ //if(!rejuv) oxyloss++ if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1) - if(stat != 2) stat = 1 + if(stat != DEAD) stat = UNCONSCIOUS Paralyse(5) - if (stat != 2) //Alive. + if (stat != DEAD) //Alive. if (silent) silent-- if (resting || sleeping || paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc. if (stunned > 0) AdjustStunned(-1) - stat = 0 + stat = CONSCIOUS if (weakened > 0) AdjustWeakened(-1) lying = 1 - stat = 0 + stat = CONSCIOUS if (paralysis > 0) AdjustParalysis(-1) blinded = 1 lying = 1 - stat = 1 + stat = UNCONSCIOUS if (sleeping > 0) handle_dreams() adjustHalLoss(-5) blinded = 1 lying = 1 - stat = 1 + stat = UNCONSCIOUS if (prob(10) && health && !hal_crit) spawn(0) emote("snore") @@ -792,7 +798,7 @@ if(resting) lying = 1 - stat = 0 + stat = CONSCIOUS var/h = hand hand = 0 @@ -803,12 +809,12 @@ else //Not stunned. lying = 0 - stat = 0 + stat = CONSCIOUS else //Dead. lying = 1 blinded = 1 - stat = 2 + stat = DEAD silent = 0 if (stuttering) stuttering-- diff --git a/code/modules/mob/living/carbon/human/login.dm b/code/modules/mob/living/carbon/human/login.dm index 6bbbc532d2..07c7801158 100644 --- a/code/modules/mob/living/carbon/human/login.dm +++ b/code/modules/mob/living/carbon/human/login.dm @@ -1,12 +1,12 @@ /mob/living/carbon/human/Login() ..() - update_clothing() + update_hud() if (!isturf(src.loc)) src.client.eye = src.loc src.client.perspective = EYE_PERSPECTIVE - if (src.stat == 2) + if (src.stat == DEAD) src.verbs += /mob/proc/ghost - return \ No newline at end of file + return diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm new file mode 100644 index 0000000000..c8e594d409 --- /dev/null +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -0,0 +1,603 @@ + /////////////////////// + //UPDATE_ICONS SYSTEM// + /////////////////////// +/* +Calling this a system is perhaps a bit trumped up. It is essentially update_clothing dismantled into its +core parts. The key difference is that when we generate overlays we do not generate either lying or standing +versions. Instead, we generate both and store them in two fixed-length lists, both using the same list-index +(The indexes are in setup.dm): Each list for humans is (at the time of writing) of length 19. +This will hopefully be reduced as the system is refined. + + var/overlays_lying[19] //For the lying down stance + var/overlays_standing[19] //For the standing stance + +When we call update_icons, the 'lying' variable is checked and then the appropriate list is assigned to our overlays! +That in itself uses a tiny bit more memory (no more than all the ridiculous lists the game has already mind you). + +On the other-hand, it should be very CPU cheap in comparison to the old system. +In the old system, we updated all our overlays every life() call, even if we were standing still inside a crate! +or dead!. 25ish overlays, all generated from scratch every second for every xeno/human/monkey and then applied. +More often than not update_clothing was being called a few times in addition to that! CPU was not the only issue, +all those icons had to be sent to every client. So really the cost was extremely cumulative. To the point where +update_clothing would frequently appear in the top 10 most CPU intensive procs during profiling. + +Another feature of this new system is that our lists are indexed. This means we can update specific overlays! +So we only regenerate icons when we need them to be updated! This is the main saving for this system. + +In practice this means that: + everytime you fall over, we just switch between precompiled lists. Which is fast and cheap. + Everytime you do something minor like take a pen out of your pocket, we only update the in-hand overlay + etc... + + +There are several things that need to be remembered: + +> Whenever we do something that should cause an overlay to update (which doesn't use standard procs + ( i.e. you do something like l_hand = /obj/item/something new(src) ) + You will need to call the relevant update_inv_* proc: + update_inv_head() + update_inv_wear_suit() + update_inv_gloves() + update_inv_shoes() + update_inv_w_uniform() + update_inv_glassed() + update_inv_l_hand() + update_inv_r_hand() + update_inv_belt() + update_inv_wear_id() + update_inv_ears() + update_inv_s_store() + update_inv_pockets() + update_inv_back() + update_inv_handcuffed() + update_inv_wear_mask() + + All of these are named after the variable they update from. They are defined at the mob/ level like + update_clothing was, so you won't cause undefined proc runtimes with usr.update_inv_wear_id() if the usr is a + metroid etc. Instead, it'll just return without doing any work. So no harm in calling it for metroids and such. + + +> There are also these special cases: + update_mutations() //handles updating your appearance for certain mutations. e.g TK head-glows + update_mutantrace() //handles updating your appearance after setting the mutantrace var + UpdateDamageIcon() //handles damage overlays for brute/burn damage //(will rename this when I geta round to it) + update_body() //Handles updating your mob's icon to reflect their gender/race/complexion etc + update_hair() //Handles updating your hair overlay (used to be update_face, but mouth and + ...eyes were merged into update_body) + +> All of these procs update our overlays_lying and overlays_standing, and then call update_icons() by default. + If you wish to update several overlays at once, you can set the argument to 0 to disable the update and call + it manually: + e.g. + update_inv_head(0) + update_inv_l_hand(0) + update_inv_r_hand() //<---calls update_icons() + + or equivillantly: + update_inv_head(0) + update_inv_l_hand(0) + update_inv_r_hand(0) + update_icons() + +> If you need to update all overlays you can use regenerate_icons(). it works exactly like update_clothing used to. + +> I reimplimented an old unused variable which was in the code called (coincidentally) var/update_icon + It can be used as another method of triggering regenerate_icons(). It's basically a flag that when set to non-zero + will call regenerate_icons() at the next life() call and then reset itself to 0. + The idea behind it is icons are regenerated only once, even if multiple events requested it. + +This system is confusing and is still a WIP. It's primary goal is speeding up the controls of the game whilst +reducing processing costs. So please bear with me while I iron out the kinks. It will be worth it, I promise. +If I can eventually free var/lying stuff from the life() process altogether, stuns/death/status stuff +will become less affected by lag-spikes and will be instantaneous! :3 + +If you have any questions/constructive-comments/bugs-to-report/or have a massivly devestated butt... +Please contact me on #coderbus IRC. ~Carn x +*/ + + +//TODO: FAT -> disability not a mutation + +/mob/living/carbon/human + var/list/overlays_lying[TOTAL_LAYERS] + var/list/overlays_standing[TOTAL_LAYERS] + + +//UPDATES OVERLAYS FROM OVERLAYS_LYING/OVERLAYS_STANDING +//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers +//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date. +/mob/living/carbon/human/update_icons() + lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again + update_hud() //TODO: remove the need for this + overlays = null + + if(lying) //can't be cloaked when lying. (for now) + icon = lying_icon + for(var/image/I in overlays_lying) + overlays += I + else + var/stealth = 0 + if(istype(wear_suit, /obj/item/clothing/suit/space/space_ninja) && wear_suit:s_active) + stealth = 1 + else + //cloaking devices. //TODO: get rid of this :< + for(var/obj/item/weapon/cloaking_device/S in list(l_hand,r_hand,belt,l_store,r_store)) + if(S.active) + stealth = 1 + break + if(stealth) + icon = 'human.dmi' + icon_state = "body_cloaked" + var/image/I = overlays_standing[L_HAND_LAYER] + if(istype(I)) overlays += I + I = overlays_standing[R_HAND_LAYER] + if(istype(I)) overlays += I + else + icon = stand_icon + for(var/image/I in overlays_standing) + overlays += I + + + +//DAMAGE OVERLAYS +//constructs damage icon for each organ from mask * damage field and saves it in our overlays_ lists +/mob/living/carbon/human/UpdateDamageIcon(var/update_icons=1) + var/image/standing = image("icon" = 'dam_human.dmi', "icon_state" = "blank") + var/image/lying = image("icon" = 'dam_human.dmi', "icon_state" = "blank2") + for(var/datum/organ/external/O in organs) + if(O.brutestate) + standing.overlays += "[O.icon_name]_[O.brutestate]0" //we're adding icon_states of the base image as overlays + lying.overlays += "[O.icon_name]2_[O.brutestate]0" + if(O.burnstate) + standing.overlays += "[O.icon_name]_0[O.burnstate]" + lying.overlays += "[O.icon_name]2_0[O.burnstate]" + + overlays_standing[DAMAGE_LAYER] = standing + overlays_lying[DAMAGE_LAYER] = lying + if(update_icons) update_icons() + +//BASE MOB SPRITE +/mob/living/carbon/human/proc/update_body() + if(stand_icon) del(stand_icon) + if(lying_icon) del(lying_icon) + if(mutantrace) return + var/husk = (HUSK in src.mutations) + var/fat = (FAT in src.mutations) + var/g = "m" + if(gender == FEMALE) g = "f" + //Base mob icon + if(husk) + stand_icon = new /icon('human.dmi', "husk_s") + lying_icon = new /icon('human.dmi', "husk_l") + else if(fat) + stand_icon = new /icon('human.dmi', "fatbody_s") + lying_icon = new /icon('human.dmi', "fatbody_l") + else + stand_icon = new /icon('human.dmi', "body_[g]_s") + lying_icon = new /icon('human.dmi', "body_[g]_l") + + //Skin tone + if(s_tone >= 0) + stand_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) + lying_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) + else + stand_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) + lying_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) + + //Eyes + var/icon/eyes_s = new/icon('human_face.dmi', "eyes_s") + var/icon/eyes_l = new/icon('human_face.dmi', "eyes_l") + eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD) + eyes_l.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD) + stand_icon.Blend(eyes_s, ICON_OVERLAY) + lying_icon.Blend(eyes_l, ICON_OVERLAY) + + //Mouth + stand_icon.Blend(new/icon('human_face.dmi', "mouth_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new/icon('human_face.dmi', "mouth_[g]_l"), ICON_OVERLAY) + + //Underwear + if(underwear < 6 && underwear > 0) + if(!fat) + stand_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY) + lying_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_l"), ICON_OVERLAY) + + +//HAIR OVERLAY +/mob/living/carbon/human/proc/update_hair(var/update_icons=1) + //Reset our hair + overlays_lying[HAIR_LAYER] = null + overlays_standing[HAIR_LAYER] = null + + //mutants don't have hair. masks and helmets can obscure our hair too. + if( mutantrace || (head && (head.flags & BLOCKHAIR)) || (wear_mask && (wear_mask.flags & BLOCKHAIR)) ) + if(update_icons) update_icons() + return + + //base icons + var/icon/face_standing = new /icon('human_face.dmi',"bald_s") + var/icon/face_lying = new /icon('human_face.dmi',"bald_l") + + if(facial_hair_style) + var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") + var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l") + facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + face_standing.Blend(facial_s, ICON_OVERLAY) + face_lying.Blend(facial_l, ICON_OVERLAY) + + if(hair_style) + var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") + var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l") + hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + face_standing.Blend(hair_s, ICON_OVERLAY) + face_lying.Blend(hair_l, ICON_OVERLAY) + + overlays_lying[HAIR_LAYER] = image(face_lying) + overlays_standing[HAIR_LAYER] = image(face_standing) + + if(update_icons) update_icons() + +/mob/living/carbon/human/update_mutations(var/update_icons=1) + var/fat + if( FAT in mutations ) + fat = "fat" + if( w_uniform && !(w_uniform&ONESIZEFITSALL) ) + src << "\red You burst out of \the [w_uniform]!" + var/obj/item/clothing/c = w_uniform + u_equip(c) //Check + if(client) // + client.screen -= c // + if(c) // + c:loc = loc // + c:dropped(src) // + c:layer = initial(c:layer) // + if( wear_suit && !(wear_suit&ONESIZEFITSALL) ) + src << "\red You burst out of \the [wear_suit]!" + var/obj/item/clothing/c = wear_suit + u_equip(c) + if(client) + client.screen -= c + if(c) + c:loc = loc + c:dropped(src) + c:layer = initial(c:layer) + + var/image/lying = image("icon" = 'genetics.dmi') + var/image/standing = image("icon" = 'genetics.dmi') + var/add_image = 0 + for(var/mut in mutations) + switch(mut) + if(HULK) + lying.underlays += "hulk[fat]_l" + standing.underlays += "hulk[fat]_s" + add_image = 1 + if(COLD_RESISTANCE) + lying.underlays += "fire[fat]_l" + standing.underlays += "fire[fat]_s" + add_image = 1 + if(TK) + lying.underlays += "telekinesishead[fat]_l" + standing.underlays += "telekinesishead[fat]_s" + add_image = 1 + if(LASER) + lying.overlays += "lasereyes_l" + standing.overlays += "lasereyes_s" + add_image = 1 + if(add_image) + overlays_lying[MUTATIONS_LAYER] = lying + overlays_standing[MUTATIONS_LAYER] = standing + else + overlays_lying[MUTATIONS_LAYER] = null + overlays_standing[MUTATIONS_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/proc/update_mutantrace(var/update_icons=1) + var/fat + if( FAT in mutations ) + fat = "fat" + + switch(mutantrace) + if("lizard","golem","metroid") + overlays_lying[MUTANTRACE_LAYER] = image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat]_l") + overlays_standing[MUTANTRACE_LAYER] = image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat]_s") + if("plant") + if(stat == DEAD) //TODO + overlays_lying[MUTANTRACE_LAYER] = image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace]_d") + else + overlays_lying[MUTANTRACE_LAYER] = image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat]_[gender]_l") + overlays_standing[MUTANTRACE_LAYER] = image("icon" = 'genetics.dmi', "icon_state" = "[mutantrace][fat]_[gender]_s") + else + overlays_lying[MUTANTRACE_LAYER] = null + overlays_standing[MUTANTRACE_LAYER] = null + update_body() + update_hair(0) + if(update_icons) update_icons() + +/* --------------------------------------- */ +//For legacy support. +/mob/living/carbon/human/regenerate_icons() + ..() + if(monkeyizing) return + update_mutations(0) + update_mutantrace(0) + update_inv_w_uniform(0) + update_inv_wear_id(0) + update_inv_gloves(0) + update_inv_glasses(0) + update_inv_ears(0) + update_inv_shoes(0) + update_inv_s_store(0) + update_inv_wear_mask(0) + update_inv_head(0) + update_inv_belt(0) + update_inv_back(0) + update_inv_wear_suit(0) + update_inv_r_hand(0) + update_inv_l_hand(0) + update_inv_handcuffed(0) + update_inv_pockets(0) + update_icons() + //Hud Stuff + update_hud() + +/* --------------------------------------- */ +//vvvvvv UPDATE_INV PROCS vvvvvv + +/mob/living/carbon/human/update_inv_w_uniform(var/update_icons=1) + if(w_uniform) + w_uniform.screen_loc = ui_iclothing //what is this? + if( istype(w_uniform, /obj/item/clothing/under) ) + var/t_color = w_uniform.color + if(!t_color) t_color = icon_state + var/image/lying = image("icon_state" = "[t_color]_l") + var/image/standing = image("icon_state" = "[t_color]_s") + if( (FAT in mutations) ) + lying.icon = 'uniform_fat.dmi' + standing.icon = 'uniform_fat.dmi' + else + lying.icon = 'uniform.dmi' + standing.icon = 'uniform.dmi' + + if(w_uniform.blood_DNA) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "uniformblood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "uniformblood") + overlays_lying[UNIFORM_LAYER] = lying + overlays_standing[UNIFORM_LAYER] = standing + else + overlays_lying[UNIFORM_LAYER] = null + overlays_standing[UNIFORM_LAYER] = null + // Automatically drop anything in store / id / belt if you're not wearing a uniform. //CHECK IF NECESARRY + for( var/obj/item/thing in list(r_store, l_store, wear_id, belt) ) // + if(thing) // + u_equip(thing) // + if (client) // + client.screen -= thing // + // + if (thing) // + thing.loc = loc // + thing.dropped(src) // + thing.layer = initial(thing.layer) + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_wear_id(var/update_icons=1) + if(wear_id) + overlays_lying[ID_LAYER] = image("icon" = 'mob.dmi', "icon_state" = "id2") + overlays_standing[ID_LAYER] = image("icon" = 'mob.dmi', "icon_state" = "id") + wear_id.screen_loc = ui_id //TODO + else + overlays_lying[ID_LAYER] = null + overlays_standing[ID_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_gloves(var/update_icons=1) + if(gloves) + var/t_state = gloves.item_state + if(!t_state) t_state = gloves.icon_state + var/image/lying = image("icon" = 'hands.dmi', "icon_state" = "[t_state]2") + var/image/standing = image("icon" = 'hands.dmi', "icon_state" = "[t_state]") + if(gloves.blood_DNA) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "bloodyhands2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "bloodyhands") + gloves.screen_loc = ui_gloves + overlays_lying[GLOVES_LAYER] = lying + overlays_standing[GLOVES_LAYER] = standing + else + if(blood_DNA) + overlays_lying[GLOVES_LAYER] = image("icon" = 'blood.dmi', "icon_state" = "bloodyhands2") + overlays_standing[GLOVES_LAYER] = image("icon" = 'blood.dmi', "icon_state" = "bloodyhands") + else + overlays_lying[GLOVES_LAYER] = null + overlays_standing[GLOVES_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_glasses(var/update_icons=1) + if(glasses) + overlays_lying[GLASSES_LAYER] = image("icon" = 'eyes.dmi', "icon_state" = "[glasses.icon_state]2") + overlays_standing[GLASSES_LAYER] = image("icon" = 'eyes.dmi', "icon_state" = "[glasses.icon_state]") + else + overlays_lying[GLASSES_LAYER] = null + overlays_standing[GLASSES_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_ears(var/update_icons=1) + if(ears) + overlays_lying[EARS_LAYER] = image("icon" = 'ears.dmi', "icon_state" = "[ears.icon_state]2") + overlays_standing[EARS_LAYER] = image("icon" = 'ears.dmi', "icon_state" = "[ears.icon_state]") + else + overlays_lying[EARS_LAYER] = null + overlays_standing[EARS_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_shoes(var/update_icons=1) + if(shoes) + var/image/lying = image("icon" = 'feet.dmi', "icon_state" = "[shoes.icon_state]2") + var/image/standing = image("icon" = 'feet.dmi', "icon_state" = "[shoes.icon_state]") + if(shoes.blood_DNA) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "shoeblood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "shoeblood") + overlays_lying[SHOES_LAYER] = lying + overlays_standing[SHOES_LAYER] = standing + else + overlays_lying[SHOES_LAYER] = null + overlays_standing[SHOES_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_s_store(var/update_icons=1) + if(s_store) + var/t_state = s_store.item_state + if(!t_state) t_state = s_store.icon_state + overlays_lying[SUIT_STORE_LAYER] = image("icon" = 'belt_mirror.dmi', "icon_state" = "[t_state]2") + overlays_standing[SUIT_STORE_LAYER] = image("icon" = 'belt_mirror.dmi', "icon_state" = "[t_state]") + s_store.screen_loc = ui_sstore1 //TODO + else + overlays_lying[SUIT_STORE_LAYER] = null + overlays_standing[SUIT_STORE_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_head(var/update_icons=1) + if(head) + head.screen_loc = ui_head //TODO + var/image/lying + var/image/standing + if(istype(head,/obj/item/clothing/head/kitty)) + lying = image("icon" = head:mob2) + standing = image("icon" = head:mob) + else + lying = image("icon" = 'head.dmi', "icon_state" = "[head.icon_state]2") + standing = image("icon" = 'head.dmi', "icon_state" = "[head.icon_state]") + if(head.blood_DNA) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "helmetblood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "helmetblood") + overlays_lying[HEAD_LAYER] = lying + overlays_standing[HEAD_LAYER] = standing + else + overlays_lying[HEAD_LAYER] = null + overlays_standing[HEAD_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_belt(var/update_icons=1) + if(belt) + belt.screen_loc = ui_belt //TODO + var/t_state = belt.item_state + if(!t_state) t_state = belt.icon_state + overlays_lying[BELT_LAYER] = image("icon" = 'belt.dmi', "icon_state" = "[t_state]2") + overlays_standing[BELT_LAYER] = image("icon" = 'belt.dmi', "icon_state" = "[t_state]") + else + overlays_lying[BELT_LAYER] = null + overlays_standing[BELT_LAYER] = null + if(update_icons) update_icons() + + + +/mob/living/carbon/human/update_inv_wear_suit(var/update_icons=1) + if( wear_suit && istype(wear_suit, /obj/item/clothing/suit) ) //TODO check this + wear_suit.screen_loc = ui_oclothing //TODO + var/image/lying = image("icon" = 'suit.dmi', "icon_state" = "[wear_suit.icon_state]2") + var/image/standing = image("icon" = 'suit.dmi', "icon_state" = "[wear_suit.icon_state]") + + if( istype(wear_suit, /obj/item/clothing/suit/straight_jacket) ) //TODO + if (handcuffed) // + handcuffed.loc = loc // + handcuffed.layer = initial(handcuffed.layer) // + handcuffed = null // + if (l_hand || r_hand) // + var/h = hand // + hand = 1 // + drop_item() // + hand = 0 // + drop_item() // + hand = h // + + if(wear_suit.blood_DNA) + var/t_state + if( istype(wear_suit, /obj/item/clothing/suit/armor/vest || /obj/item/clothing/suit/wcoat) ) + t_state = "armor" + else if( istype(wear_suit, /obj/item/clothing/suit/det_suit || /obj/item/clothing/suit/labcoat) ) + t_state = "coat" + else + t_state = "suit" + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "[t_state]blood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "[t_state]blood") + + overlays_lying[SUIT_LAYER] = lying + overlays_standing[SUIT_LAYER] = standing + else + overlays_lying[SUIT_LAYER] = null + overlays_standing[SUIT_LAYER] = null + if(update_icons) update_icons() + +/mob/living/carbon/human/update_inv_pockets(var/update_icons=1) + if(l_store) l_store.screen_loc = ui_storage1 //TODO + if(r_store) r_store.screen_loc = ui_storage2 //TODO + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_wear_mask(var/update_icons=1) + if( wear_mask && istype(wear_mask, /obj/item/clothing/mask) ) + wear_mask.screen_loc = ui_mask //TODO + var/image/lying = image("icon" = 'mask.dmi', "icon_state" = "[wear_mask.icon_state]2") + var/image/standing = image("icon" = 'mask.dmi', "icon_state" = "[wear_mask.icon_state]") + if( !istype(wear_mask, /obj/item/clothing/mask/cigarette) && wear_mask.blood_DNA ) + lying.overlays += image("icon" = 'blood.dmi', "icon_state" = "maskblood2") + standing.overlays += image("icon" = 'blood.dmi', "icon_state" = "maskblood") + overlays_lying[FACEMASK_LAYER] = lying + overlays_standing[FACEMASK_LAYER] = standing + else + overlays_lying[FACEMASK_LAYER] = null + overlays_standing[FACEMASK_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_back(var/update_icons=1) + if(back) + back.screen_loc = ui_back //TODO + overlays_lying[BACK_LAYER] = image("icon" = 'back.dmi', "icon_state" = "[back.icon_state]2") + overlays_standing[BACK_LAYER] = image("icon" = 'back.dmi', "icon_state" = "[back.icon_state]") + else + overlays_lying[BACK_LAYER] = null + overlays_standing[BACK_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_hud() //TODO: do away with this if possible + if(client) + client.screen |= contents + hud_used.other_update() //Updates the screenloc of the items on the 'other' inventory bar + + +/mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) + if(handcuffed) + pulling = null //TODO: should be handled elsewhere + overlays_lying[HANDCUFF_LAYER] = image("icon" = 'mob.dmi', "icon_state" = "handcuff2") + overlays_standing[HANDCUFF_LAYER] = image("icon" = 'mob.dmi', "icon_state" = "handcuff1") + else + overlays_lying[HANDCUFF_LAYER] = null + overlays_standing[HANDCUFF_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1) + if(r_hand) + r_hand.screen_loc = ui_rhand //TODO + var/t_state = r_hand.item_state + if(!t_state) t_state = r_hand.icon_state + overlays_standing[R_HAND_LAYER] = image("icon" = 'items_righthand.dmi', "icon_state" = "[t_state]") + else + overlays_standing[R_HAND_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1) + if(l_hand) + l_hand.screen_loc = ui_lhand //TODO + var/t_state = l_hand.item_state + if(!t_state) t_state = l_hand.icon_state + overlays_standing[L_HAND_LAYER] = image("icon" = 'items_lefthand.dmi', "icon_state" = "[t_state]") + else + overlays_standing[L_HAND_LAYER] = null + if(update_icons) update_icons() diff --git a/code/modules/mob/living/carbon/metroid/login.dm b/code/modules/mob/living/carbon/metroid/login.dm index 6b696c8a51..831c6e1004 100644 --- a/code/modules/mob/living/carbon/metroid/login.dm +++ b/code/modules/mob/living/carbon/metroid/login.dm @@ -1,12 +1,12 @@ /mob/living/carbon/metroid/Login() ..() - update_clothing() + update_hud() if (!isturf(src.loc)) src.client.eye = src.loc src.client.perspective = EYE_PERSPECTIVE - if (src.stat == 2) + if (src.stat == DEAD) src.verbs += /mob/proc/ghost - return \ No newline at end of file + return diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index efc5ff0767..89bedffd23 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -9,7 +9,7 @@ real_name = name spawn (1) - update_clothing() + regenerate_icons() src << "\blue Your icons have been generated!" ..() @@ -283,43 +283,6 @@ return - -/mob/living/carbon/metroid/update_clothing() - ..() - - if (monkeyizing) - return - - - if (client) - if (i_select) - if (intent) - client.screen += hud_used.intents - - var/list/L = dd_text2list(intent, ",") - L[1] += ":-11" - i_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - i_select.screen_loc = null - if (m_select) - if (m_int) - client.screen += hud_used.mov_int - - var/list/L = dd_text2list(m_int, ",") - L[1] += ":-11" - m_select.screen_loc = dd_list2text(L,",") //ICONS4, FUCKING SHIT - else - m_select.screen_loc = null - - - for (var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - spawn (0) - show_inv(M) - return - - - /mob/living/carbon/metroid/attack_metroid(mob/living/carbon/metroid/M as mob) if (!ticker) M << "You cannot attack people before the game has started." @@ -490,8 +453,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -594,8 +559,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G diff --git a/code/modules/mob/living/carbon/metroid/update_icons.dm b/code/modules/mob/living/carbon/metroid/update_icons.dm new file mode 100644 index 0000000000..8902770055 --- /dev/null +++ b/code/modules/mob/living/carbon/metroid/update_icons.dm @@ -0,0 +1 @@ +//no special icon processing diff --git a/code/modules/mob/living/carbon/monkey/hud.dm b/code/modules/mob/living/carbon/monkey/hud.dm index bff60a1b9b..c8f8678dce 100644 --- a/code/modules/mob/living/carbon/monkey/hud.dm +++ b/code/modules/mob/living/carbon/monkey/hud.dm @@ -4,13 +4,8 @@ src.adding = list( ) src.other = list( ) - src.intents = list( ) - src.mon_blo = list( ) - src.m_ints = list( ) - src.mov_int = list( ) src.vimpaired = list( ) src.darkMask = list( ) - src.intent_small_hud_objects = list( ) //var/icon/blocked = icon(ui_style,"blocked") @@ -58,41 +53,6 @@ src.adding += using action_intent = using -//intent small hud objects - using = new src.h_type( src ) - using.name = "help" - using.icon = ui_style - using.icon_state = "help_small" - using.screen_loc = ui_help_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "disarm" - using.icon = ui_style - using.icon_state = "disarm_small" - using.screen_loc = ui_disarm_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "grab" - using.icon = ui_style - using.icon_state = "grab_small" - using.screen_loc = ui_grab_small - using.layer = 21 - src.intent_small_hud_objects += using - - using = new src.h_type( src ) - using.name = "harm" - using.icon = ui_style - using.icon_state = "harm_small" - using.screen_loc = ui_harm_small - using.layer = 21 - src.intent_small_hud_objects += using - -//end intent small hud objects - using = new src.h_type( src ) using.name = "mov_intent" using.dir = SOUTHWEST diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index d4285e247e..15fe43e4b4 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -11,24 +11,18 @@ /mob/living/carbon/monkey/Life() set invisibility = 0 set background = 1 - - if (src.monkeyizing) - return - + if (src.monkeyizing) return ..() var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE if(src.loc) environment = loc.return_air() - if (src.stat != 2) //still breathing - + if (src.stat != DEAD) //still breathing //First, resolve location and get a breath - if(air_master.current_cycle%4==2) //Only try to take a breath every 4 seconds, unless suffocating breathe() - else //Still give containing object the chance to interact if(istype(loc, /obj/)) var/obj/location_as_object = loc @@ -69,12 +63,16 @@ //Being buckled to a chair or bed check_if_buckled() + //Temporary, whilst I finish the regenerate_icons changes ~Carn + if( update_icon ) //forces a full overlay update + update_icon = 0 + regenerate_icons() + else if( lying != lying_prev ) + update_icons() + // Yup. update_canmove() - // Update clothing - update_clothing() - clamp_values() // Grabbing diff --git a/code/modules/mob/living/carbon/monkey/login.dm b/code/modules/mob/living/carbon/monkey/login.dm index 9f24a42fec..0a0c216129 100644 --- a/code/modules/mob/living/carbon/monkey/login.dm +++ b/code/modules/mob/living/carbon/monkey/login.dm @@ -1,54 +1,11 @@ /mob/living/carbon/monkey/Login() ..() - update_clothing() - /* - if (!( src.primary )) - var/t1 = rand(1000, 1500) - dna_ident += t1 - if (dna_ident > 65536.0) - dna_ident = rand(1, 1500) - src.primary = new /datum/dna( null ) - src.primary.uni_identity = text("[]", dna_ident) - while(length(src.primary.uni_identity) < 4) - src.primary.uni_identity = text("0[]", src.primary.uni_identity) - var/t2 = text("[]", rand(1, 256)) - if (length(t2) < 2) - src.primary.uni_identity = text("[]0[]", src.primary.uni_identity, t2) - else - src.primary.uni_identity = text("[][]", src.primary.uni_identity, t2) - t2 = text("[]", rand(1, 256)) - if (length(t2) < 2) - src.primary.uni_identity = text("[]0[]", src.primary.uni_identity, t2) - else - src.primary.uni_identity = text("[][]", src.primary.uni_identity, t2) - t2 = text("[]", rand(1, 256)) - if (length(t2) < 2) - src.primary.uni_identity = text("[]0[]", src.primary.uni_identity, t2) - else - src.primary.uni_identity = text("[][]", src.primary.uni_identity, t2) - t2 = text("[]", rand(1, 256)) - if (length(t2) < 2) - src.primary.uni_identity = text("[]0[]", src.primary.uni_identity, t2) - else - src.primary.uni_identity = text("[][]", src.primary.uni_identity, t2) - t2 = (src.gender == "male" ? text("[]", rand(1, 124)) : text("[]", rand(127, 250))) - if (length(t2) < 2) - src.primary.uni_identity = text("[]0[]", src.primary.uni_identity, t2) - else - src.primary.uni_identity = text("[][]", src.primary.uni_identity, t2) - src.primary.spec_identity = "2B6696D2B127E5A4" - src.primary.struc_enzymes = "CDEAF5B90AADBC6BA8033DB0A7FD613FA" - src.primary.unique_enzymes = "C8FFFE7EC09D80AEDEDB9A5A0B4085B61" - src.primary.n_chromo = 16 - */ + update_hud() if (!isturf(src.loc)) src.client.eye = src.loc src.client.perspective = EYE_PERSPECTIVE - if (src.stat == 2) + if (src.stat == DEAD) src.verbs += /mob/proc/ghost - if(src.name == "monkey") - src.name = text("monkey ([rand(1, 1000)])") - src.real_name = src.name - return \ No newline at end of file + return diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index fddb26cfba..1274fd8a39 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -213,8 +213,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -286,8 +288,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -399,82 +403,7 @@ stat("Genetic Damage Time", changeling.geneticdamage) return -/mob/living/carbon/monkey/update_clothing() - if(buckled) - if(istype(buckled, /obj/structure/stool/bed/chair)) - lying = 0 - else - lying = 1 - if(update_icon) // Skie - ..() - for(var/i in overlays) - overlays -= i - - if (!( lying )) - icon_state = "monkey1" - else - icon_state = "monkey0" - - if (wear_mask) - if (istype(wear_mask, /obj/item/clothing/mask)) - var/t1 = wear_mask.icon_state - overlays += image("icon" = 'monkey.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = layer) - wear_mask.screen_loc = ui_monkey_mask - - if (r_hand) - if(update_icon) - overlays += image("icon" = 'items_righthand.dmi', "icon_state" = r_hand.item_state ? r_hand.item_state : r_hand.icon_state, "layer" = layer) - r_hand.screen_loc = ui_rhand - - if (l_hand) - if(update_icon) - overlays += image("icon" = 'items_lefthand.dmi', "icon_state" = l_hand.item_state ? l_hand.item_state : l_hand.icon_state, "layer" = layer) - l_hand.screen_loc = ui_lhand - - if (back) - var/t1 = back.icon_state //apparently tables make me upset and cause my dreams to shatter - overlays += image("icon" = 'back.dmi', "icon_state" = text("[][]", t1, (!( lying ) ? null : "2")), "layer" = layer) - back.screen_loc = ui_monkey_back - - if (handcuffed && update_icon) - pulling = null - if (!( lying )) - overlays += image("icon" = 'monkey.dmi', "icon_state" = "handcuff1", "layer" = layer) - else - overlays += image("icon" = 'monkey.dmi', "icon_state" = "handcuff2", "layer" = layer) - - if (client) - client.screen -= contents - client.screen += contents - client.screen -= hud_used.m_ints - client.screen -= hud_used.mov_int - if (i_select) - if (intent) - client.screen += hud_used.m_ints - - var/list/L = dd_text2list(intent, ",") - L[1] += ":-11" - i_select.screen_loc = dd_list2text(L,",") //ICONS, FUCKING SHIT//What - - else - i_select.screen_loc = null - if (m_select) - if (m_int) - client.screen += hud_used.mov_int - - var/list/L = dd_text2list(m_int, ",") - L[1] += ":-11" - m_select.screen_loc = dd_list2text(L,",") //ICONS, FUCKING SHIT//the fuck - - else - m_select.screen_loc = null - for(var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - spawn( 0 ) - show_inv(M) - return - return /mob/living/carbon/monkey/Move() if ((!( buckled ) || buckled.loc != loc)) @@ -760,8 +689,8 @@ if ((M.client && !( M.blinded ))) M.show_message(text("[] is now running on internals.", target), 1) else - source.update_clothing() - target.update_clothing() + source.regenerate_icons() + target.regenerate_icons() del(src) return diff --git a/code/modules/mob/living/carbon/monkey/update_icons.dm b/code/modules/mob/living/carbon/monkey/update_icons.dm new file mode 100644 index 0000000000..2fc11fdd6b --- /dev/null +++ b/code/modules/mob/living/carbon/monkey/update_icons.dm @@ -0,0 +1,89 @@ +/mob/living/carbon/monkey + var/list/overlays_lying[M_TOTAL_LAYERS] + var/list/overlays_standing[M_TOTAL_LAYERS] + +/mob/living/carbon/monkey/regenerate_icons() + ..() + update_inv_wear_mask(0) + update_inv_back(0) + update_inv_r_hand(0) + update_inv_l_hand(0) + update_inv_handcuffed(0) + update_icons() + //Hud Stuff + update_hud() + return + +/mob/living/carbon/monkey/update_icons() + update_hud() + lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again + overlays = null + if(lying) + icon_state = "monkey0" + for(var/image/I in overlays_lying) + overlays += I + else + icon_state = "monkey1" + for(var/image/I in overlays_standing) + overlays += I + + +//////// +/mob/living/carbon/monkey/update_inv_wear_mask(var/update_icons=1) + if( wear_mask && istype(wear_mask, /obj/item/clothing/mask) ) + overlays_lying[M_MASK_LAYER] = image("icon" = 'monkey.dmi', "icon_state" = "[wear_mask.icon_state]2") + overlays_standing[M_MASK_LAYER] = image("icon" = 'monkey.dmi', "icon_state" = "[wear_mask.icon_state]") + wear_mask.screen_loc = ui_monkey_mask + else + overlays_lying[M_MASK_LAYER] = null + overlays_standing[M_MASK_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/monkey/update_inv_r_hand(var/update_icons=1) + if(r_hand) + var/t_state = r_hand.item_state + if(!t_state) t_state = r_hand.icon_state + overlays_standing[M_R_HAND_LAYER] = image("icon" = 'items_righthand.dmi', "icon_state" = t_state) + r_hand.screen_loc = ui_rhand + else + overlays_standing[M_R_HAND_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/monkey/update_inv_l_hand(var/update_icons=1) + if(l_hand) + var/t_state = l_hand.item_state + if(!t_state) t_state = l_hand.icon_state + overlays_standing[M_L_HAND_LAYER] = image("icon" = 'items_lefthand.dmi', "icon_state" = t_state) + l_hand.screen_loc = ui_lhand + else + overlays_standing[M_L_HAND_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/monkey/update_inv_back(var/update_icons=1) + if(back) + overlays_lying[M_BACK_LAYER] = image("icon" = 'back.dmi', "icon_state" = "[back.icon_state]2") + overlays_standing[M_BACK_LAYER] = image("icon" = 'back.dmi', "icon_state" = "[back.icon_state]") + back.screen_loc = ui_monkey_back + else + overlays_lying[M_BACK_LAYER] = null + overlays_standing[M_BACK_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/monkey/update_inv_handcuffed(var/update_icons=1) + if(handcuffed) + pulling = null + overlays_lying[M_HANDCUFF_LAYER] = image("icon" = 'monkey.dmi', "icon_state" = "handcuff2") + overlays_standing[M_HANDCUFF_LAYER] = image("icon" = 'monkey.dmi', "icon_state" = "handcuff1") + else + overlays_lying[M_HANDCUFF_LAYER] = null + overlays_standing[M_HANDCUFF_LAYER] = null + if(update_icons) update_icons() + + +/mob/living/carbon/monkey/update_hud() + if (client) + client.screen |= contents diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index ee13a6ad6b..9b173ad669 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -41,11 +41,8 @@ var/extradam = 0 //added to when organ is at max dam for(var/datum/organ/external/affecting in H.organs) if(!affecting) continue - if(affecting.take_damage(0, divided_damage+extradam)) - extradam = 0 - else - extradam += divided_damage - H.UpdateDamageIcon() + if(affecting.take_damage(0, divided_damage+extradam)) //TODO: fix the extradam stuff. Or, ebtter yet...rewrite this entire proc ~Carn + H.UpdateDamageIcon() H.updatehealth() return 1 else if(istype(src, /mob/living/carbon/monkey)) @@ -173,19 +170,20 @@ /mob/living/proc/check_if_buckled() if (buckled) - if(buckled == /obj/structure/stool/bed || istype(buckled, /obj/machinery/conveyor)) - lying = 1 - if(lying) - var/h = hand - hand = 0 - drop_item() - hand = 1 - drop_item() - hand = h density = 1 + if( istype(buckled, /obj/structure/stool/bed/chair) ) + lying = 0 + else + lying = 1 else density = !lying - + if(lying) + var/h = hand + hand = 0 + drop_item() + hand = 1 + drop_item() + hand = h /mob/living/proc/Examine_OOC() set name = "Examine Meta-Info (OOC)" diff --git a/code/modules/mob/living/silicon/ai/login.dm b/code/modules/mob/living/silicon/ai/login.dm index e4f8f57643..13464e3e15 100644 --- a/code/modules/mob/living/silicon/ai/login.dm +++ b/code/modules/mob/living/silicon/ai/login.dm @@ -4,7 +4,7 @@ blood.override = 1 client.images += blood ..() - update_clothing() + regenerate_icons() for(var/S in src.client.screen) del(S) src.flash = new /obj/screen( null ) diff --git a/code/modules/mob/living/silicon/robot/hud.dm b/code/modules/mob/living/silicon/robot/hud.dm index cdc8adb3e2..1feb4b54fe 100644 --- a/code/modules/mob/living/silicon/robot/hud.dm +++ b/code/modules/mob/living/silicon/robot/hud.dm @@ -3,10 +3,6 @@ src.adding = list( ) src.other = list( ) - src.intents = list( ) - src.mon_blo = list( ) - src.m_ints = list( ) - src.mov_int = list( ) src.vimpaired = list( ) src.darkMask = list( ) diff --git a/code/modules/mob/living/silicon/robot/login.dm b/code/modules/mob/living/silicon/robot/login.dm index 0649e75a16..898c15e4b1 100644 --- a/code/modules/mob/living/silicon/robot/login.dm +++ b/code/modules/mob/living/silicon/robot/login.dm @@ -1,7 +1,7 @@ /mob/living/silicon/robot/Login(var/syndie = 0) ..() - update_clothing() + regenerate_icons() if (!isturf(src.loc)) src.client.eye = src.loc diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index fe64fb3c06..ad49d96860 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -579,8 +579,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G @@ -712,8 +714,10 @@ cell.layer = 20 if (user.hand ) user.l_hand = cell + user.update_inv_l_hand() else user.r_hand = cell + user.update_inv_r_hand() cell.add_fingerprint(user) cell.updateicon() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 41a36c8530..5958360f48 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -100,14 +100,13 @@ // organStructure.ProcessOrgans() return -/mob/proc/update_clothing() - return /mob/proc/restrained() if (handcuffed) return 1 return +//Used by monkeys, *chimpers* //TODO: eliminate this convoluted proc it's incredibly shitty. ~Carn /mob/proc/db_click(text, t1) var/obj/item/weapon/W = equipped() switch(text) @@ -119,6 +118,7 @@ u_equip(W) wear_mask = W W.equipped(src, text) + update_inv_wear_mask() if("back") if (back) return @@ -132,15 +132,8 @@ u_equip(W) back = W W.equipped(src, text) - if("back") - if ((back || !( istype(W, /obj/item/weapon) ))) - return - if (!( W.flags & 1 )) - return - u_equip(W) - back = W - W.equipped(src, text) - else + update_inv_back() + return @@ -173,6 +166,7 @@ if (W) u_equip(W) + update_icons() if (client) client.screen -= W if (W) @@ -193,7 +187,7 @@ u_equip(item) //if (client) // client.screen -= item - //update_clothing() + //regenerate_icons() return /mob/proc/get_active_hand() @@ -213,19 +207,21 @@ I.loc = src if (hand) l_hand = I + update_inv_l_hand() else r_hand = I + update_inv_r_hand() I.layer = 20 - update_clothing() /mob/proc/put_in_inactive_hand(var/obj/item/I) I.loc = src if (!hand) l_hand = I + update_inv_l_hand() else r_hand = I + update_inv_r_hand() I.layer = 20 - update_clothing() /mob/proc/reset_view(atom/A) if (client) @@ -277,15 +273,19 @@ /mob/proc/u_equip(W as obj) if (W == r_hand) r_hand = null + update_inv_r_hand() else if (W == l_hand) l_hand = null + update_inv_l_hand() else if (W == handcuffed) handcuffed = null + update_inv_handcuffed() else if (W == back) back = null + update_inv_back() else if (W == wear_mask) wear_mask = null - update_clothing() + update_inv_wear_mask() return diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 507127d21f..5bf15af1f7 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -73,34 +73,35 @@ var/other_mobs = null var/memory = "" var/poll_answer = 0.0 - var/sdisabilities = 0//Carbon - var/disabilities = 0//Carbon + var/sdisabilities = 0 //Carbon + var/disabilities = 0 //Carbon var/atom/movable/pulling = null var/stat = 0.0 var/next_move = null var/prev_move = null - var/monkeyizing = null//Carbon + var/monkeyizing = null //Carbon var/other = 0.0 var/hand = null - var/eye_blind = null//Carbon - var/eye_blurry = null//Carbon - var/ear_deaf = null//Carbon - var/ear_damage = null//Carbon - var/stuttering = null//Carbon + var/eye_blind = null //Carbon + var/eye_blurry = null //Carbon + var/ear_deaf = null //Carbon + var/ear_damage = null //Carbon + var/stuttering = null //Carbon var/real_name = null var/original_name = null //Original name is only used in ghost chat! It is not to be edited by anything! var/blinded = null - var/bhunger = 0//Carbon + var/bhunger = 0 //Carbon var/ajourn = 0 var/rejuv = null - var/druggy = 0//Carbon - var/confused = 0//Carbon + var/druggy = 0 //Carbon + var/confused = 0 //Carbon var/antitoxs = null var/plasma = null - var/sleeping = 0.0//Carbon - var/resting = 0.0//Carbon - var/lying = 0.0 - var/canmove = 1.0 + var/sleeping = 0 //Carbon + var/resting = 0 //Carbon + var/lying = 0 + var/lying_prev = 0 + var/canmove = 1 var/eye_stat = null//Living, potentially Carbon var/lastpuke = 0 var/unacidable = 0 diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index c666f87332..2e08bcf342 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -273,10 +273,12 @@ It's fairly easy to fix if dealing with single letters but not so much with comp if(!r_hand) I.loc = src r_hand = I + update_inv_r_hand() I.layer = 20 else if(!l_hand) I.loc = src l_hand = I + update_inv_l_hand() I.layer = 20 else I.loc = get_turf(src) \ No newline at end of file diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index 10fe110e21..83f8f15eba 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -754,9 +754,6 @@ datum/preferences backbag = 1 //Same as above character.backbag = backbag - character.update_face() - character.update_body() - if(!safety)//To prevent run-time errors due to null datum when using randomize_appearance_for() spawn(10) if(character&&character.client) diff --git a/code/modules/mob/organ/organ.dm b/code/modules/mob/organ/organ.dm index 9a7cb621e5..5aebf7cc87 100644 --- a/code/modules/mob/organ/organ.dm +++ b/code/modules/mob/organ/organ.dm @@ -22,13 +22,14 @@ var/icon_name = null var/body_part = null - var/damage_state = "00" + var/brutestate = 0 + var/burnstate = 0 var/brute_dam = 0 var/burn_dam = 0 - var/bandaged = 0 +// var/bandaged = 0 var/max_damage = 0 - var/wound_size = 0 - var/max_size = 0 +// var/wound_size = 0 +// var/max_size = 0 proc/take_damage(brute, burn) @@ -55,8 +56,7 @@ else return 0 - var/result = src.update_icon() - return result + return update_icon() proc/heal_damage(brute, burn) @@ -71,40 +71,34 @@ // new damage icon system // returns just the brute/burn damage code - proc/damage_state_text() - var/tburn = 0 - var/tbrute = 0 - + proc/update_icon() + var/tburn + var/tbrute if(burn_dam ==0) - tburn =0 - else if (src.burn_dam < (src.max_damage * 0.25 / 2)) + tburn = 0 + else if (src.burn_dam < (src.max_damage * 0.33)) tburn = 1 - else if (src.burn_dam < (src.max_damage * 0.75 / 2)) + else if (src.burn_dam < (src.max_damage * 0.66)) tburn = 2 else tburn = 3 if (src.brute_dam == 0) tbrute = 0 - else if (src.brute_dam < (src.max_damage * 0.25 / 2)) + else if (src.brute_dam < (src.max_damage * 0.33)) tbrute = 1 - else if (src.brute_dam < (src.max_damage * 0.75 / 2)) + else if (src.brute_dam < (src.max_damage * 0.66)) tbrute = 2 else tbrute = 3 - return "[tbrute][tburn]" - - -// new damage icon system -// adjusted to set damage_state to brute/burn code only (without r_name0 as before) - proc/update_icon() - var/n_is = src.damage_state_text() - if (n_is != src.damage_state) - src.damage_state = n_is + if((tbrute != brutestate) || (tburn != burnstate)) + brutestate = tbrute + burnstate = tburn return 1 return 0 - - + + + proc/getDisplayName() switch(src.name) if("l_leg") @@ -119,9 +113,10 @@ return src.name - +/* /**************************************************** INTERNAL ORGANS ****************************************************/ /datum/organ/internal name = "internal" +*/ diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index cd7b9c3268..ea4ce34e7f 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -325,6 +325,7 @@ if("walk") usr.m_intent = "run" usr.hud_used.move_intent.icon_state = "running" + if(istype(usr,/mob/living/carbon/alien/humanoid)) usr.update_icons() if("m_intent") if (!( usr.m_int )) switch(usr.m_intent) @@ -420,22 +421,18 @@ usr.a_intent = "help" usr.hud_used.action_intent.icon_state = "help" usr.hud_used.show_intent_icons = 0 - usr.client.screen -= usr.hud_used.intent_small_hud_objects if("harm") usr.a_intent = "hurt" usr.hud_used.action_intent.icon_state = "harm" usr.hud_used.show_intent_icons = 0 - usr.client.screen -= usr.hud_used.intent_small_hud_objects if("grab") usr.a_intent = "grab" usr.hud_used.action_intent.icon_state = "grab" usr.hud_used.show_intent_icons = 0 - usr.client.screen -= usr.hud_used.intent_small_hud_objects if("disarm") usr.a_intent = "disarm" usr.hud_used.action_intent.icon_state = "disarm" usr.hud_used.show_intent_icons = 0 - usr.client.screen -= usr.hud_used.intent_small_hud_objects if("pull") usr.pulling = null if("throw") @@ -541,6 +538,7 @@ usr.resting = !( usr.resting ) usr << "\blue You are now [(usr.resting) ? "resting" : "getting up"]" + /mob/living/verb/resist() set name = "Resist" set category = "IC" diff --git a/code/modules/mob/simple_animal/corgi.dm b/code/modules/mob/simple_animal/corgi.dm index 7d87f75271..a23ac110cc 100644 --- a/code/modules/mob/simple_animal/corgi.dm +++ b/code/modules/mob/simple_animal/corgi.dm @@ -22,31 +22,9 @@ var/obj/item/inventory_head var/obj/item/inventory_back -/mob/living/simple_animal/corgi/update_clothing() - overlays = list() - - if(inventory_head) - var/head_icon_state = inventory_head.icon_state - if(health <= 0) - head_icon_state += "2" - - var/icon/head_icon = icon('corgi_head.dmi',head_icon_state) - if(head_icon) - overlays += head_icon - - if(inventory_back) - var/back_icon_state = inventory_back.icon_state - if(health <= 0) - back_icon_state += "2" - - var/icon/back_icon = icon('corgi_back.dmi',back_icon_state) - if(back_icon) - overlays += back_icon - return - /mob/living/simple_animal/corgi/Life() ..() - update_clothing() + regenerate_icons() /mob/living/simple_animal/corgi/show_inv(mob/user as mob) user.machine = src @@ -179,7 +157,7 @@ usr.drop_item() item_to_add.loc = src src.inventory_head = item_to_add - update_clothing() + regenerate_icons() //Various hats and items (worn on his head) change Ian's behaviour. His attributes are reset when a HAT is removed. @@ -267,7 +245,7 @@ usr.drop_item() item_to_add.loc = src src.inventory_back = item_to_add - update_clothing() + regenerate_icons() //show_inv(usr) //Commented out because changing Ian's name and then calling up his inventory opens a new inventory...which is annoying. else diff --git a/code/modules/mob/simple_animal/life.dm b/code/modules/mob/simple_animal/life.dm index 7a51610a92..81ccecf574 100644 --- a/code/modules/mob/simple_animal/life.dm +++ b/code/modules/mob/simple_animal/life.dm @@ -279,8 +279,10 @@ G.assailant = M if (M.hand) M.l_hand = G + M.update_inv_l_hand() else M.r_hand = G + M.update_inv_r_hand() G.layer = 20 G.affecting = src grabbed_by += G diff --git a/code/modules/mob/simple_animal/update_icons.dm b/code/modules/mob/simple_animal/update_icons.dm new file mode 100644 index 0000000000..1b010a23b2 --- /dev/null +++ b/code/modules/mob/simple_animal/update_icons.dm @@ -0,0 +1,21 @@ +/mob/living/simple_animal/corgi/regenerate_icons() + overlays = list() + + if(inventory_head) + var/head_icon_state = inventory_head.icon_state + if(health <= 0) + head_icon_state += "2" + + var/icon/head_icon = icon('corgi_head.dmi',head_icon_state) + if(head_icon) + overlays += head_icon + + if(inventory_back) + var/back_icon_state = inventory_back.icon_state + if(health <= 0) + back_icon_state += "2" + + var/icon/back_icon = icon('corgi_back.dmi',back_icon_state) + if(back_icon) + overlays += back_icon + return diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index c93d5a3980..2098f6e321 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -5,7 +5,7 @@ if (W==w_uniform) // will be teared continue drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 stunned = 1 @@ -64,7 +64,7 @@ return for(var/obj/item/W in src) drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 icon = null @@ -152,7 +152,7 @@ return for(var/obj/item/W in src) drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 icon = null @@ -163,7 +163,6 @@ //client.screen -= main_hud1.contents client.screen -= hud_used.contents client.screen -= hud_used.adding - client.screen -= hud_used.mon_blo client.screen -= list( oxygen, throw_icon, i_select, m_select, toxin, internals, fire, hands, healths, pullin, blind, flash, rest, sleep, mach ) client.screen -= list( zone_sel, oxygen, throw_icon, i_select, m_select, toxin, internals, fire, hands, healths, pullin, blind, flash, rest, sleep, mach ) var/mob/living/silicon/robot/O = new /mob/living/silicon/robot( loc ) @@ -216,7 +215,7 @@ return for(var/obj/item/W in src) drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 icon = null @@ -256,7 +255,7 @@ return for(var/obj/item/W in src) drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 icon = null @@ -307,7 +306,7 @@ return for(var/obj/item/W in src) drop_from_slot(W) - update_clothing() + regenerate_icons() monkeyizing = 1 canmove = 0 icon = null diff --git a/code/modules/mob/update_icons.dm b/code/modules/mob/update_icons.dm new file mode 100644 index 0000000000..64f2a2fdf7 --- /dev/null +++ b/code/modules/mob/update_icons.dm @@ -0,0 +1,62 @@ +//Most of these are defined at this level to reduce on checks elsewhere in the code. +//Having them here also makes for a nice reference list of the various overlay-updating procs available + +/mob/proc/regenerate_icons() //TODO: phase this out completely if possible + return + +/mob/proc/update_icons() + return + +/mob/proc/update_hud() + return + +/mob/proc/update_inv_handcuffed() + return + +/mob/proc/update_inv_back() + return + +/mob/proc/update_inv_l_hand() + return + +/mob/proc/update_inv_r_hand() + return + +/mob/proc/update_inv_wear_mask() + return + +/mob/proc/update_inv_wear_suit() + return + +/mob/proc/update_inv_w_uniform() + return + +/mob/proc/update_inv_belt() + return + +/mob/proc/update_inv_head() + return + +/mob/proc/update_inv_gloves() + return + +/mob/proc/update_mutations() + return + +/mob/proc/update_inv_wear_id() + return + +/mob/proc/update_inv_shoes() + return + +/mob/proc/update_inv_glasses() + return + +/mob/proc/update_inv_s_store() + return + +/mob/proc/update_inv_pockets() + return + +/mob/proc/update_inv_ears() + return diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index 5bb535e00e..9809ecc4fe 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -26,12 +26,13 @@ if(!(M.r_hand)) M.u_equip(src) M.r_hand = src + M.update_inv_r_hand() else if(over_object.name == "l_hand") if(!(M.l_hand)) M.u_equip(src) M.l_hand = src - M.update_clothing() + M.update_inv_l_hand() src.add_fingerprint(usr) return diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index c36913b0c1..86006f28fb 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -370,7 +370,8 @@ on = has_power() update() - user.update_clothing() + user.update_inv_l_hand(0) + user.update_inv_r_hand() if(on && rigged) explode() else @@ -486,10 +487,9 @@ var/datum/organ/external/affecting = H.get_organ("[user.hand ? "l" : "r" ]_arm") - affecting.take_damage( 0, 5 ) // 5 burn damage - + if(affecting.take_damage( 0, 5 )) // 5 burn damage + H.UpdateDamageIcon() H.updatehealth() - H.UpdateDamageIcon() return // if burned, don't remove the light // create a light tube/bulb item and put it in the user's hand @@ -501,8 +501,10 @@ L.layer = 20 if(user.hand) user.l_hand = L + user.update_inv_l_hand() else user.r_hand = L + user.update_inv_r_hand() // light item inherits the switchcount, then zero it L.switchcount = switchcount @@ -514,7 +516,6 @@ status = LIGHT_EMPTY update() - user.update_clothing() // break the light and make sparks if was on diff --git a/code/modules/projectiles/projectile/change.dm b/code/modules/projectiles/projectile/change.dm index cae60a735b..7c86838fef 100644 --- a/code/modules/projectiles/projectile/change.dm +++ b/code/modules/projectiles/projectile/change.dm @@ -29,7 +29,7 @@ if("monkey") if (M.monkeyizing) return - M.update_clothing() +// M.regenerate_icons() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -48,7 +48,7 @@ if("robot") if (M.monkeyizing) return - M.update_clothing() +// M.regenerate_icons() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -56,7 +56,6 @@ if(M.client) M.client.screen -= M.hud_used.contents M.client.screen -= M.hud_used.adding - M.client.screen -= M.hud_used.mon_blo M.client.screen -= list( M.oxygen, M.throw_icon, M.i_select, M.m_select, M.toxin, M.internals, M.fire, M.hands, M.healths, M.pullin, M.blind, M.flash, M.rest, M.sleep, M.mach ) M.client.screen -= list( M.zone_sel, M.oxygen, M.throw_icon, M.i_select, M.m_select, M.toxin, M.internals, M.fire, M.hands, M.healths, M.pullin, M.blind, M.flash, M.rest, M.sleep, M.mach ) @@ -98,7 +97,7 @@ if("metroid") if (M.monkeyizing) return - M.update_clothing() +// M.regenerate_icons() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -129,7 +128,7 @@ if("alien") if (M.monkeyizing) return - M.update_clothing() +// M.regenerate_icons() M.monkeyizing = 1 M.canmove = 0 M.icon = null @@ -155,7 +154,7 @@ if("human") if (M.monkeyizing) return - M.update_clothing() +// M.regenerate_icons() M.monkeyizing = 1 M.canmove = 0 M.icon = null diff --git a/code/setup.dm b/code/setup.dm index 81fd678835..02843df9ed 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -172,32 +172,42 @@ var/MAX_EXPLOSION_RANGE = 14 #define HIDEEARS 2 //APPLIES ONLY TO HELMETS!! #define HIDEEYES 4 //APPLIES ONLY TO HELMETS!! -//clothing-overlay layers. They are floats so they always appear above the Mob -#define DAMAGE_LAYER -23 -#define UNIFORM_LAYER -22 -#define B_UNIFORM_LAYER -21 -#define SHOES_LAYER -20 -#define B_SHOES_LAYER -19 -#define ID_LAYER -18 -#define GLOVES_LAYER -17 -#define B_GLOVES_LAYER -16 -#define EARS_LAYER -15 -#define SUIT_LAYER -14 -#define B_SUIT_LAYER -13 -#define FACE_LAYER -12 -#define GLASSES_LAYER -11 -#define FACEMASK_LAYER -10 -#define B_FACEMASK_LAYER -9 -#define HEAD_LAYER -8 -#define B_HEAD_LAYER -7 -#define SUIT_STORE_LAYER -6 -#define BELT_LAYER -5 -#define BACK_LAYER -4 -#define CUFFED_LAYER -3 -#define SHIELD_LAYER -2 -#define INHANDS_LAYER -1 +//Human Overlays Indexes +#define MUTANTRACE_LAYER 1 //TODO: make part of body? +#define MUTATIONS_LAYER 2 +#define DAMAGE_LAYER 3 +#define UNIFORM_LAYER 4 +#define ID_LAYER 5 +#define SHOES_LAYER 6 +#define GLOVES_LAYER 7 +#define EARS_LAYER 8 +#define SUIT_LAYER 9 +#define GLASSES_LAYER 10 +#define FACEMASK_LAYER 11 +#define BELT_LAYER 12 //Possible make this an overlay of somethign required to wear a belt? +#define SUIT_STORE_LAYER 13 +#define BACK_LAYER 14 +#define HAIR_LAYER 15 //TODO: make part of head layer? +#define HEAD_LAYER 16 +#define HANDCUFF_LAYER 17 +#define L_HAND_LAYER 18 +#define R_HAND_LAYER 19 +#define TOTAL_LAYERS 19 +//Monkey Overlays Indexes +#define M_MASK_LAYER 1 +#define M_BACK_LAYER 2 +#define M_HANDCUFF_LAYER 3 +#define M_L_HAND_LAYER 4 +#define M_R_HAND_LAYER 5 +#define M_TOTAL_LAYERS 5 +//Xeno Overlays Indexes +#define X_HEAD_LAYER 1 +#define X_SUIT_LAYER 2 +#define X_L_HAND_LAYER 3 +#define X_R_HAND_LAYER 4 +#define X_TOTAL_LAYERS 4 //Cant seem to find a mob bitflags area other than the powers one diff --git a/html/changelog.html b/html/changelog.html index 0533cc47c6..1df84cdee6 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -47,6 +47,20 @@ should be listed in the changelog upon commit tho. Thanks. --> +