Hardsuit Storage Module (#15711)

This commit is contained in:
Geeves
2023-03-05 07:01:30 +00:00
committed by GitHub
parent 35ed5fd51d
commit e07439dce3
5 changed files with 97 additions and 13 deletions
+1
View File
@@ -1657,6 +1657,7 @@
#include "code\modules\clothing\spacesuits\rig\modules\computer.dm"
#include "code\modules\clothing\spacesuits\rig\modules\modules.dm"
#include "code\modules\clothing\spacesuits\rig\modules\ninja.dm"
#include "code\modules\clothing\spacesuits\rig\modules\storage.dm"
#include "code\modules\clothing\spacesuits\rig\modules\utility.dm"
#include "code\modules\clothing\spacesuits\rig\modules\vision.dm"
#include "code\modules\clothing\spacesuits\rig\suits\alien.dm"
@@ -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"
@@ -0,0 +1,52 @@
/obj/item/rig_module/storage
name = "mounted storage unit"
interface_name = "mounted storage unit"
interface_desc = "A storage unit for storing a precious few items in your hardsuit."
icon_state = "paper"
origin_tech = list(TECH_MAGNET = 2, TECH_MATERIAL = 2, TECH_ENGINEERING = 3)
category = MODULE_GENERAL
var/obj/item/storage/internal/hardsuit/pockets
var/storage_slots = null
var/storage_max_w_class = ITEMSIZE_NORMAL
var/storage_max_storage_space = 9
/obj/item/rig_module/storage/Initialize()
. = ..()
pockets = new /obj/item/storage/internal/hardsuit(src)
pockets.storage_slots = storage_slots
pockets.max_w_class = storage_max_w_class
pockets.max_storage_space = storage_max_storage_space
/obj/item/rig/attack_hand(mob/user as mob)
var/obj/item/rig_module/storage/storage = locate() in installed_modules
if(storage && !storage.pockets.handle_attack_hand(user))
return
return ..()
/obj/item/rig/MouseDrop(obj/over_object as obj)
var/obj/item/rig_module/storage/storage = locate() in installed_modules
if(storage && !storage.pockets.handle_mousedrop(usr, over_object))
return
return ..()
/obj/item/rig/handle_middle_mouse_click(mob/user)
var/obj/item/rig_module/storage/storage = locate() in installed_modules
if(storage && Adjacent(user))
storage.pockets.open(user)
return TRUE
return FALSE
/obj/item/rig/emp_act(severity)
var/obj/item/rig_module/storage/storage = locate() in installed_modules
if(storage)
storage.pockets.emp_act(severity)
return ..()
/obj/item/rig/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
var/obj/item/rig_module/storage/storage = locate() in installed_modules
if(storage)
storage.pockets.hear_talk(M, msg, verb, speaking)
return ..()
@@ -3,6 +3,13 @@
category = "Hardsuit (Modules)"
time = 10
/datum/design/hardsuitmodules/storage
name = "Storage Module"
desc = "A storage unit for storing a precious few items in a hardsuit."
req_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3)
materials = list(DEFAULT_WALL_MATERIAL = 30000, MATERIAL_GLASS = 20000)
build_path = /obj/item/rig_module/storage
/datum/design/hardsuitmodules/iss_module
name = "IIS Module"
desc = "An integrated intelligence system module suitable for most hardsuits."
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- rscadd: "Added hardsuit storage modules to the mechfab."