Secure safe, secure briefcase, and vaults improvements (#93085)

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
Tim
2025-10-20 15:19:58 +02:00
committed by GitHub
co-authored by SmArtKar
parent f2529991f2
commit 0ee962c4b4
7 changed files with 253 additions and 21 deletions
+97 -6
View File
@@ -6,6 +6,16 @@
base_icon_state = "wall_safe"
result_path = /obj/structure/secure_safe
pixel_shift = 32
w_class = WEIGHT_CLASS_GIGANTIC
obj_flags = CONDUCTS_ELECTRICITY
resistance_flags = FIRE_PROOF
custom_materials = list(
/datum/material/alloy/plasteel = SHEET_MATERIAL_AMOUNT*5,
/datum/material/titanium = SHEET_MATERIAL_AMOUNT*3,
)
material_flags = MATERIAL_EFFECTS
/// The lock code transferred from the structure
var/stored_lock_code
/obj/item/wallframe/secure_safe/Initialize(mapload)
. = ..()
@@ -13,12 +23,55 @@
max_specific_storage = WEIGHT_CLASS_GIGANTIC,
max_total_storage = 20,
)
atom_storage.set_locked(STORAGE_FULLY_LOCKED)
if(stored_lock_code && !(obj_flags & EMAGGED))
atom_storage.set_locked(STORAGE_FULLY_LOCKED)
update_appearance()
/obj/item/wallframe/secure_safe/after_attach(obj/attached_to)
/obj/item/wallframe/secure_safe/update_icon_state()
. = ..()
if(obj_flags & EMAGGED)
icon_state = "[base_icon_state]_broken"
else
icon_state = "[base_icon_state][stored_lock_code ? "_locked" : null]"
/obj/item/wallframe/secure_safe/emag_act(mob/user, obj/item/card/emag/emag_card)
. = ..()
if(obj_flags & EMAGGED)
return FALSE
obj_flags |= EMAGGED
visible_message(span_warning("Sparks fly from [src]!"), blind_message = span_hear("You hear a faint electrical spark."))
balloon_alert(user, "lock destroyed")
playsound(src, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
stored_lock_code = null
atom_storage.locked = STORAGE_NOT_LOCKED
update_appearance()
return TRUE
/obj/item/wallframe/secure_safe/after_attach(obj/structure/secure_safe/safe)
if(!istype(safe))
return ..()
for(var/obj/item in contents)
item.forceMove(attached_to)
item.forceMove(safe)
var/datum/component/lockable_storage/storage_component = safe.GetComponent(/datum/component/lockable_storage)
if(stored_lock_code)
storage_component?.set_lock_code(stored_lock_code)
if(obj_flags & EMAGGED)
storage_component?.break_lock()
return ..()
/datum/armor/secure_safe
melee = 30
bullet = 30
laser = 20
energy = 20
bomb = 30
fire = 95
acid = 30
/**
* Wall safes
@@ -33,21 +86,47 @@
base_icon_state = "wall_safe"
anchored = TRUE
density = FALSE
resistance_flags = FIRE_PROOF
obj_flags = CONDUCTS_ELECTRICITY
armor_type = /datum/armor/secure_safe
max_integrity = 300
damage_deflection = 21
custom_materials = list(
/datum/material/alloy/plasteel = SHEET_MATERIAL_AMOUNT*5,
/datum/material/titanium = SHEET_MATERIAL_AMOUNT*3,
)
material_flags = MATERIAL_EFFECTS
/// The lock code used to open the safe
var/stored_lock_code
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe, 32)
/obj/structure/secure_safe/Initialize(mapload)
. = ..()
//this will create the storage for us.
AddComponent(/datum/component/lockable_storage)
AddComponent(/datum/component/lockable_storage, stored_lock_code)
if(!density)
find_and_hang_on_wall()
if(mapload)
PopulateContents()
RegisterSignal(src, COMSIG_LOCKABLE_STORAGE_SET_CODE, PROC_REF(update_lock_code))
/obj/structure/secure_safe/atom_deconstruct(disassembled)
if(!density) //if we're a wall item, we'll drop a wall frame.
var/obj/item/wallframe/secure_safe/new_safe = new(get_turf(src))
// Transfer lock code to the wallframe
var/datum/component/lockable_storage/storage_component = GetComponent(/datum/component/lockable_storage)
if(storage_component)
new_safe.stored_lock_code = storage_component.lock_code
if(obj_flags & EMAGGED)
new_safe.obj_flags |= EMAGGED
new_safe.update_appearance()
for(var/obj/item in contents)
item.forceMove(new_safe)
@@ -55,6 +134,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe, 32)
new /obj/item/paper(src)
new /obj/item/pen(src)
/obj/structure/secure_safe/proc/update_lock_code(obj/structure/secure_safe/safe, new_code)
SIGNAL_HANDLER
stored_lock_code = new_code
/obj/structure/secure_safe/ex_act(severity, target)
if(severity <= EXPLODE_LIGHT)
return FALSE
return ..()
/obj/structure/secure_safe/hos
name = "head of security's safe"
@@ -77,11 +166,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe, 32)
icon_state = "spare_safe"
base_icon_state = "spare_safe"
armor_type = /datum/armor/safe_caps_spare
max_integrity = 300
damage_deflection = 30 // prevents stealing the captain's spare using null rods/lavaland monsters/AP projectiles
density = TRUE
anchored_tabletop_offset = 6
custom_materials = list(/datum/material/gold = SMALL_MATERIAL_AMOUNT)
custom_materials = list(
/datum/material/alloy/plasteel = SHEET_MATERIAL_AMOUNT*5,
/datum/material/gold = SHEET_MATERIAL_AMOUNT*3,
)
material_flags = MATERIAL_EFFECTS
/datum/armor/safe_caps_spare