diff --git a/code/game/objects/items/weapons/RCD.dm b/code/game/objects/items/weapons/RCD.dm
index 5d85ea20e2b..acfbb12aa30 100644
--- a/code/game/objects/items/weapons/RCD.dm
+++ b/code/game/objects/items/weapons/RCD.dm
@@ -27,225 +27,226 @@ RCD
var/mode = 1
var/canRwall = 0
- New()
+/obj/item/weapon/rcd/New()
+ desc = "A RCD. It currently holds [matter]/[max_matter] matter-units."
+ src.spark_system = new /datum/effect/system/spark_spread
+ spark_system.set_up(5, 0, src)
+ spark_system.attach(src)
+ rcd_list += src
+ return
+
+/obj/item/weapon/rcd/Destroy()
+ qdel(spark_system)
+ spark_system = null
+ rcd_list -= src
+ return ..()
+
+/obj/item/weapon/rcd/attackby(obj/item/weapon/W, mob/user, params)
+ ..()
+ if(istype(W, /obj/item/weapon/rcd_ammo))
+ var/obj/item/weapon/rcd_ammo/R = W
+ if((matter + R.ammoamt) > max_matter)
+ to_chat(user, "The RCD cant hold any more matter-units.")
+ return
+ matter += R.ammoamt
+ user.drop_item()
+ qdel(W)
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ to_chat(user, "The RCD now holds [matter]/[max_matter] matter-units.")
desc = "A RCD. It currently holds [matter]/[max_matter] matter-units."
- src.spark_system = new /datum/effect/system/spark_spread
- spark_system.set_up(5, 0, src)
- spark_system.attach(src)
- rcd_list += src
return
- Destroy()
- qdel(spark_system)
- spark_system = null
- rcd_list -= src
- return ..()
- attackby(obj/item/weapon/W, mob/user, params)
- ..()
- if(istype(W, /obj/item/weapon/rcd_ammo))
- var/obj/item/weapon/rcd_ammo/R = W
- if((matter + R.ammoamt) > max_matter)
- to_chat(user, "The RCD cant hold any more matter-units.")
- return
- matter += R.ammoamt
- user.drop_item()
- qdel(W)
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- to_chat(user, "The RCD now holds [matter]/[max_matter] matter-units.")
- desc = "A RCD. It currently holds [matter]/[max_matter] matter-units."
+/obj/item/weapon/rcd/attack_self(mob/user)
+ //Change the mode
+ playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
+ switch(mode)
+ if(1)
+ mode = 2
+ to_chat(user, "Changed mode to 'Airlock'")
+ if(prob(20))
+ src.spark_system.start()
+ return
+ if(2)
+ mode = 3
+ to_chat(user, "Changed mode to 'Deconstruct'")
+ if(prob(20))
+ src.spark_system.start()
+ return
+ if(3)
+ mode = 4
+ to_chat(user, "Changed mode to 'Windows'")
+ if(prob(20))
+ src.spark_system.start()
+ return
+ if(4)
+ mode = 1
+ to_chat(user, "Changed mode to 'Floor & Walls'")
+ if(prob(20))
+ src.spark_system.start()
return
- attack_self(mob/user)
- //Change the mode
- playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
- switch(mode)
- if(1)
- mode = 2
- to_chat(user, "Changed mode to 'Airlock'")
- if(prob(20))
- src.spark_system.start()
- return
- if(2)
- mode = 3
- to_chat(user, "Changed mode to 'Deconstruct'")
- if(prob(20))
- src.spark_system.start()
- return
- if(3)
- mode = 4
- to_chat(user, "Changed mode to 'Windows'")
- if(prob(20))
- src.spark_system.start()
- return
- if(4)
- mode = 1
- to_chat(user, "Changed mode to 'Floor & Walls'")
- if(prob(20))
- src.spark_system.start()
- return
-
- proc/activate()
- playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
+/obj/item/weapon/rcd/proc/activate()
+ playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
- afterattack(atom/A, mob/user, proximity)
- if(!proximity) return
- if(istype(A,/area/shuttle)||istype(A,/turf/space/transit))
- return 0
- if(!(istype(A, /turf) || istype(A, /obj/machinery/door/airlock) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/window)))
- return 0
+/obj/item/weapon/rcd/afterattack(atom/A, mob/user, proximity)
+ if(!proximity) return
+ if(istype(A,/area/shuttle)||istype(A,/turf/space/transit))
+ return 0
+ if(!(istype(A, /turf) || istype(A, /obj/machinery/door/airlock) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/window)))
+ return 0
- switch(mode)
- if(1)
- if(istype(A, /turf/space))
- if(useResource(1, user))
- to_chat(user, "Building Floor...")
+ switch(mode)
+ if(1)
+ if(istype(A, /turf/space))
+ if(useResource(1, user))
+ to_chat(user, "Building Floor...")
+ activate()
+ var/turf/AT = A
+ AT.ChangeTurf(/turf/simulated/floor/plating)
+ return 1
+ return 0
+
+ if(istype(A, /turf/simulated/floor))
+ if(checkResource(3, user))
+ to_chat(user, "Building Wall ...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 20, target = A))
+ if(!useResource(3, user)) return 0
+ activate()
+ var/turf/AT = A
+ AT.ChangeTurf(/turf/simulated/wall)
+ return 1
+ return 0
+
+ if(2)
+ if(istype(A, /turf/simulated/floor))
+ if(checkResource(10, user))
+ to_chat(user, "Building Airlock...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 50, target = A))
+ if(!useResource(10, user)) return 0
+ activate()
+ var/obj/machinery/door/airlock/T = new /obj/machinery/door/airlock( A )
+ T.autoclose = 1
+ return 1
+ return 0
+ return 0
+
+ if(3)
+ if(istype(A, /turf/simulated/wall))
+ if(istype(A, /turf/simulated/wall/r_wall) && !canRwall)
+ return 0
+ if(checkResource(5, user))
+ to_chat(user, "Deconstructing Wall...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 40, target = A))
+ if(!useResource(5, user)) return 0
activate()
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/floor/plating)
return 1
- return 0
+ return 0
- if(istype(A, /turf/simulated/floor))
- if(checkResource(3, user))
- to_chat(user, "Building Wall ...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(do_after(user, 20, target = A))
- if(!useResource(3, user)) return 0
- activate()
- var/turf/AT = A
- AT.ChangeTurf(/turf/simulated/wall)
- return 1
- return 0
-
- if(2)
- if(istype(A, /turf/simulated/floor))
- if(checkResource(10, user))
- to_chat(user, "Building Airlock...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(do_after(user, 50, target = A))
- if(!useResource(10, user)) return 0
- activate()
- var/obj/machinery/door/airlock/T = new /obj/machinery/door/airlock( A )
- T.autoclose = 1
- return 1
- return 0
- return 0
-
- if(3)
- if(istype(A, /turf/simulated/wall))
- if(istype(A, /turf/simulated/wall/r_wall) && !canRwall)
- return 0
- if(checkResource(5, user))
- to_chat(user, "Deconstructing Wall...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(do_after(user, 40, target = A))
- if(!useResource(5, user)) return 0
- activate()
- var/turf/AT = A
- AT.ChangeTurf(/turf/simulated/floor/plating)
- return 1
- return 0
-
- if(istype(A, /turf/simulated/floor))
- if(checkResource(5, user))
- to_chat(user, "Deconstructing Floor...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(do_after(user, 50, target = A))
- if(!useResource(5, user)) return 0
- activate()
- var/turf/AT = A
- AT.ChangeTurf(/turf/space)
- return 1
- return 0
-
- if(istype(A, /obj/machinery/door/airlock))
- if(checkResource(20, user))
- to_chat(user, "Deconstructing Airlock...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(do_after(user, 50, target = A))
- if(!useResource(20, user)) return 0
- activate()
- qdel(A)
- return 1
- return 0
-
- if(istype(A, /obj/structure/window)) // You mean the grille of course, do you?
- A = locate(/obj/structure/grille) in A.loc
-
- if(istype(A, /obj/structure/grille))
- if(!checkResource(2, user))
- return 0
- to_chat(user, "Deconstructing window...")
+ if(istype(A, /turf/simulated/floor))
+ if(checkResource(5, user))
+ to_chat(user, "Deconstructing Floor...")
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(!do_after(user, 20, target = A))
- return 0
- if(locate(/obj/structure/window/full/shuttle) in A.contents)
- return 0 // Let's not give shuttle-griefers an easy time.
- if(!useResource(2, user))
- return 0
- activate()
- var/turf/T1 = get_turf(A)
- qdel(A)
- A = null
- for(var/obj/structure/window/W in T1.contents)
- W.disassembled = 1
- W.density = 0
- qdel(W)
- for(var/cdir in cardinal)
- var/turf/T2 = get_step(T1, cdir)
- if(locate(/obj/structure/window/full/shuttle) in T2.contents)
- continue // Shuttle windows? Nah. We don't need extra windows there.
- if(!(locate(/obj/structure/grille) in T2.contents))
- continue
- for(var/obj/structure/window/W in T2.contents)
+ if(do_after(user, 50, target = A))
+ if(!useResource(5, user)) return 0
+ activate()
+ var/turf/AT = A
+ AT.ChangeTurf(/turf/space)
+ return 1
+ return 0
+
+ if(istype(A, /obj/machinery/door/airlock))
+ if(checkResource(20, user))
+ to_chat(user, "Deconstructing Airlock...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 50, target = A))
+ if(!useResource(20, user)) return 0
+ activate()
+ qdel(A)
+ return 1
+ return 0
+
+ if(istype(A, /obj/structure/window)) // You mean the grille of course, do you?
+ A = locate(/obj/structure/grille) in A.loc
+
+ if(istype(A, /obj/structure/grille))
+ if(!checkResource(2, user))
+ return 0
+ to_chat(user, "Deconstructing window...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(!do_after(user, 20, target = A))
+ return 0
+ if(locate(/obj/structure/window/full/shuttle) in A.contents)
+ return 0 // Let's not give shuttle-griefers an easy time.
+ if(!useResource(2, user))
+ return 0
+ activate()
+ var/turf/T1 = get_turf(A)
+ qdel(A)
+ A = null
+ for(var/obj/structure/window/W in T1.contents)
+ W.disassembled = 1
+ W.density = 0
+ qdel(W)
+ for(var/cdir in cardinal)
+ var/turf/T2 = get_step(T1, cdir)
+ if(locate(/obj/structure/window/full/shuttle) in T2.contents)
+ continue // Shuttle windows? Nah. We don't need extra windows there.
+ if(!(locate(/obj/structure/grille) in T2.contents))
+ continue
+ for(var/obj/structure/window/W in T2.contents)
+ if(W.dir == turn(cdir, 180))
+ W.disassembled = 1
+ W.density = 0
+ qdel(W)
+ var/obj/structure/window/reinforced/W = new(T2)
+ W.dir = turn(cdir, 180)
+ return 1
+ return 0
+ if(4)
+ if(istype(A, /turf/simulated/floor))
+ if(locate(/obj/structure/grille) in contents)
+ return 0 // We already have window
+ if(!checkResource(2, user))
+ return 0
+ to_chat(user, "Constructing window...")
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(!do_after(user, 20, target = A))
+ return 0
+ if(locate(/obj/structure/grille) in A.contents)
+ return 0 // We already have window
+ if(!useResource(2, user))
+ return 0
+ activate()
+ new /obj/structure/grille(A)
+ for(var/obj/structure/window/W in contents)
+ W.disassembled = 1 // Prevent that annoying glass breaking sound
+ W.density = 0
+ qdel(W)
+ for(var/cdir in cardinal)
+ var/turf/T = get_step(A, cdir)
+ if(locate(/obj/structure/grille) in T.contents)
+ for(var/obj/structure/window/W in T.contents)
if(W.dir == turn(cdir, 180))
W.disassembled = 1
W.density = 0
qdel(W)
- var/obj/structure/window/reinforced/W = new(T2)
- W.dir = turn(cdir, 180)
- return 1
- return 0
- if(4)
- if(istype(A, /turf/simulated/floor))
- if(locate(/obj/structure/grille) in contents)
- return 0 // We already have window
- if(!checkResource(2, user))
- return 0
- to_chat(user, "Constructing window...")
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- if(!do_after(user, 20, target = A))
- return 0
- if(locate(/obj/structure/grille) in A.contents)
- return 0 // We already have window
- if(!useResource(2, user))
- return 0
- activate()
- new /obj/structure/grille(A)
- for(var/obj/structure/window/W in contents)
- W.disassembled = 1 // Prevent that annoying glass breaking sound
- W.density = 0
- qdel(W)
- for(var/cdir in cardinal)
- var/turf/T = get_step(A, cdir)
- if(locate(/obj/structure/grille) in T.contents)
- for(var/obj/structure/window/W in T.contents)
- if(W.dir == turn(cdir, 180))
- W.disassembled = 1
- W.density = 0
- qdel(W)
- else // Build a window!
- var/obj/structure/window/reinforced/W = new(A)
- W.dir = cdir
- var/turf/AT = A
- AT.ChangeTurf(/turf/simulated/floor/plating) // Platings go under windows.
- return 1
- else
- to_chat(user, "ERROR: RCD in MODE: [mode] attempted use by [user]. Send this text #coderbus or an admin.")
- return 0
+ else // Build a window!
+ var/obj/structure/window/reinforced/W = new(A)
+ W.dir = cdir
+ var/turf/AT = A
+ AT.ChangeTurf(/turf/simulated/floor/plating) // Platings go under windows.
+ return 1
+ else
+ to_chat(user, "ERROR: RCD in MODE: [mode] attempted use by [user]. Send this text #coderbus or an admin.")
+ return 0
/obj/item/weapon/rcd/proc/useResource(var/amount, var/mob/user)
if(matter < amount)