Sprite updates & state fix for zippo lighters (#22150)

* Update lighter icon state code

This commit adds a new `update_icon_state()` method which updates the
held icon sprite with the appropriate sprite for lit status before
updating the graphic, and drops the use of explicit icon_state
definitions for lit/unlit in favour of consistently named sprites for
lighters.

As no "lit" graphic exists for held zippos, nor sprites for other
custom or base lighters, updating of 'item_state' has been removed which
fixes #21257.

The naming of zippo sprites has been updated to reflect this change and
stay consistent with the base lighter object and sprites.

* Add missing sprites for colored zippos and lit state

This adds copies of the base zippo sprite for spiters to work on when
updating for custom held zippo combinations.

* Adds held sprite references for custom zippos

This change adds in overrides for item_state for zippos that differ from
the base silver model, which include:

* zippo-gold
* zippo-blue
* zippo-black
* zippo-red
* zippo-purple

* Update held item sprite for lighter lit status

* Set parent items file for fluff lighters

* Update zippo sprites with lit and color variations

This commit adds the colorized versions of zippo lighters, as well
as including the lit animation ported over from TG appearances,
with variations applied for Paradise flame colors.

* fixup! Update lighter icon state code

* fixup! Update lighter icon state code

* fixup! Add missing sprites for colored zippos and lit state

* Correct purple held sprite to have blue flame

* Update code/modules/customitems/item_defines.dm

Fixup for ad1b5fb

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

---------

Co-authored-by: XFirebirdX <xfirebirdx@users.noreply.github.com>
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
This commit is contained in:
StealthCT
2023-09-09 13:31:18 +01:00
committed by GitHub
co-authored by Henri215 XFirebirdX
parent 391948bf14
commit 2ab351cc91
9 changed files with 38 additions and 45 deletions
+22 -26
View File
@@ -3,6 +3,8 @@
name = "cheap lighter"
desc = "A cheap-as-free lighter."
icon = 'icons/obj/items.dmi'
lefthand_file = 'icons/mob/inhands/lighter_lefthand.dmi'
righthand_file = 'icons/mob/inhands/lighter_righthand.dmi'
icon_state = "lighter-g"
item_state = "lighter-g"
w_class = WEIGHT_CLASS_TINY
@@ -12,8 +14,6 @@
attack_verb = null
resistance_flags = FIRE_PROOF
var/lit = FALSE
var/icon_on = "lighter-g-on"
var/icon_off = "lighter-g"
/// Cooldown until the next turned on message/sound can be activated
var/next_on_message
/// Cooldown until the next turned off message/sound can be activated
@@ -22,9 +22,7 @@
/obj/item/lighter/random/New()
..()
var/color = pick("r","c","y","g")
icon_on = "lighter-[color]-on"
icon_off = "lighter-[color]"
icon_state = icon_off
icon_state = "lighter-[color]"
/obj/item/lighter/attack_self(mob/living/user)
. = ..()
@@ -43,13 +41,12 @@
/obj/item/lighter/proc/turn_on_lighter(mob/living/user)
lit = TRUE
w_class = WEIGHT_CLASS_BULKY
icon_state = icon_on
item_state = icon_on
force = 5
damtype = BURN
hitsound = 'sound/items/welder.ogg'
attack_verb = list("burnt", "singed")
update_icon()
attempt_light(user)
set_light(2)
START_PROCESSING(SSobj, src)
@@ -70,12 +67,11 @@
/obj/item/lighter/proc/turn_off_lighter(mob/living/user)
lit = FALSE
w_class = WEIGHT_CLASS_TINY
icon_state = icon_off
item_state = icon_off
hitsound = "swing_hit"
force = 0
attack_verb = null //human_defense.dm takes care of it
update_icon()
if(user)
show_off_message(user)
set_light(0)
@@ -119,14 +115,20 @@
location.hotspot_expose(700, 5)
return
/obj/item/lighter/update_icon_state()
icon_state = "[initial(icon_state)][lit ? "-on" : ""]"
return ..()
/obj/item/lighter/update_overlays()
item_state = "[initial(item_state)][lit ? "-on" : ""]"
return ..()
// Zippo lighters
/obj/item/lighter/zippo
name = "zippo lighter"
desc = "The zippo."
icon_state = "zippo"
item_state = "zippo"
icon_on = "zippoon"
icon_off = "zippo"
/obj/item/lighter/zippo/turn_on_lighter(mob/living/user)
. = ..()
@@ -159,37 +161,31 @@
/obj/item/lighter/zippo/nt_rep
name = "gold engraved zippo"
desc = "An engraved golden Zippo lighter with the letters NT on it."
icon_state = "zippo_nt_off"
icon_on = "zippo_nt_on"
icon_off = "zippo_nt_off"
icon_state = "zippo-nt"
item_state = "zippo-gold"
/obj/item/lighter/zippo/blue
name = "blue zippo lighter"
desc = "A zippo lighter made of some blue metal."
icon_state = "bluezippo"
icon_on = "bluezippoon"
icon_off = "bluezippo"
icon_state = "zippo-blue"
item_state = "zippo-blue"
/obj/item/lighter/zippo/black
name = "black zippo lighter"
desc = "A black zippo lighter."
icon_state = "blackzippo"
icon_on = "blackzippoon"
icon_off = "blackzippo"
icon_state = "zippo-black"
item_state = "zippo-black"
/obj/item/lighter/zippo/engraved
name = "engraved zippo lighter"
desc = "A intricately engraved zippo lighter."
icon_state = "engravedzippo"
icon_on = "engravedzippoon"
icon_off = "engravedzippo"
icon_state = "zippo-engraved"
/obj/item/lighter/zippo/gonzofist
name = "Gonzo Fist zippo"
desc = "A Zippo lighter with the iconic Gonzo Fist on a matte black finish."
icon_state = "gonzozippo"
icon_on = "gonzozippoon"
icon_off = "gonzozippo"
icon_state = "zippo-gonzo"
item_state = "zippo-red"
///////////
//MATCHES//