U_I Phase 2.0: Code cleanup

Removing calls to update_icons_layers and the like, stubbing them to help track down future calls.
This commit is contained in:
Arokha Sieyes
2018-03-07 23:39:52 -05:00
parent 62e0c122fa
commit 53a185f838
41 changed files with 396 additions and 577 deletions

View File

@@ -80,29 +80,33 @@
#define BLOCKHEADHAIR 0x20 // Hides the user's hair overlay. Leaves facial hair. #define BLOCKHEADHAIR 0x20 // Hides the user's hair overlay. Leaves facial hair.
#define BLOCKHAIR 0x40 // Hides the user's hair, facial and otherwise. #define BLOCKHAIR 0x40 // Hides the user's hair, facial and otherwise.
// Slots. // Slots as numbers //
#define slot_back 1 //Hands
#define slot_wear_mask 2 #define slot_l_hand 1
#define slot_handcuffed 3 #define slot_r_hand 2 //Some things may reference this, try to keep it here
#define slot_l_hand 4 //Shown unless F12 pressed
#define slot_r_hand 5 #define slot_back 3
#define slot_belt 6 #define slot_belt 4
#define slot_wear_id 7 #define slot_wear_id 5
#define slot_l_ear 8 #define slot_l_store 6
#define slot_glasses 9 #define slot_r_store 7 //Some things may reference this, try to keep it here
//Shown when inventory unhidden
#define slot_glasses 8
#define slot_wear_mask 9
#define slot_gloves 10 #define slot_gloves 10
#define slot_head 11 #define slot_head 11
#define slot_shoes 12 #define slot_shoes 12
#define slot_wear_suit 13 #define slot_wear_suit 13
#define slot_w_uniform 14 #define slot_w_uniform 14
#define slot_l_store 15 #define slot_s_store 15
#define slot_r_store 16 #define slot_l_ear 16
#define slot_s_store 17 #define slot_r_ear 17
#define slot_in_backpack 18 //Secret slots
#define slot_legcuffed 19 #define slot_legs 18
#define slot_r_ear 20 #define slot_tie 19
#define slot_legs 21 #define slot_handcuffed 20
#define slot_tie 22 #define slot_legcuffed 21
#define slot_in_backpack 22
// Inventory slot strings. // Inventory slot strings.
// since numbers cannot be used as associative list keys. // since numbers cannot be used as associative list keys.

View File

@@ -267,5 +267,3 @@
//Some mob icon layering defines //Some mob icon layering defines
#define BODY_LAYER -100 #define BODY_LAYER -100
#define BACKPLANE_LAYER -101
#define HUD_LAYER -105

View File

@@ -922,8 +922,8 @@ proc/sort_atoms_by_layer(var/list/atoms)
/proc/gen_hud_image(var/file, var/person, var/state, var/plane) /proc/gen_hud_image(var/file, var/person, var/state, var/plane)
var/image/img = image(file, person, state) var/image/img = image(file, person, state)
img.plane = plane //Thanks Byond. img.plane = plane //Thanks Byond.
img.layer = HUD_LAYER img.layer = MOB_LAYER-0.02
img.appearance_flags = APPEARANCE_UI|KEEP_APART img.appearance_flags = APPEARANCE_UI
return img return img
/** /**

View File

@@ -164,6 +164,7 @@ var/list/global_huds = list(
var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = 0 var/action_buttons_hidden = 0
var/list/slot_info
datum/hud/New(mob/owner) datum/hud/New(mob/owner)
mymob = owner mymob = owner

View File

@@ -14,6 +14,7 @@
src.adding = list() src.adding = list()
src.other = list() src.other = list()
src.hotkeybuttons = list() //These can be disabled for hotkey users src.hotkeybuttons = list() //These can be disabled for hotkey users
src.slot_info = list()
var/list/hud_elements = list() var/list/hud_elements = list()
var/obj/screen/using var/obj/screen/using
@@ -33,6 +34,7 @@
inv_box.screen_loc = slot_data["loc"] inv_box.screen_loc = slot_data["loc"]
inv_box.slot_id = slot_data["slot"] inv_box.slot_id = slot_data["slot"]
inv_box.icon_state = slot_data["state"] inv_box.icon_state = slot_data["state"]
slot_info["[inv_box.slot_id]"] = inv_box.screen_loc
if(slot_data["dir"]) if(slot_data["dir"])
inv_box.set_dir(slot_data["dir"]) inv_box.set_dir(slot_data["dir"])
@@ -164,9 +166,9 @@
inv_box.slot_id = slot_r_hand inv_box.slot_id = slot_r_hand
inv_box.color = ui_color inv_box.color = ui_color
inv_box.alpha = ui_alpha inv_box.alpha = ui_alpha
src.r_hand_hud_object = inv_box src.r_hand_hud_object = inv_box
src.adding += inv_box src.adding += inv_box
slot_info["[slot_r_hand]"] = inv_box.screen_loc
inv_box = new /obj/screen/inventory/hand() inv_box = new /obj/screen/inventory/hand()
inv_box.hud = src inv_box.hud = src
@@ -181,6 +183,7 @@
inv_box.alpha = ui_alpha inv_box.alpha = ui_alpha
src.l_hand_hud_object = inv_box src.l_hand_hud_object = inv_box
src.adding += inv_box src.adding += inv_box
slot_info["[slot_l_hand]"] = inv_box.screen_loc
using = new /obj/screen/inventory() using = new /obj/screen/inventory()
using.name = "hand" using.name = "hand"

View File

@@ -50,8 +50,6 @@ var/datum/antagonist/mercenary/mercs
var/obj/item/device/radio/uplink/U = new(player.loc, player.mind, DEFAULT_TELECRYSTAL_AMOUNT) var/obj/item/device/radio/uplink/U = new(player.loc, player.mind, DEFAULT_TELECRYSTAL_AMOUNT)
player.put_in_hands(U) player.put_in_hands(U)
player.update_icons_layers()
create_id("Mercenary", player) create_id("Mercenary", player)
create_radio(SYND_FREQ, player) create_radio(SYND_FREQ, player)
return 1 return 1

View File

@@ -47,7 +47,6 @@ var/datum/antagonist/technomancer/technomancers
technomancer_mob.equip_to_slot_or_del(new /obj/item/device/flashlight(technomancer_mob), slot_belt) technomancer_mob.equip_to_slot_or_del(new /obj/item/device/flashlight(technomancer_mob), slot_belt)
technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(technomancer_mob), slot_shoes) technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(technomancer_mob), slot_shoes)
technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/head/technomancer/master(technomancer_mob), slot_head) technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/head/technomancer/master(technomancer_mob), slot_head)
technomancer_mob.update_icons_layers()
return 1 return 1
/datum/antagonist/technomancer/proc/equip_apprentice(var/mob/living/carbon/human/technomancer_mob) /datum/antagonist/technomancer/proc/equip_apprentice(var/mob/living/carbon/human/technomancer_mob)
@@ -67,7 +66,6 @@ var/datum/antagonist/technomancer/technomancers
technomancer_mob.equip_to_slot_or_del(new /obj/item/device/flashlight(technomancer_mob), slot_belt) technomancer_mob.equip_to_slot_or_del(new /obj/item/device/flashlight(technomancer_mob), slot_belt)
technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(technomancer_mob), slot_shoes) technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(technomancer_mob), slot_shoes)
technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/head/technomancer/apprentice(technomancer_mob), slot_head) technomancer_mob.equip_to_slot_or_del(new /obj/item/clothing/head/technomancer/apprentice(technomancer_mob), slot_head)
technomancer_mob.update_icons()
return 1 return 1
/datum/antagonist/technomancer/check_victory() /datum/antagonist/technomancer/check_victory()

View File

@@ -87,7 +87,6 @@ var/datum/antagonist/wizard/wizards
wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/box(wizard_mob), slot_in_backpack) wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/box(wizard_mob), slot_in_backpack)
wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/teleportation_scroll(wizard_mob), slot_r_store) wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/teleportation_scroll(wizard_mob), slot_r_store)
wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/spellbook(wizard_mob), slot_r_hand) wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/spellbook(wizard_mob), slot_r_hand)
wizard_mob.update_icons_layers()
return 1 return 1
/datum/antagonist/wizard/check_victory() /datum/antagonist/wizard/check_victory()

View File

@@ -122,7 +122,6 @@
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
visible_message("<span class='warning'>[src] pulls on their clothes, peeling it off along with parts of their skin attached!</span>", visible_message("<span class='warning'>[src] pulls on their clothes, peeling it off along with parts of their skin attached!</span>",
"<span class='notice'>We remove and deform our equipment.</span>") "<span class='notice'>We remove and deform our equipment.</span>")
M.update_icons_layers()
M.mind.changeling.armor_deployed = 0 M.mind.changeling.armor_deployed = 0
return success return success
@@ -138,7 +137,6 @@
M.equip_to_slot_or_del(I, slot_head) M.equip_to_slot_or_del(I, slot_head)
grown_items_list.Add("a helmet") grown_items_list.Add("a helmet")
playsound(src, 'sound/effects/blobattack.ogg', 30, 1) playsound(src, 'sound/effects/blobattack.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -148,7 +146,6 @@
M.equip_to_slot_or_del(I, slot_w_uniform) M.equip_to_slot_or_del(I, slot_w_uniform)
grown_items_list.Add("a uniform") grown_items_list.Add("a uniform")
playsound(src, 'sound/effects/blobattack.ogg', 30, 1) playsound(src, 'sound/effects/blobattack.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -158,7 +155,6 @@
M.equip_to_slot_or_del(I, slot_gloves) M.equip_to_slot_or_del(I, slot_gloves)
grown_items_list.Add("some gloves") grown_items_list.Add("some gloves")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -168,7 +164,6 @@
M.equip_to_slot_or_del(I, slot_shoes) M.equip_to_slot_or_del(I, slot_shoes)
grown_items_list.Add("shoes") grown_items_list.Add("shoes")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -178,7 +173,6 @@
M.equip_to_slot_or_del(I, slot_belt) M.equip_to_slot_or_del(I, slot_belt)
grown_items_list.Add("a belt") grown_items_list.Add("a belt")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -188,7 +182,6 @@
M.equip_to_slot_or_del(I, slot_glasses) M.equip_to_slot_or_del(I, slot_glasses)
grown_items_list.Add("some glasses") grown_items_list.Add("some glasses")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -198,7 +191,6 @@
M.equip_to_slot_or_del(I, slot_wear_mask) M.equip_to_slot_or_del(I, slot_wear_mask)
grown_items_list.Add("a mask") grown_items_list.Add("a mask")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -208,7 +200,6 @@
M.equip_to_slot_or_del(I, slot_back) M.equip_to_slot_or_del(I, slot_back)
grown_items_list.Add("a backpack") grown_items_list.Add("a backpack")
playsound(src, 'sound/effects/blobattack.ogg', 30, 1) playsound(src, 'sound/effects/blobattack.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -218,7 +209,6 @@
M.equip_to_slot_or_del(I, slot_wear_suit) M.equip_to_slot_or_del(I, slot_wear_suit)
grown_items_list.Add("an exosuit") grown_items_list.Add("an exosuit")
playsound(src, 'sound/effects/blobattack.ogg', 30, 1) playsound(src, 'sound/effects/blobattack.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
@@ -228,20 +218,13 @@
M.equip_to_slot_or_del(I, slot_wear_id) M.equip_to_slot_or_del(I, slot_wear_id)
grown_items_list.Add("an ID card") grown_items_list.Add("an ID card")
playsound(src, 'sound/effects/splat.ogg', 30, 1) playsound(src, 'sound/effects/splat.ogg', 30, 1)
M.update_icons_layers()
success = 1 success = 1
sleep(1 SECOND) sleep(1 SECOND)
var/feedback = english_list(grown_items_list, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "" ) var/feedback = english_list(grown_items_list, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "" )
M << "<span class='notice'>We have grown [feedback].</span>" M << "<span class='notice'>We have grown [feedback].</span>"
/*
for(var/I in stuff_to_equip)
world << I
world << stuff_to_equip
world << "Proc ended."
*/
M.update_icons()
if(success) if(success)
M.mind.changeling.armor_deployed = 1 M.mind.changeling.armor_deployed = 1
M.mind.changeling.chem_charges -= 10 M.mind.changeling.chem_charges -= 10

