mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 16:10:02 +01:00
Mob Sprite Item Pixelshifting (#12170)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
var/list/mob_icon_icon_states = list()
|
||||
|
||||
/obj/item/proc/get_mob_overlay(var/mob/living/carbon/human/H, var/mob_icon, var/mob_state, var/slot)
|
||||
// If we don't actually need to offset this, don't bother with any of the generation/caching.
|
||||
if(!mob_icon_icon_states[mob_icon])
|
||||
mob_icon_icon_states[mob_icon] = icon_states(mob_icon)
|
||||
if(LAZYLEN(H.species.equip_adjust) && H.species.equip_adjust[slot] && length(H.species.equip_adjust[slot]) && (mob_state in mob_icon_icon_states[mob_icon]))
|
||||
// Check the cache for previously made icons.
|
||||
var/image_key = "[mob_icon]-[mob_state]-[color]-[slot]"
|
||||
if(!LAZYISIN(H.species.equip_overlays, image_key))
|
||||
var/icon/final_I = new(H.species.icon_template ? H.species.icon_template : 'icons/mob/human.dmi',"blank")
|
||||
var/list/shifts = H.species.equip_adjust[slot]
|
||||
|
||||
// Apply all pixel shifts for each direction.
|
||||
for(var/shift_facing in shifts)
|
||||
var/list/facing_list = shifts[shift_facing]
|
||||
var/use_dir = text2num(shift_facing)
|
||||
var/icon/equip = new(mob_icon, icon_state = mob_state, dir = use_dir)
|
||||
var/icon/canvas = new(H.species.icon_template ? H.species.icon_template : 'icons/mob/human.dmi',"blank")
|
||||
canvas.Blend(equip, ICON_OVERLAY, facing_list["x"]+1, facing_list["y"]+1)
|
||||
if(build_from_parts)
|
||||
var/icon/parts_icon = new(mob_icon, icon_state = "[item_state][contained_sprite ? slot_str_to_contained_flag(slot) : ""]_[worn_overlay]", dir = use_dir)
|
||||
canvas.Blend(parts_icon, ICON_OVERLAY, facing_list["x"]+1, facing_list["y"]+1)
|
||||
final_I.Insert(canvas, dir = use_dir)
|
||||
LAZYINITLIST(H.species.equip_overlays)
|
||||
var/image/final_image = overlay_image(final_I, color = color, flags = RESET_COLOR|RESET_ALPHA)
|
||||
H.species.equip_overlays[image_key] = final_image
|
||||
var/image/I = new() // We return a copy of the cached image, in case downstream procs mutate it.
|
||||
I.appearance = H.species.equip_overlays[image_key]
|
||||
return I
|
||||
var/image/I = overlay_image(mob_icon, mob_state, color, RESET_COLOR|RESET_ALPHA)
|
||||
if(build_from_parts)
|
||||
I.add_overlay(overlay_image(mob_icon, "[item_state][contained_sprite ? slot_str_to_contained_flag(slot) : ""]_[worn_overlay]", null, RESET_COLOR|RESET_ALPHA))
|
||||
return I
|
||||
@@ -296,6 +296,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
attack_verb = list("burnt", "singed")
|
||||
icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
|
||||
icon_off = "cigoff"
|
||||
has_blood_overlay = FALSE
|
||||
type_butt = /obj/item/trash/cigbutt
|
||||
chem_volume = 30
|
||||
burn_rate = 0.006 //Lasts ~166 seconds)
|
||||
|
||||
@@ -28,6 +28,23 @@
|
||||
add_overlay(I.get_belt_overlay())
|
||||
..()
|
||||
|
||||
/obj/item/storage/belt/get_mob_overlay(mob/living/carbon/human/H, mob_icon, mob_state, slot)
|
||||
var/image/I = ..()
|
||||
for(var/obj/item/i in contents)
|
||||
var/c_state
|
||||
var/c_icon
|
||||
if(i.contained_sprite)
|
||||
c_state = "[UNDERSCORE_OR_NULL(i.icon_species_tag)][i.item_state][WORN_BELT]"
|
||||
c_icon = icon_override || icon
|
||||
else
|
||||
c_icon = INV_BELT_DEF_ICON
|
||||
c_state = i.item_state || i.icon_state
|
||||
var/image/belt_item_image = image(c_icon, c_state)
|
||||
belt_item_image.color = i.color
|
||||
belt_item_image.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(belt_item_image)
|
||||
return I
|
||||
|
||||
/obj/item/storage/belt/verb/toggle_layer()
|
||||
set name = "Switch Belt Layer"
|
||||
set category = "Object"
|
||||
|
||||
@@ -198,8 +198,10 @@
|
||||
drop_sound = 'sound/items/drop/cloth.ogg'
|
||||
pickup_sound = 'sound/items/pickup/cloth.ogg'
|
||||
|
||||
/obj/item/storage/wallet/lanyard/New()
|
||||
..()
|
||||
var/image/plastic_film
|
||||
|
||||
/obj/item/storage/wallet/lanyard/Initialize()
|
||||
. = ..()
|
||||
var/image/film_image = new/image(icon, icon_state = "lanyard_film")
|
||||
film_image.appearance_flags = RESET_COLOR
|
||||
overlays += film_image
|
||||
@@ -212,3 +214,13 @@
|
||||
film_image.appearance_flags = RESET_COLOR
|
||||
overlays += film_image
|
||||
mob_icon_update()
|
||||
|
||||
/obj/item/storage/wallet/lanyard/get_mob_overlay(mob/living/carbon/human/H, mob_icon, mob_state, slot)
|
||||
var/image/I = ..()
|
||||
if(front_id)
|
||||
I.add_overlay(image('icons/mob/lanyard_overlays.dmi', icon_state = "lanyard-[front_id_overlay_state]"))
|
||||
else
|
||||
if(!plastic_film)
|
||||
plastic_film = image('icons/mob/lanyard_overlays.dmi', icon_state = "plasticfilm")
|
||||
I.add_overlay(plastic_film)
|
||||
return I
|
||||
Reference in New Issue
Block a user