Merge pull request #4375 from monster860/windowrcd

Gives the RCD the ability to construct and deconstruct windows.
This commit is contained in:
TheDZD
2016-05-12 19:35:51 -04:00

View File

@@ -74,6 +74,12 @@ RCD
src.spark_system.start()
return
if(3)
mode = 4
to_chat(user, "<span class='notice'>Changed mode to 'Windows'</span>")
if(prob(20))
src.spark_system.start()
return
if(4)
mode = 1
to_chat(user, "<span class='notice'>Changed mode to 'Floor & Walls'</span>")
if(prob(20))
@@ -88,7 +94,7 @@ RCD
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)))
if(!(istype(A, /turf) || istype(A, /obj/machinery/door/airlock) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/window)))
return 0
switch(mode)
@@ -97,7 +103,8 @@ RCD
if(useResource(1, user))
to_chat(user, "Building Floor...")
activate()
A:ChangeTurf(/turf/simulated/floor/plating)
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/floor/plating)
return 1
return 0
@@ -108,7 +115,8 @@ RCD
if(do_after(user, 20, target = A))
if(!useResource(3, user)) return 0
activate()
A:ChangeTurf(/turf/simulated/wall)
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/wall)
return 1
return 0
@@ -136,7 +144,8 @@ RCD
if(do_after(user, 40, target = A))
if(!useResource(5, user)) return 0
activate()
A:ChangeTurf(/turf/simulated/floor/plating)
var/turf/AT = A
AT.ChangeTurf(/turf/simulated/floor/plating)
return 1
return 0
@@ -147,7 +156,8 @@ RCD
if(do_after(user, 50, target = A))
if(!useResource(5, user)) return 0
activate()
A:ChangeTurf(/turf/space)
var/turf/AT = A
AT.ChangeTurf(/turf/space)
return 1
return 0
@@ -161,7 +171,78 @@ RCD
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)
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