View File

@@ -56,7 +56,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/head/chameleon/changeling /obj/item/clothing/head/chameleon/changeling
name = "malformed head" name = "malformed head"
@@ -78,7 +77,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/suit/chameleon/changeling /obj/item/clothing/suit/chameleon/changeling
name = "chitinous chest" name = "chitinous chest"
@@ -104,7 +102,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/shoes/chameleon/changeling /obj/item/clothing/shoes/chameleon/changeling
name = "malformed feet" name = "malformed feet"
@@ -130,7 +127,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/weapon/storage/backpack/chameleon/changeling /obj/item/weapon/storage/backpack/chameleon/changeling
name = "backpack" name = "backpack"
@@ -158,7 +154,6 @@ var/global/list/changeling_fabricated_clothing = list(
for(var/atom/movable/AM in src.contents) //Dump whatever's in the bag before deleting. for(var/atom/movable/AM in src.contents) //Dump whatever's in the bag before deleting.
AM.forceMove(get_turf(loc)) AM.forceMove(get_turf(loc))
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/gloves/chameleon/changeling /obj/item/clothing/gloves/chameleon/changeling
name = "malformed hands" name = "malformed hands"
@@ -185,8 +180,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/mask/chameleon/changeling /obj/item/clothing/mask/chameleon/changeling
name = "chitin visor" name = "chitin visor"
@@ -213,7 +206,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/clothing/glasses/chameleon/changeling /obj/item/clothing/glasses/chameleon/changeling
name = "chitin goggles" name = "chitin goggles"
@@ -235,7 +227,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/weapon/storage/belt/chameleon/changeling /obj/item/weapon/storage/belt/chameleon/changeling
name = "waist pouch" name = "waist pouch"
@@ -261,7 +252,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/weapon/card/id/syndicate/changeling /obj/item/weapon/card/id/syndicate/changeling
name = "chitinous card" name = "chitinous card"
@@ -291,8 +281,6 @@ var/global/list/changeling_fabricated_clothing = list(
visible_message("<span class='warning'>[H] tears off [src]!</span>", visible_message("<span class='warning'>[H] tears off [src]!</span>",
"<span class='notice'>We remove [src].</span>") "<span class='notice'>We remove [src].</span>")
qdel(src) qdel(src)
H.update_icons_layers()
/obj/item/weapon/card/id/syndicate/changeling/Click() //Since we can't hold it in our hands, and attack_hand() doesn't work if it in inventory... /obj/item/weapon/card/id/syndicate/changeling/Click() //Since we can't hold it in our hands, and attack_hand() doesn't work if it in inventory...
if(!registered_user) if(!registered_user)

View File

@@ -155,7 +155,6 @@
var/mob/M = obj.loc var/mob/M = obj.loc
if(ismob(M)) if(ismob(M))
M.remove_from_mob(obj) M.remove_from_mob(obj)
M.update_icons_layers() //so their overlays update
if(!silent) if(!silent)
var/obj/oldobj = obj var/obj/oldobj = obj

View File

@@ -283,6 +283,7 @@
// note this isn't called during the initial dressing of a player // note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(var/mob/user, var/slot) /obj/item/proc/equipped(var/mob/user, var/slot)
hud_layerise() hud_layerise()
user.position_hud_item(src,slot)
if(user.client) user.client.screen |= src if(user.client) user.client.screen |= src
if(user.pulling == src) user.stop_pulling() if(user.pulling == src) user.stop_pulling()
return return
@@ -698,7 +699,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
if(slot_l_hand_str) if(slot_l_hand_str)
state2use += "_l" state2use += "_l"
testing("[src] (\ref[src]) - Worn Icon:[icon2use], Worn State:[state2use], Worn Layer:[layer2use]") // testing("[src] (\ref[src]) - Slot: [slot_name], Inhands: [inhands], Worn Icon:[icon2use], Worn State:[state2use], Worn Layer:[layer2use]")
//Generate the base onmob icon //Generate the base onmob icon
var/icon/standing_icon = icon(icon = icon2use, icon_state = state2use) var/icon/standing_icon = icon(icon = icon2use, icon_state = state2use)

View File

@@ -487,7 +487,6 @@
M.timeofdeath = 0 M.timeofdeath = 0
M.stat = UNCONSCIOUS //Life() can bring them back to consciousness if it needs to. M.stat = UNCONSCIOUS //Life() can bring them back to consciousness if it needs to.
M.regenerate_icons()
M.failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath. M.failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath.
M.reload_fullscreen() M.reload_fullscreen()

View File

@@ -103,6 +103,13 @@
target.update_inv_handcuffed() target.update_inv_handcuffed()
return 1 return 1
/obj/item/weapon/handcuffs/equipped(var/mob/living/user,var/slot)
. = ..()
if(slot == slot_handcuffed)
user.drop_r_hand()
user.drop_l_hand()
user.stop_pulling()
var/last_chew = 0 var/last_chew = 0
/mob/living/carbon/human/RestrainedClickOn(var/atom/A) /mob/living/carbon/human/RestrainedClickOn(var/atom/A)
if (A != src) return ..() if (A != src) return ..()
@@ -315,3 +322,11 @@ var/last_chew = 0
target.legcuffed = lcuffs target.legcuffed = lcuffs
target.update_inv_legcuffed() target.update_inv_legcuffed()
return 1 return 1
/obj/item/weapon/handcuffs/legcuffs/equipped(var/mob/living/user,var/slot)
. = ..()
if(slot == slot_legcuffed)
if(user.m_intent != "walk")
user.m_intent = "walk"
if(user.hud_used && user.hud_used.move_intent)
user.hud_used.move_intent.icon_state = "walking"

View File

@@ -1001,11 +1001,6 @@
//strip their stuff and stick it in the crate //strip their stuff and stick it in the crate
for(var/obj/item/I in M) for(var/obj/item/I in M)
M.drop_from_inventory(I, locker) M.drop_from_inventory(I, locker)
if(ishuman(M))
var/mob/living/carbon/human/H = M
H.update_icons_layers() //Cheaper
else
M.update_icons()
//so they black out before warping //so they black out before warping
M.Paralyse(5) M.Paralyse(5)
@@ -1188,10 +1183,8 @@
usr << "This can only be used on instances of type /mob/living/carbon/human" usr << "This can only be used on instances of type /mob/living/carbon/human"
return return
var/block=text2num(href_list["block"]) var/block=text2num(href_list["block"])
//testing("togmutate([href_list["block"]] -> [block])")
usr.client.cmd_admin_toggle_block(H,block) usr.client.cmd_admin_toggle_block(H,block)
show_player_panel(H) show_player_panel(H)
//H.regenerate_icons()
else if(href_list["adminplayeropts"]) else if(href_list["adminplayeropts"])
var/mob/M = locate(href_list["adminplayeropts"]) var/mob/M = locate(href_list["adminplayeropts"])

View File

@@ -37,7 +37,6 @@
if(ishuman(usr)) if(ishuman(usr))
var/mob/living/carbon/human/H = usr var/mob/living/carbon/human/H = usr
H.name = H.get_visible_name() 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.loc = O.loc // Appear where the object you were controlling is -- TLE
usr.client.eye = usr usr.client.eye = usr

View File

@@ -287,10 +287,10 @@ datum/preferences
if(icon_updates) if(icon_updates)
character.force_update_limbs() character.force_update_limbs()
character.update_mutations(0) character.update_icons_body()
character.update_underwear(0) character.update_mutations()
character.update_hair(0) character.update_underwear()
character.update_icons_all() character.update_hair()
/datum/preferences/proc/open_load_dialog(mob/user) /datum/preferences/proc/open_load_dialog(mob/user)
var/dat = "<body>" var/dat = "<body>"

View File

@@ -265,6 +265,15 @@
return return
..() ..()
/obj/item/clothing/suit/straight_jacket/equipped(var/mob/living/user,var/slot)
. = ..()
if(slot == slot_wear_suit)
user.drop_l_hand()
user.drop_r_hand()
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.drop_from_inventory(H.handcuffed)
/obj/item/clothing/suit/ianshirt /obj/item/clothing/suit/ianshirt
name = "worn shirt" name = "worn shirt"
desc = "A worn out, curiously comfortable t-shirt with a picture of Ian. You wouldn't go so far as to say it feels like being hugged when you wear it but it's pretty close. Good for sleeping in." desc = "A worn out, curiously comfortable t-shirt with a picture of Ian. You wouldn't go so far as to say it feels like being hugged when you wear it but it's pretty close. Good for sleeping in."

View File

@@ -247,7 +247,6 @@
var/mob/M = obj.loc var/mob/M = obj.loc
if(ismob(M)) if(ismob(M))
M.remove_from_mob(obj) M.remove_from_mob(obj)
M.update_icons_layers() //so their overlays update
if(!silent) if(!silent)
var/obj/oldobj = obj var/obj/oldobj = obj

View File

@@ -103,7 +103,6 @@
if (ishuman(body)) if (ishuman(body))
var/mob/living/carbon/human/H = body var/mob/living/carbon/human/H = body
icon = H.icon icon = H.icon
LAZYCLEARLIST(H.list_huds)
H.update_icons() H.update_icons()
overlays = H.overlays overlays = H.overlays
else else

View File

@@ -83,8 +83,6 @@ var/list/holder_mob_icon_cache = list()
H.update_inv_l_hand() H.update_inv_l_hand()
else if(H.r_hand == src) else if(H.r_hand == src)
H.update_inv_r_hand() H.update_inv_r_hand()
//else
//H.regenerate_icons() //Basically just too expensive. Probably also not necessary.
//Mob specific holders. //Mob specific holders.
/obj/item/weapon/holder/diona /obj/item/weapon/holder/diona

View File

@@ -138,7 +138,6 @@ var/list/slot_equipment_priority = list( \
remove_from_mob(W, target) remove_from_mob(W, target)
if(!(W && W.loc)) if(!(W && W.loc))
return 1 // self destroying objects (tk, grabs) return 1 // self destroying objects (tk, grabs)
update_icons_layers()
return 1 return 1
return 0 return 0

View File

@@ -290,10 +290,8 @@
H.bloody_hands = 0 H.bloody_hands = 0
H.update_inv_gloves(0) H.update_inv_gloves(0)
H.germ_level = 0 H.germ_level = 0
update_icons_layers(FALSE) //apply the now updated overlays to the mob
update_icons_body() update_icons_body()
/mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) /mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..() ..()
var/temp_inc = max(min(BODYTEMP_HEATING_MAX*(1-get_heat_protection()), exposed_temperature - bodytemperature), 0) var/temp_inc = max(min(BODYTEMP_HEATING_MAX*(1-get_heat_protection()), exposed_temperature - bodytemperature), 0)

View File

@@ -5,7 +5,8 @@
icon = 'icons/effects/effects.dmi' //We have an ultra-complex update icons that overlays everything, don't load some stupid random male human icon = 'icons/effects/effects.dmi' //We have an ultra-complex update icons that overlays everything, don't load some stupid random male human
icon_state = "nothing" icon_state = "nothing"
var/list/hud_list[TOTAL_HUDS] has_huds = TRUE //We do have HUDs (like health, wanted, status, not inventory slots)
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us. var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
var/obj/item/weapon/rig/wearing_rig // This is very not good, but it's much much better than calling get_rig() every update_canmove() call. var/obj/item/weapon/rig/wearing_rig // This is very not good, but it's much much better than calling get_rig() every update_canmove() call.
var/last_push_time //For human_attackhand.dm, keeps track of the last use of disarm var/last_push_time //For human_attackhand.dm, keeps track of the last use of disarm
@@ -40,9 +41,8 @@
nutrition = rand(200,400) nutrition = rand(200,400)
make_hud_overlays()
human_mob_list |= src human_mob_list |= src
..() ..()
hide_underwear.Cut() hide_underwear.Cut()
@@ -59,13 +59,6 @@
for(var/organ in organs) for(var/organ in organs)
qdel(organ) qdel(organ)
LAZYCLEARLIST(list_layers)
list_layers = null //Be free!
LAZYCLEARLIST(list_body)
list_body = null
LAZYCLEARLIST(list_huds)
list_huds = null
return ..() return ..()
/mob/living/carbon/human/Stat() /mob/living/carbon/human/Stat()

View File

@@ -102,8 +102,6 @@
can_be_antagged = TRUE can_be_antagged = TRUE
var/has_huds = TRUE //Do they have all the fancy life huds? Not for mannequins.
// Used by mobs in virtual reality to point back to the "real" mob the client belongs to. // Used by mobs in virtual reality to point back to the "real" mob the client belongs to.
var/mob/living/carbon/human/vr_holder = null var/mob/living/carbon/human/vr_holder = null
// Used by "real" mobs after they leave a VR session // Used by "real" mobs after they leave a VR session

View File

@@ -108,7 +108,7 @@
return FBP_NONE return FBP_NONE
/mob/living/carbon/human/proc/make_hud_overlays() /mob/living/carbon/human/make_hud_overlays()
hud_list[HEALTH_HUD] = gen_hud_image(ingame_hud_med, src, "100", plane = PLANE_CH_HEALTH) hud_list[HEALTH_HUD] = gen_hud_image(ingame_hud_med, src, "100", plane = PLANE_CH_HEALTH)
if(isSynthetic()) if(isSynthetic())
hud_list[STATUS_HUD] = gen_hud_image(ingame_hud, src, "hudrobo", plane = PLANE_CH_STATUS) hud_list[STATUS_HUD] = gen_hud_image(ingame_hud, src, "hudrobo", plane = PLANE_CH_STATUS)

View File

@@ -2,7 +2,8 @@
var/obj/item/organ/internal/eyes/eyes = internal_organs_by_name[O_EYES] var/obj/item/organ/internal/eyes/eyes = internal_organs_by_name[O_EYES]
if(eyes) if(eyes)
eyes.update_colour() eyes.update_colour()
regenerate_icons() update_icons_body() //Body handles eyes
update_eyes() //For floating eyes only
/mob/living/carbon/var/list/internal_organs = list() /mob/living/carbon/var/list/internal_organs = list()
/mob/living/carbon/human/var/list/organs = list() /mob/living/carbon/human/var/list/organs = list()

View File

@@ -152,12 +152,14 @@ This saves us from having to call add_fingerprint() any time something is put in
else if (W == wear_id) else if (W == wear_id)
wear_id = null wear_id = null
update_inv_wear_id() update_inv_wear_id()
BITSET(hud_updateflag, ID_HUD)
BITSET(hud_updateflag, WANTED_HUD)
else if (W == r_store) else if (W == r_store)
r_store = null r_store = null
update_inv_pockets() //update_inv_pockets() //Doesn't do anything.
else if (W == l_store) else if (W == l_store)
l_store = null l_store = null
update_inv_pockets() //update_inv_pockets() //Doesn't do anything.
else if (W == s_store) else if (W == s_store)
s_store = null s_store = null
update_inv_s_store() update_inv_s_store()
@@ -195,8 +197,7 @@ This saves us from having to call add_fingerprint() any time something is put in
//This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible() //This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible()
//set redraw_mob to 0 if you don't wish the hud to be updated - if you're doing it manually in your own proc. /mob/living/carbon/human/equip_to_slot(obj/item/W as obj, slot)
/mob/living/carbon/human/equip_to_slot(obj/item/W as obj, slot, redraw_mob = 1)
if(!slot) if(!slot)
return return
@@ -213,39 +214,41 @@ This saves us from having to call add_fingerprint() any time something is put in
src.back = W src.back = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += back worn_clothing += back
update_inv_back(redraw_mob) update_inv_back()
if(slot_wear_mask) if(slot_wear_mask)
src.wear_mask = W src.wear_mask = W
if(wear_mask.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR)) if(wear_mask.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair update_hair() //rebuild hair
update_inv_ears(0) update_inv_ears()
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += wear_mask worn_clothing += wear_mask
update_inv_wear_mask(redraw_mob) update_inv_wear_mask()
if(slot_handcuffed) if(slot_handcuffed)
src.handcuffed = W src.handcuffed = W
update_inv_handcuffed(redraw_mob) update_inv_handcuffed()
if(slot_legcuffed) if(slot_legcuffed)
src.legcuffed = W src.legcuffed = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_legcuffed(redraw_mob) update_inv_legcuffed()
if(slot_l_hand) if(slot_l_hand)
src.l_hand = W src.l_hand = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_l_hand(redraw_mob) update_inv_l_hand()
if(slot_r_hand) if(slot_r_hand)
src.r_hand = W src.r_hand = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_r_hand(redraw_mob) update_inv_r_hand()
if(slot_belt) if(slot_belt)
src.belt = W src.belt = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += belt worn_clothing += belt
update_inv_belt(redraw_mob) update_inv_belt()
if(slot_wear_id) if(slot_wear_id)
src.wear_id = W src.wear_id = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_wear_id(redraw_mob) update_inv_wear_id()
BITSET(hud_updateflag, ID_HUD)
BITSET(hud_updateflag, WANTED_HUD)
if(slot_l_ear) if(slot_l_ear)
src.l_ear = W src.l_ear = W
if(l_ear.slot_flags & SLOT_TWOEARS) if(l_ear.slot_flags & SLOT_TWOEARS)
@@ -254,7 +257,7 @@ This saves us from having to call add_fingerprint() any time something is put in
src.r_ear = O src.r_ear = O
O.hud_layerise() O.hud_layerise()
W.equipped(src, slot) W.equipped(src, slot)
update_inv_ears(redraw_mob) update_inv_ears()
if(slot_r_ear) if(slot_r_ear)
src.r_ear = W src.r_ear = W
if(r_ear.slot_flags & SLOT_TWOEARS) if(r_ear.slot_flags & SLOT_TWOEARS)
@@ -263,54 +266,54 @@ This saves us from having to call add_fingerprint() any time something is put in
src.l_ear = O src.l_ear = O
O.hud_layerise() O.hud_layerise()
W.equipped(src, slot) W.equipped(src, slot)
update_inv_ears(redraw_mob) update_inv_ears()
if(slot_glasses) if(slot_glasses)
src.glasses = W src.glasses = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_glasses(redraw_mob) update_inv_glasses()
if(slot_gloves) if(slot_gloves)
src.gloves = W src.gloves = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += glasses worn_clothing += glasses
update_inv_gloves(redraw_mob) update_inv_gloves()
if(slot_head) if(slot_head)
src.head = W src.head = W
if(head.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR|HIDEMASK)) if(head.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR|HIDEMASK))
update_hair(redraw_mob) //rebuild hair update_hair() //rebuild hair
update_inv_ears(0) update_inv_ears(0)
update_inv_wear_mask(0) update_inv_wear_mask(0)
if(istype(W,/obj/item/clothing/head/kitty)) if(istype(W,/obj/item/clothing/head/kitty))
W.update_icon(src) W.update_icon(src)
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += head worn_clothing += head
update_inv_head(redraw_mob) update_inv_head()
if(slot_shoes) if(slot_shoes)
src.shoes = W src.shoes = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += shoes worn_clothing += shoes
update_inv_shoes(redraw_mob) update_inv_shoes()
if(slot_wear_suit) if(slot_wear_suit)
src.wear_suit = W src.wear_suit = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += wear_suit worn_clothing += wear_suit
update_inv_wear_suit(redraw_mob) update_inv_wear_suit()
if(slot_w_uniform) if(slot_w_uniform)
src.w_uniform = W src.w_uniform = W
W.equipped(src, slot) W.equipped(src, slot)
worn_clothing += w_uniform worn_clothing += w_uniform
update_inv_w_uniform(redraw_mob) update_inv_w_uniform()
if(slot_l_store) if(slot_l_store)
src.l_store = W src.l_store = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_pockets(redraw_mob) //update_inv_pockets() //Doesn't do anything
if(slot_r_store) if(slot_r_store)
src.r_store = W src.r_store = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_pockets(redraw_mob) //update_inv_pockets() //Doesn't do anything
if(slot_s_store) if(slot_s_store)
src.s_store = W src.s_store = W
W.equipped(src, slot) W.equipped(src, slot)
update_inv_s_store(redraw_mob) update_inv_s_store()
if(slot_in_backpack) if(slot_in_backpack)
if(src.get_active_hand() == W) if(src.get_active_hand() == W)
src.remove_from_mob(W) src.remove_from_mob(W)

