Spooky Candles (#17916)

* >:)

big time candle flicker zone

* suggested changes + timed better

increased flicker time to 4 seconds from just 1 or so. now more noticable, but not obvious

* Apply suggestions from code review

Suggested changes

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
Kugamo
2022-06-07 18:32:24 +01:00
committed by GitHub
co-authored by AffectedArc07
parent 8b9c6dc5f0
commit d501a33efd
3 changed files with 29 additions and 7 deletions
+29 -7
View File
@@ -9,6 +9,7 @@
var/lit = 0
var/infinite = 0
var/start_lit = 0
var/flickering = FALSE
light_color = "#E09D37"
/obj/item/candle/New()
@@ -22,13 +23,10 @@
return ..()
/obj/item/candle/update_icon()
var/i
if(wax>150)
i = 1
else if(wax>80)
i = 2
else i = 3
icon_state = "candle[i][lit ? "_lit" : ""]"
if(flickering)
icon_state = "candle[get_icon_index()]_flicker"
else
icon_state = "candle[get_icon_index()][lit ? "_lit" : ""]"
/obj/item/candle/can_enter_storage(obj/item/storage/S, mob/user)
if(lit)
@@ -62,6 +60,22 @@
START_PROCESSING(SSobj, src)
update_icon()
/obj/item/candle/proc/get_icon_index()
if(wax > 150)
. = 1
else if(wax > 80)
. = 2
else
. = 3
/obj/item/candle/proc/start_flickering()
flickering = TRUE
update_icon()
addtimer(CALLBACK(src, .proc/stop_flickering), 4 SECONDS, TIMER_UNIQUE)
/obj/item/candle/proc/stop_flickering()
flickering = FALSE
update_icon()
/obj/item/candle/process()
if(!lit)
@@ -90,3 +104,11 @@
/obj/item/candle/eternal
desc = "A candle. This one seems to have an odd quality about the wax."
infinite = 1
/obj/item/candle/get_spooked()
if(lit)
start_flickering()
playsound(src, 'sound/effects/candle_flicker.ogg', 15, 1)
return TRUE
return FALSE