Merge pull request #16279 from Core0verload/HUDfuckery

Slot icons micro-refactor
This commit is contained in:
duncathan salt
2016-03-30 23:30:06 -06:00
25 changed files with 334 additions and 256 deletions
+7 -8
View File
@@ -111,13 +111,12 @@
usr << "<span class='warning'>Your other hand is too busy holding the [item_in_hand.name]</span>"
return
src.hand = !( src.hand )
if(hud_used.l_hand_hud_object && hud_used.r_hand_hud_object)
if(hand) //This being 1 means the left hand is in use
hud_used.l_hand_hud_object.icon_state = "hand_l_active"
hud_used.r_hand_hud_object.icon_state = "hand_r_inactive"
else
hud_used.l_hand_hud_object.icon_state = "hand_l_inactive"
hud_used.r_hand_hud_object.icon_state = "hand_r_active"
if(hud_used && hud_used.inv_slots[slot_l_hand] && hud_used.inv_slots[slot_r_hand])
var/obj/screen/inventory/hand/H
H = hud_used.inv_slots[slot_l_hand]
H.update_icon()
H = hud_used.inv_slots[slot_r_hand]
H.update_icon()
/*if (!( src.hand ))
src.hands.dir = NORTH
else
@@ -170,7 +169,7 @@
return
if(weakeyes)
Stun(2)
if (damage == 1)
src << "<span class='warning'>Your eyes sting a little.</span>"
if(prob(40))
@@ -155,6 +155,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_w_uniform()
remove_overlay(UNIFORM_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_w_uniform]
inv.update_icon()
if(istype(w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = w_uniform
if(client && hud_used && hud_used.hud_shown)
@@ -192,6 +196,11 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_wear_id()
remove_overlay(ID_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_id]
inv.update_icon()
if(wear_id)
if(client && hud_used && hud_used.hud_shown)
wear_id.screen_loc = ui_id
@@ -206,6 +215,11 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_gloves()
remove_overlay(GLOVES_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_gloves]
inv.update_icon()
if(gloves)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
@@ -231,6 +245,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_glasses()
remove_overlay(GLASSES_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_glasses]
inv.update_icon()
if(glasses)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
@@ -248,6 +266,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_ears()
remove_overlay(EARS_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_ears]
inv.update_icon()
if(ears)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
@@ -263,6 +285,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_shoes()
remove_overlay(SHOES_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_shoes]
inv.update_icon()
if(shoes)
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
@@ -278,6 +304,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_s_store()
remove_overlay(SUIT_STORE_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_s_store]
inv.update_icon()
if(s_store)
if(client && hud_used && hud_used.hud_shown)
s_store.screen_loc = ui_sstore1
@@ -294,17 +324,25 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_head()
..()
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_head]
inv.update_icon()
update_mutant_bodyparts()
/mob/living/carbon/human/update_inv_belt()
remove_overlay(BELT_LAYER)
if(belt)
if(client && hud_used && hud_used.hud_shown)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_belt]
inv.update_icon()
if(hud_used.hud_shown && belt)
client.screen += belt
belt.screen_loc = ui_belt
if(belt)
var/t_state = belt.item_state
if(!t_state)
t_state = belt.icon_state
@@ -320,6 +358,10 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_wear_suit()
remove_overlay(SUIT_LAYER)
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_suit]
inv.update_icon()
if(istype(wear_suit, /obj/item/clothing/suit))
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown) //if the inventory is open ...
@@ -340,19 +382,30 @@ Please contact me on #coderbus IRC. ~Carnie x
/mob/living/carbon/human/update_inv_pockets()
if(l_store)
if(client && hud_used && hud_used.hud_shown)
client.screen += l_store
l_store.screen_loc = ui_storage1
if(r_store)
if(client && hud_used && hud_used.hud_shown)
client.screen += r_store
r_store.screen_loc = ui_storage2
if(client && hud_used)
var/obj/screen/inventory/inv
inv = hud_used.inv_slots[slot_l_store]
inv.update_icon()
inv = hud_used.inv_slots[slot_r_store]
inv.update_icon()
if(hud_used.hud_shown)
if(l_store)
client.screen += l_store
l_store.screen_loc = ui_storage1
if(r_store)
client.screen += r_store
r_store.screen_loc = ui_storage2
/mob/living/carbon/human/update_inv_wear_mask()
..()
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_mask]
inv.update_icon()
update_mutant_bodyparts()
/mob/living/carbon/human/update_inv_handcuffed()
@@ -105,6 +105,11 @@
/mob/living/carbon/update_inv_back()
remove_overlay(BACK_LAYER)
if(client && hud_used && hud_used.inv_slots[slot_back])
var/obj/screen/inventory/inv = hud_used.inv_slots[slot_back]
inv.update_icon()
if(back)
var/image/standing = back.build_worn_icon(state = back.icon_state, default_layer = BACK_LAYER, default_icon_file = 'icons/mob/back.dmi')
overlays_standing[BACK_LAYER] = standing
@@ -128,15 +133,11 @@
//update whether handcuffs appears on our hud.
/mob/living/carbon/proc/update_hud_handcuffed()
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
var/obj/screen/inventory/R = hud_used.inv_slots[slot_r_hand]
var/obj/screen/inventory/L = hud_used.inv_slots[slot_l_hand]
if(R && L)
if(handcuffed) //hud handcuff icons
R.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="markus")
L.overlays += image("icon"='icons/mob/screen_gen.dmi', "icon_state"="gabrielle")
else
R.overlays = null
L.overlays = null
R.update_icon()
L.update_icon()
//update whether our head item appears on our hud.
/mob/living/carbon/proc/update_hud_head(obj/item/I)
@@ -34,13 +34,12 @@
return
hand = !hand
if(hud_used.l_hand_hud_object && hud_used.r_hand_hud_object)
if(hand)
hud_used.l_hand_hud_object.icon_state = "hand_l_active"
hud_used.r_hand_hud_object.icon_state = "hand_r_inactive"
else
hud_used.l_hand_hud_object.icon_state = "hand_l_inactive"
hud_used.r_hand_hud_object.icon_state = "hand_r_active"
if(hud_used && hud_used.inv_slots[slot_l_hand] && hud_used.inv_slots[slot_r_hand])
var/obj/screen/inventory/hand/H
H = hud_used.inv_slots[slot_l_hand]
H.update_icon()
H = hud_used.inv_slots[slot_r_hand]
H.update_icon()
/mob/living/simple_animal/drone/unEquip(obj/item/I, force)
+8 -8
View File
@@ -92,15 +92,15 @@
if(over_object == M)
M.put_in_hands(src)
else if(istype(over_object, /obj/screen))
switch(over_object.name)
if("r_hand")
if(!remove_item_from_storage(M))
M.unEquip(src)
else if(istype(over_object, /obj/screen/inventory/hand))
var/obj/screen/inventory/hand/H = over_object
if(!remove_item_from_storage(M))
if(!M.unEquip(src))
return
switch(H.slot_id)
if(slot_r_hand)
M.put_in_r_hand(src)
if("l_hand")
if(!remove_item_from_storage(M))
M.unEquip(src)
if(slot_l_hand)
M.put_in_l_hand(src)
add_fingerprint(M)
+8 -8
View File
@@ -31,15 +31,15 @@
if(over_object == M)
M.put_in_hands(src)
else if(istype(over_object, /obj/screen))
switch(over_object.name)
if("r_hand")
if(!remove_item_from_storage(M))
M.unEquip(src)
else if(istype(over_object, /obj/screen/inventory/hand))
var/obj/screen/inventory/hand/H = over_object
if(!remove_item_from_storage(M))
if(!M.unEquip(src))
return
switch(H.slot_id)
if(slot_r_hand)
M.put_in_r_hand(src)
if("l_hand")
if(!remove_item_from_storage(M))
M.unEquip(src)
if(slot_l_hand)
M.put_in_l_hand(src)
add_fingerprint(M)