Minor refactors/fixes (#4589)

changes:

Underwear has been promoted to a human layer; this might fix some potential issues with human icon caching.
turf/Entered() code has been cleaned up and proximity checks have been timerized.
Fixed an issue where openspaces wouldn't render objects that entered an openspace after init.
Shortened organ keymap prefix as it didn't really need to be that long.
This commit is contained in:
Lohikar
2018-04-15 22:13:24 +03:00
committed by Erki
parent 7279e608ea
commit 9c33cc2e09
8 changed files with 134 additions and 101 deletions
+1
View File
@@ -387,6 +387,7 @@ datum/preferences
character.update_mutations(0)
character.update_body(0)
character.update_hair(0)
character.update_underwear(0)
character.update_icons()
/datum/preferences/proc/open_load_dialog_sql(mob/user)
@@ -87,28 +87,29 @@ There are several things that need to be remembered:
#define MUTATIONS_LAYER 1
#define DAMAGE_LAYER 2
#define SURGERY_LAYER 3
#define UNIFORM_LAYER 4
#define ID_LAYER 5
#define SHOES_LAYER 6
#define GLOVES_LAYER 7
#define BELT_LAYER 8
#define SUIT_LAYER 9
#define TAIL_LAYER 10
#define GLASSES_LAYER 11
#define BELT_LAYER_ALT 12
#define SUIT_STORE_LAYER 13
#define BACK_LAYER 14
#define HAIR_LAYER 15
#define EARS_LAYER 16
#define FACEMASK_LAYER 17
#define HEAD_LAYER 18
#define COLLAR_LAYER 19
#define HANDCUFF_LAYER 20
#define LEGCUFF_LAYER 21
#define L_HAND_LAYER 22
#define R_HAND_LAYER 23
#define FIRE_LAYER 24 //If you're on fire
#define TOTAL_LAYERS 24
#define UNDERWEAR_LAYER 4
#define UNIFORM_LAYER 5
#define ID_LAYER 6
#define SHOES_LAYER 7
#define GLOVES_LAYER 8
#define BELT_LAYER 9
#define SUIT_LAYER 10
#define TAIL_LAYER 11
#define GLASSES_LAYER 12
#define BELT_LAYER_ALT 13
#define SUIT_STORE_LAYER 14
#define BACK_LAYER 15
#define HAIR_LAYER 16
#define EARS_LAYER 17
#define FACEMASK_LAYER 18
#define HEAD_LAYER 19
#define COLLAR_LAYER 20
#define HANDCUFF_LAYER 21
#define LEGCUFF_LAYER 22
#define L_HAND_LAYER 23
#define R_HAND_LAYER 24
#define FIRE_LAYER 25 //If you're on fire
#define TOTAL_LAYERS 25
//////////////////////////////////
#define UNDERSCORE_OR_NULL(target) "[target ? "[target]_" : ""]"
@@ -261,17 +262,17 @@ There are several things that need to be remembered:
//And no change in rendering for other parts (they icon_position is 0, so goes to 'else' part)
if(part.icon_position&(LEFT|RIGHT))
var/icon/temp2 = new('icons/mob/human.dmi',"blank")
temp2.Insert(new/icon(temp,dir=NORTH),dir=NORTH)
temp2.Insert(new/icon(temp,dir=SOUTH),dir=SOUTH)
temp2.Insert(new /icon(temp ,dir = NORTH), dir = NORTH)
temp2.Insert(new /icon(temp, dir = SOUTH), dir = SOUTH)
if(!(part.icon_position & LEFT))
temp2.Insert(new/icon(temp,dir=EAST),dir=EAST)
temp2.Insert(new /icon(temp, dir = EAST), dir = EAST)
if(!(part.icon_position & RIGHT))
temp2.Insert(new/icon(temp,dir=WEST),dir=WEST)
temp2.Insert(new /icon(temp, dir = WEST), dir = WEST)
base_icon.Blend(temp2, ICON_OVERLAY)
if(part.icon_position & LEFT)
temp2.Insert(new/icon(temp,dir=EAST),dir=EAST)
temp2.Insert(new /icon(temp, dir = EAST), dir = EAST)
if(part.icon_position & RIGHT)
temp2.Insert(new/icon(temp,dir=WEST),dir=WEST)
temp2.Insert(new /icon(temp, dir = WEST), dir = WEST)
base_icon.Blend(temp2, ICON_UNDERLAY)
else
base_icon.Blend(temp, ICON_OVERLAY)
@@ -296,37 +297,29 @@ There are several things that need to be remembered:
//END CACHED ICON GENERATION.
stand_icon.Blend(base_icon,ICON_OVERLAY)
//Underwear
if(underwear && species.appearance_flags & HAS_UNDERWEAR)
var/uwear = "[underwear]"
var/icon/undies = SSicon_cache.human_underwear_cache[uwear]
if (!undies)
undies = new('icons/mob/human.dmi', underwear)
SSicon_cache.human_underwear_cache[uwear] = undies
stand_icon.Blend(undies, ICON_OVERLAY)
if(undershirt && species.appearance_flags & HAS_UNDERWEAR)
var/ushirt = "[undershirt]"
var/icon/shirt = SSicon_cache.human_undershirt_cache[ushirt]
if (!shirt)
shirt = new('icons/mob/human.dmi', undershirt)
SSicon_cache.human_undershirt_cache[ushirt] = shirt
stand_icon.Blend(shirt, ICON_OVERLAY)
if(socks && species.appearance_flags & HAS_SOCKS)
var/sockskey = "[socks]"
var/icon/socksicon = SSicon_cache.human_socks_cache[sockskey]
if (!socksicon)
socksicon = new('icons/mob/human.dmi', socks)
SSicon_cache.human_socks_cache[sockskey] = socksicon
stand_icon.Blend(socksicon, ICON_OVERLAY)
if(update_icons)
update_icons()
//tail
update_tail_showing(0)
/mob/living/carbon/human/proc/update_underwear(update_icons = TRUE)
var/list/ovr
if(underwear && (species.appearance_flags & HAS_UNDERWEAR))
LAZYADD(ovr, SSicon_cache.get_state('icons/mob/human.dmi', "[underwear]"))
if(undershirt && (species.appearance_flags & HAS_UNDERWEAR))
LAZYADD(ovr, SSicon_cache.get_state('icons/mob/human.dmi', "[undershirt]"))
if(socks && (species.appearance_flags & HAS_SOCKS))
LAZYADD(ovr, SSicon_cache.get_state('icons/mob/human.dmi', "[socks]"))
overlays_raw[UNDERWEAR_LAYER] = ovr
if (update_icons)
update_icons()
// This proc generates & returns an icon representing a human's hair, using a cached icon from SSicon_cache if possible.
// If `hair_is_visible` is FALSE, only facial hair will be drawn.
/mob/living/carbon/human/proc/generate_hair_icon(hair_is_visible = TRUE)
@@ -451,30 +444,33 @@ There are several things that need to be remembered:
return
..()
if(transforming) return
update_mutations(0)
update_body(0)
update_hair(0)
update_inv_w_uniform(0)
update_inv_wear_id(0)
update_inv_gloves(0)
update_inv_glasses(0)
update_inv_ears(0)
update_inv_shoes(0)
update_inv_s_store(0)
update_inv_wear_mask(0)
update_inv_head(0)
update_inv_belt(0)
update_inv_back(0)
update_inv_wear_suit(0)
update_inv_r_hand(0)
update_inv_l_hand(0)
update_inv_handcuffed(0)
update_inv_legcuffed(0)
update_inv_pockets(0)
update_fire(0)
update_surgery(0)
if(transforming)
return
update_mutations(FALSE)
update_body(FALSE)
update_hair(FALSE)
update_inv_w_uniform(FALSE)
update_inv_wear_id(FALSE)
update_inv_gloves(FALSE)
update_inv_glasses(FALSE)
update_inv_ears(FALSE)
update_inv_shoes(FALSE)
update_inv_s_store(FALSE)
update_inv_wear_mask(FALSE)
update_inv_head(FALSE)
update_inv_belt(FALSE)
update_inv_back(FALSE)
update_inv_wear_suit(FALSE)
update_inv_r_hand(FALSE)
update_inv_l_hand(FALSE)
update_inv_handcuffed(FALSE)
update_inv_legcuffed(FALSE)
update_inv_pockets(FALSE)
update_fire(FALSE)
update_surgery(FALSE)
update_underwear(FALSE)
UpdateDamageIcon()
update_icons()
//Hud Stuff
+1 -1
View File
@@ -7,7 +7,7 @@
/turf/Entered(atom/movable/thing, turf/oldLoc)
. = ..()
if (thing.bound_overlay || !thing.no_z_overlay || !above || !(above.flags & MIMIC_BELOW) || (isturf(oldLoc) && oldLoc.above && (oldLoc.above.flags & MIMIC_BELOW)))
if (thing.bound_overlay || thing.no_z_overlay || !TURF_IS_MIMICING(above))
return
above.update_mimic()