mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] Safe code documentation [MDB IGNORE] (#10758)
* Safe code documentation (#64096) Adds better documentation and variable naming to safe code. Also removed one variable that hasn't done anything in years. * Safe code documentation Co-authored-by: dragomagol <66640614+dragomagol@users.noreply.github.com>
This commit is contained in:
@@ -7,23 +7,31 @@
|
||||
* Wall Safe
|
||||
*/
|
||||
|
||||
// -----------------------------
|
||||
// Generic Item
|
||||
// -----------------------------
|
||||
///Generic Safe
|
||||
/obj/item/storage/secure
|
||||
name = "secstorage"
|
||||
var/icon_locking = "secureb"
|
||||
var/icon_sparking = "securespark"
|
||||
var/icon_opened = "secure0"
|
||||
var/code = ""
|
||||
var/l_code = null
|
||||
var/l_set = FALSE
|
||||
var/l_setshort = FALSE
|
||||
var/l_hacking = FALSE
|
||||
var/open = FALSE
|
||||
var/can_hack_open = TRUE
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
desc = "This shouldn't exist. If it does, create an issue report."
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
|
||||
/// icon_state of locked safe
|
||||
var/icon_locking = "secureb"
|
||||
/// icon_state of sparking safe
|
||||
var/icon_sparking = "securespark"
|
||||
/// icon_state of opened safe
|
||||
var/icon_opened = "secure0"
|
||||
/// The code entered by the user
|
||||
var/entered_code
|
||||
/// The code that will open this safe
|
||||
var/lock_code
|
||||
/// Does this lock have a code set?
|
||||
var/lock_set = FALSE
|
||||
/// Is this lock currently being hacked?
|
||||
var/lock_hacking = FALSE
|
||||
/// Is the safe service panel open?
|
||||
var/panel_open = FALSE
|
||||
/// Is this door hackable?
|
||||
var/can_hack_open = TRUE
|
||||
|
||||
|
||||
/obj/item/storage/secure/ComponentInitialize()
|
||||
. = ..()
|
||||
@@ -34,30 +42,30 @@
|
||||
/obj/item/storage/secure/examine(mob/user)
|
||||
. = ..()
|
||||
if(can_hack_open)
|
||||
. += "The service panel is currently <b>[open ? "unscrewed" : "screwed shut"]</b>."
|
||||
. += "The service panel is currently <b>[panel_open ? "unscrewed" : "screwed shut"]</b>."
|
||||
|
||||
/obj/item/storage/secure/attackby(obj/item/W, mob/user, params)
|
||||
/obj/item/storage/secure/attackby(obj/item/weapon, mob/user, params)
|
||||
if(can_hack_open && SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
|
||||
if (W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
if (W.use_tool(src, user, 20))
|
||||
open = !open
|
||||
to_chat(user, span_notice("You [open ? "open" : "close"] the service panel."))
|
||||
if (weapon.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
if (weapon.use_tool(src, user, 20))
|
||||
panel_open = !panel_open
|
||||
to_chat(user, span_notice("You [panel_open ? "open" : "close"] the service panel."))
|
||||
return
|
||||
if (W.tool_behaviour == TOOL_WIRECUTTER)
|
||||
if (weapon.tool_behaviour == TOOL_WIRECUTTER)
|
||||
to_chat(user, span_danger("[src] is protected from this sort of tampering, yet it appears the internal memory wires can still be <b>pulsed</b>."))
|
||||
return
|
||||
if (W.tool_behaviour == TOOL_MULTITOOL)
|
||||
if(l_hacking)
|
||||
if (weapon.tool_behaviour == TOOL_MULTITOOL)
|
||||
if(lock_hacking)
|
||||
to_chat(user, span_danger("This safe is already being hacked."))
|
||||
return
|
||||
if(open == TRUE)
|
||||
if(panel_open == TRUE)
|
||||
to_chat(user, span_danger("Now attempting to reset internal memory, please hold."))
|
||||
l_hacking = TRUE
|
||||
if (W.use_tool(src, user, 400))
|
||||
lock_hacking = TRUE
|
||||
if (weapon.use_tool(src, user, 400))
|
||||
to_chat(user, span_danger("Internal memory reset - lock has been disengaged."))
|
||||
l_set = FALSE
|
||||
lock_set = FALSE
|
||||
|
||||
l_hacking = FALSE
|
||||
lock_hacking = FALSE
|
||||
return
|
||||
|
||||
to_chat(user, span_warning("You must <b>unscrew</b> the service panel before you can pulse the wiring!"))
|
||||
@@ -71,11 +79,9 @@
|
||||
user.set_machine(src)
|
||||
var/dat = text("<TT><B>[]</B><BR>\n\nLock Status: []",src, (locked ? "LOCKED" : "UNLOCKED"))
|
||||
var/message = "Code"
|
||||
if ((l_set == 0) && (!l_setshort))
|
||||
if (lock_set == 0)
|
||||
dat += text("<p>\n<b>5-DIGIT PASSCODE NOT SET.<br>ENTER NEW PASSCODE.</b>")
|
||||
if (l_setshort)
|
||||
dat += text("<p>\n<font color=red><b>ALERT: MEMORY SYSTEM ERROR - 6040 201</b></font>")
|
||||
message = text("[]", code)
|
||||
message = text("[]", entered_code)
|
||||
if (!locked)
|
||||
message = "*****"
|
||||
dat += text("<HR>\n>[]<BR>\n<A href='?src=[REF(src)];type=1'>1</A>-<A href='?src=[REF(src)];type=2'>2</A>-<A href='?src=[REF(src)];type=3'>3</A><BR>\n<A href='?src=[REF(src)];type=4'>4</A>-<A href='?src=[REF(src)];type=5'>5</A>-<A href='?src=[REF(src)];type=6'>6</A><BR>\n<A href='?src=[REF(src)];type=7'>7</A>-<A href='?src=[REF(src)];type=8'>8</A>-<A href='?src=[REF(src)];type=9'>9</A><BR>\n<A href='?src=[REF(src)];type=R'>R</A>-<A href='?src=[REF(src)];type=0'>0</A>-<A href='?src=[REF(src)];type=E'>E</A><BR>\n</TT>", message)
|
||||
@@ -87,26 +93,26 @@
|
||||
return
|
||||
if (href_list["type"])
|
||||
if (href_list["type"] == "E")
|
||||
if (!l_set && (length(code) == 5) && (!l_setshort) && (code != "ERROR"))
|
||||
l_code = code
|
||||
l_set = TRUE
|
||||
else if ((code == l_code) && l_set)
|
||||
if (!lock_set && (length(entered_code) == 5) && (entered_code != "ERROR"))
|
||||
lock_code = entered_code
|
||||
lock_set = TRUE
|
||||
else if ((entered_code == lock_code) && lock_set)
|
||||
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, FALSE)
|
||||
cut_overlays()
|
||||
add_overlay(icon_opened)
|
||||
code = null
|
||||
entered_code = null
|
||||
else
|
||||
code = "ERROR"
|
||||
entered_code = "ERROR"
|
||||
else
|
||||
if ((href_list["type"] == "R") && (!l_setshort))
|
||||
if (href_list["type"] == "R")
|
||||
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, TRUE)
|
||||
cut_overlays()
|
||||
code = null
|
||||
entered_code = null
|
||||
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_HIDE_FROM, usr)
|
||||
else
|
||||
code += text("[]", sanitize_text(href_list["type"]))
|
||||
if (length(code) > 5)
|
||||
code = "ERROR"
|
||||
entered_code += text("[]", sanitize_text(href_list["type"]))
|
||||
if (length(entered_code) > 5)
|
||||
entered_code = "ERROR"
|
||||
add_fingerprint(usr)
|
||||
for(var/mob/M in viewers(1, loc))
|
||||
if ((M.client && M.machine == src))
|
||||
@@ -114,10 +120,7 @@
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
// -----------------------------
|
||||
// Secure Briefcase
|
||||
// -----------------------------
|
||||
///Secure Briefcase
|
||||
/obj/item/storage/secure/briefcase
|
||||
name = "secure briefcase"
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
@@ -144,21 +147,17 @@
|
||||
STR.max_combined_w_class = 21
|
||||
STR.max_w_class = WEIGHT_CLASS_NORMAL
|
||||
|
||||
//Syndie variant of Secure Briefcase. Contains space cash, slightly more robust.
|
||||
///Syndie variant of Secure Briefcase. Contains space cash, slightly more robust.
|
||||
/obj/item/storage/secure/briefcase/syndie
|
||||
force = 15
|
||||
|
||||
/obj/item/storage/secure/briefcase/syndie/PopulateContents()
|
||||
..()
|
||||
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
|
||||
for(var/i in 1 to STR.max_items - 2)
|
||||
var/datum/component/storage/storage_space = GetComponent(/datum/component/storage)
|
||||
for(var/i in 1 to storage_space.max_items - 2)
|
||||
new /obj/item/stack/spacecash/c1000(src)
|
||||
|
||||
|
||||
// -----------------------------
|
||||
// Secure Safe
|
||||
// -----------------------------
|
||||
|
||||
///Secure Safe
|
||||
/obj/item/storage/secure/safe
|
||||
name = "secure safe"
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
@@ -216,8 +215,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/secure/safe/caps_spare, 32)
|
||||
/obj/item/storage/secure/safe/caps_spare/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
l_code = SSid_access.spare_id_safe_code
|
||||
l_set = TRUE
|
||||
lock_code = SSid_access.spare_id_safe_code
|
||||
lock_set = TRUE
|
||||
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, TRUE)
|
||||
|
||||
/obj/item/storage/secure/safe/caps_spare/PopulateContents()
|
||||
|
||||
@@ -90,6 +90,7 @@ GLOBAL_VAR_INIT(sc_safecode5, "[rand(0,9)]")
|
||||
|
||||
/obj/item/paper/fluff/awaymissions/stationcollision/safehint_paper_hydro
|
||||
name = "shredded paper"
|
||||
|
||||
/obj/item/paper/fluff/awaymissions/stationcollision/safehint_paper_hydro/Initialize(mapload)
|
||||
. = ..()
|
||||
info = "<i>Although the paper is shredded, you can clearly see the number:</i> '[GLOB.sc_safecode2]'"
|
||||
@@ -101,6 +102,7 @@ GLOBAL_VAR_INIT(sc_safecode5, "[rand(0,9)]")
|
||||
|
||||
/obj/item/paper/fluff/awaymissions/stationcollision/safehint_paper_bible
|
||||
name = "hidden paper"
|
||||
|
||||
/obj/item/paper/fluff/awaymissions/stationcollision/safehint_paper_bible/Initialize(mapload)
|
||||
. = ..()
|
||||
info = {"<i>It would appear that the pen hidden with the paper had leaked ink over the paper.
|
||||
@@ -128,10 +130,9 @@ GLOBAL_VAR_INIT(sc_safecode5, "[rand(0,9)]")
|
||||
|
||||
/obj/item/storage/secure/safe/sc_ssafe/Initialize(mapload)
|
||||
. = ..()
|
||||
l_code = "[GLOB.sc_safecode1][GLOB.sc_safecode2][GLOB.sc_safecode3][GLOB.sc_safecode4][GLOB.sc_safecode5]"
|
||||
l_set = 1
|
||||
lock_code = "[GLOB.sc_safecode1][GLOB.sc_safecode2][GLOB.sc_safecode3][GLOB.sc_safecode4][GLOB.sc_safecode5]"
|
||||
lock_set = TRUE
|
||||
new /obj/item/gun/energy/mindflayer(src)
|
||||
new /obj/item/soulstone(src)
|
||||
new /obj/item/clothing/suit/hooded/cultrobes/hardened(src)
|
||||
//new /obj/item/teleportation_scroll(src)
|
||||
new /obj/item/stack/ore/diamond(src)
|
||||
|
||||
Reference in New Issue
Block a user