diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index 63d9cdea7ad..e1d07164042 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -29,12 +29,6 @@
difficulty = 5
excludefromjob = list("Captain")
-/datum/objective_item/steal/rcd
- name = "a rapid-construction-device"
- targetitem = /obj/item/weapon/rcd
- difficulty = 3
- excludefromjob = list("Chief Engineer", "Quartermaster", "Cargo Technician")
-
/datum/objective_item/steal/jetpack
name = "a jetpack"
targetitem = /obj/item/weapon/tank/jetpack
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 8662dce832e..0f478bacaf0 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -904,7 +904,7 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
icon_state = "engivend"
icon_deny = "engivend-deny"
req_access_txt = "11" //Engineering Equipment access
- products = list(/obj/item/clothing/glasses/meson/engine = 2,/obj/item/device/multitool = 4,/obj/item/weapon/airlock_electronics = 10,/obj/item/weapon/module/power_control = 10,/obj/item/weapon/airalarm_electronics = 10,/obj/item/weapon/stock_parts/cell/high = 10)
+ products = list(/obj/item/clothing/glasses/meson/engine = 2,/obj/item/device/multitool = 4,/obj/item/weapon/airlock_electronics = 10,/obj/item/weapon/module/power_control = 10,/obj/item/weapon/airalarm_electronics = 10,/obj/item/weapon/stock_parts/cell/high = 10, /obj/item/weapon/rcd/loaded = 3,)
contraband = list(/obj/item/weapon/stock_parts/cell/potato = 3)
premium = list(/obj/item/weapon/storage/belt/utility = 3)
diff --git a/code/game/objects/items/weapons/RCD.dm b/code/game/objects/items/weapons/RCD.dm
index d00a5b9d291..5f17edb6067 100644
--- a/code/game/objects/items/weapons/RCD.dm
+++ b/code/game/objects/items/weapons/RCD.dm
@@ -22,13 +22,122 @@ RCD
origin_tech = "engineering=4;materials=2"
var/datum/effect/effect/system/spark_spread/spark_system
var/matter = 0
- var/max_matter = 100
+ var/max_matter = 160
var/working = 0
var/mode = 1
var/canRwall = 0
var/disabled = 0
var/airlock_type = /obj/machinery/door/airlock
var/advanced_airlock_setting = 1 //Set to 1 if you want more paintjobs available
+ var/sheetmultiplier = 4 //Controls the amount of matter added for each glass/metal sheet, triple for plasteel
+
+ var/list/conf_access = null
+ var/use_one_access = 0 //If the airlock should require ALL or only ONE of the listed accesses.
+ var/last_configurator = null
+ var/locked = 1
+
+/obj/item/weapon/rcd/verb/change_airlock_access()
+ set name = "Change Airlock Access"
+ set category = "Object"
+ set src in usr
+
+ if (!ishuman(usr))
+ return ..(usr)
+
+ var/mob/living/carbon/human/H = usr
+ if(H.getBrainLoss() >= 60)
+ return
+
+ var/t1 = text("")
+
+
+ if (last_configurator)
+ t1 += "Operator: [last_configurator]
"
+
+ if (locked)
+ t1 += "Swipe ID
"
+ else
+ t1 += "Lock Interface
"
+
+ if(use_one_access)
+ t1 += "Restriction Type: At least one access required
"
+ else
+ t1 += "Restriction Type: All accesses required
"
+
+ t1 += "Remove All
"
+
+ var/accesses = ""
+ accesses += "Access
"
+ accesses += ""
+ t1 += "[accesses]"
+
+ t1 += text("Close
\n", src)
+
+ var/datum/browser/popup = new(usr, "airlock_electronics", "Access Control", 900, 500)
+ popup.set_content(t1)
+ popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
+ popup.open()
+ onclose(usr, "airlock")
+
+/obj/item/weapon/rcd/Topic(href, href_list)
+ ..()
+ if (usr.stat || usr.restrained() || !ishuman(usr))
+ return
+ if (href_list["close"])
+ usr << browse(null, "window=airlock")
+ return
+
+ if (href_list["login"])
+ var/obj/item/I = usr.get_active_hand()
+ if (istype(I, /obj/item/device/pda))
+ var/obj/item/device/pda/pda = I
+ I = pda.id
+ if (I && src.check_access(I))
+ src.locked = 0
+ src.last_configurator = I:registered_name
+
+ if (locked)
+ return
+
+ if (href_list["logout"])
+ locked = 1
+
+ if (href_list["access"])
+ toggle_access(href_list["access"])
+
+ change_airlock_access()
+
+/obj/item/weapon/rcd/proc/toggle_access(var/acc)
+ if (acc == "all")
+ conf_access = null
+ else if(acc == "one")
+ use_one_access = !use_one_access
+ else
+ var/req = text2num(acc)
+
+ if (conf_access == null)
+ conf_access = list()
+
+ if (!(req in conf_access))
+ conf_access += req
+ else
+ conf_access -= req
+ if (!conf_access.len)
+ conf_access = null
/obj/item/weapon/rcd/verb/change_airlock_setting()
set name = "Change Airlock Setting"
@@ -107,6 +216,9 @@ RCD
/obj/item/weapon/rcd/attackby(obj/item/weapon/W, mob/user, params)
..()
+ if(isrobot(user)) //Make sure cyborgs can't load their RCDs
+ return
+ var/loaded = 0
if(istype(W, /obj/item/weapon/rcd_ammo))
var/obj/item/weapon/rcd_ammo/R = W
if((matter + R.ammoamt) > max_matter)
@@ -117,10 +229,34 @@ RCD
qdel(W)
matter += R.ammoamt
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ loaded = 1
+ else if(istype(W, /obj/item/stack/sheet/metal) || istype(W, /obj/item/stack/sheet/glass))
+ loaded = loadwithsheets(W, sheetmultiplier, user)
+ else if(istype(W, /obj/item/stack/sheet/plasteel))
+ loaded = loadwithsheets(W, 3*sheetmultiplier, user) //Plasteel is worth 3 times more than glass or metal
+ if(loaded)
user << "The RCD now holds [matter]/[max_matter] matter-units."
desc = "A RCD. It currently holds [matter]/[max_matter] matter-units."
- return
+ return
+/obj/item/weapon/rcd/proc/loadwithsheets(obj/item/stack/sheet/S, var/value, mob/user)
+ var/maxsheets = round((max_matter-matter)/value) //calculate the max number of sheets that will fit in RCD
+ if(maxsheets > 0)
+ if(S.amount > maxsheets)
+ //S.amount -= maxsheets
+ S.use(maxsheets)
+ matter += value*maxsheets
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ user << "You insert [maxsheets] [S.name] sheets into the RCD. "
+ else
+ matter += value*(S.amount)
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ user << "You insert [S.amount] [S.name] sheets into the RCD. "
+ user.unEquip()
+ qdel(S)
+ return 1
+ user << "You can't insert any more [S.name] sheets into the RCD!"
+ return 0
/obj/item/weapon/rcd/attack_self(mob/user)
//Change the mode
@@ -129,21 +265,19 @@ RCD
if(1)
mode = 2
user << "You change RCD's mode to 'Airlock'."
- if(prob(20))
- src.spark_system.start()
- return
if(2)
mode = 3
user << "You change RCD's mode to 'Deconstruct'."
- if(prob(20))
- src.spark_system.start()
- return
if(3)
+ mode = 4
+ user << "You change RCD's mode to 'Grilles & Windows'."
+ if(4)
mode = 1
user << "You change RCD's mode to 'Floor & Walls'."
- if(prob(20))
- src.spark_system.start()
- return
+
+ if(prob(20))
+ src.spark_system.start()
+ return
/obj/item/weapon/rcd/proc/activate()
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
@@ -155,7 +289,7 @@ RCD
return 0
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)
@@ -191,12 +325,28 @@ RCD
break
if(door_check)
+ if (!conf_access)
+ user << "Configure access first!"
+ return 0
user << "You start 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 airlock_type( A )
+
+ T.electronics = new/obj/item/weapon/airlock_electronics( src.loc )
+
+ T.electronics.conf_access = conf_access.Copy()
+ T.electronics.use_one_access = use_one_access
+ T.electronics.last_configurator = last_configurator
+ T.electronics.locked = locked
+
+ if(T.electronics.use_one_access)
+ T.req_one_access = T.electronics.conf_access
+ else
+ T.req_access = T.electronics.conf_access
+
if(!T.checkForMultipleDoors())
qdel(T)
useResource(-10, user)
@@ -249,7 +399,59 @@ RCD
qdel(A)
return 1
return 0
+
+ if(istype(A, /obj/structure/window))
+ if(checkResource(5, user))
+ user << "You start deconstructing the window..."
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 50))
+ if(!useResource(5, user)) return 0
+ activate()
+ qdel(A)
+ return 1
+ return 0
+
+ if(istype(A, /obj/structure/grille))
+ if(checkResource(5, user))
+ user << "You start deconstructing the grille..."
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 50))
+ if(!useResource(5, user)) return 0
+ activate()
+ qdel(A)
+ return 1
+ return 0
return 0
+
+ if (4)
+ if(istype(A, /turf/simulated/floor))
+ if(checkResource(5, user))
+ for(var/obj/structure/grille/GRILLE in A)
+ user << "There is already a grille there!"
+ return 0
+ user << "You start building a grille..."
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 40))
+ if(!useResource(5, user)) return 0
+ activate()
+ var/obj/structure/grille/G = new/obj/structure/grille(A)
+ G.anchored = 1
+ return 1
+ return 0
+ return 0
+ if(istype(A, /obj/structure/grille))
+ if(checkResource(5, user))
+ user << "You start building a window..."
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ if(do_after(user, 40))
+ if(!useResource(5, user)) return 0
+ activate()
+ var/obj/structure/window/WD = new/obj/structure/window/fulltile(A.loc)
+ WD.anchored = 1
+ return 1
+ return 0
+ return 0
+
else
user << "ERROR: RCD in MODE: [mode] attempted use by [user]. Send this text #coderbus or an admin."
return 0
@@ -280,7 +482,7 @@ RCD
canRwall = 1
/obj/item/weapon/rcd/loaded
- matter = 100
+ matter = 160
/obj/item/weapon/rcd/combat
name = "combat RCD"
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 432dd620b70..caf820d48d3 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -158,6 +158,8 @@
icon_state = "grille"
R.use(1)
return
+ else if(istype(W, /obj/item/weapon/rcd) && istype(loc, /turf/simulated)) //Do not attack the grille if the user is holding an RCD
+ return
//window placing begin
else if(istype(W, /obj/item/stack/sheet/rglass) || istype(W, /obj/item/stack/sheet/glass))
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 5b0b47205f6..e51cae64843 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -256,6 +256,8 @@
disassembled = 1
user << "You successfully disassemble [src]."
qdel(src)
+ else if(istype(I, /obj/item/weapon/rcd)) //Do not attack the window if the user is holding an RCD
+ return
else
if(I.damtype == BRUTE || I.damtype == BURN)