View File

@@ -1582,26 +1582,24 @@
we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images. we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images.
This proc below is only called when those HUD elements need to change as determined by the mobs hud_updateflag. This proc below is only called when those HUD elements need to change as determined by the mobs hud_updateflag.
*/ */
/mob/living/carbon/human/proc/handle_hud_list() /mob/living/carbon/human/proc/handle_hud_list()
if (BITTEST(hud_updateflag, HEALTH_HUD)) if (BITTEST(hud_updateflag, HEALTH_HUD))
var/image/holder = hud_list[HEALTH_HUD] var/image/holder = grab_hud(HEALTH_HUD)
if(stat == DEAD) if(stat == DEAD)
holder.icon_state = "-100" // X_X holder.icon_state = "-100" // X_X
else else
holder.icon_state = RoundHealth((health-config.health_threshold_crit)/(getMaxHealth()-config.health_threshold_crit)*100) holder.icon_state = RoundHealth((health-config.health_threshold_crit)/(getMaxHealth()-config.health_threshold_crit)*100)
hud_list[HEALTH_HUD] = holder apply_hud(HEALTH_HUD, holder)
if (BITTEST(hud_updateflag, LIFE_HUD)) if (BITTEST(hud_updateflag, LIFE_HUD))
var/image/holder = hud_list[LIFE_HUD] var/image/holder = grab_hud(LIFE_HUD)
if(isSynthetic()) if(isSynthetic())
holder.icon_state = "hudrobo" holder.icon_state = "hudrobo"
else if(stat == DEAD) else if(stat == DEAD)
holder.icon_state = "huddead" holder.icon_state = "huddead"
else else
holder.icon_state = "hudhealthy" holder.icon_state = "hudhealthy"
hud_list[LIFE_HUD] = holder apply_hud(LIFE_HUD, holder)
if (BITTEST(hud_updateflag, STATUS_HUD)) if (BITTEST(hud_updateflag, STATUS_HUD))
var/foundVirus = 0 var/foundVirus = 0
@@ -1610,8 +1608,8 @@
foundVirus = 1 foundVirus = 1
break break
var/image/holder = hud_list[STATUS_HUD] var/image/holder = grab_hud(STATUS_HUD)
var/image/holder2 = hud_list[STATUS_HUD_OOC] var/image/holder2 = grab_hud(STATUS_HUD_OOC)
if (isSynthetic()) if (isSynthetic())
holder.icon_state = "hudrobo" holder.icon_state = "hudrobo"
else if(stat == DEAD) else if(stat == DEAD)
@@ -1633,11 +1631,11 @@
else else
holder2.icon_state = "hudhealthy" holder2.icon_state = "hudhealthy"
hud_list[STATUS_HUD] = holder apply_hud(STATUS_HUD, holder)
hud_list[STATUS_HUD_OOC] = holder2 apply_hud(STATUS_HUD_OOC, holder2)
if (BITTEST(hud_updateflag, ID_HUD)) if (BITTEST(hud_updateflag, ID_HUD))
var/image/holder = hud_list[ID_HUD] var/image/holder = grab_hud(ID_HUD)
if(wear_id) if(wear_id)
var/obj/item/weapon/card/id/I = wear_id.GetID() var/obj/item/weapon/card/id/I = wear_id.GetID()
if(I) if(I)
@@ -1647,11 +1645,10 @@
else else
holder.icon_state = "hudunknown" holder.icon_state = "hudunknown"
apply_hud(ID_HUD, holder)
hud_list[ID_HUD] = holder
if (BITTEST(hud_updateflag, WANTED_HUD)) if (BITTEST(hud_updateflag, WANTED_HUD))
var/image/holder = hud_list[WANTED_HUD] var/image/holder = grab_hud(WANTED_HUD)
holder.icon_state = "hudblank" holder.icon_state = "hudblank"
var/perpname = name var/perpname = name
if(wear_id) if(wear_id)
@@ -1674,15 +1671,16 @@
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released")) else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
holder.icon_state = "hudreleased" holder.icon_state = "hudreleased"
break break
hud_list[WANTED_HUD] = holder
apply_hud(WANTED_HUD, holder)
if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \ if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \
|| BITTEST(hud_updateflag, IMPCHEM_HUD) \ || BITTEST(hud_updateflag, IMPCHEM_HUD) \
|| BITTEST(hud_updateflag, IMPTRACK_HUD)) || BITTEST(hud_updateflag, IMPTRACK_HUD))
var/image/holder1 = hud_list[IMPTRACK_HUD] var/image/holder1 = grab_hud(IMPTRACK_HUD)
var/image/holder2 = hud_list[IMPLOYAL_HUD] var/image/holder2 = grab_hud(IMPLOYAL_HUD)
var/image/holder3 = hud_list[IMPCHEM_HUD] var/image/holder3 = grab_hud(IMPCHEM_HUD)
holder1.icon_state = "hudblank" holder1.icon_state = "hudblank"
holder2.icon_state = "hudblank" holder2.icon_state = "hudblank"
@@ -1698,21 +1696,21 @@
if(istype(I,/obj/item/weapon/implant/chem)) if(istype(I,/obj/item/weapon/implant/chem))
holder3.icon_state = "hud_imp_chem" holder3.icon_state = "hud_imp_chem"
hud_list[IMPTRACK_HUD] = holder1 apply_hud(IMPTRACK_HUD, holder1)
hud_list[IMPLOYAL_HUD] = holder2 apply_hud(IMPLOYAL_HUD, holder2)
hud_list[IMPCHEM_HUD] = holder3 apply_hud(IMPCHEM_HUD, holder3)
if (BITTEST(hud_updateflag, SPECIALROLE_HUD)) if (BITTEST(hud_updateflag, SPECIALROLE_HUD))
var/image/holder = hud_list[SPECIALROLE_HUD] var/image/holder = grab_hud(SPECIALROLE_HUD)
holder.icon_state = "hudblank" holder.icon_state = "hudblank"
if(mind && mind.special_role) if(mind && mind.special_role)
if(hud_icon_reference[mind.special_role]) if(hud_icon_reference[mind.special_role])
holder.icon_state = hud_icon_reference[mind.special_role] holder.icon_state = hud_icon_reference[mind.special_role]
else else
holder.icon_state = "hudsyndicate" holder.icon_state = "hudsyndicate"
hud_list[SPECIALROLE_HUD] = holder apply_hud(SPECIALROLE_HUD, holder)
hud_updateflag = 0 hud_updateflag = 0
update_icons_huds()
/mob/living/carbon/human/handle_stunned() /mob/living/carbon/human/handle_stunned()
if(!can_feel_pain()) if(!can_feel_pain())

