Adds worn overlay y offset variable. (#58400)

Co-authored-by: Krysonism <49783092+Krysonism@users.noreply.github.com>
This commit is contained in:
AnturK
2021-04-15 11:06:17 -07:00
committed by GitHub
co-authored by Krysonism
parent cd03fa4254
commit c54afc5dce
8 changed files with 23 additions and 32 deletions
+2 -1
View File
@@ -53,7 +53,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
var/inhand_x_dimension = 32
///Same as for [worn_y_dimension][/obj/item/var/worn_y_dimension] but for inhands, uses the lefthand_ and righthand_ file vars
var/inhand_y_dimension = 32
/// Worn overlay will be shifted by this along y axis
var/worn_y_offset = 0
max_integrity = 200
+1 -4
View File
@@ -104,13 +104,10 @@
name = "cage"
desc = "A cage that restrains the will of the self, allowing one to see the profane world for what it is."
flags_inv = NONE
worn_icon = 'icons/mob/large-worn-icons/64x64/head.dmi'
icon_state = "cage"
inhand_icon_state = "cage"
worn_x_dimension = 64
worn_y_dimension = 64
clothing_flags = LARGE_WORN_ICON
dynamic_hair_suffix = ""
worn_y_offset = 7
/obj/item/storage/box/holy/sentinel
name = "Stone Sentinel Kit"
+1 -4
View File
@@ -299,13 +299,10 @@
/obj/item/clothing/head/helmet/plate/crusader/prophet
name = "Prophet's Hat"
desc = "A religious-looking hat."
worn_icon = 'icons/mob/large-worn-icons/64x64/head.dmi'
icon_state = null
flags_1 = 0
armor = list(MELEE = 60, BULLET = 60, LASER = 60, ENERGY = 60, BOMB = 70, BIO = 50, RAD = 50, FIRE = 60, ACID = 60) //religion protects you from disease and radiation, honk.
worn_x_dimension = 64
worn_y_dimension = 64
clothing_flags = LARGE_WORN_ICON
worn_y_offset = 6
/obj/item/clothing/head/helmet/plate/crusader/prophet/red
icon_state = "prophet-red"
+1 -4
View File
@@ -202,13 +202,10 @@
/obj/item/clothing/head/helmet/constable
name = "constable helmet"
desc = "A british looking helmet."
worn_icon = 'icons/mob/large-worn-icons/64x64/head.dmi'
icon_state = "constable"
inhand_icon_state = "constable"
worn_x_dimension = 64
worn_y_dimension = 64
clothing_flags = LARGE_WORN_ICON
custom_price = PAYCHECK_HARD * 1.5
worn_y_offset = 4
/obj/item/clothing/head/helmet/swat/nanotrasen
name = "\improper SWAT helmet"
+1 -4
View File
@@ -491,13 +491,10 @@
name = "shrine maiden's wig"
desc = "Purify in style!"
flags_inv = HIDEHAIR //bald
worn_icon = 'icons/mob/large-worn-icons/64x64/head.dmi'
icon_state = "shrine_wig"
inhand_icon_state = "shrine_wig"
worn_x_dimension = 64
worn_y_dimension = 64
clothing_flags = LARGE_WORN_ICON
dynamic_hair_suffix = ""
worn_y_offset = 1
/obj/item/clothing/head/intern
name = "\improper CentCom Head Intern beancap"
@@ -528,27 +528,29 @@ generate/load female uniform sprites matching all previously decided variables
standing = center_image(standing, isinhands ? inhand_x_dimension : worn_x_dimension, isinhands ? inhand_y_dimension : worn_y_dimension)
//Handle held offsets
var/mob/M = loc
if(istype(M))
var/list/L = get_held_offsets()
if(L)
standing.pixel_x += L["x"] //+= because of center()ing
standing.pixel_y += L["y"]
//Worn offsets
var/list/offsets = get_worn_offsets(isinhands)
standing.pixel_x += offsets[1]
standing.pixel_y += offsets[2]
standing.alpha = alpha
standing.color = color
return standing
/obj/item/proc/get_held_offsets()
var/list/L
if(ismob(loc))
var/mob/M = loc
L = M.get_item_offsets_for_index(M.get_held_index_of_item(src))
return L
/// Returns offsets used for equipped item overlays in list(px_offset,py_offset) form.
/obj/item/proc/get_worn_offsets(isinhands)
. = list(0,0) //(px,py)
if(isinhands)
//Handle held offsets
var/mob/holder = loc
if(istype(holder))
var/list/offsets = holder.get_item_offsets_for_index(holder.get_held_index_of_item(src))
if(offsets)
.[1] = offsets["x"]
.[2] = offsets["y"]
else
.[2] = worn_y_offset
//Can't think of a better way to do this, sadly
/mob/proc/get_item_offsets_for_index(i)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB