Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cleans up lighter code a tiny bit and fixes colored lighters becoming green #26129

Merged
merged 7 commits into from
Jul 5, 2024
17 changes: 9 additions & 8 deletions code/game/objects/items/weapons/lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
var/next_on_message
/// Cooldown until the next turned off message/sound can be activated
var/next_off_message
/// Our lighter color suffix. => [base_icon_state]-[lightercolor] => lighter-r
var/lighter_color = null
Spaghetti-bit marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/lighter/random/New()
..()
var/color = pick("r","c","y","g")
icon_state = "lighter-[color]"
/obj/item/lighter/random/Initialize(mapload)
. = ..()
lighter_color = pick("r","c","y","g")
base_icon_state = "lighter"
Spaghetti-bit marked this conversation as resolved.
Show resolved Hide resolved
update_icon()

/obj/item/lighter/attack_self(mob/living/user)
. = ..()
Expand Down Expand Up @@ -118,12 +121,10 @@
return

/obj/item/lighter/update_icon_state()
icon_state = "[initial(icon_state)][lit ? "-on" : ""]"
return ..()
icon_state = "[base_icon_state ? "[base_icon_state]" : initial(icon_state)][lighter_color ? "-[lighter_color]" : ""][lit ? "-on" : ""]"

/obj/item/lighter/update_overlays()
item_state = "[initial(item_state)][lit ? "-on" : ""]"
return ..()
item_state = "[base_icon_state ? "[base_icon_state]" : initial(item_state)][lighter_color ? "-[lighter_color]" : ""][lit ? "-on" : ""]"

/obj/item/lighter/get_heat()
return lit * 1500
Expand Down