Cleanup of all the update_clothing() calls.

Mostly I replaced them with rebuild_appearance() or update_body_appearance() where suitable.

I also reorganized the new update_clothing() code a bit.
This commit is contained in:
cib
2012-05-27 18:41:27 +02:00
parent 479563cb28
commit 0799cddb4b
46 changed files with 144 additions and 182 deletions
+2 -5
View File
@@ -863,8 +863,7 @@
return
src.admin_invis =! src.admin_invis
if(src.mob)
var/mob/m = src.mob//probably don't need this cast, but I'm too lazy to check if /client.mob is of type /mob or not
m.update_clothing()
mob.rebuild_appearance()
log_admin("[key_name(usr)] has turned their invisibility [src.admin_invis ? "ON" : "OFF"]")
message_admins("[key_name_admin(usr)] has turned their invisibility [src.admin_invis ? "ON" : "OFF"]", 1)
@@ -971,9 +970,7 @@
M.gender = MALE
else
M.gender = FEMALE
M.update_body()
M.update_face()
M.update_clothing()
M.rebuild_appearance()
M.check_dna(M)
+1
View File
@@ -1583,6 +1583,7 @@
del(src)
spawn(5)
user.update_clothing()
playsound(M.loc,'eatfood.ogg', rand(10,50), 1)
return 1
else if(istype(M, /mob/living/simple_animal/livestock))
@@ -13,7 +13,7 @@
src.resting_icon = new /icon('alien.dmi', "aliend_sleep")
src.running_icon = new /icon('alien.dmi', "aliend_running")
src.icon = src.stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
//Drones use the same base as generic humanoids.
@@ -12,7 +12,7 @@
src.resting_icon = new /icon('alien.dmi', "alienh_sleep")
src.running_icon = new /icon('alien.dmi', "alienh_running")
src.icon = src.stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
@@ -12,7 +12,7 @@
src.resting_icon = new /icon('alien.dmi', "aliens_sleep")
src.running_icon = new /icon('alien.dmi', "aliens_running")
src.icon = src.stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
@@ -13,7 +13,7 @@
resting_icon = new /icon('alien.dmi', "alienh_sleep")
running_icon = new /icon('alien.dmi', "alienh_running")
icon = stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
..()
@@ -1,7 +1,7 @@
/mob/living/carbon/alien/humanoid/Login()
..()
update_clothing()
rebuild_appearance()
if (!isturf(src.loc))
src.client.eye = src.loc
@@ -15,7 +15,7 @@
src.resting_icon = new /icon('alien.dmi', "queen_sleep")
src.running_icon = new /icon('alien.dmi', "queen_running")
src.icon = src.stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
@@ -7,7 +7,7 @@
name = text("alien larva ([rand(1, 1000)])")
real_name = name
spawn (1)
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
// spawn(1200) grow() Grow after 120 seconds -- TLE Commented out because life.dm has better version -- Urist
..()
@@ -1,7 +1,7 @@
/mob/living/carbon/alien/larva/Login()
..()
update_clothing()
rebuild_appearance()
if (!isturf(src.loc))
src.client.eye = src.loc
@@ -25,7 +25,7 @@
remove_special_verbs()
update_clothing()
rebuild_appearance()
death(gibbed)
..()
+8 -69
View File
@@ -133,14 +133,13 @@
stand_icon = new /icon('human.dmi', "body_[g]_s")
lying_icon = new /icon('human.dmi', "body_[g]_l")
icon = stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
spawn(10) // Failsafe for.. weirdness.
update_clothing()
update_body()
rebuild_appearance()
vessel = new/datum/reagents(600)
vessel.my_atom = src
@@ -151,8 +150,7 @@
..()
spawn(5) // Failsafe for.. weirdness.
update_clothing()
update_body()
rebuild_appearance()
/*var/known_languages = list()
known_languages.Add("english")*/
@@ -918,6 +916,10 @@
body_overlays_lying += body_lying
body_overlays_standing += body_standing
// face_lying and face_standing are the face icons, not a flag
body_overlays_lying += face_standing // yes, the vars are named wrong, I didn't do it -- CIB
body_overlays_standing += face_lying
/mob/living/carbon/human/proc/rebuild_clothing_overlays()
@@ -1158,58 +1160,6 @@
last_b_state = stat
/mob/living/carbon/human/proc/handle_clothing()
// Non-visual stuff that was in update_clothing()
if(buckled)
if(istype(buckled, /obj/structure/stool/bed/chair))
lying = 0
else
lying = 1
if(!w_uniform)
// Automatically drop anything in store / id / belt if you're not wearing a uniform.
for (var/obj/item/thing in list(r_store, l_store, wear_id, belt))
if (thing)
u_equip(thing)
if (client)
client.screen -= thing
if (thing)
thing.loc = loc
thing.dropped(src)
thing.layer = initial(thing.layer)
// Why this stuff was in handle_clothing() is beyond me
var/shielded = 0
for (var/obj/item/weapon/cloaking_device/S in src)
if (S.active)
shielded = 2
break
if(istype(wear_suit, /obj/item/clothing/suit/space/space_ninja)&&wear_suit:s_active)
shielded = 3
switch(shielded)
if(1)
if(2)
invisibility = 2
//New stealth. Hopefully doesn't lag too much. /N
if(istype(loc, /turf))//If they are standing on a turf.
AddCamoOverlay(loc)//Overlay camo.
if(3)
if(istype(loc, /turf))
//Ninjas may flick into view once in a while if they are stealthed.
if(prob(90))
NinjaStealthActive(loc)
else
NinjaStealthMalf()
else
invisibility = 0
// WHY IS THIS IN UPDATE_CLOTHING?!?!
name = get_visible_name()
/mob/living/carbon/human/proc/misc_clothing_updates()
// Temporary proc to shove stuff in that was put into update_clothing()
// for questionable reasons
@@ -1268,20 +1218,11 @@
icon = lying_icon
overlays += body_overlays_standing
// What is this for?
if (face_lying)
overlays += face_lying
if(!lying)
icon = stand_icon
overlays += body_overlays_lying
// What is this for?
if (face_standing)
overlays += face_standing
overlays += clothing_overlays
@@ -2739,9 +2680,7 @@ It can still be worn/put on as normal.
gender = MALE
else
gender = FEMALE
update_body()
update_face()
update_clothing()
rebuild_appearance()
check_dna()
for(var/mob/M in view())
@@ -70,5 +70,4 @@
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>[] has tried to disarm []!</B>", M, src), 1)
update_clothing()
return
@@ -211,7 +211,6 @@
playsound(loc, 'punchmiss.ogg', 25, 1, -1)
visible_message("\red <B>[M] attempted to disarm [src]!</B>")
update_clothing()
return
/mob/living/carbon/human/proc/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, inrange, params)
@@ -20,5 +20,4 @@
src = null
src = H.monkeyize()
contract_disease(D,1,0)
update_clothing()
return
@@ -68,5 +68,4 @@
UpdateDamageIcon()
updatehealth()
update_clothing()
return 1
@@ -197,5 +197,4 @@ emp_act
if(src.wear_suit) src.wear_suit.add_blood(src)
if(src.w_uniform) src.w_uniform.add_blood(src)
UpdateDamageIcon()
update_clothing()
UpdateDamageIcon()
+57 -7
View File
@@ -29,18 +29,18 @@
//Being buckled to a chair or bed
check_if_buckled()
handle_clothing()
// Update clothing
// update_clothing()
// TODO: this check and the lyingcheck variable should probably be removed in favor of the visual_lying check
if((lyingcheck != lying) || (buckle_check != (buckled ? 1 : 0))) //This is a fix for falling down / standing up not updating icons. Instead of going through and changing every
spawn(5)
update_clothing() //instance in the code where lying is modified, I've just added a new variable "lyingcheck" which will be compared
update_lying() //instance in the code where lying is modified, I've just added a new variable "lyingcheck" which will be compared
lyingcheck = lying //to lying, so if lying ever changes, update_clothing() will run like normal.
if(stat == 2)
if((!lying || !lyingcheck) && !buckled)
if(!lying && !buckled)
lying = 1
update_clothing()
update_lying()
return
life_tick++
@@ -137,7 +137,7 @@
if (stat != 0)
if(!lying)
lying = 1 //Seriously, stay down :x
update_clothing()
update_lying()
@@ -1489,4 +1489,54 @@
else if(shock_stage == 40)
src << "<font color='red'><b>"+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")
else if(shock_stage == 80)
src << "<font color='red'><b>"+pick("You see a light at the end of the tunnel!", "You feel like you could die any moment now.", "You're about to lose consciousness.")
src << "<font color='red'><b>"+pick("You see a light at the end of the tunnel!", "You feel like you could die any moment now.", "You're about to lose consciousness.")
/mob/living/carbon/human/proc/handle_clothing()
// Non-visual stuff that was in update_clothing()
if(buckled)
if(istype(buckled, /obj/structure/stool/bed/chair))
lying = 0
else
lying = 1
if(!w_uniform)
// Automatically drop anything in store / id / belt if you're not wearing a uniform.
for (var/obj/item/thing in list(r_store, l_store, wear_id, belt))
if (thing)
u_equip(thing)
if (client)
client.screen -= thing
if (thing)
thing.loc = loc
thing.dropped(src)
thing.layer = initial(thing.layer)
// Why this stuff was in handle_clothing() is beyond me
var/shielded = 0
for (var/obj/item/weapon/cloaking_device/S in src)
if (S.active)
shielded = 2
break
if(istype(wear_suit, /obj/item/clothing/suit/space/space_ninja)&&wear_suit:s_active)
shielded = 3
switch(shielded)
if(1)
if(2)
invisibility = 2
//New stealth. Hopefully doesn't lag too much. /N
if(istype(loc, /turf))//If they are standing on a turf.
AddCamoOverlay(loc)//Overlay camo.
if(3)
if(istype(loc, /turf))
//Ninjas may flick into view once in a while if they are stealthed.
if(prob(90))
NinjaStealthActive(loc)
else
NinjaStealthMalf()
else
invisibility = 0
name = get_visible_name()
@@ -1,7 +1,7 @@
/mob/living/carbon/human/Login()
..()
update_clothing()
rebuild_appearance()
if (!isturf(src.loc))
src.client.eye = src.loc
@@ -1,7 +1,7 @@
/mob/living/carbon/metroid/Login()
..()
update_clothing()
rebuild_appearance()
if (!isturf(src.loc))
src.client.eye = src.loc
@@ -9,7 +9,7 @@
real_name = name
spawn (1)
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
..()
@@ -1,7 +1,7 @@
/mob/living/carbon/monkey/Login()
..()
update_clothing()
rebuild_appearance()
/*
if (!( src.primary ))
var/t1 = rand(1000, 1500)
@@ -69,7 +69,7 @@
if(!lying_icon)
lying_icon = new /icon('monkey.dmi', "monkey0")
icon = stand_icon
update_clothing()
rebuild_appearance()
src << "\blue Your icons have been generated!"
..()
@@ -928,7 +928,6 @@
UpdateDamageIcon()
updatehealth()
update_clothing()
return 1
/*/mob/living/carbon/monkey/UpdateDamageIcon()
-16
View File
@@ -29,22 +29,6 @@
src.health = 100
src.stat = 0
/mob/living/proc/rebuild_appearance()
// Rebuild the entire mob appearance completely, this should ONLY be called in rare cases,
// e.g. when the mob spawns.
/mob/living/proc/update_body_appearance()
// Call this proc whenever something about the appearance of the body itself changes.
// For example, this must be called when you add a wound to a mob.
/mob/living/proc/update_lying()
// Call this whenever the lying status of a mob changes.
/mob/living/update_clothing()
// Call this proc whenever something about the clothing of a mob changes. Normally, you
// don't need to call this by hand, as the equip procs will do it for you.
..()
//sort of a legacy burn method for /electrocute, /shock, and the e_chair
/mob/living/proc/burn_skin(burn_amount, used_weapon = null)
-1
View File
@@ -498,7 +498,6 @@ mob/living/parasite/meme/verb/Analgesic()
mob/proc/clearHUD()
update_clothing()
if(client) client.screen.Cut()
// Take control of the mob
+1 -1
View File
@@ -1,6 +1,6 @@
/mob/living/silicon/ai/Login()
..()
update_clothing()
rebuild_appearance()
for(var/S in src.client.screen)
del(S)
src.flash = new /obj/screen( null )
@@ -1,7 +1,7 @@
/mob/living/silicon/robot/Login()
..()
update_clothing()
rebuild_appearance()
if (!isturf(src.loc))
src.client.eye = src.loc
+23 -4
View File
@@ -177,9 +177,6 @@
item.loc = null
item.layer = initial(item.layer)
u_equip(item)
//if (client)
// client.screen -= item
//update_clothing()
return
/mob/proc/get_active_hand()
@@ -1151,4 +1148,26 @@ note dizziness decrements automatically in the mob's Life() proc.
for(var/file in args)
src << browse_rsc(file)
return 1
return 0
return 0
/** The stuff below here really should be in /mob/living, but due to tons of procs that should only
take /mob/living only taking /mob(or, indeed, some silly procs relying on usr.. yes, *procs*, not verbs..),
I'm putting this stuff into /mob for now
**/
/mob/proc/rebuild_appearance()
// Rebuild the entire mob appearance completely, this should ONLY be called in rare cases,
// e.g. when the mob spawns.
return update_clothing() // most mobs still implement update_clothing() by simply rebuilding the entire appearance
/mob/proc/update_body_appearance()
// Call this proc whenever something about the appearance of the body itself changes.
// For example, this must be called when you add a wound to a mob.
/mob/proc/update_lying()
// Call this whenever the lying status of a mob changes.
/mob/update_clothing()
// Call this proc whenever something about the clothing of a mob changes. Normally, you
// don't need to call this by hand, as the equip procs will do it for you.
..()
+5 -2
View File
@@ -235,7 +235,8 @@
var/datum/autopsy_data/W = autopsy_data[V]
del W
autopsy_data = list()
return update_icon()
var/result = update_icon()
return result
proc/add_wound(var/used_weapon, var/damage)
var/datum/autopsy_data/W = autopsy_data[used_weapon]
@@ -248,6 +249,7 @@
W.damage += damage
W.time_inflicted = world.time
owner.update_body_appearance()
proc/get_damage() //returns total damage
@@ -314,6 +316,7 @@
var/n_is = damage_state_text()
if (n_is != damage_state)
damage_state = n_is
owner.update_body_appearance() // I'm not sure about this, Sky probably knows better where to put it
return 1
return 0
@@ -412,7 +415,7 @@
for(var/datum/organ/wound/W in wounds)
W.update_health()
del(W)
owner.update_body()
owner.update_body_appearance()
owner.update_clothing()
proc/createwound(var/size = 1, var/type = 0, var/damage)
+1 -2
View File
@@ -47,7 +47,7 @@
/mob/living/simple_animal/corgi/Life()
..()
update_clothing()
rebuild_appearance()
/mob/living/simple_animal/corgi/show_inv(mob/user as mob)
/*
@@ -182,7 +182,6 @@
usr.drop_item()
item_to_add.loc = src
src.inventory_head = item_to_add
update_clothing()
//Various hats and items (worn on his head) change Ian's behaviour. His attributes are reset when a HAT is removed.
+7 -7
View File
@@ -5,7 +5,7 @@
if (W==w_uniform) // will be teared
continue
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
stunned = 1
@@ -69,7 +69,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
@@ -156,7 +156,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
@@ -222,7 +222,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
@@ -262,7 +262,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
@@ -313,7 +313,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
@@ -347,7 +347,7 @@
return
for(var/obj/item/W in src)
drop_from_slot(W)
update_clothing()
rebuild_appearance()
monkeyizing = 1
canmove = 0
icon = null
+1 -1
View File
@@ -385,7 +385,7 @@ mob/proc
spawn(0) //Make it show the 2 states properly
if(target_locked)
target_locked.icon_state = "locking"
update_clothing()
update_clothing() // update_clothing clears overlays, so this might break stuff
sleep(20)
if(target_locked)
target_locked.icon_state = "locked"
@@ -29,23 +29,22 @@
if("monkey")
if (M.monkeyizing)
return
if(istype(M,/mob/carbon/living/human))
if(istype(M,/mob/living/carbon/human))
M:monkeyize()
if("robot")
if (M.monkeyizing)
return
if(istype(M,/mob/carbon/living/human))
if(istype(M,/mob/living/carbon/human))
M:Robotize()
if("metroid")
if (M.monkeyizing)
return
if(istype(M,/mob/carbon/living/human))
if(istype(M,/mob/living/carbon/human))
M:Metroidize()
if("alien")
if (M.monkeyizing)
return
Alienize
if(istype(M,/mob/carbon/living/human))
if(istype(M,/mob/living/carbon/human))
M:Alienize()
if("human")
if (M.monkeyizing)