mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +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/displays_id = 1
|
||||||
var/rolled_down = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled
|
var/rolled_down = -1 //0 = unrolled, 1 = rolled, -1 = cannot be toggled
|
||||||
sprite_sheets = list("Vox" = 'icons/mob/species/vox/uniform.dmi')
|
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.
|
//convenience var for defining the icon state for the overlay used when the clothing is worn.
|
||||||
//Also used by rolling/unrolling.
|
//Also used by rolling/unrolling.
|
||||||
var/worn_state = null
|
var/worn_state = null
|
||||||
|
|
||||||
/obj/item/clothing/under/New()
|
/obj/item/clothing/under/New()
|
||||||
if(worn_state)
|
if(worn_state)
|
||||||
if(!item_state_slots)
|
if(!item_state_slots)
|
||||||
item_state_slots = list()
|
item_state_slots = list()
|
||||||
item_state_slots[slot_w_uniform_str] = worn_state
|
item_state_slots[slot_w_uniform_str] = worn_state
|
||||||
else
|
else
|
||||||
worn_state = icon_state
|
worn_state = icon_state
|
||||||
|
|
||||||
//autodetect rollability
|
/obj/item/clothing/under/proc/update_rolldown_status()
|
||||||
if(rolled_down < 0)
|
|
||||||
if((worn_state + "_d_s") in icon_states('icons/mob/uniform.dmi'))
|
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
|
rolled_down = 0
|
||||||
|
else
|
||||||
|
rolled_down = -1
|
||||||
|
if(H) update_clothing_icon()
|
||||||
|
|
||||||
/obj/item/clothing/under/update_clothing_icon()
|
/obj/item/clothing/under/update_clothing_icon()
|
||||||
if (ismob(src.loc))
|
if (ismob(src.loc))
|
||||||
@@ -459,10 +477,10 @@ BLIND // can't see anything
|
|||||||
|
|
||||||
if (( usr.restrained() ) || ( usr.stat ))
|
if (( usr.restrained() ) || ( usr.stat ))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (!usr.unEquip(src))
|
if (!usr.unEquip(src))
|
||||||
return
|
return
|
||||||
|
|
||||||
switch(over_object.name)
|
switch(over_object.name)
|
||||||
if("r_hand")
|
if("r_hand")
|
||||||
usr.put_in_r_hand(src)
|
usr.put_in_r_hand(src)
|
||||||
@@ -542,10 +560,11 @@ BLIND // can't see anything
|
|||||||
if(!istype(usr, /mob/living)) return
|
if(!istype(usr, /mob/living)) return
|
||||||
if(usr.stat) 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>"
|
usr << "<span class='notice'>You cannot roll down [src]!</span>"
|
||||||
return
|
return
|
||||||
|
|
||||||
rolled_down = !rolled_down
|
rolled_down = !rolled_down
|
||||||
if(rolled_down)
|
if(rolled_down)
|
||||||
body_parts_covered &= LOWER_TORSO|LEGS|FEET
|
body_parts_covered &= LOWER_TORSO|LEGS|FEET
|
||||||
|
|||||||
@@ -49,18 +49,22 @@
|
|||||||
item.icon = CUSTOM_ITEM_OBJ
|
item.icon = CUSTOM_ITEM_OBJ
|
||||||
item.icon_state = item_icon
|
item.icon_state = item_icon
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if(inherit_inhands)
|
if(inherit_inhands)
|
||||||
apply_inherit_inhands(item)
|
apply_inherit_inhands(item)
|
||||||
else
|
else
|
||||||
item.item_state_slots = null
|
item.item_state_slots = null
|
||||||
item.item_icons = null
|
item.item_icons = null
|
||||||
|
|
||||||
item.icon = CUSTOM_ITEM_OBJ
|
item.icon = CUSTOM_ITEM_OBJ
|
||||||
item.icon_state = item_icon
|
item.icon_state = item_icon
|
||||||
item.item_state = null
|
item.item_state = null
|
||||||
item.icon_override = CUSTOM_ITEM_MOB
|
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.
|
// Kits are dumb so this is going to have to be hardcoded/snowflake.
|
||||||
if(istype(item, /obj/item/device/kit))
|
if(istype(item, /obj/item/device/kit))
|
||||||
var/obj/item/device/kit/K = item
|
var/obj/item/device/kit/K = item
|
||||||
@@ -81,9 +85,9 @@
|
|||||||
/datum/custom_item/proc/apply_inherit_inhands(var/obj/item/item)
|
/datum/custom_item/proc/apply_inherit_inhands(var/obj/item/item)
|
||||||
var/list/new_item_icons = list()
|
var/list/new_item_icons = list()
|
||||||
var/list/new_item_state_slots = list()
|
var/list/new_item_state_slots = list()
|
||||||
|
|
||||||
var/list/available_states = icon_states(CUSTOM_ITEM_MOB)
|
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
|
//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.
|
//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
|
//This has to be done before we touch any of item's vars
|
||||||
@@ -93,7 +97,7 @@
|
|||||||
if(!("[item_icon]_r" in available_states))
|
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_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')
|
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_state_slots = new_item_state_slots
|
||||||
item.item_icons = new_item_icons
|
item.item_icons = new_item_icons
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user