Merge pull request #10659 from phil235/HandcuffOverlayFix

Handcuff, fire, overlays_standing fixes
This commit is contained in:
Jordie
2015-07-23 22:21:52 +10:00
27 changed files with 345 additions and 497 deletions
+5 -5
View File
@@ -259,7 +259,7 @@ BLIND // can't see anything
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
return 1
@@ -390,7 +390,7 @@ atom/proc/generate_female_clothing(index,t_color,icon,type)
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
/obj/item/clothing/proc/weldingvisortoggle() //Malk: proc to toggle welding visors on helmets, masks, goggles, etc.
if(can_use(usr))
@@ -414,11 +414,11 @@ atom/proc/generate_female_clothing(index,t_color,icon,type)
tint = 0
if(istype(src, /obj/item/clothing/head)) //makes the mob-overlays update
usr.update_inv_head(0)
usr.update_inv_head()
if(istype(src, /obj/item/clothing/glasses))
usr.update_inv_glasses(0)
usr.update_inv_glasses()
if(istype(src, /obj/item/clothing/mask))
usr.update_inv_wear_mask(0)
usr.update_inv_wear_mask()
/obj/item/clothing/proc/can_use(mob/user)
if(user && ismob(user))
+4 -4
View File
@@ -58,14 +58,14 @@
flags_inv |= (visor_flags_inv)
icon_state = initial(icon_state)
usr << "[toggle_message] \the [src]."
usr.update_inv_head(0)
usr.update_inv_head()
else
up = !up
flags &= ~(visor_flags)
flags_inv &= ~(visor_flags_inv)
icon_state = "[initial(icon_state)]up"
usr << "[alt_toggle_message] \the [src]"
usr.update_inv_head(0)
usr.update_inv_head()
if(active_sound)
while(up)
playsound(src.loc, "[active_sound]", 100, 0, 4)
@@ -180,7 +180,7 @@
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
H.update_inv_head(0)
H.update_inv_head()
return
@@ -214,7 +214,7 @@
update_helmlight(user)
S.update_brightness(user)
update_icon()
usr.update_inv_head(0)
usr.update_inv_head()
verbs -= /obj/item/clothing/head/helmet/proc/toggle_helmlight
return
+1 -1
View File
@@ -38,7 +38,7 @@
else
icon_state = "[item_color]soft"
user << "<span class='notice'>You flip the hat back in normal position.</span>"
usr.update_inv_head(0) //so our mob-overlays update
usr.update_inv_head() //so our mob-overlays update
/obj/item/clothing/head/soft/examine(mob/user)
..()
+1 -1
View File
@@ -29,7 +29,7 @@
magpulse = !magpulse
icon_state = "[magboot_state][magpulse]"
user << "<span class='notice'>You [magpulse ? "enable" : "disable"] the mag-pulse traction system.</span>"
user.update_inv_shoes(0) //so our mob-overlays update
user.update_inv_shoes() //so our mob-overlays update
user.update_gravity(user.mob_has_gravity())
/obj/item/clothing/shoes/magboots/negates_gravity()
+2 -2
View File
@@ -30,7 +30,7 @@
W.equipped(src,slot_l_hand)
if(client) client.screen |= W
if(pulling == W) stop_pulling()
update_inv_l_hand(0)
update_inv_l_hand()
W.pixel_x = initial(W.pixel_x)
W.pixel_y = initial(W.pixel_y)
return 1
@@ -49,7 +49,7 @@
W.equipped(src,slot_r_hand)
if(client) client.screen |= W
if(pulling == W) stop_pulling()
update_inv_r_hand(0)
update_inv_r_hand()
W.pixel_x = initial(W.pixel_x)
W.pixel_y = initial(W.pixel_y)
return 1
@@ -1,12 +1,3 @@
//Xeno Overlays Indexes//////////
#define X_L_HAND_LAYER 1
#define X_R_HAND_LAYER 2
#define X_FIRE_LAYER 3
#define X_TOTAL_LAYERS 3
/////////////////////////////////
/mob/living/carbon/alien/humanoid
var/list/overlays_standing[X_TOTAL_LAYERS]
/mob/living/carbon/alien/humanoid/update_icons()
update_hud() //TODO: remove the need for this to be here
@@ -50,15 +41,10 @@
pixel_y = get_standard_pixel_y_offset(lying)
/mob/living/carbon/alien/humanoid/regenerate_icons()
..()
if (notransform) return
update_inv_r_hand(0)
update_inv_l_hand(0)
update_hud()
// update_icons() //Handled in update_transform(), leaving this here as a reminder
update_fire()
update_transform()
if(!..())
update_hud()
// update_icons() //Handled in update_transform(), leaving this here as a reminder
update_transform()
/mob/living/carbon/alien/humanoid/update_transform() //The old method of updating lying/standing was update_icons(). Aliens still expect that.
if(lying > 0)
@@ -67,47 +53,12 @@
update_icons()
/mob/living/carbon/alien/humanoid/update_hud()
if(client)
client.screen |= contents
/mob/living/carbon/alien/humanoid/update_inv_r_hand(update_icons = 1)
if(r_hand)
var/t_state = r_hand.item_state
if(!t_state)
t_state = r_hand.icon_state
r_hand.screen_loc = ui_rhand
overlays_standing[X_R_HAND_LAYER] = image("icon" = r_hand.righthand_file, "icon_state" = t_state)
else
overlays_standing[X_R_HAND_LAYER] = null
if(update_icons)
update_icons()
/mob/living/carbon/alien/humanoid/update_inv_l_hand(update_icons = 1)
if(l_hand)
var/t_state = l_hand.item_state
if(!t_state)
t_state = l_hand.icon_state
l_hand.screen_loc = ui_lhand
overlays_standing[X_L_HAND_LAYER] = image("icon" = l_hand.lefthand_file, "icon_state" = t_state)
else
overlays_standing[X_L_HAND_LAYER] = null
if(update_icons)
update_icons()
/mob/living/carbon/alien/humanoid/update_fire()
overlays -= overlays_standing[X_FIRE_LAYER]
if(on_fire)
overlays_standing[X_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -X_FIRE_LAYER)
overlays += overlays_standing[X_FIRE_LAYER]
return
else
overlays_standing[X_FIRE_LAYER] = null
//Xeno Overlays Indexes//////////
#undef X_L_HAND_LAYER
#undef X_R_HAND_LAYER
#undef X_FIRE_LAYER
#undef X_TOTAL_LAYERS
#undef FACEMASK_LAYER
#undef HEAD_LAYER
#undef BACK_LAYER
#undef LEGCUFF_LAYER
#undef HANDCUFF_LAYER
#undef L_HAND_LAYER
#undef R_HAND_LAYER
#undef FIRE_LAYER
#undef TOTAL_LAYERS
@@ -22,4 +22,7 @@
icon_state = "larva[state]"
/mob/living/carbon/alien/larva/update_transform() //All this is handled in update_icons()
return update_icons()
return update_icons()
/mob/living/carbon/larva/update_inv_handcuffed()
return
+6 -6
View File
@@ -433,13 +433,13 @@ var/const/GALOSHES_DONT_HELP = 8
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob()
update_inv_handcuffed(0)
update_inv_handcuffed()
return
if(legcuffed)
legcuffed.loc = loc
legcuffed.dropped()
legcuffed = null
update_inv_legcuffed(0)
update_inv_legcuffed()
else
src << "<span class='warning'>You fail to remove [I]!</span>"
@@ -456,11 +456,11 @@ var/const/GALOSHES_DONT_HELP = 8
if(handcuffed)
handcuffed = null
update_inv_handcuffed(0)
update_inv_handcuffed()
return
else
legcuffed = null
update_inv_legcuffed(0)
update_inv_legcuffed()
else
src << "<span class='warning'>You fail to break [I]!</span>"
@@ -470,7 +470,7 @@ var/const/GALOSHES_DONT_HELP = 8
handcuffed = null
if (buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob()
update_inv_handcuffed(0)
update_inv_handcuffed()
if (client)
client.screen -= W
if (W)
@@ -481,7 +481,7 @@ var/const/GALOSHES_DONT_HELP = 8
if (legcuffed)
var/obj/item/weapon/W = legcuffed
legcuffed = null
update_inv_legcuffed(0)
update_inv_legcuffed()
if (client)
client.screen -= W
if (W)
@@ -791,11 +791,11 @@
var/mob/living/carbon/human/H = src
if(H.gloves)
if(H.gloves.clean_blood())
H.update_inv_gloves(0)
H.update_inv_gloves()
else
..() // Clear the Blood_DNA list
if(H.bloody_hands)
H.bloody_hands = 0
H.bloody_hands_mob = null
H.update_inv_gloves(0)
H.update_inv_gloves()
update_icons() //apply the now updated overlays to the mob
@@ -170,10 +170,10 @@ emp_act
if(get_dist(H, src) <= 1) //people with TK won't get smeared with blood
if(H.wear_suit)
H.wear_suit.add_blood(src)
H.update_inv_wear_suit(0) //updates mob overlays to show the new blood (no refresh)
H.update_inv_wear_suit() //updates mob overlays to show the new blood (no refresh)
else if(H.w_uniform)
H.w_uniform.add_blood(src)
H.update_inv_w_uniform(0) //updates mob overlays to show the new blood (no refresh)
H.update_inv_w_uniform() //updates mob overlays to show the new blood (no refresh)
if (H.gloves)
var/obj/item/clothing/gloves/G = H.gloves
G.add_blood(H)
@@ -194,13 +194,13 @@ emp_act
if(bloody) //Apply blood
if(wear_mask)
wear_mask.add_blood(src)
update_inv_wear_mask(0)
update_inv_wear_mask()
if(head)
head.add_blood(src)
update_inv_head(0)
update_inv_head()
if(glasses && prob(33))
glasses.add_blood(src)
update_inv_glasses(0)
update_inv_glasses()
if("chest") //Easier to score a stun but lasts less time
if(stat == CONSCIOUS && I.force && prob(I.force + 10))
@@ -211,10 +211,10 @@ emp_act
if(bloody)
if(wear_suit)
wear_suit.add_blood(src)
update_inv_wear_suit(0)
update_inv_wear_suit()
if(w_uniform)
w_uniform.add_blood(src)
update_inv_w_uniform(0)
update_inv_w_uniform()
if(Iforce > 10 || Iforce >= 5 && prob(33))
forcesay(hit_appends) //forcesay checks stat already
@@ -167,9 +167,9 @@
return
if(H.equip_to_appropriate_slot(I))
if(hand)
update_inv_l_hand(0)
update_inv_l_hand()
else
update_inv_r_hand(0)
update_inv_r_hand()
else if(s_active && s_active.can_be_inserted(I,1)) //if storage active insert there
s_active.handle_item_insertion(I)
else if(istype(S, /obj/item/weapon/storage) && S.can_be_inserted(I,1)) //see if we have box in other hand
@@ -250,7 +250,7 @@
wear_suit = null
if(I.flags_inv & HIDEJUMPSUIT)
update_inv_w_uniform()
update_inv_wear_suit(0)
update_inv_wear_suit()
else if(I == w_uniform)
if(r_store)
unEquip(r_store, 1) //Again, makes sense for pockets to drop.
@@ -262,45 +262,45 @@
unEquip(belt)
w_uniform = null
update_suit_sensors()
update_inv_w_uniform(0)
update_inv_w_uniform()
else if(I == gloves)
gloves = null
update_inv_gloves(0)
update_inv_gloves()
else if(I == glasses)
glasses = null
update_inv_glasses(0)
update_inv_glasses()
else if(I == ears)
ears = null
update_inv_ears(0)
update_inv_ears()
else if(I == shoes)
shoes = null
update_inv_shoes(0)
update_inv_shoes()
else if(I == belt)
belt = null
update_inv_belt(0)
update_inv_belt()
else if(I == wear_mask)
wear_mask = null
if(I.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
update_hair() //rebuild hair
if(internal)
if(internals)
internals.icon_state = "internal0"
internal = null
sec_hud_set_ID()
update_inv_wear_mask(0)
update_inv_wear_mask()
else if(I == wear_id)
wear_id = null
sec_hud_set_ID()
update_inv_wear_id(0)
update_inv_wear_id()
else if(I == r_store)
r_store = null
update_inv_pockets(0)
update_inv_pockets()
else if(I == l_store)
l_store = null
update_inv_pockets(0)
update_inv_pockets()
else if(I == s_store)
s_store = null
update_inv_s_store(0)
update_inv_s_store()
//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.
+10 -10
View File
@@ -578,17 +578,17 @@
if(H.overeatduration < 100)
H << "<span class='notice'>You feel fit again!</span>"
H.disabilities &= ~FAT
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
H.update_inv_wear_suit()
else
if(H.overeatduration > 500)
H << "<span class='danger'>You suddenly feel blubbery!</span>"
H.disabilities |= FAT
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
H.update_inv_wear_suit()
// nutrition decrease and satiety
if (H.nutrition > 0 && H.stat != 2)
if (H.nutrition > 0 && H.stat != DEAD)
var/hunger_rate = HUNGER_FACTOR
if(H.satiety > 0)
H.satiety--
@@ -1016,10 +1016,10 @@
if(get_dist(H, H) <= 1) //people with TK won't get smeared with blood
if(H.wear_suit)
H.wear_suit.add_blood(H)
H.update_inv_wear_suit(0) //updates mob overlays to show the new blood (no refresh)
H.update_inv_wear_suit() //updates mob overlays to show the new blood (no refresh)
else if(H.w_uniform)
H.w_uniform.add_blood(H)
H.update_inv_w_uniform(0) //updates mob overlays to show the new blood (no refresh)
H.update_inv_w_uniform() //updates mob overlays to show the new blood (no refresh)
if (H.gloves)
var/obj/item/clothing/gloves/G = H.gloves
G.add_blood(H)
@@ -1042,13 +1042,13 @@
if(bloody) //Apply blood
if(H.wear_mask)
H.wear_mask.add_blood(H)
H.update_inv_wear_mask(0)
H.update_inv_wear_mask()
if(H.head)
H.head.add_blood(H)
H.update_inv_head(0)
H.update_inv_head()
if(H.glasses && prob(33))
H.glasses.add_blood(H)
H.update_inv_glasses(0)
H.update_inv_glasses()
if("chest") //Easier to score a stun but lasts less time
if(H.stat == CONSCIOUS && I.force && prob(I.force + 10))
@@ -1059,10 +1059,10 @@
if(bloody)
if(H.wear_suit)
H.wear_suit.add_blood(H)
H.update_inv_wear_suit(0)
H.update_inv_wear_suit()
if(H.w_uniform)
H.w_uniform.add_blood(H)
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
if(Iforce > 10 || Iforce >= 5 && prob(33))
H.forcesay(hit_appends) //forcesay checks stat already.
@@ -47,8 +47,7 @@ If you have any questions/constructive-comments/bugs-to-report
Please contact me on #coderbus IRC. ~Carnie x
//Carn can sometimes be hard to reach now. However IRC is still your best bet for getting help.
*/
//Human Overlays Indexes/////////
// Human Overlays Indexes /////////////////
#define SPECIES_LAYER 26 // mutantrace colors... these are on a seperate layer in order to prvent
#define BODY_BEHIND_LAYER 25
#define BODY_LAYER 24 //underwear, undershirts, socks, eyes, lips(makeup)
@@ -65,21 +64,11 @@ Please contact me on #coderbus IRC. ~Carnie x
#define GLASSES_LAYER 13
#define BELT_LAYER 12 //Possible make this an overlay of somethign required to wear a belt?
#define SUIT_STORE_LAYER 11
#define BACK_LAYER 10
#define HAIR_LAYER 9 //TODO: make part of head layer?
#define FACEMASK_LAYER 8
#define HEAD_LAYER 7
#define HANDCUFF_LAYER 6
#define LEGCUFF_LAYER 5
#define L_HAND_LAYER 4
#define R_HAND_LAYER 3 //Having the two hands seperate seems rather silly, merge them together? It'll allow for code to be reused on mobs with arbitarily many hands
#define BODY_FRONT_LAYER 2
#define FIRE_LAYER 1 //If you're on fire
#define TOTAL_LAYERS 26 //KEEP THIS UP-TO-DATE OR SHIT WILL BREAK ;_;
//////////////////////////////////
#define HAIR_LAYER 10 //TODO: make part of head layer?
#define BODY_FRONT_LAYER 9
/mob/living/carbon/human
var/list/overlays_standing[TOTAL_LAYERS]
//KEEP THE TOTAL_LAYER DEFINE UPDATED !
//////////////////////////////////////////
/mob/living/carbon/human/proc/update_base_icon_state()
//var/race = dna ? dna.mutantrace : null
@@ -94,17 +83,6 @@ Please contact me on #coderbus IRC. ~Carnie x
icon_state = "[base_icon_state]_s"
/mob/living/carbon/human/proc/apply_overlay(cache_index)
var/image/I = overlays_standing[cache_index]
if(I)
overlays += I
/mob/living/carbon/human/proc/remove_overlay(cache_index)
if(overlays_standing[cache_index])
overlays -= overlays_standing[cache_index]
overlays_standing[cache_index] = null
//UPDATES OVERLAYS FROM OVERLAYS_STANDING
//TODO: Remove all instances where this proc is called. It used to be the fastest way to swap between standing/lying.
/mob/living/carbon/human/update_icons()
@@ -174,12 +152,7 @@ Please contact me on #coderbus IRC. ~Carnie x
dna.species.handle_body(src)
/mob/living/carbon/human/update_fire()
remove_overlay(FIRE_LAYER)
if(on_fire)
overlays_standing[FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"=-FIRE_LAYER)
apply_overlay(FIRE_LAYER)
..("Standing")
/mob/living/carbon/human/proc/update_augments()
@@ -212,33 +185,28 @@ Please contact me on #coderbus IRC. ~Carnie x
/* --------------------------------------- */
//For legacy support.
/mob/living/carbon/human/regenerate_icons()
..()
if(notransform) return
update_body()
update_hair()
update_inv_w_uniform()
update_inv_wear_id()
update_inv_gloves()
update_inv_glasses()
update_inv_ears()
update_inv_shoes()
update_inv_s_store()
update_inv_wear_mask()
update_inv_head()
update_inv_belt()
update_inv_back()
update_inv_wear_suit()
update_inv_r_hand()
update_inv_l_hand()
update_inv_handcuffed()
update_inv_legcuffed()
update_inv_pockets()
update_fire()
update_transform()
//Hud Stuff
update_hud()
// Mutantrace colors
update_mutcolor()
if(!..())
update_body()
update_hair()
update_inv_w_uniform()
update_inv_wear_id()
update_inv_gloves()
update_inv_glasses()
update_inv_ears()
update_inv_shoes()
update_inv_s_store()
update_inv_wear_mask()
update_inv_head()
update_inv_belt()
update_inv_back()
update_inv_wear_suit()
update_inv_pockets()
update_transform()
//Hud Stuff
update_hud()
// Mutantrace colors
update_mutcolor()
/* --------------------------------------- */
//vvvvvv UPDATE_INV PROCS vvvvvv
@@ -414,27 +382,12 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_head()
remove_overlay(HEAD_LAYER)
if(head)
var/obj/item/H = ..()
if(H)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
head.screen_loc = ui_head //TODO //...draw the item in the inventory screen
client.screen += head //Either way, add the item to the HUD
var/image/standing
if(head.alternate_worn_icon)
standing = image("icon"=head.alternate_worn_icon, "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
if(!standing)
standing = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
standing.color = head.color // For now, this is here solely for kitty ears, but everything should do this eventually
standing.alpha = head.alpha
overlays_standing[HEAD_LAYER] = standing
if(head.blood_DNA)
standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="helmetblood")
H.screen_loc = ui_head //TODO //...draw the item in the inventory screen
client.screen += H //Either way, add the item to the HUD
apply_overlay(HEAD_LAYER)
@@ -491,6 +444,7 @@ Please contact me on #coderbus IRC. ~Carnie x
apply_overlay(SUIT_LAYER)
/mob/living/carbon/human/update_inv_pockets()
if(l_store)
l_store.screen_loc = ui_storage1 //TODO
@@ -503,125 +457,41 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_wear_mask()
remove_overlay(FACEMASK_LAYER)
if(istype(wear_mask, /obj/item/clothing/mask))
var/obj/item/clothing/mask/M = ..()
if(M)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
wear_mask.screen_loc = ui_mask //TODO //...draw the item in the inventory screen
client.screen += wear_mask //Either way, add the item to the HUD
var/image/standing
if(wear_mask.alternate_worn_icon)
standing = image("icon"=wear_mask.alternate_worn_icon, "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
if(!standing)
standing = image("icon"='icons/mob/mask.dmi', "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
overlays_standing[FACEMASK_LAYER] = standing
if(wear_mask.blood_DNA && !istype(wear_mask, /obj/item/clothing/mask/cigarette))
standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="maskblood")
M.screen_loc = ui_mask //TODO //...draw the item in the inventory screen
client.screen += M //Either way, add the item to the HUD
update_mutant_bodyparts()
apply_overlay(FACEMASK_LAYER)
/mob/living/carbon/human/update_inv_back()
remove_overlay(BACK_LAYER)
if(back)
back.screen_loc = ui_back
var/obj/item/B = ..()
if(B)
B.screen_loc = ui_back
if(client && hud_used && hud_used.hud_shown)
client.screen += back
var/image/standing
if(back.alternate_worn_icon)
standing = image("icon"=back.alternate_worn_icon, "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
if(!standing)
standing = image("icon"='icons/mob/back.dmi', "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
overlays_standing[BACK_LAYER] = standing
client.screen += B
apply_overlay(BACK_LAYER)
/mob/living/carbon/human/update_hud() //TODO: do away with this if possible
if(client)
client.screen |= contents
if(hud_used)
hud_used.hidden_inventory_update() //Updates the screenloc of the items on the 'other' inventory bar
/mob/living/carbon/human/update_inv_handcuffed()
remove_overlay(HANDCUFF_LAYER)
if(handcuffed)
drop_r_hand()
drop_l_hand()
stop_pulling() //TODO: should be handled elsewhere
if(hud_used) //hud handcuff icons
var/obj/screen/inventory/R = hud_used.adding[3]
var/obj/screen/inventory/L = hud_used.adding[4]
R.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="markus")
L.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="gabrielle")
overlays_standing[HANDCUFF_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="handcuff1", "layer"=-HANDCUFF_LAYER)
else
if(hud_used)
var/obj/screen/inventory/R = hud_used.adding[3]
var/obj/screen/inventory/L = hud_used.adding[4]
R.overlays = null
L.overlays = null
apply_overlay(HANDCUFF_LAYER)
if(..())
overlays_standing[HANDCUFF_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="handcuff1", "layer"=-HANDCUFF_LAYER)
apply_overlay(HANDCUFF_LAYER)
/mob/living/carbon/human/update_inv_legcuffed()
remove_overlay(LEGCUFF_LAYER)
if(legcuffed)
overlays_standing[LEGCUFF_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="legcuff1", "layer"=-LEGCUFF_LAYER)
overlays_standing[LEGCUFF_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="legcuff1", "layer"=-LEGCUFF_LAYER)
apply_overlay(LEGCUFF_LAYER)
/mob/living/carbon/human/update_hud() //TODO: do away with this if possible
if(..())
if(hud_used)
hud_used.hidden_inventory_update() //Updates the screenloc of the items on the 'other' inventory bar
/mob/living/carbon/human/update_inv_r_hand()
remove_overlay(R_HAND_LAYER)
if (handcuffed)
drop_r_hand()
return
if(r_hand)
r_hand.screen_loc = ui_rhand //TODO
if(client)
client.screen += r_hand
var/t_state = r_hand.item_state
if(!t_state) t_state = r_hand.icon_state
overlays_standing[R_HAND_LAYER] = image("icon" = r_hand.righthand_file, "icon_state"="[t_state]", "layer"=-R_HAND_LAYER)
apply_overlay(R_HAND_LAYER)
/mob/living/carbon/human/update_inv_l_hand()
remove_overlay(L_HAND_LAYER)
if (handcuffed)
drop_l_hand()
return
if(l_hand)
l_hand.screen_loc = ui_lhand //TODO
if(client)
client.screen += l_hand
var/t_state = l_hand.item_state
if(!t_state) t_state = l_hand.icon_state
overlays_standing[L_HAND_LAYER] = image("icon" = l_hand.lefthand_file, "icon_state"="[t_state]", "layer"=-L_HAND_LAYER)
apply_overlay(L_HAND_LAYER)
/mob/living/carbon/human/proc/wear_female_version(t_color, icon, layer, type)
var/index = "[t_color]_s"
@@ -652,15 +522,7 @@ Please contact me on #coderbus IRC. ~Carnie x
#undef EARS_LAYER
#undef SUIT_LAYER
#undef GLASSES_LAYER
#undef FACEMASK_LAYER
#undef BELT_LAYER
#undef SUIT_STORE_LAYER
#undef BACK_LAYER
#undef HAIR_LAYER
#undef HEAD_LAYER
#undef HANDCUFF_LAYER
#undef LEGCUFF_LAYER
#undef L_HAND_LAYER
#undef R_HAND_LAYER
#undef FIRE_LAYER
#undef TOTAL_LAYERS
+6 -6
View File
@@ -25,22 +25,22 @@
if(I == head)
head = null
if(I.flags & BLOCKHAIR)
update_hair(0)
update_inv_head(0)
update_hair()
update_inv_head()
else if(I == back)
back = null
update_inv_back(0)
update_inv_back()
else if(I == wear_mask)
if(istype(src, /mob/living/carbon/human)) //If we don't do this hair won't be properly rebuilt.
return
wear_mask = null
update_inv_wear_mask(0)
update_inv_wear_mask()
else if(I == handcuffed)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob()
update_inv_handcuffed(0)
update_inv_handcuffed()
else if(I == legcuffed)
legcuffed = null
update_inv_legcuffed(0)
update_inv_legcuffed()
@@ -1,31 +1,13 @@
//Monkey Overlays Indexes////////
#define M_FIRE_LAYER 7
#define M_MASK_LAYER 6
#define M_HEAD_LAYER 5
#define M_BACK_LAYER 4
#define M_HANDCUFF_LAYER 3
#define M_L_HAND_LAYER 2
#define M_R_HAND_LAYER 1
#define M_TOTAL_LAYERS 7
/////////////////////////////////
/mob/living/carbon/monkey
var/list/overlays_standing[M_TOTAL_LAYERS]
/mob/living/carbon/monkey/regenerate_icons()
..()
update_inv_wear_mask(0)
update_inv_head(0)
update_inv_back(0)
update_inv_r_hand(0)
update_inv_l_hand(0)
update_inv_handcuffed(0)
update_fire()
update_icons()
update_transform()
//Hud Stuff
update_hud()
return
if(!..())
update_inv_wear_mask()
update_inv_head()
update_inv_back()
update_icons()
update_transform()
//Hud Stuff
update_hud()
/mob/living/carbon/monkey/update_icons()
update_hud()
@@ -35,138 +17,43 @@
overlays += I
////////
/mob/living/carbon/monkey/update_inv_wear_mask(update_icons=1)
if(wear_mask && istype(wear_mask, /obj/item/clothing/mask) )
wear_mask.screen_loc = ui_monkey_mask
/mob/living/carbon/monkey/update_inv_wear_mask()
var/obj/item/clothing/mask/M = ..()
if(M)
M.screen_loc = ui_monkey_mask
if(client && hud_used)
client.screen += wear_mask
overlays -= overlays_standing[M_MASK_LAYER]
var/image/standing = image("icon" = 'icons/mob/mask.dmi', "icon_state" = "[wear_mask.icon_state]", "layer" = -M_MASK_LAYER)
if(!istype(wear_mask, /obj/item/clothing/mask/cigarette) && wear_mask.blood_DNA )
standing.overlays += image("icon" = 'icons/effects/blood.dmi', "icon_state" = "maskblood")
overlays_standing[M_MASK_LAYER] = standing
overlays += overlays_standing[M_MASK_LAYER]
else
overlays -= overlays_standing[M_MASK_LAYER]
overlays_standing[M_MASK_LAYER] = null
if(update_icons) update_icons()
client.screen += M
apply_overlay(FACEMASK_LAYER)
/mob/living/carbon/monkey/update_inv_head(update_icons=1)
if(head)
head.screen_loc = ui_monkey_head
/mob/living/carbon/monkey/update_inv_head()
var/obj/item/H = ..()
if(H)
H.screen_loc = ui_monkey_head
if(client && hud_used)
client.screen += head
overlays -= overlays_standing[M_HEAD_LAYER]
var/image/standing = image("icon" = 'icons/mob/head.dmi', "icon_state" = "[head.icon_state]", "layer" = -M_HEAD_LAYER)
overlays_standing[M_HEAD_LAYER] = standing
overlays += overlays_standing[M_HEAD_LAYER]
else
overlays -= overlays_standing[M_HEAD_LAYER]
overlays_standing[M_HEAD_LAYER] = null
if(update_icons) update_icons()
client.screen += H
apply_overlay(HEAD_LAYER)
/mob/living/carbon/monkey/update_inv_r_hand(update_icons=1)
if (handcuffed)
drop_r_hand()
return
if(r_hand)
r_hand.screen_loc = ui_rhand
/mob/living/carbon/monkey/update_inv_back()
var/obj/item/B = ..()
if(B)
B.screen_loc = ui_monkey_back
if(client && hud_used)
client.screen += r_hand
var/t_state = r_hand.item_state
if(!t_state) t_state = r_hand.icon_state
overlays -= overlays_standing[M_R_HAND_LAYER]
var/image/standing = image("icon" = r_hand.righthand_file, "icon_state" = t_state, "layer" = -M_R_HAND_LAYER)
standing.pixel_y = 2
overlays_standing[M_R_HAND_LAYER] = standing
overlays += overlays_standing[M_R_HAND_LAYER]
else
overlays -= overlays_standing[M_R_HAND_LAYER]
overlays_standing[M_R_HAND_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_inv_l_hand(update_icons=1)
if (handcuffed)
drop_l_hand()
return
if(l_hand)
l_hand.screen_loc = ui_lhand
if(client && hud_used)
client.screen += l_hand
var/t_state = l_hand.item_state
if(!t_state) t_state = l_hand.icon_state
overlays -= overlays_standing[M_L_HAND_LAYER]
var/image/standing = image("icon" = l_hand.lefthand_file, "icon_state" = t_state, "layer" = -M_L_HAND_LAYER)
standing.pixel_y = 2
overlays_standing[M_L_HAND_LAYER] = standing
overlays += overlays_standing[M_L_HAND_LAYER]
else
overlays -= overlays_standing[M_L_HAND_LAYER]
overlays_standing[M_L_HAND_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_inv_back(update_icons=1)
if(back)
back.screen_loc = ui_monkey_back
if(client && hud_used)
client.screen += back
overlays -= overlays_standing[M_BACK_LAYER]
overlays_standing[M_BACK_LAYER] = image("icon" = 'icons/mob/back.dmi', "icon_state" = "[back.icon_state]", "layer" = -M_BACK_LAYER)
overlays += overlays_standing[M_BACK_LAYER]
else
overlays -= overlays_standing[M_BACK_LAYER]
overlays_standing[M_BACK_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_inv_handcuffed(update_icons=1)
if(handcuffed)
drop_r_hand()
drop_l_hand()
stop_pulling()
if(hud_used) //hud handcuff icons
var/obj/screen/inventory/R = hud_used.adding[4]
var/obj/screen/inventory/L = hud_used.adding[5]
R.overlays += image("icon" = 'icons/mob/screen_gen.dmi', "icon_state" = "markus")
L.overlays += image("icon" = 'icons/mob/screen_gen.dmi', "icon_state" = "gabrielle")
overlays -= overlays_standing[M_HANDCUFF_LAYER]
overlays_standing[M_HANDCUFF_LAYER] = image("icon" = 'icons/mob/monkey.dmi', "icon_state" = "handcuff1", "layer" = -M_HANDCUFF_LAYER)
overlays += overlays_standing[M_HANDCUFF_LAYER]
else
if(hud_used)
var/obj/screen/inventory/R = hud_used.adding[4]
var/obj/screen/inventory/L = hud_used.adding[5]
R.overlays = null
L.overlays = null
overlays -= overlays_standing[M_HANDCUFF_LAYER]
overlays_standing[M_HANDCUFF_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_hud()
if(client)
client.screen |= contents
client.screen += B
apply_overlay(BACK_LAYER)
/mob/living/carbon/monkey/update_fire()
overlays -= overlays_standing[M_FIRE_LAYER]
if(on_fire)
overlays_standing[M_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -M_FIRE_LAYER)
overlays += overlays_standing[M_FIRE_LAYER]
return
else
overlays_standing[M_FIRE_LAYER] = null
..("Monkey_burning")
/mob/living/carbon/monkey/update_inv_handcuffed()
if(..())
overlays_standing[HANDCUFF_LAYER] = image("icon"='icons/mob/mob.dmi', "icon_state"="handcuff1", "layer"=-HANDCUFF_LAYER)
apply_overlay(HANDCUFF_LAYER)
//Monkey Overlays Indexes////////
#undef M_FIRE_LAYER
#undef M_MASK_LAYER
#undef M_BACK_LAYER
#undef M_HANDCUFF_LAYER
#undef M_L_HAND_LAYER
#undef M_R_HAND_LAYER
#undef M_TOTAL_LAYERS
/mob/living/carbon/monkey/update_inv_legcuffed()
remove_overlay(LEGCUFF_LAYER)
if(legcuffed)
var/image/standing = image("icon"='icons/mob/mob.dmi', "icon_state"="legcuff1", "layer"=-LEGCUFF_LAYER)
standing.pixel_y = 8
overlays_standing[LEGCUFF_LAYER] = standing
apply_overlay(LEGCUFF_LAYER)
+149 -4
View File
@@ -1,6 +1,18 @@
//LOOK G-MA, I'VE JOINED CARBON PROCS THAT ARE IDENTICAL IN ALL CASES INTO ONE PROC, I'M BETTER THAN LIFE()
//I thought about mob/living but silicons and simple_animals don't want this just yet.
//Right now just handles lying down, but could handle other cases later.
//Carbon Overlays Indexes/////////
#define FACEMASK_LAYER 8
#define HEAD_LAYER 7
#define BACK_LAYER 6
#define LEGCUFF_LAYER 5
#define HANDCUFF_LAYER 4
#define L_HAND_LAYER 3
#define R_HAND_LAYER 2 //Having the two hands seperate seems rather silly, merge them together? It'll allow for code to be reused on mobs with arbitarily many hands
#define FIRE_LAYER 1 //If you're on fire
#define TOTAL_LAYERS 26 //KEEP THIS UP-TO-DATE OR SHIT WILL BREAK ;_;
//////////////////////////////////
//IMPORTANT: Multiple animate() calls do not stack well, so try to do them all at once if you can.
/mob/living/carbon/update_transform()
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
@@ -27,4 +39,137 @@
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, dir = final_dir, easing = EASE_IN|EASE_OUT)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
/mob/living/carbon
var/list/overlays_standing[TOTAL_LAYERS]
/mob/living/carbon/proc/apply_overlay(cache_index)
var/image/I = overlays_standing[cache_index]
if(I)
overlays += I
/mob/living/carbon/proc/remove_overlay(cache_index)
if(overlays_standing[cache_index])
overlays -= overlays_standing[cache_index]
overlays_standing[cache_index] = null
/mob/living/carbon/update_inv_r_hand()
remove_overlay(R_HAND_LAYER)
if (handcuffed)
drop_r_hand()
return
if(r_hand)
r_hand.screen_loc = ui_rhand
if(client && hud_used)
client.screen += r_hand
var/t_state = r_hand.item_state
if(!t_state)
t_state = r_hand.icon_state
overlays_standing[R_HAND_LAYER] = image("icon" = r_hand.righthand_file, "icon_state"="[t_state]", "layer"=-R_HAND_LAYER)
apply_overlay(R_HAND_LAYER)
/mob/living/carbon/update_inv_l_hand()
remove_overlay(L_HAND_LAYER)
if (handcuffed)
drop_l_hand()
return
if(l_hand)
l_hand.screen_loc = ui_lhand
if(client && hud_used)
client.screen += l_hand
var/t_state = l_hand.item_state
if(!t_state)
t_state = l_hand.icon_state
overlays_standing[L_HAND_LAYER] = image("icon" = l_hand.lefthand_file, "icon_state"="[t_state]", "layer"=-L_HAND_LAYER)
apply_overlay(L_HAND_LAYER)
/mob/living/carbon/update_fire(var/fire_icon = "Generic_mob_burning")
remove_overlay(FIRE_LAYER)
if(on_fire)
overlays_standing[FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"= fire_icon, "layer"=-FIRE_LAYER)
apply_overlay(FIRE_LAYER)
/mob/living/carbon/update_hud()
if(client)
client.screen |= contents
return 1
/mob/living/carbon/regenerate_icons()
if(notransform)
return 1
update_inv_r_hand()
update_inv_l_hand()
update_inv_handcuffed()
update_inv_legcuffed()
update_fire()
/mob/living/carbon/update_inv_wear_mask()
remove_overlay(FACEMASK_LAYER)
if(istype(wear_mask, /obj/item/clothing/mask))
var/image/standing
if(wear_mask.alternate_worn_icon)
standing = image("icon"=wear_mask.alternate_worn_icon, "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
if(!standing)
standing = image("icon"='icons/mob/mask.dmi', "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
overlays_standing[FACEMASK_LAYER] = standing
if(wear_mask.blood_DNA && (wear_mask.body_parts_covered & HEAD))
standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="maskblood")
return wear_mask
/mob/living/carbon/human/update_inv_back()
remove_overlay(BACK_LAYER)
if(back)
var/image/standing
if(back.alternate_worn_icon)
standing = image("icon"=back.alternate_worn_icon, "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
if(!standing)
standing = image("icon"='icons/mob/back.dmi', "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
overlays_standing[BACK_LAYER] = standing
return back
/mob/living/carbon/human/update_inv_head()
remove_overlay(HEAD_LAYER)
if(head)
var/image/standing
if(head.alternate_worn_icon)
standing = image("icon"=head.alternate_worn_icon, "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
if(!standing)
standing = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
standing.color = head.color // For now, this is here solely for kitty ears, but everything should do this eventually
standing.alpha = head.alpha
overlays_standing[HEAD_LAYER] = standing
if(head.blood_DNA)
standing.overlays += image("icon"='icons/effects/blood.dmi', "icon_state"="helmetblood")
return head
/mob/living/carbon/update_inv_handcuffed()
remove_overlay(HANDCUFF_LAYER)
if(handcuffed)
drop_r_hand()
drop_l_hand()
stop_pulling() //TODO: should be handled elsewhere
if(hud_used) //hud handcuff icons
var/obj/screen/inventory/R = hud_used.r_hand_hud_object
var/obj/screen/inventory/L = hud_used.l_hand_hud_object
R.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="markus")
L.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="gabrielle")
return 1
else
if(hud_used)
var/obj/screen/inventory/R = hud_used.r_hand_hud_object
var/obj/screen/inventory/L = hud_used.l_hand_hud_object
R.overlays = null
L.overlays = null
@@ -192,9 +192,9 @@
return
/mob/living/silicon/robot/update_fire()
overlays -= image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing")
overlays -= image("icon"='icons/mob/OnFire.dmi', "icon_state"="Generic_mob_burning")
if(on_fire)
overlays += image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing")
overlays += image("icon"='icons/mob/OnFire.dmi', "icon_state"="Generic_mob_burning")
/mob/living/silicon/robot/fire_act()
if(!on_fire) //Silicons don't gain stacks from hotspots, but hotspots can ignite them
@@ -876,16 +876,16 @@
if(cleaned_human.lying)
if(cleaned_human.head)
cleaned_human.head.clean_blood()
cleaned_human.update_inv_head(0)
cleaned_human.update_inv_head()
if(cleaned_human.wear_suit)
cleaned_human.wear_suit.clean_blood()
cleaned_human.update_inv_wear_suit(0)
cleaned_human.update_inv_wear_suit()
else if(cleaned_human.w_uniform)
cleaned_human.w_uniform.clean_blood()
cleaned_human.update_inv_w_uniform(0)
cleaned_human.update_inv_w_uniform()
if(cleaned_human.shoes)
cleaned_human.shoes.clean_blood()
cleaned_human.update_inv_shoes(0)
cleaned_human.update_inv_shoes()
cleaned_human.clean_blood()
cleaned_human << "<span class='danger'>[src] cleans your face!</span>"
return
@@ -125,9 +125,9 @@
return
if(equip_to_appropriate_slot(I))
if(hand)
update_inv_l_hand(0)
update_inv_l_hand()
else
update_inv_r_hand(0)
update_inv_r_hand()
else if(s_active && s_active.can_be_inserted(I,1)) //if storage active insert there
s_active.handle_item_insertion(I)
else if(istype(S, /obj/item/weapon/storage) && S.can_be_inserted(I,1)) //see if we have box in other hand
+2 -2
View File
@@ -421,12 +421,12 @@ var/list/slot_equipment_priority = list( \
var/obj/item/W = l_hand
if (W)
W.attack_self(src)
update_inv_l_hand(0)
update_inv_l_hand()
else
var/obj/item/W = r_hand
if (W)
W.attack_self(src)
update_inv_r_hand(0)
update_inv_r_hand()
return
/*
+2 -2
View File
@@ -229,9 +229,9 @@
semicd = 0
if(user.hand)
user.update_inv_l_hand(0)
user.update_inv_l_hand()
else
user.update_inv_r_hand(0)
user.update_inv_r_hand()
feedback_add_details("gun_fired","[src.name]")
/obj/item/weapon/gun/attack(mob/M as mob, mob/user)
@@ -576,21 +576,21 @@
C.l_hand.clean_blood()
if(C.wear_mask)
if(C.wear_mask.clean_blood())
C.update_inv_wear_mask(0)
C.update_inv_wear_mask()
if(ishuman(M))
var/mob/living/carbon/human/H = C
if(H.head)
if(H.head.clean_blood())
H.update_inv_head(0)
H.update_inv_head()
if(H.wear_suit)
if(H.wear_suit.clean_blood())
H.update_inv_wear_suit(0)
H.update_inv_wear_suit()
else if(H.w_uniform)
if(H.w_uniform.clean_blood())
H.update_inv_w_uniform(0)
H.update_inv_w_uniform()
if(H.shoes)
if(H.shoes.clean_blood())
H.update_inv_shoes(0)
H.update_inv_shoes()
M.clean_blood()
/datum/reagent/cryptobiolin