diff --git a/_maps/RandomRuins/SpaceRuins/oldstation.dmm b/_maps/RandomRuins/SpaceRuins/oldstation.dmm
index e820b06f61..89e2c553b9 100644
--- a/_maps/RandomRuins/SpaceRuins/oldstation.dmm
+++ b/_maps/RandomRuins/SpaceRuins/oldstation.dmm
@@ -1651,7 +1651,7 @@
/turf/open/floor/plasteel/white,
/area/ruin/space/has_grav/ancientstation/rnd)
"eD" = (
-/obj/machinery/mecha_part_fabricator,
+/obj/machinery/mecha_part_fabricator/offstation,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/plasteel/white,
/area/ruin/space/has_grav/ancientstation/rnd)
@@ -2010,12 +2010,12 @@
/turf/open/floor/plasteel,
/area/ruin/space/has_grav/ancientstation/deltacorridor)
"fu" = (
-/obj/machinery/rnd/production/protolathe,
+/obj/machinery/rnd/production/protolathe/offstation,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/plasteel/white,
/area/ruin/space/has_grav/ancientstation/rnd)
"fv" = (
-/obj/machinery/rnd/production/circuit_imprinter,
+/obj/machinery/rnd/production/circuit_imprinter/offstation,
/obj/effect/decal/cleanable/dirt,
/obj/item/reagent_containers/dropper,
/turf/open/floor/plasteel/white,
diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm
index 3fb149d071..37633ae52f 100644
--- a/code/__DEFINES/misc.dm
+++ b/code/__DEFINES/misc.dm
@@ -71,14 +71,6 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
#define ABOVE_SHOES_LAYER (SHOES_LAYER-1)
#define ABOVE_BODY_FRONT_LAYER (BODY_FRONT_LAYER-1)
-
-//Security levels
-#define SEC_LEVEL_GREEN 0
-#define SEC_LEVEL_BLUE 1
-#define SEC_LEVEL_AMBER 2
-#define SEC_LEVEL_RED 3
-#define SEC_LEVEL_DELTA 4
-
//some arbitrary defines to be used by self-pruning global lists. (see master_controller)
#define PROCESS_KILL 26 //Used to trigger removal from a processing list
diff --git a/code/__DEFINES/security_levels.dm b/code/__DEFINES/security_levels.dm
new file mode 100644
index 0000000000..19c66d9125
--- /dev/null
+++ b/code/__DEFINES/security_levels.dm
@@ -0,0 +1,10 @@
+//Security levels
+#define SEC_LEVEL_GREEN 1
+#define SEC_LEVEL_BLUE 2
+#define SEC_LEVEL_AMBER 3
+#define SEC_LEVEL_RED 4
+#define SEC_LEVEL_DELTA 5
+
+//Macro helpers.
+#define SECLEVEL2NUM(text) (GLOB.all_security_levels.Find(text))
+#define NUM2SECLEVEL(num) (ISINRANGE(num, 1, length(GLOB.all_security_levels)) ? GLOB.all_security_levels[num] : null)
diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm
index e4a3ff1f9a..58d73ded68 100644
--- a/code/controllers/subsystem/shuttle.dm
+++ b/code/controllers/subsystem/shuttle.dm
@@ -217,13 +217,13 @@ SUBSYSTEM_DEF(shuttle)
call_reason = trim(html_encode(call_reason))
- if(length(call_reason) < CALL_SHUTTLE_REASON_LENGTH && seclevel2num(get_security_level()) > SEC_LEVEL_GREEN)
+ if(length(call_reason) < CALL_SHUTTLE_REASON_LENGTH && SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level)) > SEC_LEVEL_GREEN)
to_chat(user, "You must provide a reason.")
return
var/area/signal_origin = get_area(user)
var/emergency_reason = "\nNature of emergency:\n\n[call_reason]"
- var/security_num = seclevel2num(get_security_level())
+ var/security_num = SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level))
switch(security_num)
if(SEC_LEVEL_RED,SEC_LEVEL_DELTA)
emergency.request(null, signal_origin, html_decode(emergency_reason), 1) //There is a serious threat we gotta move no time to give them five minutes.
@@ -285,7 +285,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/canRecall()
if(!emergency || emergency.mode != SHUTTLE_CALL || emergencyNoRecall || SSticker.mode.name == "meteor")
return
- var/security_num = seclevel2num(get_security_level())
+ var/security_num = SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level))
switch(security_num)
if(SEC_LEVEL_GREEN)
if(emergency.timeLeft(1) < emergencyCallTime)
@@ -642,7 +642,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/autoEnd() //CIT CHANGE - allows shift to end without being a proper shuttle call?
if(EMERGENCY_IDLE_OR_RECALLED)
SSshuttle.emergency.request(silent = TRUE)
- priority_announce("The shift has come to an end and the shuttle called. [seclevel2num(get_security_level()) == SEC_LEVEL_RED ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [emergency.timeLeft(600)] minutes.", null, "shuttlecalled", "Priority")
+ priority_announce("The shift has come to an end and the shuttle called. [SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level)) == SEC_LEVEL_RED ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [emergency.timeLeft(600)] minutes.", null, "shuttlecalled", "Priority")
log_game("Round end vote passed. Shuttle has been auto-called.")
message_admins("Round end vote passed. Shuttle has been auto-called.")
emergencyNoRecall = TRUE
diff --git a/code/datums/world_topic.dm b/code/datums/world_topic.dm
index c2855250f4..30699d36f4 100644
--- a/code/datums/world_topic.dm
+++ b/code/datums/world_topic.dm
@@ -169,7 +169,7 @@
.["real_mode"] = SSticker.mode.name
// Key-authed callers may know the truth behind the "secret"
- .["security_level"] = get_security_level()
+ .["security_level"] = NUM2SECLEVEL(GLOB.security_level)
.["round_duration"] = SSticker ? round((world.time-SSticker.round_start_time)/10) : 0
// Amount of world's ticks in seconds, useful for calculating round duration
diff --git a/code/game/gamemodes/gangs/dominator.dm b/code/game/gamemodes/gangs/dominator.dm
index 858c10c46c..dca50be5b9 100644
--- a/code/game/gamemodes/gangs/dominator.dm
+++ b/code/game/gamemodes/gangs/dominator.dm
@@ -229,7 +229,7 @@
if(!was_stranded)
priority_announce("All hostile activity within station systems has ceased.","Network Alert")
- if(get_security_level() == "delta")
+ if(NUM2SECLEVEL(GLOB.security_level) == "delta")
set_security_level("red")
SSshuttle.clearHostileEnvironment(src)
diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index 8b3958e606..64704d4771 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -439,8 +439,3 @@
desc = "An autolathe reprogrammed with security protocols to prevent hacking."
hackable = FALSE
circuit = /obj/item/circuitboard/machine/autolathe/secure
-
-//Called when the object is constructed by an autolathe
-//Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes
-/obj/item/proc/autolathe_crafted(obj/machinery/autolathe/A)
- return
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index 4c3d85a162..6eb06e3be4 100755
--- a/code/game/machinery/computer/communications.dm
+++ b/code/game/machinery/computer/communications.dm
@@ -111,7 +111,7 @@
to_chat(usr, "Authorization confirmed. Modifying security level.")
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
//Only notify people if an actual change happened
- var/security_level = get_security_level()
+ var/security_level = NUM2SECLEVEL(GLOB.security_level)
log_game("[key_name(usr)] has changed the security level to [security_level] with [src] at [AREACOORD(usr)].")
message_admins("[ADMIN_LOOKUPFLW(usr)] has changed the security level to [security_level] with [src] at [AREACOORD(usr)].")
deadchat_broadcast("[usr.real_name] has changed the security level to [security_level] with [src] at [get_area_name(usr, TRUE)].", usr)
@@ -404,7 +404,7 @@
security_level_cd = world.time + 15 SECONDS
if(GLOB.security_level != old_level)
//Only notify people if an actual change happened
- var/security_level = get_security_level()
+ var/security_level = NUM2SECLEVEL(GLOB.security_level)
log_game("[key_name(usr)] has changed the security level to [security_level] from [src] at [AREACOORD(usr)].")
message_admins("[ADMIN_LOOKUPFLW(usr)] has changed the security level to [security_level] from [src] at [AREACOORD(usr)].")
deadchat_broadcast("[usr.real_name] has changed the security level to [security_level] from [src] at [get_area_name(usr, TRUE)].", usr)
@@ -555,7 +555,7 @@
dat += " Biohazard \]
"
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
if(STATE_ALERT_LEVEL)
- dat += "Current alert level: [get_security_level()]
"
+ dat += "Current alert level: [NUM2SECLEVEL(GLOB.security_level)]
"
if(GLOB.security_level == SEC_LEVEL_DELTA)
dat += "The self-destruct mechanism is active. Find a way to deactivate the mechanism to lower the alert level or evacuate."
else
@@ -563,8 +563,8 @@
dat += "Blue
"
dat += "Green"
if(STATE_CONFIRM_LEVEL)
- dat += "Current alert level: [get_security_level()]
"
- dat += "Confirm the change to: [num2seclevel(tmp_alertlevel)]
"
+ dat += "Current alert level: [NUM2SECLEVEL(GLOB.security_level)]
"
+ dat += "Confirm the change to: [NUM2SECLEVEL(tmp_alertlevel)]
"
dat += "Swipe ID to confirm change.
"
if(STATE_TOGGLE_EMERGENCY)
playsound(src, 'sound/machines/terminal_prompt.ogg', 50, 0)
@@ -696,7 +696,7 @@
dat += " Biohazard \]
"
if(STATE_ALERT_LEVEL)
- dat += "Current alert level: [get_security_level()]
"
+ dat += "Current alert level: [NUM2SECLEVEL(GLOB.security_level)]
"
if(GLOB.security_level == SEC_LEVEL_DELTA)
dat += "The self-destruct mechanism is active. Find a way to deactivate the mechanism to lower the alert level or evacuate."
else
diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm
index 9acc8921b9..fb321665bc 100644
--- a/code/game/mecha/mech_fabricator.dm
+++ b/code/game/mecha/mech_fabricator.dm
@@ -19,6 +19,7 @@
var/processing_queue = 0
var/screen = "main"
var/temp
+ var/offstation_security_levels = TRUE
var/list/part_sets = list(
"Cyborg",
"Ripley",
@@ -72,6 +73,8 @@
for(var/obj/item/stock_parts/manipulator/Ml in component_parts)
T += Ml.rating
time_coeff = round(initial(time_coeff) - (initial(time_coeff)*(T))/5,0.01)
+ var/obj/item/circuitboard/machine/mechfab/C = circuit
+ offstation_security_levels = C.offstation_security_levels
/obj/machinery/mecha_part_fabricator/examine(mob/user)
. = ..()
@@ -106,13 +109,27 @@
if(!(set_name in D.category))
continue
output += "[output_part_info(D)]
\["
- if(check_resources(D))
+ if(check_clearance(D) && check_resources(D))
output += "
Build | "
output += "
Add to queue\]\[
?\]
"
return output
+/obj/machinery/mecha_part_fabricator/proc/check_clearance(datum/design/D)
+ if(!(obj_flags & EMAGGED) && (offstation_security_levels || is_station_level(z)) && !ISINRANGE(GLOB.security_level, D.min_security_level, D.max_security_level))
+ return FALSE
+ return TRUE
+
/obj/machinery/mecha_part_fabricator/proc/output_part_info(datum/design/D)
- var/output = "[initial(D.name)] (Cost: [output_part_cost(D)]) [get_construction_time_w_coeff(D)/10]sec"
+ var/clearance = !(obj_flags & EMAGGED) && (offstation_security_levels || is_station_level(z))
+ var/sec_text = ""
+ if(clearance && (D.min_security_level > SEC_LEVEL_GREEN || D.max_security_level < SEC_LEVEL_DELTA))
+ sec_text = " (Allowed security levels: "
+ for(var/n in D.min_security_level to D.max_security_level)
+ sec_text += NUM2SECLEVEL(n)
+ if(n + 1 <= D.max_security_level)
+ sec_text += ", "
+ sec_text += ") "
+ var/output = "[initial(D.name)] (Cost: [output_part_cost(D)]) [sec_text][get_construction_time_w_coeff(D)/10]sec"
return output
/obj/machinery/mecha_part_fabricator/proc/output_part_cost(datum/design/D)
@@ -216,6 +233,11 @@
while(D)
if(stat&(NOPOWER|BROKEN))
return FALSE
+ if(!check_clearance(D))
+ say("Security level not met. Queue processing stopped.")
+ temp = {"Security level not met to build next part.
+ Try again | Return"}
+ return FALSE
if(!check_resources(D))
say("Not enough resources. Queue processing stopped.")
temp = {"Not enough resources to build next part.
@@ -236,7 +258,7 @@
for(var/datum/design/D in queue)
i++
var/obj/part = D.build_path
- output += ""
+ output += ""
output += initial(part.name) + " - "
output += "[i>1?"↑":null] "
output += "[i↓":null] "
@@ -440,3 +462,7 @@
return FALSE
return TRUE
+
+/obj/machinery/mecha_part_fabricator/offstation
+ offstation_security_levels = FALSE
+ circuit = /obj/item/circuitboard/machine/mechfab/offstation
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 5c80b81ba5..9778499aac 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -896,3 +896,11 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
. = ..()
if(var_name == NAMEOF(src, slowdown))
set_slowdown(var_value) //don't care if it's a duplicate edit as slowdown'll be set, do it anyways to force normal behavior.
+
+//Called when the object is constructed by an autolathe
+//Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes
+/obj/item/proc/autolathe_crafted(obj/machinery/autolathe/A)
+ return
+
+/obj/item/proc/rnd_crafted(obj/machinery/rnd/production/P)
+ return
diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm
index ef0380fce0..57638060f3 100644
--- a/code/game/objects/items/circuitboards/machine_circuitboards.dm
+++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm
@@ -308,6 +308,13 @@
/obj/item/stock_parts/manipulator = 1,
/obj/item/stock_parts/micro_laser = 1,
/obj/item/stack/sheet/glass = 1)
+ var/offstation_security_levels = TRUE
+
+/obj/item/circuitboard/machine/mechfab/offstation
+ offstation_security_levels = FALSE
+
+/obj/item/circuitboard/machine/mechfab/rnd_crafted(obj/machinery/rnd/production/P)
+ offstation_security_levels = P.offstation_security_levels
/obj/item/circuitboard/machine/cryo_tube
name = "Cryotube (Machine Board)"
@@ -759,6 +766,13 @@
/obj/item/stock_parts/matter_bin = 1,
/obj/item/stock_parts/manipulator = 1,
/obj/item/reagent_containers/glass/beaker = 2)
+ var/offstation_security_levels = TRUE
+
+/obj/item/circuitboard/machine/circuit_imprinter/offstation
+ offstation_security_levels = FALSE
+
+/obj/item/circuitboard/machine/mechfab/rnd_crafted(obj/machinery/rnd/production/P)
+ offstation_security_levels = P.offstation_security_levels
/obj/item/circuitboard/machine/circuit_imprinter/department
name = "Departmental Circuit Imprinter (Machine Board)"
@@ -832,6 +846,13 @@
/obj/item/stock_parts/matter_bin = 2,
/obj/item/stock_parts/manipulator = 2,
/obj/item/reagent_containers/glass/beaker = 2)
+ var/offstation_security_levels = TRUE
+
+/obj/item/circuitboard/machine/protolathe/offstation
+ offstation_security_levels = FALSE
+
+/obj/item/circuitboard/machine/protolathe/rnd_crafted(obj/machinery/rnd/production/P)
+ offstation_security_levels = P.offstation_security_levels
/obj/item/circuitboard/machine/protolathe/department
name = "Departmental Protolathe (Machine Board)"
diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm
index 515c39ffcb..2d2e60cfbf 100644
--- a/code/game/objects/items/storage/boxes.dm
+++ b/code/game/objects/items/storage/boxes.dm
@@ -1117,9 +1117,9 @@
desc = "A box containing a gift for worthy golems."
/obj/item/storage/box/rndboards/PopulateContents()
- new /obj/item/circuitboard/machine/protolathe(src)
+ new /obj/item/circuitboard/machine/protolathe/offstation(src)
new /obj/item/circuitboard/machine/destructive_analyzer(src)
- new /obj/item/circuitboard/machine/circuit_imprinter(src)
+ new /obj/item/circuitboard/machine/circuit_imprinter/offstation(src)
new /obj/item/circuitboard/computer/rdconsole(src)
/obj/item/storage/box/silver_sulf
diff --git a/code/game/world.dm b/code/game/world.dm
index bee595047f..1d719ee138 100644
--- a/code/game/world.dm
+++ b/code/game/world.dm
@@ -298,8 +298,8 @@ GLOBAL_LIST(topic_status_cache)
if(SSmapping.config) // this just stops the runtime, honk.
features += "[SSmapping.config.map_name]" //CIT CHANGE - makes the hub entry display the current map
- if(get_security_level())//CIT CHANGE - makes the hub entry show the security level
- features += "[get_security_level()] alert"
+ if(NUM2SECLEVEL(GLOB.security_level))//CIT CHANGE - makes the hub entry show the security level
+ features += "[NUM2SECLEVEL(GLOB.security_level)] alert"
if (n > 1)
features += "~[n] players"
diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm
index fcb57a5a2e..ffab8174e5 100644
--- a/code/modules/antagonists/cult/cult_items.dm
+++ b/code/modules/antagonists/cult/cult_items.dm
@@ -539,7 +539,7 @@
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
var/cursetime = 1800
var/timer = SSshuttle.emergency.timeLeft(1) + cursetime
- var/security_num = seclevel2num(get_security_level())
+ var/security_num = SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level))
var/set_coefficient = 1
switch(security_num)
if(SEC_LEVEL_GREEN)
diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
index 5552efef1f..dc44a3b2d8 100644
--- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
+++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
@@ -41,7 +41,7 @@
STOP_PROCESSING(SSobj, core)
update_icon()
GLOB.poi_list |= src
- previous_level = get_security_level()
+ previous_level = NUM2SECLEVEL(GLOB.security_level)
/obj/machinery/nuclearbomb/Destroy()
safety = FALSE
@@ -419,7 +419,7 @@
return
timing = !timing
if(timing)
- previous_level = get_security_level()
+ previous_level = NUM2SECLEVEL(GLOB.security_level)
detonation_timer = world.time + (timer_set * 10)
for(var/obj/item/pinpointer/nuke/syndicate/S in GLOB.pinpointer_list)
S.switch_mode_to(TRACK_INFILTRATOR)
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 4ef5993d2d..b389e386d4 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -237,7 +237,7 @@
return
if(!CONFIG_GET(flag/disable_secborg) && GLOB.security_level < CONFIG_GET(number/minimum_secborg_alert))
- to_chat(src, "NOTICE: Due to local station regulations, the security cyborg module and its variants are only available during [num2seclevel(CONFIG_GET(number/minimum_secborg_alert))] alert and greater.")
+ to_chat(src, "NOTICE: Due to local station regulations, the security cyborg module and its variants are only available during [NUM2SECLEVEL(CONFIG_GET(number/minimum_secborg_alert))] alert and greater.")
var/list/modulelist = list("Standard" = /obj/item/robot_module/standard, \
"Engineering" = /obj/item/robot_module/engineering, \
diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm
index f3ac118134..f19ff767d2 100644
--- a/code/modules/research/designs.dm
+++ b/code/modules/research/designs.dm
@@ -36,6 +36,9 @@ other types of metals and chemistry for reagents).
var/dangerous_construction = FALSE //notify and log for admin investigations if this is printed.
var/departmental_flags = ALL //bitflags for deplathes.
var/list/datum/techweb_node/unlocked_by = list()
+ ///minimum and security levels the design can be printed on.
+ var/min_security_level = SEC_LEVEL_GREEN
+ var/max_security_level = SEC_LEVEL_DELTA
var/research_icon //Replaces the item icon in the research console
var/research_icon_state
var/icon_cache
diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm
index bd571607d2..0550fa9334 100644
--- a/code/modules/research/machinery/_production.dm
+++ b/code/modules/research/machinery/_production.dm
@@ -3,6 +3,7 @@
desc = "Makes researched and prototype items with materials and energy."
layer = BELOW_OBJ_LAYER
var/consoleless_interface = TRUE //Whether it can be used without a console.
+ var/offstation_security_levels = TRUE
var/efficiency_coeff = 1 //Materials needed / coeff = actual.
var/list/categories = list()
var/datum/component/remote_materials/materials
@@ -98,6 +99,7 @@
var/obj/item/I = O
I.material_flags |= MATERIAL_NO_EFFECTS //Find a better way to do this.
I.set_custom_materials(matlist.Copy())
+ I.rnd_crafted(src)
SSblackbox.record_feedback("nested tally", "item_printed", amount, list("[type]", "[path]"))
investigate_log("[key_name(user)] built [amount] of [path] at [src]([type]).", INVESTIGATE_RESEARCH)
@@ -134,6 +136,12 @@
if(D.build_type && !(D.build_type & allowed_buildtypes))
say("This machine does not have the necessary manipulation systems for this design. Please contact Nanotrasen Support!")
return FALSE
+ if(!(obj_flags & EMAGGED) && (offstation_security_levels || is_station_level(z)))
+ if(GLOB.security_level < D.min_security_level)
+ say("Minimum security alert level required to print this design not met, please contact the command staff.")
+ return FALSE
+ if(GLOB.security_level > D.max_security_level)
+ say("Exceeded maximum security alert level required to print this design, please contact the command staff.")
if(!materials.mat_container)
say("No connection to material storage, please contact the quartermaster.")
return FALSE
@@ -275,15 +283,26 @@
temp_material += " [all_materials[M]/coeff] [CallMaterialName(M)]"
c = min(c,t)
- if (c >= 1)
+ var/clearance = !(obj_flags & EMAGGED) && (offstation_security_levels || is_station_level(z))
+ var/sec_text = ""
+ if(clearance && (D.min_security_level > SEC_LEVEL_GREEN || D.max_security_level < SEC_LEVEL_DELTA))
+ sec_text = " (Allowed security levels: "
+ for(var/n in D.min_security_level to D.max_security_level)
+ sec_text += NUM2SECLEVEL(n)
+ if(n + 1 <= D.max_security_level)
+ sec_text += ", "
+ sec_text += ")"
+
+ clearance = !clearance || ISINRANGE(GLOB.security_level, D.min_security_level, D.max_security_level)
+ if (c >= 1 && clearance)
l += "[D.name][RDSCREEN_NOBREAK]"
if(c >= 5)
l += "x5[RDSCREEN_NOBREAK]"
if(c >= 10)
l += "x10[RDSCREEN_NOBREAK]"
- l += "[temp_material][RDSCREEN_NOBREAK]"
+ l += "[temp_material][sec_text][RDSCREEN_NOBREAK]"
else
- l += "[D.name][temp_material][RDSCREEN_NOBREAK]"
+ l += "[D.name][temp_material][sec_text][RDSCREEN_NOBREAK]"
l += ""
return l
diff --git a/code/modules/research/machinery/circuit_imprinter.dm b/code/modules/research/machinery/circuit_imprinter.dm
index 948dad61db..661ebe31c0 100644
--- a/code/modules/research/machinery/circuit_imprinter.dm
+++ b/code/modules/research/machinery/circuit_imprinter.dm
@@ -30,3 +30,9 @@
total_rating += M.rating * 2 //There is only one.
total_rating = max(1, total_rating)
efficiency_coeff = total_rating
+ var/obj/item/circuitboard/machine/circuit_imprinter/C = circuit
+ offstation_security_levels = C.offstation_security_levels
+
+/obj/machinery/rnd/production/circuit_imprinter/offstation
+ offstation_security_levels = FALSE
+ circuit = /obj/item/circuitboard/machine/circuit_imprinter/offstation
diff --git a/code/modules/research/machinery/protolathe.dm b/code/modules/research/machinery/protolathe.dm
index 684f27ccad..b1b31a279c 100644
--- a/code/modules/research/machinery/protolathe.dm
+++ b/code/modules/research/machinery/protolathe.dm
@@ -23,3 +23,12 @@
/obj/machinery/rnd/production/protolathe/disconnect_console()
linked_console.linked_lathe = null
..()
+
+/obj/machinery/rnd/production/protolathe/calculate_efficiency()
+ . = ..()
+ var/obj/item/circuitboard/machine/protolathe/C = circuit
+ offstation_security_levels = C.offstation_security_levels
+
+/obj/machinery/rnd/production/protolathe/offstation
+ offstation_security_levels = FALSE
+ circuit = /obj/item/circuitboard/machine/protolathe/offstation
diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm
index be1b9460b0..19f6e3ffdb 100644
--- a/code/modules/research/rdconsole.dm
+++ b/code/modules/research/rdconsole.dm
@@ -301,15 +301,26 @@ Nothing else in the console has ID requirements.
temp_material += " [all_materials[M]/coeff] [CallMaterialName(M)]"
c = min(c,t)
- if (c >= 1)
+ var/clearance = !(linked_lathe.obj_flags & EMAGGED) && (linked_lathe.offstation_security_levels || is_station_level(linked_lathe.z))
+ var/sec_text = ""
+ if(clearance && (D.min_security_level > SEC_LEVEL_GREEN || D.max_security_level < SEC_LEVEL_DELTA))
+ sec_text = " (Allowed security levels: "
+ for(var/n in D.min_security_level to D.max_security_level)
+ sec_text += NUM2SECLEVEL(n)
+ if(n + 1 <= D.max_security_level)
+ sec_text += ", "
+ sec_text += ")"
+
+ clearance = !clearance || ISINRANGE(GLOB.security_level, D.min_security_level, D.max_security_level)
+ if (c >= 1 && clearance)
l += "[D.name][RDSCREEN_NOBREAK]"
if(c >= 5)
l += "x5[RDSCREEN_NOBREAK]"
if(c >= 10)
l += "x10[RDSCREEN_NOBREAK]"
- l += "[temp_material][RDSCREEN_NOBREAK]"
+ l += "[temp_material][sec_text][RDSCREEN_NOBREAK]"
else
- l += "[D.name][temp_material][RDSCREEN_NOBREAK]"
+ l += "[D.name][temp_material][sec_text][RDSCREEN_NOBREAK]"
l += ""
l += ""
return l
diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm
index 8a58563407..b9dc9b92d3 100644
--- a/code/modules/security_levels/keycard_authentication.dm
+++ b/code/modules/security_levels/keycard_authentication.dm
@@ -41,7 +41,7 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new)
var/list/data = list()
data["waiting"] = waiting
data["auth_required"] = event_source ? event_source.event : 0
- data["red_alert"] = (seclevel2num(get_security_level()) >= SEC_LEVEL_RED) ? 1 : 0
+ data["red_alert"] = (SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level)) >= SEC_LEVEL_RED) ? 1 : 0
data["emergency_maint"] = GLOB.emergency_access
data["bsa_unlock"] = GLOB.bsa_unlock
return data
diff --git a/code/modules/security_levels/security_levels.dm b/code/modules/security_levels/security_levels.dm
index 887891ca16..52fafb81be 100644
--- a/code/modules/security_levels/security_levels.dm
+++ b/code/modules/security_levels/security_levels.dm
@@ -5,20 +5,17 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
//SEC_LEVEL_RED = code red
//SEC_LEVEL_DELTA = code delta
+ /*
+ * All security levels, per ascending alert. Nothing too fancy, really.
+ * Their positions should also match their numerical values.
+ */
+GLOBAL_LIST_INIT(all_security_levels, list("green", "blue", "amber", "red", "delta"))
+
//config.alert_desc_blue_downto
/proc/set_security_level(level)
- switch(level)
- if("green")
- level = SEC_LEVEL_GREEN
- if("blue")
- level = SEC_LEVEL_BLUE
- if("amber")
- level = SEC_LEVEL_AMBER
- if("red")
- level = SEC_LEVEL_RED
- if("delta")
- level = SEC_LEVEL_DELTA
+ if(!isnum(level))
+ level = GLOB.all_security_levels.Find(level)
//Will not be announced if you try to set to the same level as it already is
if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != GLOB.security_level)
@@ -111,46 +108,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
if(D.red_alert_access)
D.visible_message("[D] whirrs as it automatically lifts access requirements!")
playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE)
- SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level())
+ SSblackbox.record_feedback("tally", "security_level_changes", 1, NUM2SECLEVEL(GLOB.security_level))
SSnightshift.check_nightshift()
else
return
-
-/proc/get_security_level()
- switch(GLOB.security_level)
- if(SEC_LEVEL_GREEN)
- return "green"
- if(SEC_LEVEL_BLUE)
- return "blue"
- if(SEC_LEVEL_AMBER)
- return "amber"
- if(SEC_LEVEL_RED)
- return "red"
- if(SEC_LEVEL_DELTA)
- return "delta"
-
-/proc/num2seclevel(num)
- switch(num)
- if(SEC_LEVEL_GREEN)
- return "green"
- if(SEC_LEVEL_BLUE)
- return "blue"
- if(SEC_LEVEL_AMBER)
- return "amber"
- if(SEC_LEVEL_RED)
- return "red"
- if(SEC_LEVEL_DELTA)
- return "delta"
-
-/proc/seclevel2num(seclevel)
- switch( lowertext(seclevel) )
- if("green")
- return SEC_LEVEL_GREEN
- if("blue")
- return SEC_LEVEL_BLUE
- if("amber")
- return SEC_LEVEL_AMBER
- if("red")
- return SEC_LEVEL_RED
- if("delta")
- return SEC_LEVEL_DELTA
diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm
index cd08b7290a..f3b4cbddc9 100644
--- a/code/modules/shuttle/emergency.dm
+++ b/code/modules/shuttle/emergency.dm
@@ -310,7 +310,7 @@
/obj/docking_port/mobile/emergency/request(obj/docking_port/stationary/S, area/signalOrigin, reason, redAlert, set_coefficient=null, silent = FALSE)
if(!isnum(set_coefficient))
- var/security_num = seclevel2num(get_security_level())
+ var/security_num = SECLEVEL2NUM(NUM2SECLEVEL(GLOB.security_level))
switch(security_num)
if(SEC_LEVEL_GREEN)
set_coefficient = 2
diff --git a/tgstation.dme b/tgstation.dme
index 7bfbd2dde2..47ea34e6f5 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -96,6 +96,7 @@
#include "code\__DEFINES\rust_g.config.dm"
#include "code\__DEFINES\rust_g.dm"
#include "code\__DEFINES\say.dm"
+#include "code\__DEFINES\security_levels.dm"
#include "code\__DEFINES\shuttles.dm"
#include "code\__DEFINES\sight.dm"
#include "code\__DEFINES\sound.dm"