Storage / table interactions at the bottom of the interaction chain (#85512)

Because the wings were in fact made of wax 

## About The Pull Request

Storage goes to the very bottom of the interaction chain, hardcoded in
on `/atom`.
This is not preferred, obviously, but it ends up being a lot less
snowflaking overall.

Tables also go at the very bottom by extending `base_item_interaction`. 

Fixes #83742
Fixes #84434 
Fixes #83982
Fixes #85516
Fixes #84990
Fixes #84890
Closes #85036
Closes #84025 (RMB places it on the table.)
Closes #86616

Other changes:

Refactored pod storage to be less jank. Patches some exploits around it.

## Why It's Good For The Game

Should make a lot more interactions a lot more reliable... hopefully

## Changelog

🆑 Melbert
refactor: Storage and Tables are now a lower priority action, meaning
some uses of items on storage should work... better, now. Here's hoping
at least, report any oddities.
refactor: Note: For an overwhelming majority of items, **combat mode**
will attempt to attack/insert into the target, while **non-combat-mode**
will attempt to use on a target. This means screwdrivering or emagging a
MODsuit must be done on non-combat-mode, as combat mode will simply put
the screwdriver or emag into its storage. Same applies to tables, though
when in doubt, RMB may help (for things which are also weapons, like
mops).
refactor: Refactored escape pod storage, now they actually properly show
as unlocked on red alert and above.
/🆑
This commit is contained in:
MrMelbert
2024-09-12 23:48:19 +02:00
committed by GitHub
parent 76968949d7
commit 8486f2f7e2
65 changed files with 386 additions and 357 deletions
+53 -26
View File
@@ -767,6 +767,57 @@
name = "emergency disembarkation tool"
desc = "For extracting yourself from rough landings."
/datum/storage/pod
max_slots = 14
max_total_storage = WEIGHT_CLASS_BULKY * 14
/// If TRUE, we unlock regardless of security level
var/always_unlocked = FALSE
/datum/storage/pod/open_storage(mob/to_show)
if(isliving(to_show) && SSsecurity_level.get_current_level_as_number() < SEC_LEVEL_RED)
to_chat(to_show, span_warning("The storage unit will only unlock during a Red or Delta security alert."))
return FALSE
return ..()
/datum/storage/pod/New(atom/parent, max_slots, max_specific_storage, max_total_storage)
. = ..()
// all of these are a type below what actually spawn with
// (IE all space suits instead of just the emergency ones)
// because an enterprising traitor might be able to hide things,
// like their syndicate toolbox or softsuit. may be fun?
var/static/list/exception_cache = typecacheof(list(
/obj/item/clothing/suit/space,
/obj/item/pickaxe,
/obj/item/storage/toolbox,
))
src.exception_hold = exception_cache
RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, PROC_REF(update_lock))
update_lock(new_level = SSsecurity_level.get_current_level_as_number())
/datum/storage/pod/set_parent(atom/new_parent)
. = ..()
RegisterSignal(parent, COMSIG_ATOM_AFTER_SHUTTLE_MOVE, PROC_REF(pod_launch))
/datum/storage/pod/proc/update_lock(datum/source, new_level)
SIGNAL_HANDLER
if(always_unlocked)
return
locked = (new_level < SEC_LEVEL_RED) ? STORAGE_FULLY_LOCKED : STORAGE_NOT_LOCKED
parent.update_appearance(UPDATE_ICON_STATE)
if(locked) // future todo : make `locked` a setter so this behavior can be built in (avoids exploits)
close_all()
/datum/storage/pod/proc/pod_launch(datum/source, turf/old_turf)
SIGNAL_HANDLER
// This check is to ignore the movement of the shuttle from the transit level to the station as it is loaded in.
if(old_turf && is_reserved_level(old_turf.z))
return
// If the pod was launched, the storage will always open.
always_unlocked = TRUE
locked = STORAGE_NOT_LOCKED
parent.update_appearance(UPDATE_ICON_STATE)
/obj/item/storage/pod
name = "emergency space suits"
desc = "A wall mounted safe containing space suits. Will only open in emergencies."
@@ -774,11 +825,11 @@
density = FALSE
icon = 'icons/obj/storage/storage.dmi'
icon_state = "wall_safe_locked"
var/unlocked = FALSE
storage_type = /datum/storage/pod
/obj/item/storage/pod/update_icon_state()
. = ..()
icon_state = "wall_safe[unlocked ? "" : "_locked"]"
icon_state = "wall_safe[atom_storage?.locked ? "_locked" : ""]"
MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/pod, 32)
@@ -798,30 +849,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/pod, 32)
new /obj/item/bodybag/environmental(src)
new /obj/item/bodybag/environmental(src)
/obj/item/storage/pod/storage_insert_on_interacted_with(datum/storage, obj/item/inserted, mob/living/user)
return can_interact(user)
/obj/item/storage/pod/attack_hand(mob/user, list/modifiers)
if (can_interact(user))
atom_storage?.show_contents(user)
return TRUE
/obj/item/storage/pod/attack_hand_secondary(mob/user, list/modifiers)
if(!can_interact(user))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
return ..()
/obj/item/storage/pod/click_alt(mob/user)
return CLICK_ACTION_SUCCESS
/obj/item/storage/pod/can_interact(mob/user)
if(!..())
return FALSE
if(SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED || unlocked)
return TRUE
to_chat(user, "The storage unit will only unlock during a Red or Delta security alert.")
return FALSE
/obj/docking_port/mobile/emergency/backup
name = "backup shuttle"
shuttle_id = "backup"
+1 -12
View File
@@ -109,7 +109,7 @@ All ShuttleMove procs go here
// Called on atoms after everything has been moved
/atom/movable/proc/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation)
SEND_SIGNAL(src, COMSIG_ATOM_AFTER_SHUTTLE_MOVE)
SEND_SIGNAL(src, COMSIG_ATOM_AFTER_SHUTTLE_MOVE, oldT)
if(light)
update_light()
if(rotation)
@@ -250,17 +250,6 @@ All ShuttleMove procs go here
GLOB.deliverybeacons += src
GLOB.deliverybeacontags += location
/************************************Item move procs************************************/
/obj/item/storage/pod/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation)
. = ..()
// If the pod was launched, the storage will always open. The reserved_level check
// ignores the movement of the shuttle from the transit level to
// the station as it is loaded in.
if (oldT && !is_reserved_level(oldT.z))
unlocked = TRUE
update_appearance()
/************************************Mob move procs************************************/
/mob/onShuttleMove(turf/newT, turf/oldT, list/movement_force, move_dir, obj/docking_port/stationary/old_dock, obj/docking_port/mobile/moving_dock)