mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Roll-down-jumpsuit now works properly with custom items, icon_override and (hopefully) species variants.
This commit is contained in:
@@ -383,23 +383,41 @@ BLIND // can't see anything
|
||||
var/displays_id = 1
|
||||
var/rolled_down = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled
|
||||
sprite_sheets = list("Vox" = 'icons/mob/species/vox/uniform.dmi')
|
||||
|
||||
|
||||
//convenience var for defining the icon state for the overlay used when the clothing is worn.
|
||||
//Also used by rolling/unrolling.
|
||||
var/worn_state = null
|
||||
|
||||
/obj/item/clothing/under/New()
|
||||
if(worn_state)
|
||||
if(!item_state_slots)
|
||||
if(!item_state_slots)
|
||||
item_state_slots = list()
|
||||
item_state_slots[slot_w_uniform_str] = worn_state
|
||||
else
|
||||
worn_state = icon_state
|
||||
|
||||
//autodetect rollability
|
||||
if(rolled_down < 0)
|
||||
if((worn_state + "_d_s") in icon_states('icons/mob/uniform.dmi'))
|
||||
|
||||
/obj/item/clothing/under/proc/update_rolldown_status()
|
||||
|
||||
var/mob/living/carbon/human/H
|
||||
if(istype(src.loc, /mob/living/carbon/human))
|
||||
H = src.loc
|
||||
|
||||
var/icon/under_icon
|
||||
if(icon_override)
|
||||
under_icon = icon_override
|
||||
else if(H && sprite_sheets && sprite_sheets[H.species.name])
|
||||
under_icon = sprite_sheets[H.species.name]
|
||||
else if(item_icons && item_icons[slot_w_uniform_str])
|
||||
under_icon = item_icons[slot_w_uniform_str]
|
||||
else
|
||||
under_icon = INV_W_UNIFORM_DEF_ICON
|
||||
|
||||
if((worn_state + "_d_s") in icon_states(under_icon))
|
||||
if(rolled_down != 1)
|
||||
rolled_down = 0
|
||||
else
|
||||
rolled_down = -1
|
||||
if(H) update_clothing_icon()
|
||||
|
||||
/obj/item/clothing/under/update_clothing_icon()
|
||||
if (ismob(src.loc))
|
||||
@@ -459,10 +477,10 @@ BLIND // can't see anything
|
||||
|
||||
if (( usr.restrained() ) || ( usr.stat ))
|
||||
return
|
||||
|
||||
|
||||
if (!usr.unEquip(src))
|
||||
return
|
||||
|
||||
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
usr.put_in_r_hand(src)
|
||||
@@ -542,10 +560,11 @@ BLIND // can't see anything
|
||||
if(!istype(usr, /mob/living)) return
|
||||
if(usr.stat) return
|
||||
|
||||
if(rolled_down < 0)
|
||||
update_rolldown_status()
|
||||
if(rolled_down == -1)
|
||||
usr << "<span class='notice'>You cannot roll down [src]!</span>"
|
||||
return
|
||||
|
||||
|
||||
rolled_down = !rolled_down
|
||||
if(rolled_down)
|
||||
body_parts_covered &= LOWER_TORSO|LEGS|FEET
|
||||
|
||||
@@ -49,18 +49,22 @@
|
||||
item.icon = CUSTOM_ITEM_OBJ
|
||||
item.icon_state = item_icon
|
||||
return
|
||||
else
|
||||
else
|
||||
if(inherit_inhands)
|
||||
apply_inherit_inhands(item)
|
||||
else
|
||||
item.item_state_slots = null
|
||||
item.item_icons = null
|
||||
|
||||
|
||||
item.icon = CUSTOM_ITEM_OBJ
|
||||
item.icon_state = item_icon
|
||||
item.item_state = null
|
||||
item.icon_override = CUSTOM_ITEM_MOB
|
||||
|
||||
var/obj/item/clothing/under/U = item
|
||||
if(istype(U))
|
||||
U.update_rolldown_status()
|
||||
|
||||
// Kits are dumb so this is going to have to be hardcoded/snowflake.
|
||||
if(istype(item, /obj/item/device/kit))
|
||||
var/obj/item/device/kit/K = item
|
||||
@@ -81,9 +85,9 @@
|
||||
/datum/custom_item/proc/apply_inherit_inhands(var/obj/item/item)
|
||||
var/list/new_item_icons = list()
|
||||
var/list/new_item_state_slots = list()
|
||||
|
||||
|
||||
var/list/available_states = icon_states(CUSTOM_ITEM_MOB)
|
||||
|
||||
|
||||
//If l_hand or r_hand are not present, preserve them using item_icons/item_state_slots
|
||||
//Then use icon_override to make every other slot use the custom sprites by default.
|
||||
//This has to be done before we touch any of item's vars
|
||||
@@ -93,7 +97,7 @@
|
||||
if(!("[item_icon]_r" in available_states))
|
||||
new_item_state_slots[slot_r_hand_str] = get_state(item, slot_r_hand_str, "_r")
|
||||
new_item_icons[slot_r_hand_str] = get_icon(item, slot_r_hand_str, 'icons/mob/items/righthand.dmi')
|
||||
|
||||
|
||||
item.item_state_slots = new_item_state_slots
|
||||
item.item_icons = new_item_icons
|
||||
|
||||
|
||||
Reference in New Issue
Block a user