Add RCD effects
Port : https://github.com/tgstation/tgstation/pull/47894 & https://github.com/tgstation/tgstation/pull/48362/files
This commit is contained in:
@@ -452,4 +452,44 @@
|
||||
icon_state = "slugboom"
|
||||
randomdir = FALSE
|
||||
duration = 30
|
||||
pixel_x = -24
|
||||
pixel_x = -24
|
||||
|
||||
/obj/effect/constructing_effect
|
||||
icon = 'icons/effects/effects_rcd.dmi'
|
||||
icon_state = ""
|
||||
layer = ABOVE_ALL_MOB_LAYER
|
||||
anchored = TRUE
|
||||
var/status = 0
|
||||
var/delay = 0
|
||||
|
||||
/obj/effect/constructing_effect/Initialize(mapload, rcd_delay, rcd_status)
|
||||
. = ..()
|
||||
status = rcd_status
|
||||
delay = rcd_delay
|
||||
if (status == RCD_DECONSTRUCT)
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 11)
|
||||
delay -= 11
|
||||
icon_state = "rcd_end_reverse"
|
||||
else
|
||||
update_icon()
|
||||
|
||||
/obj/effect/constructing_effect/update_icon()
|
||||
icon_state = "rcd"
|
||||
if (delay < 10)
|
||||
icon_state += "_shortest"
|
||||
else if (delay < 20)
|
||||
icon_state += "_shorter"
|
||||
else if (delay < 37)
|
||||
icon_state += "_short"
|
||||
if (status == RCD_DECONSTRUCT)
|
||||
icon_state += "_reverse"
|
||||
|
||||
/obj/effect/constructing_effect/proc/end_animation()
|
||||
if (status == RCD_DECONSTRUCT)
|
||||
qdel(src)
|
||||
else
|
||||
icon_state = "rcd_end"
|
||||
addtimer(CALLBACK(src, .proc/end), 15)
|
||||
|
||||
/obj/effect/constructing_effect/proc/end()
|
||||
qdel(src)
|
||||
@@ -439,18 +439,22 @@ RLD
|
||||
var/list/rcd_results = A.rcd_vals(user, src)
|
||||
if(!rcd_results)
|
||||
return FALSE
|
||||
var/delay = rcd_results["delay"] * delay_mod
|
||||
var/obj/effect/constructing_effect/rcd_effect = new(get_turf(A), delay, src.mode)
|
||||
var/turf/the_turf = get_turf(A)
|
||||
var/turf_coords = "[COORD(the_turf)]"
|
||||
investigate_log("[user] is attempting to use [src] on [A] (loc [turf_coords] at [the_turf]) with cost [rcd_results["cost"]], delay [rcd_results["delay"]], mode [rcd_results["mode"]].", INVESTIGATE_RCD)
|
||||
if(do_after(user, rcd_results["delay"] * delay_mod, target = A))
|
||||
if(do_after(user, delay, target = A))
|
||||
if(checkResource(rcd_results["cost"], user))
|
||||
var/atom/cached = A
|
||||
if(A.rcd_act(user, src, rcd_results["mode"]))
|
||||
rcd_effect.end_animation()
|
||||
useResource(rcd_results["cost"], user)
|
||||
activate()
|
||||
investigate_log("[user] used [src] on [cached] (loc [turf_coords] at [the_turf]) with cost [rcd_results["cost"]], delay [rcd_results["delay"]], mode [rcd_results["mode"]].", INVESTIGATE_RCD)
|
||||
playsound(src, 'sound/machines/click.ogg', 50, 1)
|
||||
return TRUE
|
||||
qdel(rcd_effect)
|
||||
|
||||
/obj/item/construction/rcd/Initialize()
|
||||
. = ..()
|
||||
|
||||
BIN
icons/effects/effects_rcd.dmi
Normal file
BIN
icons/effects/effects_rcd.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Reference in New Issue
Block a user