diff --git a/code/__defines/_layers.dm b/code/__defines/_layers.dm
index b4269ce6e9a..567eddffb30 100644
--- a/code/__defines/_layers.dm
+++ b/code/__defines/_layers.dm
@@ -14,6 +14,7 @@
#define DOOR_CLOSED_LAYER 3.1 //Above most items if closed
#define BELOW_MOB_LAYER 3.7
#define ABOVE_MOB_LAYER 4.1
+#define ABOVE_ALL_MOB_LAYER 4.5
#define LIGHTING_LAYER 11
#define EFFECTS_ABOVE_LIGHTING_LAYER 12 // For overlays you want to be above light.
#define HUD_LAYER 20 //Above lighting, but below obfuscation. For in-game HUD effects (whereas SCREEN_LAYER is for abstract/OOC things like inventory slots)
@@ -30,4 +31,4 @@
#define MECH_ARM_LAYER 4.06
#define MECH_DECAL_LAYER 4.07
#define MECH_GEAR_LAYER 4.08
-#define MECH_ABOVE_LAYER 4.09
\ No newline at end of file
+#define MECH_ABOVE_LAYER 4.09
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 92c4eff6417..7156c9950d0 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -1040,7 +1040,7 @@ About the new airlock wires panel:
if(src.isElectrified())
if(src.shock(user, 75))
return
- if(istype(C, /obj/item/taperoll))
+ if(istype(C, /obj/item/taperoll) || istype(C, /obj/item/rfd))
return
if(!istype(C, /obj/item/forensics))
src.add_fingerprint(user)
diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm
index 86ec454a8a5..7913fb6b69b 100644
--- a/code/game/objects/effects/misc.dm
+++ b/code/game/objects/effects/misc.dm
@@ -37,3 +37,43 @@
/proc/shadow(atom/movable/target)
new /atom/movable/afterimage(get_turf(target), target)
+
+/obj/effect/constructing_effect
+ icon = 'icons/effects/effects_rfd.dmi'
+ icon_state = ""
+ layer = ABOVE_ALL_MOB_LAYER
+ anchored = TRUE
+ var/delay = 0
+ var/status = 0
+
+/obj/effect/constructing_effect/Initialize(mapload, build_delay, mode)
+ . = ..()
+ delay = build_delay // so the variables transfer over between procs.
+ status = mode
+ if(status == 3)
+ addtimer(CALLBACK(src, /atom/.proc/update_icon), 11)
+ delay -= 11
+ icon_state = "rfd_end_reverse"
+ else
+ update_icon()
+
+/obj/effect/constructing_effect/update_icon()
+ icon_state = "rfd"
+ if(delay < 10)
+ icon_state += "_shortest"
+ else if(delay < 20)
+ icon_state += "_shorter"
+ else if(delay < 37)
+ icon_state += "_short"
+ if(status == 3)
+ icon_state += "_reverse"
+
+/obj/effect/constructing_effect/proc/end_animation()
+ if(status == 3)
+ end()
+ else
+ icon_state = "rfd_end"
+ addtimer(CALLBACK(src, .proc/end), 15)
+
+/obj/effect/constructing_effect/proc/end()
+ qdel(src)
diff --git a/code/game/objects/items/weapons/RFD.dm b/code/game/objects/items/weapons/RFD.dm
index c8a02513d48..416c7c227b8 100644
--- a/code/game/objects/items/weapons/RFD.dm
+++ b/code/game/objects/items/weapons/RFD.dm
@@ -23,18 +23,23 @@
drop_sound = 'sound/items/drop/gun.ogg'
pickup_sound = 'sound/items/pickup/gun.ogg'
var/stored_matter = 30 // Starts off full.
- var/working = 0
+ var/working = FALSE
var/mode = 1
var/number_of_modes = 1
var/list/modes
var/crafting = FALSE
+ var/build_cost = 0
+ var/build_type
+ var/build_turf
+ var/build_delay
+
/obj/item/rfd/Initialize()
. = ..()
update_icon()
/obj/item/rfd/attack()
- return 0
+ return FALSE
/obj/item/rfd/proc/can_use(var/mob/user,var/turf/T)
return (user.Adjacent(T) && user.get_active_hand() == src && !user.stat && !user.restrained())
@@ -59,7 +64,6 @@
if((stored_matter + 10) > 30)
to_chat(user, "The RFD can't hold any more matter-units.")
return
- //TODO: Possible better animation
user.drop_from_inventory(W,src)
qdel(W)
stored_matter += 10
@@ -96,10 +100,10 @@
/obj/item/rfd/proc/useResource(var/amount, var/mob/user)
if(stored_matter < amount)
- return 0
+ return FALSE
stored_matter -= amount
update_icon()
- return 1
+ return TRUE
/obj/item/rfd/update_icon() //For the fancy "ammo" counter
overlays.Cut()
@@ -150,43 +154,38 @@ RFD Construction-Class
mode = 3
else
mode = 1
- to_chat(user, SPAN_NOTICE("You switch the selection dial to \"[current_mode]\"."))
- playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
- if(prob(20))
- spark(get_turf(src), 3, alldirs)
+ if(current_mode)
+ to_chat(user, SPAN_NOTICE("You switch the selection dial to \"[current_mode]\"."))
+ playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
+ if(prob(20))
+ spark(get_turf(src), 3, alldirs)
/obj/item/rfd/construction/afterattack(atom/A, mob/user, proximity)
if(!proximity)
return
if(disabled && !isrobot(user))
- return 0
+ return FALSE
if(istype(get_area(A),/area/shuttle)||istype(get_area(A),/turf/space/transit))
- return 0
+ return FALSE
var/turf/t = get_turf(A)
if (isNotStationLevel(t.z))
- return 0
+ return FALSE
return alter_turf(A, user, (mode == 3))
/obj/item/rfd/construction/proc/alter_turf(var/turf/T,var/mob/user,var/deconstruct)
- var/build_cost = 0
- var/build_type
- var/build_turf
- var/build_delay
- var/build_other
-
- if(working == 1)
- return 0
+ if(working)
+ return FALSE
if(mode == 3 && istype(T,/obj/machinery/door/airlock))
build_cost = 10
build_delay = 50
build_type = "airlock"
else if(mode == 2 && !deconstruct && istype(T,/turf/simulated/floor))
- build_cost = 10
- build_delay = 50
+ build_cost = 3
+ build_delay = 20
build_type = "airlock"
- build_other = /obj/machinery/door/airlock
+ build_turf = /obj/machinery/door/airlock
else if(!deconstruct && (istype(T,/turf/space) || istype(T,T.baseturf)))
build_cost = 1
build_type = "floor"
@@ -203,39 +202,48 @@ RFD Construction-Class
build_type = deconstruct ? "floor" : "wall"
build_turf = deconstruct ? T.baseturf : /turf/simulated/wall
else
- return 0
+ return FALSE
if(!build_type)
- working = 0
- return 0
+ working = FALSE
+ return FALSE
- if(!useResource(build_cost, user))
+ if(mode == 3 && !T.density && !istype(T,/turf/simulated/floor))
+ to_chat(user, "\The [build_type] must be closed before you can deconstruct it.")
+ return FALSE
+
+ if(stored_matter < build_cost)
to_chat(user, SPAN_WARNING("The \'Low Ammo\' light on the device blinks yellow."))
flick("[icon_state]-empty", src)
- return 0
+ return FALSE
- playsound(get_turf(src), 'sound/machines/hydraulic_long.ogg', 50, 1)
+ playsound(get_turf(src), 'sound/machines/hydraulic_short.ogg', 50, 1)
- working = 1
+ working = TRUE
user.visible_message(SPAN_NOTICE("[user] holds \the [src] towards \the [T]."), SPAN_NOTICE("You start [deconstruct ? "deconstructing" : "constructing"] \a [build_type]..."))
+ var/obj/effect/constructing_effect/rfd_effect = new(get_turf(T), src.build_delay, src.mode)
- if(build_delay && !do_after(user, build_delay))
- working = 0
- return 0
+ if((build_delay && !do_after(user, build_delay)) || (!useResource(build_cost, user)))
+ working = FALSE
+ rfd_effect.end_animation()
+ return FALSE
- working = 0
+ working = FALSE
if(build_delay && !can_use(user,T))
- return 0
+ return FALSE
if(build_turf)
T.ChangeTurf(build_turf)
- else if(build_other)
- new build_other(T)
else
qdel(T)
+ rfd_effect.end_animation()
playsound(get_turf(src), 'sound/effects/magnetclamp.ogg', 50, 1)
- return 1
+ build_cost = null
+ build_delay = null
+ build_type = null
+ build_turf = null // So it resets and any fuckery is avoided
+ return TRUE
/obj/item/rfd/construction/borg
canRwall = 1
@@ -247,11 +255,11 @@ RFD Construction-Class
var/cost = amount*30
if(R.cell.charge >= cost)
R.cell.use(cost)
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/item/rfd/construction/borg/infinite/useResource()
- return 1
+ return TRUE
/obj/item/rfd/construction/borg/attackby()
return
@@ -266,13 +274,13 @@ RFD Construction-Class
if(module.holder && module.holder.cell)
if(module.holder.cell.charge >= cost)
module.holder.cell.use(cost)
- return 1
+ return TRUE
else if(istype(user, /mob/living/heavy_vehicle))
var/obj/item/cell/c = user.get_cell()
if(c && c.charge >= cost)
c.use(cost)
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/item/rfd/construction/mounted/attackby()
return
@@ -462,8 +470,8 @@ RFD Piping-Class
var/selected_mode = STANDARD_PIPE
var/pipe_examine = "Pipe" // used in the examine proc to see what you're putting down at a glance
var/selected_pipe = 0 // default is standard pipe, used for the new pipe creation
- var/build_cost = 1 // this RFD only uses 1 unit of power per pipe, but can be modified if need be in future
- var/build_delay = 10
+ build_cost = 1 // this RFD only uses 1 unit of power per pipe, but can be modified if need be in future
+ build_delay = 10
// The numbers below refer to the numberized designator for each pipe, which is used in obj/item/pipe's new
// Take a look at code\game\machinery\pipe\construction.dm line 69 for more information. - Geeves
@@ -522,7 +530,7 @@ RFD Piping-Class
if(working)
return FALSE
- if(!useResource(build_cost, user))
+ if(stored_matter < build_cost)
to_chat(user, SPAN_WARNING("The \'Low Ammo\' light on the device blinks yellow."))
flick("[icon_state]-empty", src)
return FALSE
@@ -530,13 +538,12 @@ RFD Piping-Class
playsound(get_turf(src), 'sound/machines/click.ogg', 50, TRUE)
working = TRUE
- to_chat(user, SPAN_NOTICE("You start laying down your pipe..."))
+ user.visible_message(SPAN_NOTICE("[user] holds \the [src] towards \the [T]."), SPAN_NOTICE("You start laying down your pipe..."))
- if(build_delay && !do_after(user, build_delay))
+ if((build_delay && !do_after(user, build_delay)) || (!useResource(build_cost, user)))
working = FALSE
return FALSE
- working = FALSE
if(build_delay && !can_use(user, T))
return FALSE
diff --git a/html/changelogs/wezzy_RFD_anims.yml b/html/changelogs/wezzy_RFD_anims.yml
new file mode 100644
index 00000000000..1f9d9a53ca3
--- /dev/null
+++ b/html/changelogs/wezzy_RFD_anims.yml
@@ -0,0 +1,44 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: Wowzewow (Wezzy), MrDoomBringer
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - imageadd: "RFD-Cs have cool animations now. Check it out!"
+ - bugfix: "RFD-Cs can properly build airlocks now."
+ - bugfix: "RFDs no longer eat your ammo when you move away."
+ - bugfix: "RFD-Cs construct airlocks cheaper and faster to be more in line with wall deconstruction."
diff --git a/icons/effects/effects_rfd.dmi b/icons/effects/effects_rfd.dmi
new file mode 100644
index 00000000000..c97e314ed67
Binary files /dev/null and b/icons/effects/effects_rfd.dmi differ