Merge pull request #6703 from Citadel-Station-13/upstream-merge-37656

[MIRROR] Fixes EMPs not working on people/backpacks/other storage being carried on people
This commit is contained in:
deathride58
2018-05-11 03:36:01 +00:00
committed by GitHub
5 changed files with 27 additions and 27 deletions

View File

@@ -138,7 +138,7 @@
#define COMSIG_TRY_STORAGE_FILL_TYPE "storage_fill_type" //(type, amount = INFINITY, force = FALSE) //don't fuck this up. Force will ignore max_items, and amount is normally clamped to max_items.
#define COMSIG_TRY_STORAGE_TAKE "storage_take_obj" //(obj, new_loc, force = FALSE) - returns bool
#define COMSIG_TRY_STORAGE_QUICK_EMPTY "storage_quick_empty" //(loc) - returns bool - if loc is null it will dump at parent location.
#define COMSIG_TRY_STORAGE_RETURN_INVENTORY "storage_return_inventory" //(list/list_to_inject_results_into)
#define COMSIG_TRY_STORAGE_RETURN_INVENTORY "storage_return_inventory" //(list/list_to_inject_results_into, recursively_search_inside_storages = TRUE)
#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip" //(obj/item/insertion_candidate, mob/user, silent) - returns bool
/*******Non-Signal Component Related Defines*******/

View File

@@ -73,6 +73,8 @@
slave.refresh_mob_views()
/datum/component/storage/concrete/emp_act(severity)
if(emp_shielded)
return
var/atom/real_location = real_location()
for(var/i in real_location)
var/atom/A = i

View File

@@ -369,10 +369,10 @@
. = TRUE //returns TRUE if any mobs actually got a close(M) call
/datum/component/storage/proc/emp_act(severity)
var/atom/A = parent
if(!isliving(A.loc) && !emp_shielded)
var/datum/component/storage/concrete/master = master()
master.emp_act(severity)
if(emp_shielded)
return
var/datum/component/storage/concrete/master = master()
master.emp_act(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.
@@ -455,23 +455,24 @@
return FALSE
handle_item_insertion(I, FALSE, M)
/datum/component/storage/proc/return_inv()
. = list()
. += contents()
for(var/i in contents())
var/atom/a = i
GET_COMPONENT_FROM(STR, /datum/component/storage, a)
if(STR)
. += STR.return_inv()
/datum/component/storage/proc/return_inv(recursive)
var/list/ret = list()
ret |= contents()
if(recursive)
for(var/i in ret.Copy())
var/atom/A = i
A.SendSignal(COMSIG_TRY_STORAGE_RETURN_INVENTORY, ret, TRUE)
return ret
/datum/component/storage/proc/contents() //ONLY USE IF YOU NEED TO COPY CONTENTS OF REAL LOCATION, COPYING IS NOT AS FAST AS DIRECT ACCESS!
var/atom/real_location = real_location()
return real_location.contents.Copy()
/datum/component/storage/proc/signal_return_inv(list/interface)
//Abuses the fact that lists are just references, or something like that.
/datum/component/storage/proc/signal_return_inv(list/interface, recursive = TRUE)
if(!islist(interface))
return FALSE
interface |= return_inv()
interface |= return_inv(recursive)
return TRUE
/datum/component/storage/proc/mousedrop_onto(atom/over_object, mob/M)

View File

@@ -407,16 +407,14 @@
*/
//Recursive function to find everything a mob is holding. Really shitty proc tbh.
/mob/living/get_contents()
. = list()
. |= list(src)
for(var/obj/o in .)
var/list/newlist = list()
o.SendSignal(COMSIG_TRY_STORAGE_RETURN_INVENTORY, newlist)
. |= newlist
for(var/obj/item/clothing/under/U in .)
. |= U.contents
for(var/obj/item/folder/F in .)
. |= F.contents
var/list/ret = list()
ret |= contents //add our contents
for(var/i in ret.Copy()) //iterate storage objects
var/atom/A = i
A.SendSignal(COMSIG_TRY_STORAGE_RETURN_INVENTORY, ret)
for(var/obj/item/folder/F in ret.Copy()) //very snowflakey-ly iterate folders
ret |= F.contents
return ret
// Living mobs use can_inject() to make sure that the mob is not syringe-proof in general.
/mob/living/proc/can_inject()

View File

@@ -317,8 +317,7 @@
return shock_damage
/mob/living/emp_act(severity)
var/list/L = src.get_contents()
for(var/obj/O in L)
for(var/obj/O in contents)
O.emp_act(severity)
..()