|
163 | 163 | RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(mass_empty))
|
164 | 164 | RegisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_ATOM_ATTACK_GHOST, COMSIG_ATOM_ATTACK_HAND_SECONDARY), PROC_REF(open_storage_on_signal))
|
165 | 165 | RegisterSignal(parent, COMSIG_PARENT_ATTACKBY_SECONDARY, PROC_REF(open_storage_attackby_secondary))
|
166 |
| - RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(close_distance)) |
| 166 | + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(update_viewability)) |
167 | 167 | RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(update_actions))
|
168 | 168 |
|
169 | 169 | /datum/storage/proc/on_deconstruct()
|
@@ -769,6 +769,9 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
|
769 | 769 |
|
770 | 770 | remove_all(dump_loc)
|
771 | 771 |
|
| 772 | +/datum/storage/proc/is_reachable(mob/user) |
| 773 | + return parent.IsReachableBy(user) |
| 774 | + |
772 | 775 | /// Signal handler for whenever something gets mouse-dropped onto us.
|
773 | 776 | /datum/storage/proc/on_mousedropped_onto(datum/source, obj/item/dropping, mob/user)
|
774 | 777 | SIGNAL_HANDLER
|
@@ -924,15 +927,15 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
|
924 | 927 | return COMPONENT_NO_AFTERATTACK
|
925 | 928 |
|
926 | 929 | /// Opens the storage to the mob, showing them the contents to their UI.
|
927 |
| -/datum/storage/proc/open_storage(mob/to_show, performing_quickdraw) |
| 930 | +/datum/storage/proc/open_storage(mob/to_show, performing_quickdraw, skip_canreach = FALSE) |
928 | 931 | if(isobserver(to_show))
|
929 | 932 | if(to_show.active_storage == src)
|
930 | 933 | hide_contents(to_show)
|
931 | 934 | else
|
932 | 935 | show_contents(to_show)
|
933 | 936 | return FALSE
|
934 | 937 |
|
935 |
| - if(!can_be_reached_by(to_show)) |
| 938 | + if(!skip_canreach && !can_be_reached_by(to_show)) |
936 | 939 | to_chat(to_show, span_warning("You cannot reach [parent]."))
|
937 | 940 | return FALSE
|
938 | 941 |
|
@@ -980,8 +983,8 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
|
980 | 983 | to_chat(toshow, span_notice("You fumble for [toremove] and it falls on the floor."))
|
981 | 984 | return TRUE
|
982 | 985 |
|
983 |
| -/// Signal handler for whenever a mob walks away with us, close if they can't reach us. |
984 |
| -/datum/storage/proc/close_distance(datum/source) |
| 986 | +/// Close the storage for people who can no longer see it. |
| 987 | +/datum/storage/proc/update_viewability(datum/source) |
985 | 988 | SIGNAL_HANDLER
|
986 | 989 |
|
987 | 990 | for(var/mob/user in can_see_contents())
|
|
0 commit comments