mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Hardsuit Storage Module (#15711)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
//Types that use this should consider overriding emp_act() and hear_talk(), unless they shield their contents somehow.
|
||||
/obj/item/storage/internal
|
||||
var/obj/item/master_item
|
||||
var/special_master_item_handling = FALSE
|
||||
|
||||
/obj/item/storage/internal/New(obj/item/MI)
|
||||
master_item = MI
|
||||
@@ -39,20 +40,22 @@
|
||||
if (!( istype(over_object, /obj/screen) ))
|
||||
return 1
|
||||
|
||||
var/obj/item/real_master_item = special_master_item_handling ? get_master_item() : master_item
|
||||
|
||||
//makes sure master_item is equipped before putting it in hand, so that we can't drag it into our hand from miles away.
|
||||
//there's got to be a better way of doing this...
|
||||
if (!(master_item.loc == user) || (master_item.loc && master_item.loc.loc == user))
|
||||
if (!(real_master_item.loc == user) || (real_master_item.loc && real_master_item.loc.loc == user))
|
||||
return 0
|
||||
|
||||
if (!( user.restrained() ) && !( user.stat ))
|
||||
switch(over_object.name)
|
||||
if("right hand")
|
||||
user.u_equip(master_item)
|
||||
user.equip_to_slot_if_possible(master_item, slot_r_hand)
|
||||
user.u_equip(real_master_item)
|
||||
user.equip_to_slot_if_possible(real_master_item, slot_r_hand)
|
||||
if("left hand")
|
||||
user.u_equip(master_item)
|
||||
user.equip_to_slot_if_possible(master_item, slot_l_hand)
|
||||
master_item.add_fingerprint(user)
|
||||
user.u_equip(real_master_item)
|
||||
user.equip_to_slot_if_possible(real_master_item, slot_l_hand)
|
||||
real_master_item.add_fingerprint(user)
|
||||
return 0
|
||||
return 0
|
||||
|
||||
@@ -60,30 +63,45 @@
|
||||
//returns 1 if the master item's parent's attack_hand() should be called, 0 otherwise.
|
||||
//It's strange, but no other way of doing it without the ability to call another proc's parent, really.
|
||||
/obj/item/storage/internal/proc/handle_attack_hand(mob/user as mob)
|
||||
var/obj/item/real_master_item = special_master_item_handling ? get_master_item() : master_item
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.l_store == master_item && !H.get_active_hand()) //Prevents opening if it's in a pocket.
|
||||
H.put_in_hands(master_item)
|
||||
if(H.l_store == real_master_item && !H.get_active_hand()) //Prevents opening if it's in a pocket.
|
||||
H.put_in_hands(real_master_item)
|
||||
H.l_store = null
|
||||
return 0
|
||||
if(H.r_store == master_item && !H.get_active_hand())
|
||||
H.put_in_hands(master_item)
|
||||
if(H.r_store == real_master_item && !H.get_active_hand())
|
||||
H.put_in_hands(real_master_item)
|
||||
H.r_store = null
|
||||
return 0
|
||||
|
||||
src.add_fingerprint(user)
|
||||
if (master_item.loc == user)
|
||||
if(real_master_item.loc == user)
|
||||
src.open(user)
|
||||
return 0
|
||||
|
||||
for(var/mob/M in range(1, master_item.loc))
|
||||
for(var/mob/M in range(1, real_master_item.loc))
|
||||
if (M.s_active == src)
|
||||
src.close(M)
|
||||
return 1
|
||||
|
||||
/obj/item/storage/internal/Adjacent(var/atom/neighbor)
|
||||
return master_item.Adjacent(neighbor)
|
||||
var/obj/item/real_master_item = special_master_item_handling ? get_master_item() : master_item
|
||||
return real_master_item.Adjacent(neighbor)
|
||||
|
||||
/obj/item/storage/internal/proc/get_master_item()
|
||||
return master_item
|
||||
|
||||
|
||||
/obj/item/storage/internal/hardsuit
|
||||
special_master_item_handling = TRUE
|
||||
|
||||
/obj/item/storage/internal/hardsuit/get_master_item()
|
||||
if(istype(master_item.loc, /obj/item/rig))
|
||||
return master_item.loc
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/storage/internal/skrell
|
||||
name = "headtail storage"
|
||||
|
||||
Reference in New Issue
Block a user