Merge pull request #5037 from VOREStation/aro-updateicons

Rewrite human/update_icons()
This commit is contained in:
Anewbe
2018-03-11 21:03:10 -05:00
committed by GitHub
65 changed files with 1195 additions and 1448 deletions
-7
View File
@@ -1001,11 +1001,6 @@
//strip their stuff and stick it in the crate
for(var/obj/item/I in M)
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
M.Paralyse(5)
@@ -1188,10 +1183,8 @@
usr << "This can only be used on instances of type /mob/living/carbon/human"
return
var/block=text2num(href_list["block"])
//testing("togmutate([href_list["block"]] -> [block])")
usr.client.cmd_admin_toggle_block(H,block)
show_player_panel(H)
//H.regenerate_icons()
else if(href_list["adminplayeropts"])
var/mob/M = locate(href_list["adminplayeropts"])
-1
View File
@@ -37,7 +37,6 @@
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
H.name = H.get_visible_name()
// usr.regenerate_icons() //So the name is updated properly
usr.loc = O.loc // Appear where the object you were controlling is -- TLE
usr.client.eye = usr
+4 -4
View File
@@ -287,10 +287,10 @@ datum/preferences
if(icon_updates)
character.force_update_limbs()
character.update_mutations(0)
character.update_underwear(0)
character.update_hair(0)
character.update_icons_all()
character.update_icons_body()
character.update_mutations()
character.update_underwear()
character.update_hair()
/datum/preferences/proc/open_load_dialog(mob/user)
var/dat = "<body>"
+24 -20
View File
@@ -22,6 +22,7 @@
*/
var/list/sprite_sheets_refit = null
var/ear_protection = 0
var/blood_sprite_state
//Updates the icons of the mob wearing the clothing item, if any.
/obj/item/clothing/proc/update_clothing_icon()
@@ -90,10 +91,8 @@
//Set icon
if (sprite_sheets_refit && (target_species in sprite_sheets_refit))
icon_override = sprite_sheets_refit[target_species]
else
icon_override = initial(icon_override)
sprite_sheets[target_species] = sprite_sheets_refit[target_species]
if (sprite_sheets_obj && (target_species in sprite_sheets_obj))
icon = sprite_sheets_obj[target_species]
else
@@ -113,9 +112,7 @@
//Set icon
if (sprite_sheets_refit && (target_species in sprite_sheets_refit))
icon_override = sprite_sheets_refit[target_species]
else
icon_override = initial(icon_override)
sprite_sheets[target_species] = sprite_sheets_refit[target_species]
if (sprite_sheets_obj && (target_species in sprite_sheets_obj))
icon = sprite_sheets_obj[target_species]
@@ -197,6 +194,7 @@
w_class = ITEMSIZE_SMALL
icon = 'icons/obj/clothing/gloves.dmi'
siemens_coefficient = 0.9
blood_sprite_state = "bloodyhands"
var/wired = 0
var/obj/item/weapon/cell/cell = 0
var/fingerprint_chance = 0 //How likely the glove is to let fingerprints through
@@ -318,11 +316,13 @@
body_parts_covered = HEAD
slot_flags = SLOT_HEAD
w_class = ITEMSIZE_SMALL
blood_sprite_state = "helmetblood"
var/light_overlay = "helmet_light"
var/light_applied
var/brightness_on
var/on = 0
var/image/helmet_light
sprite_sheets = list(
"Teshari" = 'icons/mob/species/seromi/head.dmi',
@@ -386,29 +386,29 @@
return 1
/obj/item/clothing/head/update_icon(var/mob/user)
overlays.Cut()
var/mob/living/carbon/human/H
if(istype(user,/mob/living/carbon/human))
if(ishuman(user))
H = user
if(on)
// Generate object icon.
if(!light_overlay_cache["[light_overlay]_icon"])
light_overlay_cache["[light_overlay]_icon"] = image("icon" = 'icons/obj/light_overlays.dmi', "icon_state" = "[light_overlay]")
overlays |= light_overlay_cache["[light_overlay]_icon"]
light_overlay_cache["[light_overlay]_icon"] = image(icon = 'icons/obj/light_overlays.dmi', icon_state = "[light_overlay]")
helmet_light = light_overlay_cache["[light_overlay]_icon"]
add_overlay(helmet_light)
// Generate and cache the on-mob icon, which is used in update_inv_head().
var/cache_key = "[light_overlay][H ? "_[H.species.get_bodytype(H)]" : ""]"
var/body_type = (H && H.species.get_bodytype(H))
var/cache_key = "[light_overlay][body_type && sprite_sheets[body_type] ? "_[body_type]" : ""]"
if(!light_overlay_cache[cache_key])
var/use_icon = 'icons/mob/light_overlays.dmi'
if(H && sprite_sheets[H.species.get_bodytype(H)])
use_icon = sprite_sheets[H.species.get_bodytype(H)]
light_overlay_cache[cache_key] = image("icon" = use_icon, "icon_state" = "[light_overlay]")
var/use_icon = LAZYACCESS(sprite_sheets,body_type) || 'icons/mob/light_overlays.dmi'
light_overlay_cache[cache_key] = image(icon = use_icon, icon_state = "[light_overlay]")
else if(helmet_light)
cut_overlay(helmet_light)
helmet_light = null
if(H)
H.update_inv_head()
user.update_inv_head() //Will redraw the helmet with the light on the mob
/obj/item/clothing/head/update_clothing_icon()
if (ismob(src.loc))
@@ -427,6 +427,7 @@
body_parts_covered = HEAD
slot_flags = SLOT_MASK
body_parts_covered = FACE|EYES
blood_sprite_state = "maskblood"
sprite_sheets = list(
"Teshari" = 'icons/mob/species/seromi/masks.dmi',
"Vox" = 'icons/mob/species/vox/masks.dmi',
@@ -460,6 +461,7 @@
siemens_coefficient = 0.9
body_parts_covered = FEET
slot_flags = SLOT_FEET
blood_sprite_state = "shoeblood"
var/can_hold_knife = 0
var/obj/item/holding
@@ -574,6 +576,7 @@
w_class = ITEMSIZE_NORMAL
preserve_item = 1
sprite_sheets = list(
"Teshari" = 'icons/mob/species/seromi/suit.dmi',
"Vox" = 'icons/mob/species/vox/suit.dmi'
@@ -602,6 +605,7 @@
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
w_class = ITEMSIZE_NORMAL
show_messages = 1
blood_sprite_state = "uniformblood"
var/has_sensor = 1 //For the crew computer 2 = unable to change mode
var/sensor_mode = 0
+34
View File
@@ -0,0 +1,34 @@
/obj/item/clothing/apply_accessories(var/image/standing)
if(LAZYLEN(accessories))
for(var/obj/item/clothing/accessory/A in accessories)
standing.add_overlay(A.get_mob_overlay())
/obj/item/clothing/apply_blood(var/image/standing)
if(blood_DNA && blood_sprite_state && ishuman(loc))
var/mob/living/carbon/human/H = loc
var/image/bloodsies = image(icon = H.species.get_blood_mask(H), icon_state = blood_sprite_state)
bloodsies.color = blood_color
standing.add_overlay(bloodsies)
//UNIFORM: Always appends "_s" to iconstate, stupidly.
/obj/item/clothing/under/get_worn_icon_state(var/slot_name)
var/state2use = ..()
state2use += "_s"
return state2use
//HELMET: May have a lighting overlay
/obj/item/clothing/head/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0)
var/image/standing = ..()
if(on && slot_name == slot_head_str)
var/cache_key = "[light_overlay][LAZYACCESS(sprite_sheets,body_type) ? "_[body_type]" : ""]"
if(standing && light_overlay_cache[cache_key])
standing.add_overlay(light_overlay_cache[cache_key])
return standing
//SUIT: Blood state is slightly different
/obj/item/clothing/suit/apply_blood(var/image/standing)
if(blood_DNA && blood_sprite_state && ishuman(loc))
var/mob/living/carbon/human/H = loc
var/image/bloodsies = image(icon = H.species.get_blood_mask(H), icon_state = "[blood_overlay_type]blood")
bloodsies.color = blood_color
standing.add_overlay(bloodsies)
+10 -2
View File
@@ -179,6 +179,15 @@
spark_system = null
return ..()
/obj/item/weapon/rig/get_worn_icon_file(var/body_type,var/slot_name,var/default_icon,var/inhands)
if(!inhands && slot_name == slot_back_str)
if(icon_override)
return icon_override
else if(mob_icon)
return mob_icon
return ..()
/obj/item/weapon/rig/proc/suit_is_deployed()
if(!istype(wearer) || src.loc != wearer || wearer.back != src)
return 0
@@ -330,7 +339,6 @@
piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT)
else
piece.item_flags |= (STOPPRESSUREDAMAGE|AIRTIGHT)
update_icon(1)
/obj/item/weapon/rig/ui_action_click()
toggle_cooling(usr)
@@ -598,7 +606,7 @@
// update_inv_wear_suit(), handle species checks here.
if(wearer && sprite_sheets && sprite_sheets[wearer.species.get_bodytype(wearer)])
species_icon = sprite_sheets[wearer.species.get_bodytype(wearer)]
mob_icon = image("icon" = species_icon, "icon_state" = "[icon_state]")
mob_icon = icon(icon = species_icon, icon_state = "[icon_state]")
if(installed_modules.len)
for(var/obj/item/rig_module/module in installed_modules)
@@ -265,6 +265,15 @@
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
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."
-1
View File
@@ -247,7 +247,6 @@
var/mob/M = obj.loc
if(ismob(M))
M.remove_from_mob(obj)
M.update_icons_layers() //so their overlays update
if(!silent)
var/obj/oldobj = obj
+2 -2
View File
@@ -104,8 +104,8 @@
base_icon = 'icons/turf/flooring/asteroid.dmi'
initial_flooring = null
/turf/simulated/floor/holofloor/desert/New()
..()
/turf/simulated/floor/holofloor/desert/initialize()
. = ..()
if(prob(10))
add_overlay("asteroid[rand(0,9)]")
+1 -2
View File
@@ -103,8 +103,7 @@
if (ishuman(body))
var/mob/living/carbon/human/H = body
icon = H.icon
LAZYCLEARLIST(H.list_huds)
H.update_icons()
underlays = H.underlays
overlays = H.overlays
else
icon = body.icon
-2
View File
@@ -83,8 +83,6 @@ var/list/holder_mob_icon_cache = list()
H.update_inv_l_hand()
else if(H.r_hand == src)
H.update_inv_r_hand()
else
H.regenerate_icons()
//Mob specific holders.
/obj/item/weapon/holder/diona
+1 -2
View File
@@ -138,7 +138,6 @@ var/list/slot_equipment_priority = list( \
remove_from_mob(W, target)
if(!(W && W.loc))
return 1 // self destroying objects (tk, grabs)
update_icons_layers()
return 1
return 0
@@ -180,7 +179,7 @@ var/list/slot_equipment_priority = list( \
/mob/proc/get_inventory_slot(obj/item/I)
var/slot = 0
for(var/s in slot_back to slot_tie) //kind of worries me
for(var/s in 1 to SLOT_TOTAL)
if(get_equipped_item(s) == I)
slot = s
break
-17
View File
@@ -277,23 +277,6 @@
// ++++ROCKDTBEN++++ MOB PROCS //END
/mob/living/carbon/clean_blood()
. = ..()
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(H.gloves)
if(H.gloves.clean_blood())
H.update_inv_gloves(0)
H.gloves.germ_level = 0
else
if(H.bloody_hands)
H.bloody_hands = 0
H.update_inv_gloves(0)
H.germ_level = 0
update_icons_layers(FALSE) //apply the now updated overlays to the mob
update_icons_body()
/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)
+34 -28
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_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/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
@@ -40,9 +41,8 @@
nutrition = rand(200,400)
make_hud_overlays()
human_mob_list |= src
..()
hide_underwear.Cut()
@@ -53,20 +53,12 @@
dna.ready_dna(src)
dna.real_name = real_name
sync_organ_dna()
make_blood()
/mob/living/carbon/human/Destroy()
human_mob_list -= src
for(var/organ in organs)
qdel(organ)
LAZYCLEARLIST(list_layers)
list_layers = null //Be free!
LAZYCLEARLIST(list_body)
list_body = null
LAZYCLEARLIST(list_huds)
list_huds = null
return ..()
/mob/living/carbon/human/Stat()
@@ -1015,7 +1007,7 @@
if(!blood_DNA[M.dna.unique_enzymes])
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
hand_blood_color = blood_color
src.update_inv_gloves() //handles bloody hands overlays and updating
update_bloodied()
verbs += /mob/living/carbon/human/proc/bloody_doodle
return 1 //we applied blood to the item
@@ -1025,14 +1017,30 @@
return md5(dna.uni_identity)
/mob/living/carbon/human/clean_blood(var/washshoes)
.=..()
. = ..()
gunshot_residue = null
if(washshoes && !shoes && istype(feet_blood_DNA, /list) && feet_blood_DNA.len)
feet_blood_color = null
feet_blood_DNA.Cut()
//Always do hands (or whatever's on our hands)
if(gloves)
gloves.clean_blood()
update_inv_gloves()
gloves.germ_level = 0
else
bloody_hands = 0
germ_level = 0
//Sometimes do shoes if asked (or feet if no shoes)
if(washshoes && shoes)
shoes.clean_blood()
update_inv_shoes()
shoes.germ_level = 0
else if(washshoes && (feet_blood_color || LAZYLEN(feet_blood_DNA)))
LAZYCLEARLIST(feet_blood_DNA)
feet_blood_DNA = null
update_inv_shoes(1)
return 1
feet_blood_color = null
update_bloodied()
/mob/living/carbon/human/get_visible_implants(var/class = 0)
@@ -1168,7 +1176,7 @@
maxHealth = species.total_health
spawn(0)
regenerate_icons()
make_blood()
if(vessel.total_volume < species.blood_volume)
vessel.maximum_volume = species.blood_volume
vessel.add_reagent("blood", species.blood_volume - vessel.total_volume)
@@ -1184,6 +1192,9 @@
qdel(hud_used)
hud_used = new /datum/hud(src)
//A slew of bits that may be affected by our species change
regenerate_icons()
if(species)
if(mind)
apply_traits()
@@ -1538,22 +1549,17 @@
return species.fire_icon_state
// Called by job_controller. Makes drones start with a permit, might be useful for other people later too.
/mob/living/carbon/human/equip_post_job()
/mob/living/carbon/human/equip_post_job() //Drone Permit moved to equip_survival_gear()
var/braintype = get_FBP_type()
if(braintype == FBP_DRONE)
var/turf/T = get_turf(src)
var/obj/item/clothing/accessory/permit/drone/permit = new(T)
permit.set_name(real_name)
equip_to_slot_or_del(permit, slot_in_backpack)
equip_to_appropriate_slot(permit) // If for some reason it can't find room, it'll still be on the floor.
/mob/living/carbon/human/proc/update_icon_special(var/mutable_appearance/ma, var/update_icons = TRUE) //For things such as teshari hiding and whatnot.
/mob/living/carbon/human/proc/update_icon_special() //For things such as teshari hiding and whatnot.
if(hiding) // Hiding? Carry on.
if(stat == DEAD || paralysis || weakened || stunned) //stunned/knocked down by something that isn't the rest verb? Note: This was tried with INCAPACITATION_STUNNED, but that refused to work.
hiding = FALSE //No hiding for you. Mob layer should be updated naturally, but it actually doesn't.
else
ma.layer = HIDING_LAYER
//Can put special species icon update proc calls here, if any are ever invented.
if(update_icons)
update_icons()
layer = HIDING_LAYER
@@ -102,8 +102,6 @@
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.
var/mob/living/carbon/human/vr_holder = null
// Used by "real" mobs after they leave a VR session
@@ -108,7 +108,7 @@
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)
if(isSynthetic())
hud_list[STATUS_HUD] = gen_hud_image(ingame_hud, src, "hudrobo", plane = PLANE_CH_STATUS)
@@ -123,6 +123,7 @@
hud_list[IMPTRACK_HUD] = gen_hud_image(ingame_hud, src, "hudblank", plane = PLANE_CH_IMPTRACK)
hud_list[SPECIALROLE_HUD] = gen_hud_image(ingame_hud, src, "hudblank", plane = PLANE_CH_SPECIAL)
hud_list[STATUS_HUD_OOC] = gen_hud_image(ingame_hud, src, "hudhealthy", plane = PLANE_CH_STATUS_OOC)
add_overlay(hud_list)
/mob/living/carbon/human/recalculate_vis()
if(!vis_enabled || !plane_holder)
@@ -2,7 +2,8 @@
var/obj/item/organ/internal/eyes/eyes = internal_organs_by_name[O_EYES]
if(eyes)
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/human/var/list/organs = list()
@@ -152,12 +152,14 @@ This saves us from having to call add_fingerprint() any time something is put in
else if (W == wear_id)
wear_id = null
update_inv_wear_id()
BITSET(hud_updateflag, ID_HUD)
BITSET(hud_updateflag, WANTED_HUD)
else if (W == r_store)
r_store = null
update_inv_pockets()
//update_inv_pockets() //Doesn't do anything.
else if (W == l_store)
l_store = null
update_inv_pockets()
//update_inv_pockets() //Doesn't do anything.
else if (W == s_store)
s_store = null
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()
//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, redraw_mob = 1)
/mob/living/carbon/human/equip_to_slot(obj/item/W as obj, slot)
if(!slot)
return
@@ -213,39 +214,41 @@ This saves us from having to call add_fingerprint() any time something is put in
src.back = W
W.equipped(src, slot)
worn_clothing += back
update_inv_back(redraw_mob)
update_inv_back()
if(slot_wear_mask)
src.wear_mask = W
if(wear_mask.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair
update_inv_ears(0)
update_hair() //rebuild hair
update_inv_ears()
W.equipped(src, slot)
worn_clothing += wear_mask
update_inv_wear_mask(redraw_mob)
update_inv_wear_mask()
if(slot_handcuffed)
src.handcuffed = W
update_inv_handcuffed(redraw_mob)
update_inv_handcuffed()
if(slot_legcuffed)
src.legcuffed = W
W.equipped(src, slot)
update_inv_legcuffed(redraw_mob)
update_inv_legcuffed()
if(slot_l_hand)
src.l_hand = W
W.equipped(src, slot)
update_inv_l_hand(redraw_mob)
update_inv_l_hand()
if(slot_r_hand)
src.r_hand = W
W.equipped(src, slot)
update_inv_r_hand(redraw_mob)
update_inv_r_hand()
if(slot_belt)
src.belt = W
W.equipped(src, slot)
worn_clothing += belt
update_inv_belt(redraw_mob)
update_inv_belt()
if(slot_wear_id)
src.wear_id = W
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)
src.l_ear = W
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
O.hud_layerise()
W.equipped(src, slot)
update_inv_ears(redraw_mob)
update_inv_ears()
if(slot_r_ear)
src.r_ear = W
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
O.hud_layerise()
W.equipped(src, slot)
update_inv_ears(redraw_mob)
update_inv_ears()
if(slot_glasses)
src.glasses = W
W.equipped(src, slot)
update_inv_glasses(redraw_mob)
update_inv_glasses()
if(slot_gloves)
src.gloves = W
W.equipped(src, slot)
worn_clothing += glasses
update_inv_gloves(redraw_mob)
update_inv_gloves()
if(slot_head)
src.head = W
if(head.flags_inv & (BLOCKHAIR|BLOCKHEADHAIR|HIDEMASK))
update_hair(redraw_mob) //rebuild hair
update_hair() //rebuild hair
update_inv_ears(0)
update_inv_wear_mask(0)
if(istype(W,/obj/item/clothing/head/kitty))
W.update_icon(src)
W.equipped(src, slot)
worn_clothing += head
update_inv_head(redraw_mob)
update_inv_head()
if(slot_shoes)
src.shoes = W
W.equipped(src, slot)
worn_clothing += shoes
update_inv_shoes(redraw_mob)
update_inv_shoes()
if(slot_wear_suit)
src.wear_suit = W
W.equipped(src, slot)
worn_clothing += wear_suit
update_inv_wear_suit(redraw_mob)
update_inv_wear_suit()
if(slot_w_uniform)
src.w_uniform = W
W.equipped(src, slot)
worn_clothing += w_uniform
update_inv_w_uniform(redraw_mob)
update_inv_w_uniform()
if(slot_l_store)
src.l_store = W
W.equipped(src, slot)
update_inv_pockets(redraw_mob)
//update_inv_pockets() //Doesn't do anything
if(slot_r_store)
src.r_store = W
W.equipped(src, slot)
update_inv_pockets(redraw_mob)
//update_inv_pockets() //Doesn't do anything
if(slot_s_store)
src.s_store = W
W.equipped(src, slot)
update_inv_s_store(redraw_mob)
update_inv_s_store()
if(slot_in_backpack)
if(src.get_active_hand() == W)
src.remove_from_mob(W)
+22 -24
View File
@@ -1583,26 +1583,24 @@
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.
*/
/mob/living/carbon/human/proc/handle_hud_list()
if (BITTEST(hud_updateflag, HEALTH_HUD))
var/image/holder = hud_list[HEALTH_HUD]
var/image/holder = grab_hud(HEALTH_HUD)
if(stat == DEAD)
holder.icon_state = "-100" // X_X
else
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))
var/image/holder = hud_list[LIFE_HUD]
var/image/holder = grab_hud(LIFE_HUD)
if(isSynthetic())
holder.icon_state = "hudrobo"
else if(stat == DEAD)
holder.icon_state = "huddead"
else
holder.icon_state = "hudhealthy"
hud_list[LIFE_HUD] = holder
apply_hud(LIFE_HUD, holder)
if (BITTEST(hud_updateflag, STATUS_HUD))
var/foundVirus = 0
@@ -1611,8 +1609,8 @@
foundVirus = 1
break
var/image/holder = hud_list[STATUS_HUD]
var/image/holder2 = hud_list[STATUS_HUD_OOC]
var/image/holder = grab_hud(STATUS_HUD)
var/image/holder2 = grab_hud(STATUS_HUD_OOC)
if (isSynthetic())
holder.icon_state = "hudrobo"
else if(stat == DEAD)
@@ -1634,11 +1632,11 @@
else
holder2.icon_state = "hudhealthy"
hud_list[STATUS_HUD] = holder
hud_list[STATUS_HUD_OOC] = holder2
apply_hud(STATUS_HUD, holder)
apply_hud(STATUS_HUD_OOC, holder2)
if (BITTEST(hud_updateflag, ID_HUD))
var/image/holder = hud_list[ID_HUD]
var/image/holder = grab_hud(ID_HUD)
if(wear_id)
var/obj/item/weapon/card/id/I = wear_id.GetID()
if(I)
@@ -1648,11 +1646,10 @@
else
holder.icon_state = "hudunknown"
hud_list[ID_HUD] = holder
apply_hud(ID_HUD, holder)
if (BITTEST(hud_updateflag, WANTED_HUD))
var/image/holder = hud_list[WANTED_HUD]
var/image/holder = grab_hud(WANTED_HUD)
holder.icon_state = "hudblank"
var/perpname = name
if(wear_id)
@@ -1675,15 +1672,16 @@
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
holder.icon_state = "hudreleased"
break
hud_list[WANTED_HUD] = holder
apply_hud(WANTED_HUD, holder)
if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \
|| BITTEST(hud_updateflag, IMPCHEM_HUD) \
|| BITTEST(hud_updateflag, IMPTRACK_HUD))
var/image/holder1 = hud_list[IMPTRACK_HUD]
var/image/holder2 = hud_list[IMPLOYAL_HUD]
var/image/holder3 = hud_list[IMPCHEM_HUD]
var/image/holder1 = grab_hud(IMPTRACK_HUD)
var/image/holder2 = grab_hud(IMPLOYAL_HUD)
var/image/holder3 = grab_hud(IMPCHEM_HUD)
holder1.icon_state = "hudblank"
holder2.icon_state = "hudblank"
@@ -1699,21 +1697,21 @@
if(istype(I,/obj/item/weapon/implant/chem))
holder3.icon_state = "hud_imp_chem"
hud_list[IMPTRACK_HUD] = holder1
hud_list[IMPLOYAL_HUD] = holder2
hud_list[IMPCHEM_HUD] = holder3
apply_hud(IMPTRACK_HUD, holder1)
apply_hud(IMPLOYAL_HUD, holder2)
apply_hud(IMPCHEM_HUD, holder3)
if (BITTEST(hud_updateflag, SPECIALROLE_HUD))
var/image/holder = hud_list[SPECIALROLE_HUD]
var/image/holder = grab_hud(SPECIALROLE_HUD)
holder.icon_state = "hudblank"
if(mind && mind.special_role)
if(hud_icon_reference[mind.special_role])
holder.icon_state = hud_icon_reference[mind.special_role]
else
holder.icon_state = "hudsyndicate"
hud_list[SPECIALROLE_HUD] = holder
apply_hud(SPECIALROLE_HUD, holder)
hud_updateflag = 0
update_icons_huds()
/mob/living/carbon/human/handle_stunned()
if(!can_feel_pain())
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -72,16 +72,16 @@
/mob/living/u_equip(obj/W as obj)
if (W == r_hand)
r_hand = null
update_inv_r_hand(0)
update_inv_r_hand()
else if (W == l_hand)
l_hand = null
update_inv_l_hand(0)
update_inv_l_hand()
else if (W == back)
back = null
update_inv_back(0)
update_inv_back()
else if (W == wear_mask)
wear_mask = null
update_inv_wear_mask(0)
update_inv_wear_mask()
return
/mob/living/get_equipped_item(var/slot)
-6
View File
@@ -111,15 +111,11 @@
/mob/living/proc/handle_stunned()
if(stunned)
AdjustStunned(-1)
if(!stunned)
update_icons()
return stunned
/mob/living/proc/handle_weakened()
if(weakened)
weakened = max(weakened-1,0)
if(!weakened)
update_icons()
return weakened
/mob/living/proc/handle_stuttering()
@@ -145,8 +141,6 @@
/mob/living/proc/handle_paralysed()
if(paralysis)
AdjustParalysis(-1)
if(!paralysis)
update_icons()
return paralysis
/mob/living/proc/handle_disabilities()
+31 -8
View File
@@ -1,6 +1,13 @@
/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
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.
@@ -855,6 +862,7 @@ default behaviour is:
resting = !resting
to_chat(src, "<span class='notice'>You are now [resting ? "resting" : "getting up"]</span>")
update_canmove()
/mob/living/proc/cannot_use_vents()
if(mob_size > MOB_SMALL)
@@ -1002,14 +1010,10 @@ default behaviour is:
canmove = 0
break
//Temporarily moved here from the various life() procs
//I'm fixing stuff incrementally so this will likely find a better home.
//It just makes sense for now. ~Carn
if( update_icon ) //forces a full overlay update
update_icon = 0
regenerate_icons()
else if( lying != lying_prev )
update_icons()
if(lying != lying_prev)
lying_prev = lying
update_transform()
return canmove
// Adds overlays for specific modifiers.
@@ -1162,3 +1166,22 @@ default behaviour is:
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
@@ -54,3 +54,6 @@
var/glow_range = 2
var/glow_intensity = null
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
+1 -1
View File
@@ -7,7 +7,7 @@
var/list/stating_laws = list()// Channels laws are currently being stated on
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
//Used in say.dm.
@@ -12,6 +12,7 @@
var/list/adding = list()
var/list/other = list()
var/list/hotkeybuttons = list()
var/list/slot_info = list()
hud.adding = adding
hud.other = other
@@ -34,6 +35,7 @@
inv_box.screen_loc = slot_data["loc"]
inv_box.slot_id = slot_data["slot"]
inv_box.icon_state = slot_data["state"]
slot_info["[inv_box.slot_id]"] = inv_box.screen_loc
if(slot_data["dir"])
inv_box.set_dir(slot_data["dir"])
@@ -249,9 +251,9 @@
inv_box.slot_id = slot_r_hand
inv_box.color = ui_color
inv_box.alpha = ui_alpha
hud.r_hand_hud_object = inv_box
hud.adding += inv_box
slot_info["[slot_r_hand]"] = inv_box.screen_loc
inv_box = new /obj/screen/inventory/hand()
inv_box.hud = src
@@ -266,6 +268,7 @@
inv_box.alpha = ui_alpha
hud.l_hand_hud_object = inv_box
hud.adding += inv_box
slot_info["[slot_l_hand]"] = inv_box.screen_loc
//Swaphand titlebar
using = new /obj/screen/inventory()
+3
View File
@@ -858,14 +858,17 @@
/mob/proc/Resting(amount)
facing_dir = null
resting = max(max(resting,amount),0)
update_canmove()
return
/mob/proc/SetResting(amount)
resting = max(amount,0)
update_canmove()
return
/mob/proc/AdjustResting(amount)
resting = max(resting + amount,0)
update_canmove()
return
/mob/proc/AdjustLosebreath(amount)
+22
View File
@@ -624,6 +624,28 @@ var/global/image/backplane
backplane = image('icons/misc/win32.dmi')
backplane.alpha = 0
backplane.plane = -100
backplane.layer = MOB_LAYER-0.1
backplane.mouse_opacity = 0
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
+1 -1
View File
@@ -485,8 +485,8 @@
// Do the initial caching of the player's body icons.
new_character.force_update_limbs()
new_character.update_icons_body()
new_character.update_eyes()
new_character.regenerate_icons()
new_character.key = key //Manually transfer the key to log them in
@@ -194,30 +194,29 @@
b_skin = blue
/datum/preferences/proc/dress_preview_mob(var/mob/living/carbon/human/mannequin)
var/update_icon = FALSE
copy_to(mannequin, TRUE)
var/datum/job/previewJob
if(equip_preview_mob)
// Determine what job is marked as 'High' priority, and dress them up as such.
if(job_civilian_low & ASSISTANT)
previewJob = job_master.GetJob("Assistant")
else
for(var/datum/job/job in job_master.occupations)
var/job_flag
switch(job.department_flag)
if(CIVILIAN)
job_flag = job_civilian_high
if(MEDSCI)
job_flag = job_medsci_high
if(ENGSEC)
job_flag = job_engsec_high
if(job.flag == job_flag)
previewJob = job
break
else
if(!equip_preview_mob)
return
var/datum/job/previewJob
// Determine what job is marked as 'High' priority, and dress them up as such.
if(job_civilian_low & ASSISTANT)
previewJob = job_master.GetJob("Assistant")
else
for(var/datum/job/job in job_master.occupations)
var/job_flag
switch(job.department_flag)
if(CIVILIAN)
job_flag = job_civilian_high
if(MEDSCI)
job_flag = job_medsci_high
if(ENGSEC)
job_flag = job_engsec_high
if(job.flag == job_flag)
previewJob = job
break
if((equip_preview_mob & EQUIP_PREVIEW_LOADOUT) && !(previewJob && (equip_preview_mob & EQUIP_PREVIEW_JOB) && (previewJob.type == /datum/job/ai || previewJob.type == /datum/job/cyborg)))
var/list/equipped_slots = list() //If more than one item takes the same slot only spawn the first
for(var/thing in gear)
@@ -243,15 +242,10 @@
var/metadata = gear[G.display_name]
if(mannequin.equip_to_slot_or_del(G.spawn_item(mannequin, metadata), G.slot))
equipped_slots += G.slot
update_icon = TRUE
if((equip_preview_mob & EQUIP_PREVIEW_JOB) && previewJob)
mannequin.job = previewJob.title
previewJob.equip_preview(mannequin, player_alt_titles[previewJob.title])
update_icon = TRUE
if(update_icon)
mannequin.update_icons_all()
/datum/preferences/proc/update_preview_icon()
var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin(client_ckey)
@@ -261,16 +255,13 @@
preview_icon = icon('icons/effects/128x48.dmi', bgstate)
preview_icon.Scale(48+32, 16+32)
mannequin.dir = NORTH
var/icon/stamp = getFlatIcon(mannequin)
var/icon/stamp = getFlatIcon(mannequin, defdir=NORTH)
preview_icon.Blend(stamp, ICON_OVERLAY, 25, 17)
mannequin.dir = WEST
stamp = getFlatIcon(mannequin)
stamp = getFlatIcon(mannequin, defdir=WEST)
preview_icon.Blend(stamp, ICON_OVERLAY, 1, 9)
mannequin.dir = SOUTH
stamp = getFlatIcon(mannequin)
stamp = getFlatIcon(mannequin, defdir=SOUTH)
preview_icon.Blend(stamp, ICON_OVERLAY, 49, 1)
preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.
preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.
+3 -7
View File
@@ -8,15 +8,15 @@
if(client && !stat)
typing_indicator.invisibility = invisibility
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator))
overlays -= typing_indicator
add_overlay(typing_indicator)
else
if(state)
if(!typing)
overlays += typing_indicator
add_overlay(typing_indicator)
typing = 1
else
if(typing)
overlays -= typing_indicator
cut_overlay(typing_indicator)
typing = 0
return state
@@ -28,7 +28,6 @@
set_typing_indicator(1)
else if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 1
update_icons_huds()
var/message = input("","say (text)") as text
@@ -36,7 +35,6 @@
set_typing_indicator(0)
else if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 0
update_icons_huds()
if(message)
say_verb(message)
@@ -49,13 +47,11 @@
set_typing_indicator(1)
else if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 1
update_icons_huds()
var/message = input("","me (text)") as text
if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 0
update_icons_huds()
else if(!ishuman(src)) //If they're a mob, use the old code.
set_typing_indicator(0)
+10 -15
View File
@@ -1,31 +1,26 @@
//Most of these are defined at this level to reduce on checks elsewhere in the code.
//Having them here also makes for a nice reference list of the various overlay-updating procs available
/mob/proc/regenerate_icons() //TODO: phase this out completely if possible
/mob/proc/regenerate_icons() //Update every aspect of the mob's icons (expensive, resist the urge to use unless you need it)
return
/mob/proc/update_icons()
update_icon() //Ugh.
return
/mob/proc/update_icons_layers(var/update_icons = TRUE)
if(update_icons)
update_icons()
// Obsolete
/mob/proc/update_icons_layers()
return
/mob/proc/update_icons_huds(var/update_icons = TRUE)
if(update_icons)
update_icons()
/mob/proc/update_icons_huds()
return
/mob/proc/update_icons_body(var/update_icons = TRUE)
if(update_icons)
update_icons()
/mob/proc/update_icons_body()
return
/mob/proc/update_icons_all()
update_icons_huds(FALSE)
update_icons_body(FALSE)
update_icons_layers(FALSE)
update_icons()
return
// End obsolete
/mob/proc/update_hud()
return
-2
View File
@@ -27,8 +27,6 @@ var/const/CE_STABLE_THRESHOLD = 0.5
return
vessel.add_reagent("blood",species.blood_volume)
spawn(1)
fixblood()
//Resets blood data
/mob/living/carbon/human/proc/fixblood()
+1 -1
View File
@@ -873,7 +873,7 @@ Note that amputating the affected organ does in fact remove the infection from t
spawn(1)
victim.updatehealth()
victim.UpdateDamageIcon()
victim.regenerate_icons()
victim.update_icons_body()
dir = 2
switch(disintegrate)
+6 -2
View File
@@ -457,6 +457,10 @@
update_icon()
/obj/item/weapon/paper/get_worn_icon_state(var/slot_name)
if(slot_name == slot_head_str)
return "paper" //Gross, but required for now.
return ..()
/obj/item/weapon/paper/attackby(obj/item/weapon/P as obj, mob/user as mob)
..()
@@ -495,13 +499,13 @@
B.loc = h_user
B.hud_layerise()
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)
h_user.drop_from_inventory(src)
B.loc = h_user
B.hud_layerise()
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)
h_user.u_equip(src)
h_user.put_in_hands(B)