mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Adds the MOD Storage Module of Holding (+multiple prerequisite modsuit module refactors) (#94467)
This commit is contained in:
@@ -572,6 +572,13 @@
|
||||
balloon_alert(user, "can't install!")
|
||||
playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
|
||||
return
|
||||
if(SEND_SIGNAL(src, COMSIG_MOD_TRY_INSTALL_MODULE, new_module, user) & MOD_ABORT_INSTALL)
|
||||
return
|
||||
if(SEND_SIGNAL(new_module, COMSIG_MODULE_TRY_INSTALL, src, user) & MOD_ABORT_INSTALL)
|
||||
return
|
||||
finish_install(new_module, user)
|
||||
|
||||
/obj/item/mod/control/proc/finish_install(obj/item/mod/module/new_module, mob/user)
|
||||
new_module.forceMove(src)
|
||||
modules += new_module
|
||||
complexity += new_module.complexity
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
var/overlay_state_use
|
||||
/// Icon file for the overlay.
|
||||
var/overlay_icon_file = 'icons/mob/clothing/modsuit/mod_modules.dmi'
|
||||
/// Overlay given to the item icon of the control unit
|
||||
var/overlay_state_item
|
||||
/// Icon file for the item overlay
|
||||
var/item_overlay_icon_file = 'icons/obj/clothing/modsuit/mod_modules.dmi'
|
||||
/// Does the overlay use the control unit's colors?
|
||||
var/use_mod_colors = FALSE
|
||||
/// What modules are we incompatible with?
|
||||
@@ -459,13 +463,10 @@
|
||||
deactivate()
|
||||
return COMSIG_KB_ACTIVATED
|
||||
|
||||
///Anomaly Locked - Causes the module to not function without an anomaly.
|
||||
///Anomaly Locked - Mostly just a wrapper for modules that don't need to descend from any other module but need the anomaly_locked_module component
|
||||
/obj/item/mod/module/anomaly_locked
|
||||
name = "MOD anomaly locked module"
|
||||
desc = "A form of a module, locked behind an anomalous core to function."
|
||||
incompatible_modules = list()
|
||||
/// The core item the module runs off.
|
||||
var/obj/item/assembly/signaler/anomaly/core
|
||||
/// Accepted types of anomaly cores.
|
||||
var/list/accepted_anomalies = list(/obj/item/assembly/signaler/anomaly)
|
||||
/// If this one starts with a core in.
|
||||
@@ -475,80 +476,4 @@
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!prebuilt || !length(accepted_anomalies))
|
||||
return
|
||||
var/core_path = pick(accepted_anomalies)
|
||||
core = new core_path(src)
|
||||
update_icon_state()
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/Destroy()
|
||||
QDEL_NULL(core)
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/examine(mob/user)
|
||||
. = ..()
|
||||
if(!length(accepted_anomalies))
|
||||
return
|
||||
if(core)
|
||||
. += span_notice("There is a [core.name] installed in it. [core_removable ? "You could remove it with a <b>screwdriver</b>..." : "Unfortunately, due to a design quirk, it's unremovable."]")
|
||||
else
|
||||
var/list/core_list = list()
|
||||
for(var/path in accepted_anomalies)
|
||||
var/atom/core_path = path
|
||||
core_list += initial(core_path.name)
|
||||
. += span_notice("You need to insert \a [english_list(core_list, and_text = " or ")] for this module to function.")
|
||||
if(!core_removable)
|
||||
. += span_notice("Due to some design quirk, once a core is inserted, it won't be removable.")
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/on_select()
|
||||
if(!core)
|
||||
balloon_alert(mod.wearer, "no core!")
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/on_process(seconds_per_tick)
|
||||
. = ..()
|
||||
if(!core)
|
||||
return FALSE
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/on_active_process(seconds_per_tick)
|
||||
if(!core)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/attackby(obj/item/item, mob/living/user, list/modifiers, list/attack_modifiers)
|
||||
if(item.type in accepted_anomalies)
|
||||
if(core)
|
||||
balloon_alert(user, "core already in!")
|
||||
return
|
||||
if(!user.transferItemToLoc(item, src))
|
||||
return
|
||||
core = item
|
||||
balloon_alert(user, "core installed")
|
||||
playsound(src, 'sound/machines/click.ogg', 30, TRUE)
|
||||
update_icon_state()
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/screwdriver_act(mob/living/user, obj/item/tool)
|
||||
. = ..()
|
||||
if(!core)
|
||||
balloon_alert(user, "no core!")
|
||||
return
|
||||
if(!core_removable)
|
||||
balloon_alert(user, "already has core!")
|
||||
return
|
||||
balloon_alert(user, "removing core...")
|
||||
if(!do_after(user, 3 SECONDS, target = src))
|
||||
balloon_alert(user, "interrupted!")
|
||||
return
|
||||
balloon_alert(user, "core removed")
|
||||
core.forceMove(drop_location())
|
||||
if(Adjacent(user) && !issilicon(user))
|
||||
user.put_in_hands(core)
|
||||
core = null
|
||||
update_icon_state()
|
||||
|
||||
/obj/item/mod/module/anomaly_locked/update_icon_state()
|
||||
icon_state = initial(icon_state) + (core ? "-core" : "")
|
||||
return ..()
|
||||
AddComponent(/datum/component/anomaly_locked_module, accepted_anomalies, prebuilt, core_removable)
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#define HOLDING_MODULE_PREVENT_DUPLICATE_CHECK 1
|
||||
#define HOLDING_MODULE_CHECK_CONFIRMED 2
|
||||
|
||||
/obj/item/mod/module/storage/holding
|
||||
name = "MOD storage module of holding"
|
||||
desc = "A prototype storage module utilizing the power of anomalous bluespace phenomena \
|
||||
to store copious amounts of matter. Unfortunately, it suffers from the same drawbacks as its standalone counterpart, \
|
||||
including <b>tearing catastrophic rifts in reality</b> when nested inside bluespace pockets produced through similar means."
|
||||
icon_state = "storage_holding"
|
||||
complexity = 4
|
||||
storage_type = null // core-less modules should be safe to insert into bags of holding
|
||||
var/prebuilt = FALSE
|
||||
var/core_removable = TRUE
|
||||
var/datum/component/anomaly_locked_module/anomalock
|
||||
var/list/possible_bag_bombs = list()
|
||||
|
||||
/obj/item/mod/module/storage/holding/Initialize(mapload)
|
||||
. = ..()
|
||||
anomalock = AddComponent(/datum/component/anomaly_locked_module,\
|
||||
list(/obj/item/assembly/signaler/anomaly/bluespace),\
|
||||
prebuilt,\
|
||||
core_removable,\
|
||||
PROC_REF(pre_core_inserted),\
|
||||
PROC_REF(on_core_inserted),\
|
||||
PROC_REF(on_core_removed),\
|
||||
)
|
||||
RegisterSignal(src, COMSIG_MODULE_TRY_INSTALL, PROC_REF(try_install))
|
||||
|
||||
/obj/item/mod/module/storage/holding/Destroy()
|
||||
possible_bag_bombs.Cut()
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/pre_core_inserted(mob/user, obj/item/core, list/modifiers)
|
||||
if(possible_bag_bombs[core] == HOLDING_MODULE_PREVENT_DUPLICATE_CHECK)
|
||||
return ITEM_INTERACT_FAILURE
|
||||
var/datum/storage/bag_of_holding/other_bag
|
||||
for(var/atom/nested_loc in get_nested_locs(src))
|
||||
if(istype(nested_loc.atom_storage, /datum/storage/bag_of_holding))
|
||||
other_bag = nested_loc.atom_storage
|
||||
break
|
||||
if(other_bag && !possible_bag_bombs[core])
|
||||
INVOKE_ASYNC(src, PROC_REF(recursive_core_insertion), other_bag, user, core, modifiers)
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/recursive_core_insertion(datum/storage/bag_of_holding/bag_storage, mob/user, obj/item/core, list/modifiers)
|
||||
possible_bag_bombs[core] = HOLDING_MODULE_PREVENT_DUPLICATE_CHECK
|
||||
if(bag_storage.confirm_recursive_insertion(core, user) && !QDELETED(core) && user.is_holding(core) && IsReachableBy(user))
|
||||
anomalock.insert_core(src, user, core, modifiers)
|
||||
possible_bag_bombs -= core
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/on_core_inserted(obj/item/core, mob/user)
|
||||
for(var/atom/nested_loc in get_nested_locs(src))
|
||||
var/datum/storage/bag_of_holding/boh = nested_loc.atom_storage
|
||||
if(istype(boh))
|
||||
boh.create_rift(core, user)
|
||||
return
|
||||
core.moveToNullspace() // Otherwise, the core would become part of the suit's inventory.
|
||||
storage_type = /datum/storage/bag_of_holding
|
||||
create_storage(storage_type = /datum/storage/bag_of_holding)
|
||||
atom_storage.set_locked(STORAGE_FULLY_LOCKED)
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/on_core_removed()
|
||||
QDEL_NULL(atom_storage)
|
||||
storage_type = null
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/try_install(_source, obj/item/mod/control/suit, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
if(possible_bag_bombs[suit] == HOLDING_MODULE_PREVENT_DUPLICATE_CHECK)
|
||||
return MOD_ABORT_INSTALL
|
||||
if(!anomalock.core)
|
||||
balloon_alert(user, "no core!")
|
||||
playsound(suit, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
|
||||
return MOD_ABORT_INSTALL
|
||||
var/datum/storage/bag_of_holding/other_bag
|
||||
for(var/atom/nested_loc in get_nested_locs(suit))
|
||||
if(istype(nested_loc.atom_storage, /datum/storage/bag_of_holding))
|
||||
other_bag = nested_loc.atom_storage
|
||||
break
|
||||
if(other_bag)
|
||||
if(possible_bag_bombs[suit] == HOLDING_MODULE_CHECK_CONFIRMED)
|
||||
other_bag.create_rift(src, user)
|
||||
else
|
||||
INVOKE_ASYNC(src, PROC_REF(recursive_installation), other_bag, suit, user)
|
||||
return MOD_ABORT_INSTALL
|
||||
|
||||
/obj/item/mod/module/storage/holding/proc/recursive_installation(datum/storage/bag_of_holding/bag_storage, obj/item/mod/control/suit, mob/user)
|
||||
possible_bag_bombs[suit] = HOLDING_MODULE_PREVENT_DUPLICATE_CHECK
|
||||
if(bag_storage.confirm_recursive_insertion(src, user) && !QDELETED(suit) && user.is_holding(src) && suit.IsReachableBy(user))
|
||||
possible_bag_bombs[suit] = HOLDING_MODULE_CHECK_CONFIRMED
|
||||
suit.install(src, user)
|
||||
possible_bag_bombs -= suit
|
||||
|
||||
/obj/item/mod/module/storage/holding/prebuilt
|
||||
prebuilt = TRUE
|
||||
|
||||
/obj/item/mod/module/storage/holding/prebuilt/locked
|
||||
core_removable = FALSE
|
||||
|
||||
#undef HOLDING_MODULE_PREVENT_DUPLICATE_CHECK
|
||||
#undef HOLDING_MODULE_CHECK_CONFIRMED
|
||||
@@ -9,26 +9,19 @@
|
||||
complexity = 1
|
||||
incompatible_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/plate_compression)
|
||||
required_slots = list(ITEM_SLOT_BACK)
|
||||
/// Max weight class of items in the storage.
|
||||
var/max_w_class = WEIGHT_CLASS_NORMAL
|
||||
/// Max combined weight of all items in the storage.
|
||||
var/max_combined_w_class = 15
|
||||
/// Max amount of items in the storage.
|
||||
var/max_items = 7
|
||||
/// Is nesting same-size storage items allowed?
|
||||
var/big_nesting = FALSE
|
||||
/// The storage type to create for the module
|
||||
var/datum/storage/storage_type = /datum/storage/mod_storage
|
||||
|
||||
/obj/item/mod/module/storage/Initialize(mapload)
|
||||
. = ..()
|
||||
create_storage(max_specific_storage = max_w_class, max_total_storage = max_combined_w_class, max_slots = max_items)
|
||||
atom_storage.allow_big_nesting = TRUE
|
||||
atom_storage.set_locked(STORAGE_FULLY_LOCKED)
|
||||
if(storage_type)
|
||||
create_storage(storage_type = storage_type)
|
||||
atom_storage.set_locked(STORAGE_FULLY_LOCKED)
|
||||
|
||||
/obj/item/mod/module/storage/on_install()
|
||||
. = ..()
|
||||
var/datum/storage/modstorage = mod.create_storage(max_specific_storage = max_w_class, max_total_storage = max_combined_w_class, max_slots = max_items)
|
||||
var/datum/storage/modstorage = mod.create_storage(storage_type = storage_type)
|
||||
modstorage.set_real_location(src)
|
||||
modstorage.allow_big_nesting = big_nesting
|
||||
atom_storage.set_locked(STORAGE_NOT_LOCKED)
|
||||
var/obj/item/clothing/suit = mod.get_part_from_slot(ITEM_SLOT_OCLOTHING)
|
||||
if(istype(suit))
|
||||
@@ -61,18 +54,16 @@
|
||||
whether smuggling, or simply hauling."
|
||||
complexity = 3
|
||||
icon_state = "storage_large"
|
||||
max_combined_w_class = 21
|
||||
max_items = 14
|
||||
storage_type = /datum/storage/mod_storage/expanded
|
||||
|
||||
/obj/item/mod/module/storage/syndicate
|
||||
name = "MOD syndicate storage module"
|
||||
desc = "A storage system using nanotechnology developed by Cybersun Industries, these compartments use \
|
||||
esoteric technology to compress the physical matter of items put inside of them, \
|
||||
essentially shrinking items for much easier and more portable storage."
|
||||
icon_state = "storage_syndi"
|
||||
complexity = 3
|
||||
max_combined_w_class = 30
|
||||
max_items = 21
|
||||
icon_state = "storage_syndi"
|
||||
storage_type = /datum/storage/mod_storage/syndicate
|
||||
|
||||
/obj/item/mod/module/storage/belt
|
||||
name = "MOD case storage module"
|
||||
@@ -81,10 +72,8 @@
|
||||
If you find this equipped to a standard modular suit, then someone has almost certainly shortchanged you on a proper storage module."
|
||||
icon_state = "storage_case"
|
||||
complexity = 0
|
||||
max_w_class = WEIGHT_CLASS_SMALL
|
||||
max_combined_w_class = 21
|
||||
max_items = 7
|
||||
required_slots = list(ITEM_SLOT_BELT)
|
||||
storage_type = /datum/storage/mod_storage/belt
|
||||
|
||||
/obj/item/mod/module/storage/bluespace
|
||||
name = "MOD bluespace storage module"
|
||||
@@ -92,10 +81,7 @@
|
||||
miniaturized bluespace pockets for the ultimate in storage technology; regardless of the weight of objects put inside."
|
||||
complexity = 3
|
||||
icon_state = "storage_large"
|
||||
max_w_class = WEIGHT_CLASS_GIGANTIC
|
||||
max_combined_w_class = 60
|
||||
max_items = 21
|
||||
big_nesting = TRUE
|
||||
storage_type = /datum/storage/mod_storage/bluespace
|
||||
|
||||
///Ion Jetpack - Lets the user fly freely through space using battery charge.
|
||||
/obj/item/mod/module/jetpack
|
||||
|
||||
Reference in New Issue
Block a user