Merge pull request #11997 from Ghommie/Ghommie-cit705
code for designs' security level requirements.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
return
|
||||
|
||||
if(!CONFIG_GET(flag/disable_secborg) && GLOB.security_level < CONFIG_GET(number/minimum_secborg_alert))
|
||||
to_chat(src, "<span class='notice'>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.</span>")
|
||||
to_chat(src, "<span class='notice'>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.</span>")
|
||||
|
||||
var/list/modulelist = list("Standard" = /obj/item/robot_module/standard, \
|
||||
"Engineering" = /obj/item/robot_module/engineering, \
|
||||
|
||||
@@ -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. Currently only available for rnd production machinery and mechfab.
|
||||
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
|
||||
|
||||
@@ -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 += "<A href='?src=[REF(src)];build=[D.id];amount=1'>[D.name]</A>[RDSCREEN_NOBREAK]"
|
||||
if(c >= 5)
|
||||
l += "<A href='?src=[REF(src)];build=[D.id];amount=5'>x5</A>[RDSCREEN_NOBREAK]"
|
||||
if(c >= 10)
|
||||
l += "<A href='?src=[REF(src)];build=[D.id];amount=10'>x10</A>[RDSCREEN_NOBREAK]"
|
||||
l += "[temp_material][RDSCREEN_NOBREAK]"
|
||||
l += "[temp_material][sec_text][RDSCREEN_NOBREAK]"
|
||||
else
|
||||
l += "<span class='linkOff'>[D.name]</span>[temp_material][RDSCREEN_NOBREAK]"
|
||||
l += "<span class='linkOff'>[D.name]</span>[temp_material][sec_text][RDSCREEN_NOBREAK]"
|
||||
l += ""
|
||||
return l
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 += "<A href='?src=[REF(src)];build=[D.id];amount=1'>[D.name]</A>[RDSCREEN_NOBREAK]"
|
||||
if(c >= 5)
|
||||
l += "<A href='?src=[REF(src)];build=[D.id];amount=5'>x5</A>[RDSCREEN_NOBREAK]"
|
||||
if(c >= 10)
|
||||
l += "<A href='?src=[REF(src)];build=[D.id];amount=10'>x10</A>[RDSCREEN_NOBREAK]"
|
||||
l += "[temp_material][RDSCREEN_NOBREAK]"
|
||||
l += "[temp_material][sec_text][RDSCREEN_NOBREAK]"
|
||||
else
|
||||
l += "<span class='linkOff'>[D.name]</span>[temp_material][RDSCREEN_NOBREAK]"
|
||||
l += "<span class='linkOff'>[D.name]</span>[temp_material][sec_text][RDSCREEN_NOBREAK]"
|
||||
l += ""
|
||||
l += "</div>"
|
||||
return l
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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("<span class='notice'>[D] whirrs as it automatically lifts access requirements!</span>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user