unhardcodes modsuit parts (#82905)

## About The Pull Request

see #70061 but i almost finished it, i only need to go through every
single module and assign it a fitting part

## Changelog
🆑
refactor: modsuits have been refactored if you see bugs report them 
fix: admin cargo tech modsuit outfit now works correctly
/🆑

---------

Co-authored-by: Andrew <mt.forspam@gmail.com>
This commit is contained in:
Fikou
2024-05-19 22:03:59 -07:00
committed by GitHub
co-authored by Andrew
parent 07dbbc72a3
commit 49dccad3a0
32 changed files with 1155 additions and 835 deletions
+83 -52
View File
@@ -8,6 +8,7 @@
icon_state = "storage"
complexity = 3
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.
@@ -28,16 +29,20 @@
modstorage.set_real_location(src)
modstorage.allow_big_nesting = big_nesting
atom_storage.locked = STORAGE_NOT_LOCKED
RegisterSignal(mod.chestplate, COMSIG_ITEM_PRE_UNEQUIP, PROC_REF(on_chestplate_unequip))
var/obj/item/clothing/suit = mod.get_part_from_slot(ITEM_SLOT_OCLOTHING)
if(istype(suit))
RegisterSignal(suit, COMSIG_ITEM_PRE_UNEQUIP, PROC_REF(on_suit_unequip))
/obj/item/mod/module/storage/on_uninstall(deleting = FALSE)
atom_storage.locked = STORAGE_FULLY_LOCKED
QDEL_NULL(mod.atom_storage)
if(!deleting)
atom_storage.remove_all(mod.drop_location())
UnregisterSignal(mod.chestplate, COMSIG_ITEM_PRE_UNEQUIP)
var/obj/item/clothing/suit = mod.get_part_from_slot(ITEM_SLOT_OCLOTHING)
if(istype(suit))
UnregisterSignal(suit, COMSIG_ITEM_PRE_UNEQUIP)
/obj/item/mod/module/storage/proc/on_chestplate_unequip(obj/item/source, force, atom/newloc, no_move, invdrop, silent)
/obj/item/mod/module/storage/proc/on_suit_unequip(obj/item/source, force, atom/newloc, no_move, invdrop, silent)
if(QDELETED(source) || !mod.wearer || newloc == mod.wearer || !mod.wearer.s_store)
return
if(!atom_storage?.attempt_insert(mod.wearer.s_store, mod.wearer, override = TRUE))
@@ -68,14 +73,14 @@
/obj/item/mod/module/storage/belt
name = "MOD case storage module"
desc = "Some concessions had to be made when creating a compressed modular suit core. \
As a result, Roseus Galactic equipped their suit with a slimline storage case. \
If you find this equipped to a standard modular suit, then someone has almost certainly shortchanged you on a proper storage module."
As a result, Roseus Galactic equipped their suit with a slimline storage case. \
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
removable = FALSE
max_combined_w_class = 21
max_items = 7
required_slots = list(ITEM_SLOT_BELT)
/obj/item/mod/module/storage/bluespace
name = "MOD bluespace storage module"
@@ -102,6 +107,7 @@
cooldown_time = 0.5 SECONDS
overlay_state_inactive = "module_jetpack"
overlay_state_active = "module_jetpack_on"
required_slots = list(ITEM_SLOT_BACK)
/// Do we give the wearer a speed buff.
var/full_speed = FALSE
/// Do we have stabilizers? If yes the user won't move from inertia.
@@ -138,14 +144,10 @@
)
/obj/item/mod/module/jetpack/on_activation()
. = ..()
if(!.)
return
if(full_speed)
mod.wearer.add_movespeed_modifier(/datum/movespeed_modifier/jetpack/fullspeed)
/obj/item/mod/module/jetpack/on_deactivation(display_message = TRUE, deleting = FALSE)
. = ..()
if(full_speed)
mod.wearer.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/fullspeed)
@@ -188,6 +190,7 @@
cooldown_time = 30 SECONDS
use_energy_cost = DEFAULT_CHARGE_DRAIN * 5
incompatible_modules = list(/obj/item/mod/module/jump_jet)
required_slots = list(ITEM_SLOT_BACK)
/obj/item/mod/module/jump_jet/on_use()
. = ..()
@@ -228,6 +231,7 @@
use_energy_cost = DEFAULT_CHARGE_DRAIN * 0.1
incompatible_modules = list(/obj/item/mod/module/status_readout)
tgui_id = "status_readout"
required_slots = list(ITEM_SLOT_BACK)
/// Does this show damage types, body temp, satiety
var/display_detailed_vitals = TRUE
/// Does this show DNA data
@@ -305,22 +309,41 @@
complexity = 1
incompatible_modules = list(/obj/item/mod/module/mouthhole)
overlay_state_inactive = "module_apparatus"
required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK)
/// Former flags of the helmet.
var/former_flags = NONE
var/former_helmet_flags = NONE
/// Former visor flags of the helmet.
var/former_visor_flags = NONE
var/former_visor_helmet_flags = NONE
/// Former flags of the mask.
var/former_mask_flags = NONE
/// Former visor flags of the mask.
var/former_visor_mask_flags = NONE
/obj/item/mod/module/mouthhole/on_install()
former_flags = mod.helmet.flags_cover
former_visor_flags = mod.helmet.visor_flags_cover
mod.helmet.flags_cover &= ~(HEADCOVERSMOUTH|PEPPERPROOF)
mod.helmet.visor_flags_cover &= ~(HEADCOVERSMOUTH|PEPPERPROOF)
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(istype(helmet))
former_helmet_flags = helmet.flags_cover
former_visor_helmet_flags = helmet.visor_flags_cover
helmet.flags_cover &= ~(HEADCOVERSMOUTH|PEPPERPROOF)
helmet.visor_flags_cover &= ~(HEADCOVERSMOUTH|PEPPERPROOF)
var/obj/item/clothing/mask = mod.get_part_from_slot(ITEM_SLOT_MASK)
if(istype(mask))
former_mask_flags = mask.flags_cover
former_visor_mask_flags = mask.visor_flags_cover
mask.flags_cover &= ~(MASKCOVERSMOUTH |PEPPERPROOF)
mask.visor_flags_cover &= ~(MASKCOVERSMOUTH |PEPPERPROOF)
/obj/item/mod/module/mouthhole/on_uninstall(deleting = FALSE)
if(deleting)
return
mod.helmet.flags_cover |= former_flags
mod.helmet.visor_flags_cover |= former_visor_flags
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(istype(helmet))
helmet.flags_cover |= former_helmet_flags
helmet.visor_flags_cover |= former_visor_helmet_flags
var/obj/item/clothing/mask = mod.get_part_from_slot(ITEM_SLOT_MASK)
if(istype(mask))
mask.flags_cover |= former_mask_flags
mask.visor_flags_cover |= former_visor_mask_flags
///EMP Shield - Protects the suit from EMPs.
/obj/item/mod/module/emp_shield
@@ -332,6 +355,7 @@
complexity = 1
idle_power_cost = DEFAULT_CHARGE_DRAIN * 0.3
incompatible_modules = list(/obj/item/mod/module/emp_shield)
required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT)
/obj/item/mod/module/emp_shield/on_install()
mod.AddElement(/datum/element/empprotection, EMP_PROTECT_ALL)
@@ -349,7 +373,7 @@
/obj/item/mod/module/emp_shield/advanced/on_suit_activation()
mod.wearer.AddElement(/datum/element/empprotection, EMP_PROTECT_SELF|EMP_PROTECT_CONTENTS)
/obj/item/mod/module/emp_shield/advanced/on_suit_deactivation(deleting)
/obj/item/mod/module/emp_shield/advanced/on_suit_deactivation(deleting = FALSE)
mod.wearer.RemoveElement(/datum/element/empprotection, EMP_PROTECT_SELF|EMP_PROTECT_CONTENTS)
///Flashlight - Gives the suit a customizable flashlight.
@@ -370,6 +394,7 @@
light_range = 4
light_power = 1
light_on = FALSE
required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK)
/// Charge drain per range amount.
var/base_power = DEFAULT_CHARGE_DRAIN * 0.1
/// Minimum range we can set.
@@ -384,17 +409,11 @@
UnregisterSignal(mod.wearer, COMSIG_HIT_BY_SABOTEUR)
/obj/item/mod/module/flashlight/on_activation()
. = ..()
if(!.)
return
set_light_flags(light_flags | LIGHT_ATTACHED)
set_light_on(active)
active_power_cost = base_power * light_range
/obj/item/mod/module/flashlight/on_deactivation(display_message = TRUE, deleting = FALSE)
. = ..()
if(!.)
return
set_light_flags(light_flags & ~LIGHT_ATTACHED)
set_light_on(active)
@@ -464,15 +483,13 @@
use_energy_cost = DEFAULT_CHARGE_DRAIN * 2
incompatible_modules = list(/obj/item/mod/module/dispenser)
cooldown_time = 5 SECONDS
required_slots = list(ITEM_SLOT_GLOVES)
/// Path we dispense.
var/dispense_type = /obj/item/food/burger/plain
/// Time it takes for us to dispense.
var/dispense_time = 0 SECONDS
/obj/item/mod/module/dispenser/on_use()
. = ..()
if(!.)
return
if(dispense_time && !do_after(mod.wearer, dispense_time, target = mod))
balloon_alert(mod.wearer, "interrupted!")
return FALSE
@@ -494,6 +511,7 @@
complexity = 1
use_energy_cost = DEFAULT_CHARGE_DRAIN * 5
incompatible_modules = list(/obj/item/mod/module/longfall)
required_slots = list(ITEM_SLOT_FEET)
/obj/item/mod/module/longfall/on_suit_activation()
RegisterSignal(mod.wearer, COMSIG_LIVING_Z_IMPACT, PROC_REF(z_impact_react))
@@ -532,6 +550,7 @@
active_power_cost = DEFAULT_CHARGE_DRAIN * 0.3
incompatible_modules = list(/obj/item/mod/module/thermal_regulator)
cooldown_time = 0.5 SECONDS
required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT)
/// The temperature we are regulating to.
var/temperature_setting = BODYTEMP_NORMAL
/// Minimum temperature we can set.
@@ -579,9 +598,6 @@
UnregisterSignal(mod, COMSIG_ATOM_EMAG_ACT)
/obj/item/mod/module/dna_lock/on_use()
. = ..()
if(!.)
return
dna = mod.wearer.dna.unique_enzymes
balloon_alert(mod.wearer, "dna updated")
drain_power(use_energy_cost)
@@ -640,6 +656,7 @@
idle_power_cost = DEFAULT_CHARGE_DRAIN * 0.3
incompatible_modules = list(/obj/item/mod/module/plasma_stabilizer)
overlay_state_inactive = "module_plasma"
required_slots = list(ITEM_SLOT_HEAD)
/obj/item/mod/module/plasma_stabilizer/generate_worn_overlay()
if(locate(/obj/item/mod/module/infiltrator) in mod.modules)
@@ -663,6 +680,7 @@
This is a must-have for Nanotrasen Captains, enabling them to show off their authoritative hat even while in their MODsuit."
icon_state = "hat_holder"
incompatible_modules = list(/obj/item/mod/module/hat_stabilizer)
required_slots = list(ITEM_SLOT_HEAD)
/*Intentionally left inheriting 0 complexity and removable = TRUE;
even though it comes inbuilt into the Magnate/Corporate MODS and spawns in maints, I like the idea of stealing them*/
/// Currently "stored" hat. No armor or function will be inherited, only the icon and cover flags.
@@ -672,18 +690,24 @@
var/former_visor_flags
/obj/item/mod/module/hat_stabilizer/on_suit_activation()
RegisterSignal(mod.helmet, COMSIG_ATOM_EXAMINE, PROC_REF(add_examine))
RegisterSignal(mod.helmet, COMSIG_ATOM_ATTACKBY, PROC_REF(place_hat))
RegisterSignal(mod.helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY, PROC_REF(remove_hat))
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(!istype(helmet))
return
RegisterSignal(helmet, COMSIG_ATOM_EXAMINE, PROC_REF(add_examine))
RegisterSignal(helmet, COMSIG_ATOM_ATTACKBY, PROC_REF(place_hat))
RegisterSignal(helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY, PROC_REF(remove_hat))
/obj/item/mod/module/hat_stabilizer/on_suit_deactivation(deleting = FALSE)
if(deleting)
return
if(attached_hat) //knock off the helmet if its on their head. Or, technically, auto-rightclick it for them; that way it saves us code, AND gives them the bubble
remove_hat(src, mod.wearer)
UnregisterSignal(mod.helmet, COMSIG_ATOM_EXAMINE)
UnregisterSignal(mod.helmet, COMSIG_ATOM_ATTACKBY)
UnregisterSignal(mod.helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY)
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(!istype(helmet))
return
UnregisterSignal(helmet, COMSIG_ATOM_EXAMINE)
UnregisterSignal(helmet, COMSIG_ATOM_ATTACKBY)
UnregisterSignal(helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY)
/obj/item/mod/module/hat_stabilizer/proc/add_examine(datum/source, mob/user, list/base_examine)
SIGNAL_HANDLER
@@ -708,10 +732,12 @@
return
if(mod.wearer.transferItemToLoc(hitting_item, src, force = FALSE, silent = TRUE))
attached_hat = hat
former_flags = mod.helmet.flags_cover
former_visor_flags = mod.helmet.visor_flags_cover
mod.helmet.flags_cover |= attached_hat.flags_cover
mod.helmet.visor_flags_cover |= attached_hat.visor_flags_cover
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(istype(helmet))
former_flags = helmet.flags_cover
former_visor_flags = helmet.visor_flags_cover
helmet.flags_cover |= attached_hat.flags_cover
helmet.visor_flags_cover |= attached_hat.visor_flags_cover
balloon_alert(user, "hat attached, right-click to remove")
mod.wearer.update_clothing(mod.slot_flags)
@@ -731,10 +757,21 @@
else
balloon_alert_to_viewers("the hat falls to the floor!")
attached_hat = null
mod.helmet.flags_cover = former_flags
mod.helmet.visor_flags_cover = former_visor_flags
var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD)
if(istype(helmet))
helmet.flags_cover = former_flags
helmet.visor_flags_cover = former_visor_flags
mod.wearer.update_clothing(mod.slot_flags)
/obj/item/mod/module/hat_stabilizer/syndicate
name = "MOD elite hat stabilizer module"
desc = "A simple set of deployable stands, directly atop one's head; \
these will deploy under a hat to keep it from falling off, allowing them to be worn atop the sealed helmet. \
You still need to take the hat off your head while the helmet deploys, though. This is a must-have for \
Syndicate Operatives and Agents alike, enabling them to continue to style on the opposition even while in their MODsuit."
complexity = 0
removable = FALSE
///Sign Language Translator - allows people to sign over comms using the modsuit's gloves.
/obj/item/mod/module/signlang_radio
name = "MOD glove translator module"
@@ -745,6 +782,7 @@
complexity = 1
idle_power_cost = DEFAULT_CHARGE_DRAIN * 0.3
incompatible_modules = list(/obj/item/mod/module/signlang_radio)
required_slots = list(ITEM_SLOT_GLOVES)
/obj/item/mod/module/signlang_radio/on_suit_activation()
ADD_TRAIT(mod.wearer, TRAIT_CAN_SIGN_ON_COMMS, MOD_TRAIT)
@@ -759,6 +797,7 @@
icon_state = "joint_torsion"
complexity = 1
incompatible_modules = list(/obj/item/mod/module/joint_torsion)
required_slots = list(ITEM_SLOT_FEET)
var/power_per_step = DEFAULT_CHARGE_DRAIN * 0.3
/obj/item/mod/module/joint_torsion/on_suit_activation()
@@ -788,15 +827,6 @@
return
mod.core.add_charge(power_per_step)
/obj/item/mod/module/hat_stabilizer/syndicate
name = "MOD elite hat stabilizer module"
desc = "A simple set of deployable stands, directly atop one's head; \
these will deploy under a hat to keep it from falling off, allowing them to be worn atop the sealed helmet. \
You still need to take the hat off your head while the helmet deploys, though. This is a must-have for \
Syndicate Operatives and Agents alike, enabling them to continue to style on the opposition even while in their MODsuit."
complexity = 0
removable = FALSE
/// Module that shoves garbage inside its material container when the user crosses it, and eject the recycled material with MMB.
/obj/item/mod/module/recycler
name = "MOD recycler module"
@@ -810,6 +840,7 @@
incompatible_modules = list(/obj/item/mod/module/recycler)
overlay_state_inactive = "module_recycler"
overlay_state_active = "module_recycler"
required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT)
/// A multiplier of the amount of material extracted from the item
var/efficiency = 1
/// Items that will be collected