datums
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
var/datum/component/storage/slave = i
|
||||
slave.refresh_mob_views()
|
||||
|
||||
/datum/component/storage/concrete/emp_act(severity)
|
||||
/datum/component/storage/concrete/emp_act(datum/source, severity)
|
||||
if(emp_shielded)
|
||||
return
|
||||
var/atom/real_location = real_location()
|
||||
@@ -90,13 +90,13 @@
|
||||
slaves -= S
|
||||
return FALSE
|
||||
|
||||
/datum/component/storage/concrete/proc/on_contents_del(atom/A)
|
||||
/datum/component/storage/concrete/proc/on_contents_del(datum/source, atom/A)
|
||||
var/atom/real_location = parent
|
||||
if(A in real_location)
|
||||
usr = null
|
||||
remove_from_storage(A, null)
|
||||
|
||||
/datum/component/storage/concrete/proc/on_deconstruct(disassembled)
|
||||
/datum/component/storage/concrete/proc/on_deconstruct(datum/source, disassembled)
|
||||
if(drop_all_on_deconstruct)
|
||||
do_quick_empty()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/datum/component/storage/concrete/bluespace/bag_of_holding/handle_item_insertion(obj/item/W, prevent_warning = FALSE, mob/living/user)
|
||||
var/atom/A = parent
|
||||
if(A == W)
|
||||
if(A == W) //don't put yourself into yourself.
|
||||
return
|
||||
var/list/obj/item/storage/backpack/holding/matching = typecache_filter_list(W.GetAllContents(), typecacheof(/obj/item/storage/backpack/holding))
|
||||
matching -= A
|
||||
@@ -30,7 +30,7 @@
|
||||
for (var/obj/structure/ladder/unbreakable/binary/ladder in GLOB.ladders)
|
||||
ladder.ActivateAlmonds()
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] detonated a bag of holding at [ADMIN_VERBOSEJMP(loccheck)].")
|
||||
log_game("[key_name(user)] detonated a bag of holding at [AREACOORD(loccheck)].")
|
||||
log_game("[key_name(user)] detonated a bag of holding at [loc_name(loccheck)].")
|
||||
qdel(A)
|
||||
return
|
||||
. = ..()
|
||||
|
||||
@@ -89,12 +89,13 @@
|
||||
RegisterSignal(parent, COMSIG_ATOM_ATTACK_GHOST, .proc/show_to_ghost)
|
||||
RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/refresh_mob_views)
|
||||
RegisterSignal(parent, COMSIG_ATOM_EXITED, .proc/_remove_and_refresh)
|
||||
RegisterSignal(parent, COMSIG_ATOM_CANREACH, .proc/canreach_react)
|
||||
|
||||
RegisterSignal(parent, COMSIG_ITEM_PRE_ATTACK, .proc/preattack_intercept)
|
||||
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/attack_self)
|
||||
RegisterSignal(parent, COMSIG_ITEM_PICKUP, .proc/signal_on_pickup)
|
||||
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_PRE_THROW, .proc/close_all)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_POST_THROW, .proc/close_all)
|
||||
|
||||
RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/on_alt_click)
|
||||
RegisterSignal(parent, COMSIG_MOUSEDROP_ONTO, .proc/mousedrop_onto)
|
||||
@@ -118,6 +119,7 @@
|
||||
return
|
||||
var/obj/item/I = parent
|
||||
modeswitch_action = new(I)
|
||||
RegisterSignal(modeswitch_action, COMSIG_ACTION_TRIGGER, .proc/action_trigger)
|
||||
if(I.obj_flags & IN_INVENTORY)
|
||||
var/mob/M = I.loc
|
||||
if(!istype(M))
|
||||
@@ -143,14 +145,24 @@
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
return master? master.real_location() : null
|
||||
|
||||
/datum/component/storage/proc/attack_self(mob/M)
|
||||
/datum/component/storage/proc/canreach_react(datum/source, list/next)
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
if(!master)
|
||||
return
|
||||
. = COMPONENT_BLOCK_REACH
|
||||
next += master.parent
|
||||
for(var/i in master.slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
next += slave.parent
|
||||
|
||||
/datum/component/storage/proc/attack_self(datum/source, mob/M)
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
return FALSE
|
||||
if((M.get_active_held_item() == parent) && allow_quick_empty)
|
||||
quick_empty(M)
|
||||
|
||||
/datum/component/storage/proc/preattack_intercept(obj/O, mob/M, params)
|
||||
/datum/component/storage/proc/preattack_intercept(datum/source, obj/O, mob/M, params)
|
||||
if(!isitem(O) || !click_gather || SEND_SIGNAL(O, COMSIG_CONTAINS_STORAGE))
|
||||
return FALSE
|
||||
. = COMPONENT_NO_ATTACK
|
||||
@@ -263,7 +275,7 @@
|
||||
remove_from_storage(I, _target)
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/set_locked(new_state)
|
||||
/datum/component/storage/proc/set_locked(datum/source, new_state)
|
||||
locked = new_state
|
||||
if(locked)
|
||||
close_all()
|
||||
@@ -371,11 +383,11 @@
|
||||
close(M)
|
||||
. = TRUE //returns TRUE if any mobs actually got a close(M) call
|
||||
|
||||
/datum/component/storage/proc/emp_act(severity)
|
||||
/datum/component/storage/proc/emp_act(datum/source, severity)
|
||||
if(emp_shielded)
|
||||
return
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
master.emp_act(severity)
|
||||
master.emp_act(source, severity)
|
||||
|
||||
//This proc draws out the inventory and places the items on it. tx and ty are the upper left tile and mx, my are the bottm right.
|
||||
//The numbers are calculated from the bottom-left The bottom-left slot being 1,1.
|
||||
@@ -405,7 +417,7 @@
|
||||
return FALSE
|
||||
return master._removal_reset(thing)
|
||||
|
||||
/datum/component/storage/proc/_remove_and_refresh(atom/movable/thing)
|
||||
/datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/thing)
|
||||
_removal_reset(thing)
|
||||
refresh_mob_views()
|
||||
|
||||
@@ -447,7 +459,7 @@
|
||||
return FALSE
|
||||
|
||||
//This proc is called when you want to place an item into the storage item.
|
||||
/datum/component/storage/proc/attackby(obj/item/I, mob/M, params)
|
||||
/datum/component/storage/proc/attackby(datum/source, obj/item/I, mob/M, params)
|
||||
if(istype(I, /obj/item/hand_labeler))
|
||||
var/obj/item/hand_labeler/labeler = I
|
||||
if(labeler.mode)
|
||||
@@ -476,13 +488,13 @@
|
||||
return real_location.contents.Copy()
|
||||
|
||||
//Abuses the fact that lists are just references, or something like that.
|
||||
/datum/component/storage/proc/signal_return_inv(list/interface, recursive = TRUE)
|
||||
/datum/component/storage/proc/signal_return_inv(datum/source, list/interface, recursive = TRUE)
|
||||
if(!islist(interface))
|
||||
return FALSE
|
||||
interface |= return_inv(recursive)
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/mousedrop_onto(atom/over_object, mob/M)
|
||||
/datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M)
|
||||
set waitfor = FALSE
|
||||
. = COMPONENT_NO_MOUSEDROP
|
||||
var/atom/A = parent
|
||||
@@ -519,7 +531,7 @@
|
||||
if(force || M.CanReach(parent, view_only = TRUE))
|
||||
show_to(M)
|
||||
|
||||
/datum/component/storage/proc/mousedrop_receive(atom/movable/O, mob/M)
|
||||
/datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M)
|
||||
if(isitem(O))
|
||||
var/obj/item/I = O
|
||||
if(iscarbon(M) || isdrone(M))
|
||||
@@ -540,7 +552,7 @@
|
||||
if(real_location == I.loc)
|
||||
return FALSE //Means the item is already in the storage item
|
||||
if(locked)
|
||||
if(M)
|
||||
if(M && !stop_messages)
|
||||
host.add_fingerprint(M)
|
||||
to_chat(M, "<span class='warning'>[host] seems to be locked!</span>")
|
||||
return FALSE
|
||||
@@ -618,18 +630,18 @@
|
||||
var/obj/O = parent
|
||||
O.update_icon()
|
||||
|
||||
/datum/component/storage/proc/signal_insertion_attempt(obj/item/I, mob/M, silent = FALSE, force = FALSE)
|
||||
/datum/component/storage/proc/signal_insertion_attempt(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE)
|
||||
if((!force && !can_be_inserted(I, TRUE, M)) || (I == parent))
|
||||
return FALSE
|
||||
return handle_item_insertion(I, silent, M)
|
||||
|
||||
/datum/component/storage/proc/signal_can_insert(obj/item/I, mob/M, silent = FALSE)
|
||||
/datum/component/storage/proc/signal_can_insert(datum/source, obj/item/I, mob/M, silent = FALSE)
|
||||
return can_be_inserted(I, silent, M)
|
||||
|
||||
/datum/component/storage/proc/show_to_ghost(mob/dead/observer/M)
|
||||
/datum/component/storage/proc/show_to_ghost(datum/source, mob/dead/observer/M)
|
||||
return user_show_to_mob(M, TRUE)
|
||||
|
||||
/datum/component/storage/proc/signal_show_attempt(mob/showto, force = FALSE)
|
||||
/datum/component/storage/proc/signal_show_attempt(datum/source, mob/showto, force = FALSE)
|
||||
return user_show_to_mob(showto, force)
|
||||
|
||||
/datum/component/storage/proc/on_check()
|
||||
@@ -638,14 +650,14 @@
|
||||
/datum/component/storage/proc/check_locked()
|
||||
return locked
|
||||
|
||||
/datum/component/storage/proc/signal_take_type(type, atom/destination, amount = INFINITY, check_adjacent = FALSE, force = FALSE, mob/user, list/inserted)
|
||||
/datum/component/storage/proc/signal_take_type(datum/source, type, atom/destination, amount = INFINITY, check_adjacent = FALSE, force = FALSE, mob/user, list/inserted)
|
||||
if(!force)
|
||||
if(check_adjacent)
|
||||
if(!user || !user.CanReach(destination) || !user.CanReach(parent))
|
||||
return FALSE
|
||||
var/list/taking = typecache_filter_list(contents(), typecacheof(type))
|
||||
if(length(taking) > amount)
|
||||
taking.Cut(amount)
|
||||
if(taking.len > amount)
|
||||
taking.len = amount
|
||||
if(inserted) //duplicated code for performance, don't bother checking retval/checking for list every item.
|
||||
for(var/i in taking)
|
||||
if(remove_from_storage(i, destination))
|
||||
@@ -659,7 +671,7 @@
|
||||
var/atom/real_location = real_location()
|
||||
return max(0, max_items - real_location.contents.len)
|
||||
|
||||
/datum/component/storage/proc/signal_fill_type(type, amount = 20, force = FALSE)
|
||||
/datum/component/storage/proc/signal_fill_type(datum/source, type, amount = 20, force = FALSE)
|
||||
var/atom/real_location = real_location()
|
||||
if(!force)
|
||||
amount = min(remaining_space_items(), amount)
|
||||
@@ -668,7 +680,7 @@
|
||||
CHECK_TICK
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/on_attack_hand(mob/user)
|
||||
/datum/component/storage/proc/on_attack_hand(datum/source, mob/user)
|
||||
var/atom/A = parent
|
||||
if(!attack_hand_interact)
|
||||
return
|
||||
@@ -701,25 +713,25 @@
|
||||
else
|
||||
show_to(user)
|
||||
|
||||
/datum/component/storage/proc/signal_on_pickup(mob/user)
|
||||
/datum/component/storage/proc/signal_on_pickup(datum/source, mob/user)
|
||||
var/atom/A = parent
|
||||
update_actions()
|
||||
for(var/mob/M in range(1, A))
|
||||
if(M.active_storage == src)
|
||||
close(M)
|
||||
|
||||
/datum/component/storage/proc/signal_take_obj(atom/movable/AM, new_loc, force = FALSE)
|
||||
/datum/component/storage/proc/signal_take_obj(datum/source, atom/movable/AM, new_loc, force = FALSE)
|
||||
if(!(AM in real_location()))
|
||||
return FALSE
|
||||
return remove_from_storage(AM, new_loc)
|
||||
|
||||
/datum/component/storage/proc/signal_quick_empty(atom/loctarget)
|
||||
/datum/component/storage/proc/signal_quick_empty(datum/source, atom/loctarget)
|
||||
return do_quick_empty(loctarget)
|
||||
|
||||
/datum/component/storage/proc/signal_hide_attempt(mob/target)
|
||||
/datum/component/storage/proc/signal_hide_attempt(datum/source, mob/target)
|
||||
return hide_from(target)
|
||||
|
||||
/datum/component/storage/proc/on_alt_click(mob/user)
|
||||
/datum/component/storage/proc/on_alt_click(datum/source, mob/user)
|
||||
if(!isliving(user) || user.incapacitated() || !quickdraw || locked || !user.CanReach(parent))
|
||||
return
|
||||
var/obj/item/I = locate() in real_location()
|
||||
@@ -731,6 +743,10 @@
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] draws [I] from [parent]!</span>", "<span class='notice'>You draw [I] from [parent].</span>")
|
||||
|
||||
/datum/component/storage/proc/action_trigger(datum/signal_source, datum/action/source)
|
||||
gather_mode_switch(source.owner)
|
||||
return COMPONENT_ACTION_BLOCK_TRIGGER
|
||||
|
||||
/datum/component/storage/proc/gather_mode_switch(mob/user)
|
||||
collection_mode = (collection_mode+1)%3
|
||||
switch(collection_mode)
|
||||
|
||||
Reference in New Issue
Block a user