Merge pull request #10416 from r4d6/RCD-Updates

Massive RCD Port & Updates
This commit is contained in:
kevinz000
2020-01-12 00:45:21 -08:00
committed by GitHub
12 changed files with 530 additions and 342 deletions

View File

@@ -452,4 +452,45 @@
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
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/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)

View File

@@ -47,7 +47,11 @@ RLD
/obj/item/construction/examine(mob/user)
. = ..()
. += "\A [src]. It currently holds [matter]/[max_matter] matter-units."
. += "It currently holds [matter]/[max_matter] matter-units."
if(upgrade & RCD_UPGRADE_FRAMES)
. += "It contains the design for machine frames, computer frames and deconstruction."
if(upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS)
. += "It contains the design for firelock, air alarm, fire alarm, apc circuits and crap power cells."
/obj/item/construction/Destroy()
QDEL_NULL(spark_system)
@@ -85,9 +89,11 @@ RLD
to_chat(user, "<span class='notice'>[src] now holds [matter]/[max_matter] matter-units.</span>")
else if(istype(W, /obj/item/rcd_upgrade))
to_chat(user, "<span class='notice'>You upgrade the RCD with the [W]!</span>")
upgrade = TRUE
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
qdel(W)
var/obj/item/rcd_upgrade/rcd_up = W
if(!(upgrade & rcd_up.upgrade))
upgrade |= rcd_up.upgrade
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
qdel(W)
else
return ..()
update_icon() //ensures that ammo counters (if present) get updated
@@ -116,10 +122,10 @@ RLD
if(matter < amount)
if(user)
to_chat(user, no_ammo_message)
return 0
return FALSE
matter -= amount
update_icon()
return 1
return TRUE
/obj/item/construction/proc/checkResource(amount, mob/user)
. = matter >= amount
@@ -439,18 +445,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()
. = ..()
@@ -467,7 +477,7 @@ RLD
"Grilles & Windows" = image(icon = 'icons/mob/radial.dmi', icon_state = "grillewindow"),
"Floors & Walls" = image(icon = 'icons/mob/radial.dmi', icon_state = "wallfloor")
)
if(upgrade)
if(upgrade & RCD_UPGRADE_FRAMES)
choices += list(
"Deconstruct" = image(icon= 'icons/mob/radial.dmi', icon_state = "delete"),
"Machine Frames" = image(icon = 'icons/mob/radial.dmi', icon_state = "machine"),
@@ -593,6 +603,7 @@ RLD
energyfactor = 66
/obj/item/construction/rcd/loaded
materials = list(MAT_METAL=48000, MAT_GLASS=32000)
matter = 160
/obj/item/construction/rcd/loaded/upgraded
@@ -825,9 +836,18 @@ RLD
/obj/item/rcd_upgrade
name = "RCD advanced design disk"
desc = "It contains the design for machine frames, computer frames, and deconstruction."
desc = "It seems to be empty."
icon = 'icons/obj/module.dmi'
icon_state = "datadisk3"
var/upgrade
/obj/item/rcd_upgrade/frames
desc = "It contains the design for machine frames, computer frames and deconstruction."
upgrade = RCD_UPGRADE_FRAMES
/obj/item/rcd_upgrade/simple_circuits
desc = "It contains the design for firelock, air alarm, fire alarm, apc circuits and crap power cells."
upgrade = RCD_UPGRADE_SIMPLE_CIRCUITS
#undef GLOW_MODE
#undef LIGHT_MODE