View File

@@ -1,142 +1,62 @@
/* /*
Global associative list for caching humanoid icons. Global associative list for caching humanoid icons.
Index format m or f, followed by a string of 0 and 1 to represent bodyparts followed by husk fat hulk skeleton 1 or 0. Index format m or f, followed by a string of 0 and 1 to represent bodyparts followed by husk fat hulk skeleton 1 or 0.
TODO: Proper documentation
icon_key is [species.race_key][g][husk][fat][hulk][skeleton][s_tone]
*/ */
var/global/list/human_icon_cache = list() var/global/list/human_icon_cache = list() //key is incredibly complex, see update_icons_body()
var/global/list/tail_icon_cache = list() //key is [species.race_key][r_skin][g_skin][b_skin] var/global/list/tail_icon_cache = list() //key is [species.race_key][r_skin][g_skin][b_skin]
var/global/list/light_overlay_cache = list() var/global/list/light_overlay_cache = list() //see make_worn_icon() on helmets
var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
//Add an entry to overlays, assuming it exists
/mob/living/carbon/human/proc/apply_layer(cache_index) /mob/living/carbon/human/proc/apply_layer(cache_index)
if((. = overlays_standing[cache_index])) if((. = overlays_standing[cache_index]))
add_overlay(.) add_overlay(.)
//Remove an entry from overlays, and from the list
/mob/living/carbon/human/proc/remove_layer(cache_index) /mob/living/carbon/human/proc/remove_layer(cache_index)
var/I = overlays_standing[cache_index] var/I = overlays_standing[cache_index]
if(I) if(I)
cut_overlay(I) cut_overlay(I)
overlays_standing[cache_index] = null overlays_standing[cache_index] = null
/////////////////////// // These are used as the layers for the icons, as well as indexes in a list that holds onto them.
//UPDATE_ICONS SYSTEM// // Technically the layers used are all -100+layer to make them FLOAT_LAYER overlays.
///////////////////////
/*
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 update_icons.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_glasse()
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
slime etc. Instead, it'll just return without doing any work. So no harm in calling it for slimes and such.
> There are also these special cases:
update_mutations() //handles updating your appearance for certain mutations. e.g TK head-glows
UpdateDamageIcon() //handles damage overlays for brute/burn damage //(will rename this when I geta round to it)
update_icons_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)
update_targeted() // Updates the target overlay when someone points a gun at you
> 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
*/
//Human Overlays Indexes///////// //Human Overlays Indexes/////////
#define MUTATIONS_LAYER 1 //Mutations like fat, and lasereyes #define MUTATIONS_LAYER 1 //Mutations like fat, and lasereyes
#define SKIN_LAYER 2 //Skin things added by a call on species #define SKIN_LAYER 2 //Skin things added by a call on species
#define DAMAGE_LAYER 3 //Injury overlay sprites like open wounds #define BLOOD_LAYER 3 //Bloodied hands/feet/anything else
#define SURGERY_LEVEL 4 //Overlays for open surgical sites #define DAMAGE_LAYER 4 //Injury overlay sprites like open wounds
#define UNDERWEAR_LAYER 5 //Underwear/bras/etc #define SURGERY_LAYER 5 //Overlays for open surgical sites
#define SHOES_LAYER_ALT 6 //Shoe-slot item (when set to be under uniform via verb) #define UNDERWEAR_LAYER 6 //Underwear/bras/etc
#define UNIFORM_LAYER 7 //Uniform-slot item #define SHOES_LAYER_ALT 7 //Shoe-slot item (when set to be under uniform via verb)
#define ID_LAYER 8 //ID-slot item #define UNIFORM_LAYER 8 //Uniform-slot item
#define SHOES_LAYER 9 //Shoe-slot item #define ID_LAYER 9 //ID-slot item
#define GLOVES_LAYER 10 //Glove-slot item #define SHOES_LAYER 10 //Shoe-slot item
#define BELT_LAYER 11 //Belt-slot item #define GLOVES_LAYER 11 //Glove-slot item
#define SUIT_LAYER 12 //Suit-slot item #define BELT_LAYER 12 //Belt-slot item
#define TAIL_LAYER 13 //Some species have tails to render #define SUIT_LAYER 13 //Suit-slot item
#define GLASSES_LAYER 14 //Eye-slot item #define TAIL_LAYER 14 //Some species have tails to render
#define BELT_LAYER_ALT 15 //Belt-slot item (when set to be above suit via verb) #define GLASSES_LAYER 15 //Eye-slot item
#define SUIT_STORE_LAYER 16 //Suit storage-slot item #define BELT_LAYER_ALT 16 //Belt-slot item (when set to be above suit via verb)
#define BACK_LAYER 17 //Back-slot item #define SUIT_STORE_LAYER 17 //Suit storage-slot item
#define HAIR_LAYER 18 //The human's hair #define BACK_LAYER 18 //Back-slot item
#define EARS_LAYER 19 //Both ear-slot items (combined image) #define HAIR_LAYER 19 //The human's hair
#define EYES_LAYER 20 //Mob's eyes (used for glowing eyes) #define EARS_LAYER 20 //Both ear-slot items (combined image)
#define FACEMASK_LAYER 21 //Mask-slot item #define EYES_LAYER 21 //Mob's eyes (used for glowing eyes)
#define HEAD_LAYER 22 //Head-slot item #define FACEMASK_LAYER 22 //Mask-slot item
#define HANDCUFF_LAYER 23 //Handcuffs, if the human is handcuffed, in a secret inv slot #define HEAD_LAYER 23 //Head-slot item
#define LEGCUFF_LAYER 24 //Same as handcuffs, for legcuffs #define HANDCUFF_LAYER 24 //Handcuffs, if the human is handcuffed, in a secret inv slot
#define L_HAND_LAYER 25 //Left-hand item #define LEGCUFF_LAYER 25 //Same as handcuffs, for legcuffs
#define R_HAND_LAYER 26 //Right-hand item #define L_HAND_LAYER 26 //Left-hand item
#define MODIFIER_EFFECTS_LAYER 27 //Effects drawn by modifiers #define R_HAND_LAYER 27 //Right-hand item
#define FIRE_LAYER 28 //'Mob on fire' overlay layer #define MODIFIER_EFFECTS_LAYER 28 //Effects drawn by modifiers
#define WATER_LAYER 29 //'Mob submerged' overlay layer #define FIRE_LAYER 29 //'Mob on fire' overlay layer
#define TARGETED_LAYER 30 //'Aimed at' overlay layer #define WATER_LAYER 30 //'Mob submerged' overlay layer
#define TOTAL_LAYERS 30//<---- KEEP THIS UPDATED, should always equal the highest number here, used to initialize a list. #define TARGETED_LAYER 31 //'Aimed at' overlay layer
#define TOTAL_LAYERS 32//<---- KEEP THIS UPDATED, should always equal the highest number here, used to initialize a list.
////////////////////////////////// //////////////////////////////////
/mob/living/carbon/human /mob/living/carbon/human
var/list/list_huds = list()
var/list/list_body = list()
var/list/list_layers = list()
var/list/overlays_standing[TOTAL_LAYERS] var/list/overlays_standing[TOTAL_LAYERS]
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
@@ -146,31 +66,23 @@ Please contact me on #coderbus IRC. ~Carn x
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again crash_with("CANARY: Old human update_icons was called.")
update_hud() //TODO: remove the need for this update_hud() //TODO: remove the need for this
//1: HUDs because these are hidden behind a backplane. See update_icons_huds() //Do any species specific layering updates, such as when hiding.
//add_underlay(list_huds) //The first one can set instead of add update_icon_special()
//2: The 'layers' list (overlays_standing), from the defines above /mob/living/carbon/human/update_icons_layers()
//add_overlay(list_layers) crash_with("CANARY: Old human update_icons was called.")
//3: Apply transforms based on situation /mob/living/carbon/human/update_icons_all()
update_transform() crash_with("CANARY: Old human update_icons_all was called.")
//4: Do any species specific layering updates, such as when hiding. /mob/living/carbon/human/update_icons_huds()
update_icon_special(FALSE) crash_with("CANARY: Old human update_icons_huds was called.")
/mob/living/carbon/human/update_transform(var/mutable_appearance/passed_ma)
if(QDESTROYING(src))
return
var/mutable_appearance/ma
if(passed_ma)
ma = passed_ma
else
ma = new(src)
/mob/living/carbon/human/update_transform()
// First, get the correct size. // First, get the correct size.
var/desired_scale = icon_scale var/desired_scale = icon_scale
@@ -181,90 +93,23 @@ Please contact me on #coderbus IRC. ~Carn x
desired_scale *= M.icon_scale_percent desired_scale *= M.icon_scale_percent
// Regular stuff again. // Regular stuff again.
if(lying && !species.prone_icon) //Only rotate them if we're not drawing a specific icon for being prone.
var/matrix/M = matrix() var/matrix/M = matrix()
if(lying && !species.prone_icon) //Only rotate them if we're not drawing a specific icon for being prone.
M.Turn(90) M.Turn(90)
M.Scale(desired_scale) M.Scale(desired_scale)
M.Translate(1,-6) M.Translate(1,-6)
ma.transform = M layer = MOB_LAYER -0.01 // Fix for a byond bug where turf entry order no longer matters
ma.layer = MOB_LAYER -0.01 // Fix for a byond bug where turf entry order no longer matters
else else
var/matrix/M = matrix()
M.Scale(desired_scale) M.Scale(desired_scale)
M.Translate(0, 16*(desired_scale-1)) M.Translate(0, 16*(desired_scale-1))
ma.transform = M layer = MOB_LAYER // Fix for a byond bug where turf entry order no longer matters
ma.layer = MOB_LAYER // Fix for a byond bug where turf entry order no longer matters
if(!passed_ma) animate(src, transform = M, time = 0.5 SECONDS)
update_icon_special(ma) update_icon_special() //May contain transform-altering things
appearance = ma
//Update the layers from the defines above
/mob/living/carbon/human/update_icons_layers(var/update_icons = 1)
if(QDESTROYING(src))
return
list_layers.Cut()
for(var/entry in overlays_standing)
if(istype(entry, /image))
list_layers += entry
else if(istype(entry, /list))
for(var/inner_entry in entry)
list_layers += inner_entry
if(species && species.has_floating_eyes)
list_layers += species.get_eyes(src)
if(update_icons)
update_icons()
//HUD Icons (ingame huds, not the user interface)
//Update things like med/sec hud icons
/mob/living/carbon/human/update_icons_huds(var/update_icons = 1)
if(QDESTROYING(src))
return
cut_overlay(list_huds)
list_huds.Cut()
if(has_huds)
list_huds = hud_list.Copy()
list_huds += backplane // Required to mask HUDs in context menus: http://www.byond.com/forum/?post=2336679
//Typing indicator code
if(client && !stat) //They have a client & aren't dead/KO'd? Continue on!
if(typing_indicator && hud_typing) //They already have the indicator and are still typing
list_huds += typing_indicator
typing_indicator.invisibility = invisibility
else if(!typing_indicator && hud_typing) //Are they in their body, NOT dead, have hud_typing, do NOT have a typing indicator. and have it enabled?
typing_indicator = image(icon = 'icons/mob/talk.dmi', icon_state = "[speech_bubble_appearance()]_typing")
list_huds += typing_indicator
else if(typing_indicator && !hud_typing) //Did they stop typing?
typing = FALSE
hud_typing = FALSE
add_overlay(list_huds)
//A full, crunchy reprocess of all three cached lists
/mob/living/carbon/human/update_icons_all(var/update_icons = 1)
if(QDESTROYING(src))
return
update_icons_huds(FALSE)
update_icons_body(FALSE)
update_icons_layers(FALSE)
if(update_icons)
update_icons()
var/global/list/damage_icon_parts = list()
//DAMAGE OVERLAYS //DAMAGE OVERLAYS
//constructs damage icon for each organ from mask * damage field and saves it in our overlays_ lists //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) /mob/living/carbon/human/UpdateDamageIcon()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -309,7 +154,7 @@ var/global/list/damage_icon_parts = list()
apply_layer(DAMAGE_LAYER) apply_layer(DAMAGE_LAYER)
//BASE MOB SPRITE //BASE MOB SPRITE
/mob/living/carbon/human/update_icons_body(var/update_icons=1) /mob/living/carbon/human/update_icons_body()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -321,7 +166,7 @@ var/global/list/damage_icon_parts = list()
var/hulk = (HULK in src.mutations) var/hulk = (HULK in src.mutations)
var/skeleton = (SKELETON in src.mutations) var/skeleton = (SKELETON in src.mutations)
robolimb_count = 0 robolimb_count = 0 //TODO, here, really tho?
robobody_count = 0 robobody_count = 0
//CACHING: Generate an index key from visible bodyparts. //CACHING: Generate an index key from visible bodyparts.
@@ -330,9 +175,6 @@ var/global/list/damage_icon_parts = list()
//Create a new, blank icon for our mob to use. //Create a new, blank icon for our mob to use.
var/icon/stand_icon = new(species.icon_template ? species.icon_template : 'icons/mob/human.dmi', icon_state = "blank") var/icon/stand_icon = new(species.icon_template ? species.icon_template : 'icons/mob/human.dmi', icon_state = "blank")
//Clean old list_body
list_body.Cut()
var/g = "male" var/g = "male"
if(gender == FEMALE) if(gender == FEMALE)
g = "female" g = "female"
@@ -433,13 +275,10 @@ var/global/list/damage_icon_parts = list()
stand_icon.Blend(base_icon,ICON_OVERLAY) stand_icon.Blend(base_icon,ICON_OVERLAY)
icon = stand_icon icon = stand_icon
if(update_icons)
update_icons()
//tail //tail
update_tail_showing(0) update_tail_showing()
/mob/living/carbon/human/proc/update_skin(var/update_icons=1) /mob/living/carbon/human/proc/update_skin()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -451,8 +290,34 @@ var/global/list/damage_icon_parts = list()
overlays_standing[SKIN_LAYER] = skin overlays_standing[SKIN_LAYER] = skin
apply_layer(SKIN_LAYER) apply_layer(SKIN_LAYER)
/mob/living/carbon/human/proc/update_bloodied()
if(QDESTROYING(src))
return
remove_layer(BLOOD_LAYER)
if(!blood_DNA && !feet_blood_DNA)
return
var/image/both = image(icon = 'icons/effects/effects.dmi', icon_state = "nothing", layer = BODY_LAYER+BLOOD_LAYER)
//Bloody hands
if(blood_DNA)
var/image/bloodsies = image(icon = species.get_blood_mask(src), icon_state = "bloodyhands", layer = BODY_LAYER+BLOOD_LAYER)
bloodsies.color = hand_blood_color
both.add_overlay(bloodsies)
//Bloody feet
if(feet_blood_DNA)
var/image/bloodsies = image(icon = species.get_blood_mask(src), icon_state = "shoeblood", layer = BODY_LAYER+BLOOD_LAYER)
bloodsies.color = feet_blood_color
both.add_overlay(bloodsies)
overlays_standing[BLOOD_LAYER] = both
apply_layer(BLOOD_LAYER)
//UNDERWEAR OVERLAY //UNDERWEAR OVERLAY
/mob/living/carbon/human/proc/update_underwear(var/update_icons=1) /mob/living/carbon/human/proc/update_underwear()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -470,13 +335,13 @@ var/global/list/damage_icon_parts = list()
apply_layer(UNDERWEAR_LAYER) apply_layer(UNDERWEAR_LAYER)
//HAIR OVERLAY //HAIR OVERLAY
/mob/living/carbon/human/proc/update_hair(var/update_icons=1) /mob/living/carbon/human/proc/update_hair()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
//Reset our hair //Reset our hair
remove_layer(HAIR_LAYER) remove_layer(HAIR_LAYER)
update_eyes(0) //Pirated out of here, for glowing eyes. update_eyes() //Pirated out of here, for glowing eyes.
var/obj/item/organ/external/head/head_organ = get_organ(BP_HEAD) var/obj/item/organ/external/head/head_organ = get_organ(BP_HEAD)
if(!head_organ || head_organ.is_stump() ) if(!head_organ || head_organ.is_stump() )
@@ -484,7 +349,6 @@ var/global/list/damage_icon_parts = list()
//masks and helmets can obscure our hair. //masks and helmets can obscure our hair.
if( (head && (head.flags_inv & BLOCKHAIR)) || (wear_mask && (wear_mask.flags_inv & BLOCKHAIR))) if( (head && (head.flags_inv & BLOCKHAIR)) || (wear_mask && (wear_mask.flags_inv & BLOCKHAIR)))
if(update_icons) update_icons_layers()
return return
//base icons //base icons
@@ -516,7 +380,7 @@ var/global/list/damage_icon_parts = list()
overlays_standing[HAIR_LAYER] = image(face_standing, layer = BODY_LAYER+HAIR_LAYER) overlays_standing[HAIR_LAYER] = image(face_standing, layer = BODY_LAYER+HAIR_LAYER)
apply_layer(HAIR_LAYER) apply_layer(HAIR_LAYER)
/mob/living/carbon/human/update_eyes(var/update_icons=1) /mob/living/carbon/human/update_eyes()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -555,7 +419,7 @@ var/global/list/damage_icon_parts = list()
overlays_standing[EYES_LAYER] = eyes_image overlays_standing[EYES_LAYER] = eyes_image
apply_layer(EYES_LAYER) apply_layer(EYES_LAYER)
/mob/living/carbon/human/update_mutations(var/update_icons=1) /mob/living/carbon/human/update_mutations()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -588,54 +452,52 @@ var/global/list/damage_icon_parts = list()
apply_layer(MUTATIONS_LAYER) apply_layer(MUTATIONS_LAYER)
/* --------------------------------------- */ /* --------------------------------------- */
//For legacy support. //Recomputes every icon on the mob. Expensive.
//Useful if the species changed, or there's some
//other drastic body-shape change, but otherwise avoid.
/mob/living/carbon/human/regenerate_icons() /mob/living/carbon/human/regenerate_icons()
..() ..()
if(transforming || QDELETED(src)) return if(transforming || QDELETED(src))
return
update_mutations(0) update_icons_body()
update_skin(0) UpdateDamageIcon()
update_icons_body(0) update_mutations()
update_underwear(0) update_skin()
update_hair(0) update_underwear()
update_inv_w_uniform(0) update_hair()
update_inv_wear_id(0) update_inv_w_uniform()
update_inv_gloves(0) update_inv_wear_id()
update_inv_glasses(0) update_inv_gloves()
update_inv_ears(0) update_inv_glasses()
update_inv_shoes(0) update_inv_ears()
update_inv_s_store(0) update_inv_shoes()
update_inv_wear_mask(0) update_inv_s_store()
update_inv_head(0) update_inv_wear_mask()
update_inv_belt(0) update_inv_head()
update_inv_back(0) update_inv_belt()
update_inv_wear_suit(0) update_inv_back()
update_inv_r_hand(0) update_inv_wear_suit()
update_inv_l_hand(0) update_inv_r_hand()
update_inv_handcuffed(0) update_inv_l_hand()
update_inv_legcuffed(0) update_inv_handcuffed()
update_inv_pockets(0) update_inv_legcuffed()
update_fire(0) //update_inv_pockets() //Doesn't do anything
update_water(0) update_fire()
update_surgery(0) update_water()
UpdateDamageIcon(0) update_surgery()
update_icons_layers(0)
update_icons_huds(0)
update_icons()
//Hud Stuff
update_hud()
/* --------------------------------------- */ /* --------------------------------------- */
//vvvvvv UPDATE_INV PROCS vvvvvv //vvvvvv UPDATE_INV PROCS vvvvvv
/mob/living/carbon/human/update_inv_w_uniform(var/update_icons=1) /mob/living/carbon/human/update_inv_w_uniform()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
remove_layer(UNIFORM_LAYER) remove_layer(UNIFORM_LAYER)
//Shoes can be affected by uniform being drawn onto them //Shoes can be affected by uniform being drawn onto them
update_inv_shoes(FALSE) update_inv_shoes()
if(!w_uniform) if(!w_uniform)
return return
@@ -643,60 +505,41 @@ var/global/list/damage_icon_parts = list()
if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT) && !istype(wear_suit, /obj/item/clothing/suit/space/rig)) if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT) && !istype(wear_suit, /obj/item/clothing/suit/space/rig))
return //Wearing a suit that prevents uniform rendering return //Wearing a suit that prevents uniform rendering
//Align this item on the inventory screen TODO: Move this elsewhere
w_uniform.screen_loc = ui_iclothing
//Build a uniform sprite //Build a uniform sprite
overlays_standing[UNIFORM_LAYER] = w_uniform.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_w_uniform_str, default_icon = INV_W_UNIFORM_DEF_ICON, default_layer = UNIFORM_LAYER) overlays_standing[UNIFORM_LAYER] = w_uniform.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_w_uniform_str, default_icon = INV_W_UNIFORM_DEF_ICON, default_layer = UNIFORM_LAYER)
apply_layer(UNIFORM_LAYER) apply_layer(UNIFORM_LAYER)
/mob/living/carbon/human/update_inv_wear_id(var/update_icons=1) /mob/living/carbon/human/update_inv_wear_id()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
overlays_standing[ID_LAYER] = null remove_layer(ID_LAYER)
//Set the bits to update the ID hud since they put something in this slot (or removed it)
//TODO: Move elsewhere, update icons is not the place.
BITSET(hud_updateflag, ID_HUD)
BITSET(hud_updateflag, WANTED_HUD)
if(!wear_id) if(!wear_id)
return //Not wearing an ID return //Not wearing an ID
//Align this item on the inventory screen TODO: Move this elsewhere
wear_id.screen_loc = ui_id
//Only draw the ID on the mob if the uniform allows for it //Only draw the ID on the mob if the uniform allows for it
if(w_uniform && istype(w_uniform, /obj/item/clothing/under)) if(w_uniform && istype(w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = w_uniform var/obj/item/clothing/under/U = w_uniform
if(U.displays_id) if(U.displays_id)
overlays_standing[ID_LAYER] = wear_id.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_id_str, default_icon = INV_WEAR_ID_DEF_ICON, default_layer = ID_LAYER) overlays_standing[ID_LAYER] = wear_id.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_id_str, default_icon = INV_WEAR_ID_DEF_ICON, default_layer = ID_LAYER)
apply_layer(ID_LAYER) apply_layer(ID_LAYER)
/mob/living/carbon/human/update_inv_gloves(var/update_icons=1) /mob/living/carbon/human/update_inv_gloves()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
remove_layer(GLOVES_LAYER) remove_layer(GLOVES_LAYER)
if(!gloves && !blood_DNA) if(!gloves)
return //No gloves, no bloody hands, no reason to be here. return //No gloves, no reason to be here.
//Draw gloves if they have gloves
if(gloves)
gloves.screen_loc = ui_gloves //TODO
overlays_standing[GLOVES_LAYER] = gloves.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_gloves_str, default_icon = INV_GLOVES_DEF_ICON, default_layer = GLOVES_LAYER) overlays_standing[GLOVES_LAYER] = gloves.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_gloves_str, default_icon = INV_GLOVES_DEF_ICON, default_layer = GLOVES_LAYER)
else if(blood_DNA) //TODO: Make this proc generic
var/image/bloodsies = image(icon = species.get_blood_mask(src), icon_state = "bloodyhands")
bloodsies.color = hand_blood_color
overlays_standing[GLOVES_LAYER] = bloodsies
apply_layer(GLOVES_LAYER) apply_layer(GLOVES_LAYER)
/mob/living/carbon/human/update_inv_glasses(var/update_icons=1) /mob/living/carbon/human/update_inv_glasses()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -705,12 +548,11 @@ var/global/list/damage_icon_parts = list()
if(!glasses) if(!glasses)
return //Not wearing glasses, no need to update anything. return //Not wearing glasses, no need to update anything.
glasses.screen_loc = ui_glasses //TODO
overlays_standing[GLASSES_LAYER] = glasses.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_gloves_str, default_icon = INV_EYES_DEF_ICON, default_layer = GLASSES_LAYER) overlays_standing[GLASSES_LAYER] = glasses.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_gloves_str, default_icon = INV_EYES_DEF_ICON, default_layer = GLASSES_LAYER)
apply_layer(GLASSES_LAYER) apply_layer(GLASSES_LAYER)
/mob/living/carbon/human/update_inv_ears(var/update_icons=1) /mob/living/carbon/human/update_inv_ears()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -726,31 +568,27 @@ var/global/list/damage_icon_parts = list()
var/image/both = image(icon = 'icons/effects/effects.dmi', icon_state = "nothing", layer = BODY_LAYER+EARS_LAYER) var/image/both = image(icon = 'icons/effects/effects.dmi', icon_state = "nothing", layer = BODY_LAYER+EARS_LAYER)
if(l_ear) if(l_ear)
l_ear.screen_loc = ui_l_ear //TODO
var/image/standing = l_ear.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_l_ear_str, default_icon = INV_EARS_DEF_ICON, default_layer = EARS_LAYER) var/image/standing = l_ear.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_l_ear_str, default_icon = INV_EARS_DEF_ICON, default_layer = EARS_LAYER)
both.add_overlay(standing) both.add_overlay(standing)
if(r_ear) if(r_ear)
r_ear.screen_loc = ui_r_ear //TODO
var/image/standing = r_ear.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_r_ear_str, default_icon = INV_EARS_DEF_ICON, default_layer = EARS_LAYER) var/image/standing = r_ear.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_r_ear_str, default_icon = INV_EARS_DEF_ICON, default_layer = EARS_LAYER)
both.add_overlay(standing) both.add_overlay(standing)
overlays_standing[EARS_LAYER] = both overlays_standing[EARS_LAYER] = both
apply_layer(EARS_LAYER) apply_layer(EARS_LAYER)
/mob/living/carbon/human/update_inv_shoes(var/update_icons=1) /mob/living/carbon/human/update_inv_shoes()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
remove_layer(SHOES_LAYER) remove_layer(SHOES_LAYER)
remove_layer(SHOES_LAYER_ALT) //Dumb alternate layer for shoes being under the uniform. remove_layer(SHOES_LAYER_ALT) //Dumb alternate layer for shoes being under the uniform.
if((!shoes && !feet_blood_DNA) || (wear_suit && wear_suit.flags_inv & HIDESHOES) || (w_uniform && w_uniform.flags_inv & HIDESHOES)) if(!shoes || (wear_suit && wear_suit.flags_inv & HIDESHOES) || (w_uniform && w_uniform.flags_inv & HIDESHOES))
return //Either nothing to draw, or it'd be hidden. return //Either nothing to draw, or it'd be hidden.
if(shoes)
//Allow for shoe layer toggle nonsense //Allow for shoe layer toggle nonsense
shoes.screen_loc = ui_shoes //TODO
var/shoe_layer = SHOES_LAYER var/shoe_layer = SHOES_LAYER
if(istype(shoes, /obj/item/clothing/shoes)) if(istype(shoes, /obj/item/clothing/shoes))
var/obj/item/clothing/shoes/ushoes = shoes var/obj/item/clothing/shoes/ushoes = shoes
@@ -759,16 +597,11 @@ var/global/list/damage_icon_parts = list()
//NB: the use of a var for the layer on this one //NB: the use of a var for the layer on this one
overlays_standing[shoe_layer] = shoes.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_shoes_str, default_icon = INV_FEET_DEF_ICON, default_layer = shoe_layer) overlays_standing[shoe_layer] = shoes.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_shoes_str, default_icon = INV_FEET_DEF_ICON, default_layer = shoe_layer)
apply_layer(shoe_layer)
//Bloody feet, but not wearing shoes TODO
else if(feet_blood_DNA)
var/image/bloodsies = image(icon = species.get_blood_mask(src), icon_state = "shoeblood")
bloodsies.color = feet_blood_color
overlays_standing[SHOES_LAYER] = bloodsies
apply_layer(SHOES_LAYER) apply_layer(SHOES_LAYER)
apply_layer(SHOES_LAYER_ALT)
/mob/living/carbon/human/update_inv_s_store(var/update_icons=1) /mob/living/carbon/human/update_inv_s_store()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -777,17 +610,16 @@ var/global/list/damage_icon_parts = list()
if(!s_store) if(!s_store)
return //Why bother, nothing there. return //Why bother, nothing there.
s_store.screen_loc = ui_sstore1 //TODO
//TODO, this is unlike the rest of the things //TODO, this is unlike the rest of the things
//Basically has no variety in slot icon choices at all. WHY SPECIES ONLY?? //Basically has no variety in slot icon choices at all. WHY SPECIES ONLY??
var/t_state = s_store.item_state var/t_state = s_store.item_state
if(!t_state) if(!t_state)
t_state = s_store.icon_state t_state = s_store.icon_state
overlays_standing[SUIT_STORE_LAYER] = image(icon = species.suit_storage_icon, icon_state = t_state, layer = BODY_LAYER+SUIT_STORE_LAYER) overlays_standing[SUIT_STORE_LAYER] = image(icon = species.suit_storage_icon, icon_state = t_state, layer = BODY_LAYER+SUIT_STORE_LAYER)
apply_layer(SUIT_STORE_LAYER) apply_layer(SUIT_STORE_LAYER)
/mob/living/carbon/human/update_inv_head(var/update_icons=1) /mob/living/carbon/human/update_inv_head()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -796,12 +628,11 @@ var/global/list/damage_icon_parts = list()
if(!head) if(!head)
return //No head item, why bother. return //No head item, why bother.
head.screen_loc = ui_head //TODO
overlays_standing[HEAD_LAYER] = head.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_head_str, default_icon = INV_HEAD_DEF_ICON, default_layer = HEAD_LAYER) overlays_standing[HEAD_LAYER] = head.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_head_str, default_icon = INV_HEAD_DEF_ICON, default_layer = HEAD_LAYER)
apply_layer(HEAD_LAYER) apply_layer(HEAD_LAYER)
/mob/living/carbon/human/update_inv_belt(var/update_icons=1) /mob/living/carbon/human/update_inv_belt()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -811,8 +642,6 @@ var/global/list/damage_icon_parts = list()
if(!belt) if(!belt)
return //No belt, why bother. return //No belt, why bother.
belt.screen_loc = ui_belt //TODO - Distant screaming.
//Toggle for belt layering with uniform //Toggle for belt layering with uniform
var/belt_layer = BELT_LAYER var/belt_layer = BELT_LAYER
if(istype(belt, /obj/item/weapon/storage/belt)) if(istype(belt, /obj/item/weapon/storage/belt))
@@ -822,43 +651,31 @@ var/global/list/damage_icon_parts = list()
//NB: this uses a var from above //NB: this uses a var from above
overlays_standing[belt_layer] = belt.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_belt_str, default_icon = INV_BELT_DEF_ICON, default_layer = belt_layer) overlays_standing[belt_layer] = belt.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_belt_str, default_icon = INV_BELT_DEF_ICON, default_layer = belt_layer)
apply_layer(belt_layer) apply_layer(belt_layer)
/mob/living/carbon/human/update_inv_wear_suit(var/update_icons=1) /mob/living/carbon/human/update_inv_wear_suit()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
remove_layer(SUIT_LAYER) remove_layer(SUIT_LAYER)
//Hide/show other layers if necessary (AAAAA) TODO //Hide/show other layers if necessary
update_inv_w_uniform(FALSE) update_inv_w_uniform()
update_inv_shoes(FALSE) update_inv_shoes()
update_tail_showing(FALSE) update_tail_showing()
if(!wear_suit) if(!wear_suit)
return //No point, no suit. return //No point, no suit.
wear_suit.screen_loc = ui_oclothing //TODO
overlays_standing[SUIT_LAYER] = wear_suit.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_suit_str, default_icon = INV_SUIT_DEF_ICON, default_layer = SUIT_LAYER) overlays_standing[SUIT_LAYER] = wear_suit.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_suit_str, default_icon = INV_SUIT_DEF_ICON, default_layer = SUIT_LAYER)
apply_layer(SUIT_LAYER) apply_layer(SUIT_LAYER)
//REALLY? REAAAAAAALLY???? UPDATE ICONS??? TODO /mob/living/carbon/human/update_inv_pockets()
if( istype(wear_suit, /obj/item/clothing/suit/straight_jacket) ) crash_with("Someone called update_inv_pockets even though it's dumb")
drop_from_inventory(handcuffed)
drop_l_hand()
drop_r_hand()
/mob/living/carbon/human/update_inv_pockets(var/update_icons=1) /mob/living/carbon/human/update_inv_wear_mask()
if(QDESTROYING(src))
return
//Wow, this can probably go away, huh.
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_layers()
/mob/living/carbon/human/update_inv_wear_mask(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -867,12 +684,11 @@ var/global/list/damage_icon_parts = list()
if(!wear_mask || (head && head.flags_inv & HIDEMASK)) if(!wear_mask || (head && head.flags_inv & HIDEMASK))
return //Why bother, nothing in mask slot. return //Why bother, nothing in mask slot.
wear_mask.screen_loc = ui_mask //TODO
overlays_standing[FACEMASK_LAYER] = wear_mask.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_mask_str, default_icon = INV_MASK_DEF_ICON, default_layer = FACEMASK_LAYER) overlays_standing[FACEMASK_LAYER] = wear_mask.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_wear_mask_str, default_icon = INV_MASK_DEF_ICON, default_layer = FACEMASK_LAYER)
apply_layer(FACEMASK_LAYER) apply_layer(FACEMASK_LAYER)
/mob/living/carbon/human/update_inv_back(var/update_icons=1) /mob/living/carbon/human/update_inv_back()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -881,9 +697,8 @@ var/global/list/damage_icon_parts = list()
if(!back) if(!back)
return //Why do anything return //Why do anything
back.screen_loc = ui_back //TODO
overlays_standing[BACK_LAYER] = back.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_back_str, default_icon = INV_BACK_DEF_ICON, default_layer = BACK_LAYER) overlays_standing[BACK_LAYER] = back.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_back_str, default_icon = INV_BACK_DEF_ICON, default_layer = BACK_LAYER)
apply_layer(BACK_LAYER) apply_layer(BACK_LAYER)
//TODO: Carbon procs in my human update_icons?? //TODO: Carbon procs in my human update_icons??
@@ -902,7 +717,7 @@ var/global/list/damage_icon_parts = list()
hud_used.l_hand_hud_object.update_icon() hud_used.l_hand_hud_object.update_icon()
hud_used.r_hand_hud_object.update_icon() hud_used.r_hand_hud_object.update_icon()
/mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) /mob/living/carbon/human/update_inv_handcuffed()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -912,14 +727,11 @@ var/global/list/damage_icon_parts = list()
if(!handcuffed) if(!handcuffed)
return //Not cuffed, why bother return //Not cuffed, why bother
drop_r_hand()
drop_l_hand()
stop_pulling() //TODO: should be handled elsewhere
overlays_standing[HANDCUFF_LAYER] = handcuffed.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_handcuffed_str, default_icon = INV_HCUFF_DEF_ICON, default_layer = HANDCUFF_LAYER) overlays_standing[HANDCUFF_LAYER] = handcuffed.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_handcuffed_str, default_icon = INV_HCUFF_DEF_ICON, default_layer = HANDCUFF_LAYER)
apply_layer(HANDCUFF_LAYER) apply_layer(HANDCUFF_LAYER)
/mob/living/carbon/human/update_inv_legcuffed(var/update_icons=1) /mob/living/carbon/human/update_inv_legcuffed()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -929,15 +741,10 @@ var/global/list/damage_icon_parts = list()
return //Not legcuffed, why bother. return //Not legcuffed, why bother.
overlays_standing[LEGCUFF_LAYER] = handcuffed.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_legcuffed_str, default_icon = INV_LCUFF_DEF_ICON, default_layer = LEGCUFF_LAYER) overlays_standing[LEGCUFF_LAYER] = handcuffed.make_worn_icon(body_type = species.get_bodytype(), slot_name = slot_legcuffed_str, default_icon = INV_LCUFF_DEF_ICON, default_layer = LEGCUFF_LAYER)
apply_layer(LEGCUFF_LAYER) apply_layer(LEGCUFF_LAYER)
//TODO: Not in my update_icons /mob/living/carbon/human/update_inv_r_hand()
if(m_intent != "walk")
m_intent = "walk"
if(hud_used && src.hud_used.move_intent)
hud_used.move_intent.icon_state = "walking"
/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -946,15 +753,11 @@ var/global/list/damage_icon_parts = list()
if(!r_hand) if(!r_hand)
return //No hand, no bother. return //No hand, no bother.
r_hand.screen_loc = ui_rhand //TODO
overlays_standing[R_HAND_LAYER] = r_hand.make_worn_icon(body_type = species.get_bodytype(), inhands = TRUE, slot_name = slot_r_hand_str, default_icon = INV_R_HAND_DEF_ICON, default_layer = R_HAND_LAYER) overlays_standing[R_HAND_LAYER] = r_hand.make_worn_icon(body_type = species.get_bodytype(), inhands = TRUE, slot_name = slot_r_hand_str, default_icon = INV_R_HAND_DEF_ICON, default_layer = R_HAND_LAYER)
apply_layer(R_HAND_LAYER) apply_layer(R_HAND_LAYER)
if(handcuffed) /mob/living/carbon/human/update_inv_l_hand()
drop_r_hand() //TODO: EXCUSE ME
/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -963,15 +766,11 @@ var/global/list/damage_icon_parts = list()
if(!l_hand) if(!l_hand)
return //No hand, no bother. return //No hand, no bother.
l_hand.screen_loc = ui_lhand //TODO
overlays_standing[L_HAND_LAYER] = l_hand.make_worn_icon(body_type = species.get_bodytype(), inhands = TRUE, slot_name = slot_l_hand_str, default_icon = INV_L_HAND_DEF_ICON, default_layer = L_HAND_LAYER) overlays_standing[L_HAND_LAYER] = l_hand.make_worn_icon(body_type = species.get_bodytype(), inhands = TRUE, slot_name = slot_l_hand_str, default_icon = INV_L_HAND_DEF_ICON, default_layer = L_HAND_LAYER)
apply_layer(L_HAND_LAYER) apply_layer(L_HAND_LAYER)
if(handcuffed) /mob/living/carbon/human/proc/update_tail_showing()
drop_l_hand() //TODO: AAAAAAAAAAa
/mob/living/carbon/human/proc/update_tail_showing(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -983,7 +782,7 @@ var/global/list/damage_icon_parts = list()
if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL)) if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL))
var/icon/tail_s = get_tail_icon() var/icon/tail_s = get_tail_icon()
overlays_standing[TAIL_LAYER] = image(tail_s, icon_state = "[species_tail]_s") overlays_standing[TAIL_LAYER] = image(tail_s, icon_state = "[species_tail]_s")
animate_tail_reset(0) animate_tail_reset()
apply_layer(TAIL_LAYER) apply_layer(TAIL_LAYER)
@@ -1009,16 +808,17 @@ var/global/list/damage_icon_parts = list()
/mob/living/carbon/human/proc/set_tail_state(var/t_state) /mob/living/carbon/human/proc/set_tail_state(var/t_state)
var/image/tail_overlay = overlays_standing[TAIL_LAYER] var/image/tail_overlay = overlays_standing[TAIL_LAYER]
remove_layer(TAIL_LAYER)
if(tail_overlay && species.get_tail_animation(src)) if(tail_overlay && species.get_tail_animation(src))
tail_overlay.icon_state = t_state tail_overlay.icon_state = t_state
apply_layer(TAIL_LAYER)
return tail_overlay return tail_overlay
return null return null
//Not really once, since BYOND can't do that. //Not really once, since BYOND can't do that.
//Update this if the ability to flick() images or make looping animation start at the first frame is ever added. //Update this if the ability to flick() images or make looping animation start at the first frame is ever added.
//You can sort of flick images now with flick_overlay -Aro //You can sort of flick images now with flick_overlay -Aro
/mob/living/carbon/human/proc/animate_tail_once(var/update_icons=1) /mob/living/carbon/human/proc/animate_tail_once()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -1027,7 +827,7 @@ var/global/list/damage_icon_parts = list()
var/image/tail_overlay = overlays_standing[TAIL_LAYER] var/image/tail_overlay = overlays_standing[TAIL_LAYER]
if(tail_overlay && tail_overlay.icon_state == t_state) if(tail_overlay && tail_overlay.icon_state == t_state)
return //let the existing animation finish return //let the existing animation finish
remove_layer(TAIL_LAYER)
tail_overlay = set_tail_state(t_state) tail_overlay = set_tail_state(t_state)
if(tail_overlay) if(tail_overlay)
spawn(20) spawn(20)
@@ -1035,25 +835,21 @@ var/global/list/damage_icon_parts = list()
if(overlays_standing[TAIL_LAYER] == tail_overlay && tail_overlay.icon_state == t_state) if(overlays_standing[TAIL_LAYER] == tail_overlay && tail_overlay.icon_state == t_state)
animate_tail_stop() animate_tail_stop()
if(update_icons) update_icons_layers() apply_layer(TAIL_LAYER)
/mob/living/carbon/human/proc/animate_tail_start(var/update_icons=1) /mob/living/carbon/human/proc/animate_tail_start()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
set_tail_state("[species.get_tail(src)]_slow[rand(0,9)]") set_tail_state("[species.get_tail(src)]_slow[rand(0,9)]")
if(update_icons) update_icons_layers() /mob/living/carbon/human/proc/animate_tail_fast()
/mob/living/carbon/human/proc/animate_tail_fast(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
set_tail_state("[species.get_tail(src)]_loop[rand(0,9)]") set_tail_state("[species.get_tail(src)]_loop[rand(0,9)]")
if(update_icons) update_icons_layers() /mob/living/carbon/human/proc/animate_tail_reset()
/mob/living/carbon/human/proc/animate_tail_reset(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -1062,17 +858,13 @@ var/global/list/damage_icon_parts = list()
else else
set_tail_state("[species.get_tail(src)]_static") set_tail_state("[species.get_tail(src)]_static")
if(update_icons) update_icons_layers() /mob/living/carbon/human/proc/animate_tail_stop()
/mob/living/carbon/human/proc/animate_tail_stop(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
set_tail_state("[species.get_tail(src)]_static") set_tail_state("[species.get_tail(src)]_static")
if(update_icons) update_icons_layers() /mob/living/carbon/human/update_modifier_visuals()
/mob/living/carbon/human/update_modifier_visuals(var/update_icons=1)
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -1088,9 +880,10 @@ var/global/list/damage_icon_parts = list()
effects.overlays += I //TODO, this compositing is annoying. effects.overlays += I //TODO, this compositing is annoying.
overlays_standing[MODIFIER_EFFECTS_LAYER] = effects overlays_standing[MODIFIER_EFFECTS_LAYER] = effects
apply_layer(MODIFIER_EFFECTS_LAYER) apply_layer(MODIFIER_EFFECTS_LAYER)
/mob/living/carbon/human/update_fire(var/update_icons=1) /mob/living/carbon/human/update_fire()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -1099,10 +892,11 @@ var/global/list/damage_icon_parts = list()
if(!on_fire) if(!on_fire)
return return
overlays_standing[FIRE_LAYER] = image(icon = 'icons/mob/OnFire.dmi', icon_state = get_fire_icon_state()) overlays_standing[FIRE_LAYER] = image(icon = 'icons/mob/OnFire.dmi', icon_state = get_fire_icon_state(), layer = BODY_LAYER+FIRE_LAYER)
apply_layer(FIRE_LAYER) apply_layer(FIRE_LAYER)
/mob/living/carbon/human/update_water(var/update_icons=1) /mob/living/carbon/human/update_water()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -1112,30 +906,31 @@ var/global/list/damage_icon_parts = list()
if(!depth || lying) if(!depth || lying)
return return
overlays_standing[WATER_LAYER] = image(icon = 'icons/mob/submerged.dmi', icon_state = "human_swimming_[depth]") //TODO: Improve overlays_standing[WATER_LAYER] = image(icon = 'icons/mob/submerged.dmi', icon_state = "human_swimming_[depth]", layer = BODY_LAYER+WATER_LAYER) //TODO: Improve
apply_layer(WATER_LAYER) apply_layer(WATER_LAYER)
/mob/living/carbon/human/proc/update_surgery(var/update_icons=1) /mob/living/carbon/human/proc/update_surgery()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
remove_layer(SURGERY_LEVEL) remove_layer(SURGERY_LAYER)
var/image/total = new var/image/total = new
for(var/obj/item/organ/external/E in organs) for(var/obj/item/organ/external/E in organs)
if(E.open) if(E.open)
var/image/I = image(icon = 'icons/mob/surgery.dmi', icon_state = "[E.icon_name][round(E.open)]", layer = -SURGERY_LEVEL) var/image/I = image(icon = 'icons/mob/surgery.dmi', icon_state = "[E.icon_name][round(E.open)]", layer = BODY_LAYER+SURGERY_LAYER)
total.overlays += I //TODO: This compositing is annoying total.overlays += I //TODO: This compositing is annoying
if(total.overlays.len) if(total.overlays.len)
overlays_standing[SURGERY_LEVEL] = total overlays_standing[SURGERY_LAYER] = total
apply_layer(SURGERY_LEVEL) apply_layer(SURGERY_LAYER)
//Human Overlays Indexes///////// //Human Overlays Indexes/////////
#undef MUTATIONS_LAYER #undef MUTATIONS_LAYER
#undef SKIN_LAYER #undef SKIN_LAYER
#undef DAMAGE_LAYER #undef DAMAGE_LAYER
#undef SURGERY_LEVEL #undef SURGERY_LAYER
#undef UNDERWEAR_LAYER #undef UNDERWEAR_LAYER
#undef SHOES_LAYER_ALT #undef SHOES_LAYER_ALT
#undef UNIFORM_LAYER #undef UNIFORM_LAYER

View File

@@ -72,16 +72,16 @@
/mob/living/u_equip(obj/W as obj) /mob/living/u_equip(obj/W as obj)
if (W == r_hand) if (W == r_hand)
r_hand = null r_hand = null
update_inv_r_hand(0) update_inv_r_hand()
else if (W == l_hand) else if (W == l_hand)
l_hand = null l_hand = null
update_inv_l_hand(0) update_inv_l_hand()
else if (W == back) else if (W == back)
back = null back = null
update_inv_back(0) update_inv_back()
else if (W == wear_mask) else if (W == wear_mask)
wear_mask = null wear_mask = null
update_inv_wear_mask(0) update_inv_wear_mask()
return return
/mob/living/get_equipped_item(var/slot) /mob/living/get_equipped_item(var/slot)

View File

@@ -1,6 +1,13 @@
/mob/living/New() /mob/living/New()
..() ..()
//Prime this list if we need it.
if(has_huds)
add_overlay(backplane,TRUE) //Strap this on here, to block HUDs from appearing in rightclick menus: http://www.byond.com/forum/?post=2336679
hud_list = list()
hud_list.len = TOTAL_HUDS
make_hud_overlays()
//I'll just hang my coat up over here //I'll just hang my coat up over here
dsoverlay = image('icons/mob/darksight.dmi',global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see. dsoverlay = image('icons/mob/darksight.dmi',global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see.
var/mutable_appearance/dsma = new(dsoverlay) //Changing like ten things, might as well. var/mutable_appearance/dsma = new(dsoverlay) //Changing like ten things, might as well.
@@ -855,6 +862,7 @@ default behaviour is:
resting = !resting resting = !resting
to_chat(src, "<span class='notice'>You are now [resting ? "resting" : "getting up"]</span>") to_chat(src, "<span class='notice'>You are now [resting ? "resting" : "getting up"]</span>")
update_canmove()
/mob/living/proc/cannot_use_vents() /mob/living/proc/cannot_use_vents()
if(mob_size > MOB_SMALL) if(mob_size > MOB_SMALL)
@@ -1003,6 +1011,7 @@ default behaviour is:
break break
if(lying != lying_prev) if(lying != lying_prev)
lying_prev = lying
update_transform() update_transform()
return canmove return canmove
@@ -1157,3 +1166,22 @@ default behaviour is:
item.throw_at(target, throw_range, item.throw_speed, src) item.throw_at(target, throw_range, item.throw_speed, src)
//Add an entry to overlays, assuming it exists
/mob/living/proc/apply_hud(cache_index, var/image/I)
hud_list[cache_index] = I
if((. = hud_list[cache_index]))
//underlays += .
add_overlay(.)
//Remove an entry from overlays, and from the list
/mob/living/proc/grab_hud(cache_index)
var/I = hud_list[cache_index]
if(I)
//underlays -= I
cut_overlay(I)
hud_list[cache_index] = null
return I
/mob/living/proc/make_hud_overlays()
return

View File

@@ -54,3 +54,6 @@
var/glow_range = 2 var/glow_range = 2
var/glow_intensity = null var/glow_intensity = null
var/glow_color = "#FFFFFF" // The color they're glowing! var/glow_color = "#FFFFFF" // The color they're glowing!
var/list/hud_list //Holder for health hud, status hud, wanted hud, etc (not like inventory slots)
var/has_huds = FALSE //Whether or not we should bother initializing the above list

View File

@@ -7,7 +7,7 @@
var/list/stating_laws = list()// Channels laws are currently being stated on var/list/stating_laws = list()// Channels laws are currently being stated on
var/obj/item/device/radio/common_radio var/obj/item/device/radio/common_radio
var/list/hud_list[10] has_huds = TRUE
var/list/speech_synthesizer_langs = list() //which languages can be vocalized by the speech synthesizer var/list/speech_synthesizer_langs = list() //which languages can be vocalized by the speech synthesizer
//Used in say.dm. //Used in say.dm.

View File

@@ -12,6 +12,7 @@
var/list/adding = list() var/list/adding = list()
var/list/other = list() var/list/other = list()
var/list/hotkeybuttons = list() var/list/hotkeybuttons = list()
var/list/slot_info = list()
hud.adding = adding hud.adding = adding
hud.other = other hud.other = other
@@ -34,6 +35,7 @@
inv_box.screen_loc = slot_data["loc"] inv_box.screen_loc = slot_data["loc"]
inv_box.slot_id = slot_data["slot"] inv_box.slot_id = slot_data["slot"]
inv_box.icon_state = slot_data["state"] inv_box.icon_state = slot_data["state"]
slot_info["[inv_box.slot_id]"] = inv_box.screen_loc
if(slot_data["dir"]) if(slot_data["dir"])
inv_box.set_dir(slot_data["dir"]) inv_box.set_dir(slot_data["dir"])
@@ -249,9 +251,9 @@
inv_box.slot_id = slot_r_hand inv_box.slot_id = slot_r_hand
inv_box.color = ui_color inv_box.color = ui_color
inv_box.alpha = ui_alpha inv_box.alpha = ui_alpha
hud.r_hand_hud_object = inv_box hud.r_hand_hud_object = inv_box
hud.adding += inv_box hud.adding += inv_box
slot_info["[slot_r_hand]"] = inv_box.screen_loc
inv_box = new /obj/screen/inventory/hand() inv_box = new /obj/screen/inventory/hand()
inv_box.hud = src inv_box.hud = src
@@ -266,6 +268,7 @@
inv_box.alpha = ui_alpha inv_box.alpha = ui_alpha
hud.l_hand_hud_object = inv_box hud.l_hand_hud_object = inv_box
hud.adding += inv_box hud.adding += inv_box
slot_info["[slot_l_hand]"] = inv_box.screen_loc
//Swaphand titlebar //Swaphand titlebar
using = new /obj/screen/inventory() using = new /obj/screen/inventory()

View File

@@ -858,14 +858,17 @@
/mob/proc/Resting(amount) /mob/proc/Resting(amount)
facing_dir = null facing_dir = null
resting = max(max(resting,amount),0) resting = max(max(resting,amount),0)
update_canmove()
return return
/mob/proc/SetResting(amount) /mob/proc/SetResting(amount)
resting = max(amount,0) resting = max(amount,0)
update_canmove()
return return
/mob/proc/AdjustResting(amount) /mob/proc/AdjustResting(amount)
resting = max(resting + amount,0) resting = max(resting + amount,0)
update_canmove()
return return
/mob/proc/AdjustLosebreath(amount) /mob/proc/AdjustLosebreath(amount)

View File

@@ -624,7 +624,28 @@ var/global/image/backplane
backplane = image('icons/misc/win32.dmi') backplane = image('icons/misc/win32.dmi')
backplane.alpha = 0 backplane.alpha = 0
backplane.plane = -100 backplane.plane = -100
backplane.layer = BACKPLANE_LAYER backplane.layer = MOB_LAYER-0.01
backplane.mouse_opacity = 0 backplane.mouse_opacity = 0
return TRUE return TRUE
/mob/proc/position_hud_item(var/obj/item/item, var/slot)
if(!istype(hud_used) || !slot || !LAZYLEN(hud_used.slot_info))
return
//They may have hidden their entire hud but the hands
if(!hud_used.hud_shown && slot > slot_r_hand)
item.screen_loc = null
return
//They may have hidden the icons in the bottom left with the hide button
if(!hud_used.inventory_shown && slot > slot_r_store)
item.screen_loc = null
return
var/screen_place = hud_used.slot_info["[slot]"]
if(!screen_place)
item.screen_loc = null
return
item.screen_loc = screen_place

View File

@@ -247,8 +247,6 @@
mannequin.job = previewJob.title mannequin.job = previewJob.title
previewJob.equip_preview(mannequin, player_alt_titles[previewJob.title]) previewJob.equip_preview(mannequin, player_alt_titles[previewJob.title])
mannequin.regenerate_icons()
/datum/preferences/proc/update_preview_icon() /datum/preferences/proc/update_preview_icon()
var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin(client_ckey) var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin(client_ckey)
mannequin.delete_inventory(TRUE) mannequin.delete_inventory(TRUE)

View File

@@ -1,31 +1,26 @@
//Most of these are defined at this level to reduce on checks elsewhere in the code. //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 //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 /mob/proc/regenerate_icons() //Update every aspect of the mob's icons (expensive, resist the urge to use unless you need it)
return return
/mob/proc/update_icons() /mob/proc/update_icons()
update_icon() //Ugh. update_icon() //Ugh.
return return
/mob/proc/update_icons_layers(var/update_icons = TRUE) // Obsolete
if(update_icons) /mob/proc/update_icons_layers()
update_icons() return
/mob/proc/update_icons_huds(var/update_icons = TRUE) /mob/proc/update_icons_huds()
if(update_icons) return
update_icons()
/mob/proc/update_icons_body(var/update_icons = TRUE) /mob/proc/update_icons_body()
if(update_icons) return
update_icons()
/mob/proc/update_icons_all() /mob/proc/update_icons_all()
update_icons_huds(FALSE) return
update_icons_body(FALSE) // End obsolete
update_icons_layers(FALSE)
update_icons()
/mob/proc/update_hud() /mob/proc/update_hud()
return return

View File

@@ -873,7 +873,7 @@ Note that amputating the affected organ does in fact remove the infection from t
spawn(1) spawn(1)
victim.updatehealth() victim.updatehealth()
victim.UpdateDamageIcon() victim.UpdateDamageIcon()
victim.regenerate_icons() victim.update_icons_body()
dir = 2 dir = 2
switch(disintegrate) switch(disintegrate)

View File

@@ -499,13 +499,13 @@
B.loc = h_user B.loc = h_user
B.hud_layerise() B.hud_layerise()
h_user.l_store = B h_user.l_store = B
h_user.update_inv_pockets() //h_user.update_inv_pockets() //Doesn't do anything
else if (h_user.r_store == src) else if (h_user.r_store == src)
h_user.drop_from_inventory(src) h_user.drop_from_inventory(src)
B.loc = h_user B.loc = h_user
B.hud_layerise() B.hud_layerise()
h_user.r_store = B h_user.r_store = B
h_user.update_inv_pockets() //h_user.update_inv_pockets() //Doesn't do anything
else if (h_user.head == src) else if (h_user.head == src)
h_user.u_equip(src) h_user.u_equip(src)
h_user.put_in_hands(B) h_user.put_in_hands(B)