diff --git a/code/game/objects/effects/spawners/random/mod.dm b/code/game/objects/effects/spawners/random/mod.dm index 05a1c975c25..53f10441777 100644 --- a/code/game/objects/effects/spawners/random/mod.dm +++ b/code/game/objects/effects/spawners/random/mod.dm @@ -11,6 +11,7 @@ /obj/item/mod/module/tanner, /obj/item/mod/module/balloon, /obj/item/mod/module/paper_dispenser, + /obj/item/mod/module/hat_stabilizer, ) /obj/effect/spawner/random/mod/maint/Initialize(mapload) diff --git a/code/modules/mod/mod_theme.dm b/code/modules/mod/mod_theme.dm index a46dc9e6604..fef66529d38 100644 --- a/code/modules/mod/mod_theme.dm +++ b/code/modules/mod/mod_theme.dm @@ -518,6 +518,7 @@ complexity_max = DEFAULT_MAX_COMPLEXITY + 5 slowdown_inactive = 0.75 slowdown_active = 0.25 + inbuilt_modules = list(/obj/item/mod/module/hat_stabilizer) skins = list( "magnate" = list( HELMET_LAYER = NECK_LAYER, @@ -903,6 +904,7 @@ siemens_coefficient = 0 slowdown_inactive = 0.5 slowdown_active = 0 + inbuilt_modules = list(/obj/item/mod/module/hat_stabilizer) skins = list( "corporate" = list( HELMET_LAYER = null, diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index 91490aeaf44..f38c970477f 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -636,3 +636,102 @@ /obj/item/mod/module/plasma_stabilizer/on_unequip() REMOVE_TRAIT(mod.wearer, TRAIT_NOSELFIGNITION, MOD_TRAIT) + +//Finally, https://pipe.miroware.io/5b52ba1d94357d5d623f74aa/mspfa/Nuke%20Ops/Panels/0648.gif can be real: +///Hat Stabilizer - Allows displaying a hat over the MOD-helmet, à la plasmamen helmets. +/obj/item/mod/module/hat_stabilizer + name = "MOD hat stabilizer module" + desc = "A simple set of deployable stands, directly atop one's head; \ + these will deploy under a select few hats to keep them 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 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) + /*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. + var/obj/item/clothing/head/attached_hat + ///Whitelist of attachable hats; read note in Initialize() below this line + var/static/list/attachable_hats_list + +/obj/item/mod/module/hat_stabilizer/Initialize() + . = ..() + attachable_hats_list = typecacheof( + //List of attachable hats. Make sure these and their subtypes are all tested, so they dont appear janky. + //This list should also be gimmicky, so captains can have fun. I.E. the Santahat, Pirate hat, Tophat, Chefhat... + //Yes, I said it, the captain should have fun. + list( + /obj/item/clothing/head/caphat, + /obj/item/clothing/head/crown, + /obj/item/clothing/head/centhat, + /obj/item/clothing/head/centcom_cap, + /obj/item/clothing/head/pirate, + /obj/item/clothing/head/santa, + /obj/item/clothing/head/hardhat/reindeer, + /obj/item/clothing/head/sombrero, + /obj/item/clothing/head/kitty, + /obj/item/clothing/head/rabbitears, + /obj/item/clothing/head/festive, + /obj/item/clothing/head/powdered_wig, + /obj/item/clothing/head/weddingveil, + /obj/item/clothing/head/that, + /obj/item/clothing/head/nursehat, + /obj/item/clothing/head/chefhat, + /obj/item/clothing/head/papersack, + )) - /obj/item/clothing/head/caphat/beret + //Need to subtract the beret because its annoying + +/obj/item/mod/module/hat_stabilizer/on_suit_activation() + RegisterSignal(mod.helmet, COMSIG_PARENT_EXAMINE, .proc/add_examine) + RegisterSignal(mod.helmet, COMSIG_PARENT_ATTACKBY, .proc/place_hat) + RegisterSignal(mod.helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY, .proc/remove_hat) + +/obj/item/mod/module/hat_stabilizer/on_suit_deactivation() + 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_PARENT_EXAMINE) + UnregisterSignal(mod.helmet, COMSIG_PARENT_ATTACKBY) + UnregisterSignal(mod.helmet, COMSIG_ATOM_ATTACK_HAND_SECONDARY) + +/obj/item/mod/module/hat_stabilizer/proc/add_examine(datum/source, mob/user, list/base_examine) + SIGNAL_HANDLER + if(attached_hat) + base_examine += span_notice("There's \a [attached_hat] placed on the helmet. Right-click to remove it.") + else + base_examine += span_notice("There's nothing placed on the helmet. Yet.") + +/obj/item/mod/module/hat_stabilizer/proc/place_hat(datum/source, obj/item/hitting_item, mob/user) + SIGNAL_HANDLER + if(!istype(hitting_item, /obj/item/clothing/head)) + return + if(!mod.active) + balloon_alert(user, "suit must be active!") + return + if(!is_type_in_typecache(hitting_item, attachable_hats_list)) + balloon_alert(user, "this hat won't fit!") + return + if(attached_hat) + balloon_alert(user, "hat already attached!") + return + if(mod.wearer.transferItemToLoc(hitting_item, src, force = FALSE, silent = TRUE)) + attached_hat = hitting_item + balloon_alert(user, "hat attached, right click to remove") + mod.wearer.update_inv_back() + +/obj/item/mod/module/hat_stabilizer/generate_worn_overlay() + . = ..() + if(attached_hat) + . += attached_hat.build_worn_icon(default_layer = ABOVE_BODY_FRONT_HEAD_LAYER-0.1, default_icon_file = 'icons/mob/clothing/head.dmi') + +/obj/item/mod/module/hat_stabilizer/proc/remove_hat(datum/source, mob/user) + SIGNAL_HANDLER + . = SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + if(!attached_hat) + return + attached_hat.forceMove(drop_location()) + if(user.put_in_active_hand(attached_hat)) + balloon_alert(user, "hat removed") + else + balloon_alert_to_viewers("the hat falls to the floor!") + attached_hat = null + mod.wearer.update_inv_back() diff --git a/icons/obj/clothing/modsuit/mod_modules.dmi b/icons/obj/clothing/modsuit/mod_modules.dmi new file mode 100644 index 00000000000..50798f4845d Binary files /dev/null and b/icons/obj/clothing/modsuit/mod_modules.dmi differ