Skip to content

Commit

Permalink
Adds Functional/ Non-Functional modes to suits (#4481)
Browse files Browse the repository at this point in the history
* Added functional toggle to suits, with some exceptions

* Removes Neck slot from armor sets, equalize frontier gas mask to the captain gas mask armor.

* add other reflective armors to the list.

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: FlufflesTheDog <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: FlufflesTheDog <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: FlufflesTheDog <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: FlufflesTheDog <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: FlufflesTheDog <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* made a cute list for armor stats

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

* Update modular_nova/modules/clothing_improvements/code/functional_toggle.dm

---------

Co-authored-by: FlufflesTheDog <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Oct 17, 2024
1 parent b45ef89 commit 6042720
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 2 deletions.
104 changes: 104 additions & 0 deletions modular_nova/modules/clothing_improvements/code/functional_toggle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
Functional Toggle lets you convert stuff to functional (exo suit), with armor, cold and heat protection values, to non functional (neck), with all those set to zero.
It allows people to use a jacket over a piece or armor and only sacrifice the minimal amount of functionality in the pursuit of design.
Use CTRL + SHIFT + LEFT CLICK to turn them on and off.
*/
/obj/item/clothing/suit
/// When set to TRUE, this particular suit is not able to use the functional toggle
var/only_functional
/// A temp list to restore the intitial functional values (for armor, cold protection, etc) to the state they were in prior to using the functional toggle
var/list/functional_suit_values

/obj/item/clothing/suit/Initialize(mapload)
. = ..()

if(!(flags_1 & HAS_CONTEXTUAL_SCREENTIPS_1))
register_context()

/obj/item/clothing/suit/examine(mob/user)
. = ..()

if(!only_functional)
. += span_info("Ctrl + Shift + Left Click to swap between functional (suit) and non-functional (neck) mode, to allow for things such as wearing a (nonfunctional) jacket over a piece of armor for the visual effect.")

#define PREV_SLOT_FLAGS "fs_slots"
#define PREV_COLD_PROTECTION "fs_cold"
#define PREV_HEAT_PROTECTION "fs_heat"
#define PREV_SLOWDOWN "fs_slow"
#define PREV_ARMOR_DATUM "fs_armor"

/obj/item/clothing/suit/click_ctrl_shift(mob/user)
if(!iscarbon(user))
return NONE
if(only_functional)
return NONE
var/mob/living/carbon/char = user
if((char.get_item_by_slot(ITEM_SLOT_NECK) == src) || (char.get_item_by_slot(ITEM_SLOT_OCLOTHING) == src))
to_chat(user, span_warning("You can't adjust [src] while wearing it!"))
return CLICK_ACTION_BLOCKING
if(!user.is_holding(src))
to_chat(user, span_warning("You must be holding [src] in order to adjust it!"))
return CLICK_ACTION_BLOCKING
if(slot_flags & ITEM_SLOT_OCLOTHING)
functional_suit_values = list(
PREV_SLOT_FLAGS = slot_flags,
PREV_COLD_PROTECTION = cold_protection,
PREV_HEAT_PROTECTION = heat_protection,
PREV_SLOWDOWN = slowdown,
PREV_ARMOR_DATUM = armor_type,
)
slot_flags = ITEM_SLOT_NECK
cold_protection = null
heat_protection = null
slowdown = 0
set_armor(/datum/armor/none)
user.visible_message(span_notice("[user] adjusts [user.p_their()] [src] for non-functional use."), span_notice("You adjust your [src] for non-functional use."))
else
slot_flags = functional_suit_values[PREV_SLOT_FLAGS]
cold_protection = functional_suit_values[PREV_COLD_PROTECTION]
heat_protection = functional_suit_values[PREV_HEAT_PROTECTION]
slowdown = functional_suit_values[PREV_SLOWDOWN]
set_armor(functional_suit_values[PREV_ARMOR_DATUM])
user.visible_message(span_notice("[user] adjusts [user.p_their()] [src] for functional use."), span_notice("You adjust your [src] for functional use."))
return CLICK_ACTION_SUCCESS

#undef PREV_SLOT_FLAGS
#undef PREV_COLD_PROTECTION
#undef PREV_HEAT_PROTECTION
#undef PREV_SLOWDOWN
#undef PREV_ARMOR_DATUM
/obj/item/clothing/suit/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
. = ..()

if(only_functional)
return
if(slot_flags == ITEM_SLOT_NECK)
context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB] = "Toggle functional mode"
else
context[SCREENTIP_CONTEXT_CTRL_SHIFT_LMB] = "Toggle non-functional mode"
return CONTEXTUAL_SCREENTIP_SET

// Add the things here that shouldn't have this functionality.

/obj/item/clothing/suit/space
only_functional = TRUE

// Stuff that gives other effects, like reactive armor, reflective armor, etc.

/obj/item/clothing/suit/armor/reactive
only_functional = TRUE

/obj/item/clothing/suit/hooded/ablative
only_functional = TRUE

/obj/item/clothing/suit/armor/heavy/adamantine
only_functional = TRUE

/obj/item/clothing/suit/armor/laserproof
only_functional = TRUE

/obj/item/clothing/suit/hooded/berserker
only_functional = TRUE

/obj/item/clothing/suit/armor/abductor/vest
only_functional = TRUE
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
supports_variations_flags = CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON
worn_icon_teshari = 'modular_nova/modules/kahraman_equipment/icons/clothes/clothing_worn_teshari.dmi'
worn_icon_state = "jacket"
slot_flags = ITEM_SLOT_OCLOTHING|ITEM_SLOT_NECK
slot_flags = ITEM_SLOT_OCLOTHING
armor_type = /datum/armor/colonist_clothing
resistance_flags = NONE
allowed = null
Expand Down Expand Up @@ -207,7 +207,6 @@
worn_icon_teshari = 'modular_nova/modules/kahraman_equipment/icons/clothes/clothing_worn_teshari.dmi'
worn_icon_state = "mask"
flags_inv = HIDEEYES|HIDEFACE|HIDEFACIALHAIR|HIDESNOUT
armor_type = /datum/armor/colonist_hazard

/obj/item/clothing/mask/gas/atmos/frontier_colonist/Initialize(mapload)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -7292,6 +7292,7 @@
#include "modular_nova\modules\clock_cult\code\structures\traps\senders\lever.dm"
#include "modular_nova\modules\clock_cult\code\structures\traps\senders\pressure_sensor.dm"
#include "modular_nova\modules\clothing_improvements\code\chaplain.dm"
#include "modular_nova\modules\clothing_improvements\code\functional_toggle.dm"
#include "modular_nova\modules\clothing_improvements\code\holsters.dm"
#include "modular_nova\modules\colony_fabricator\code\cargo_packs.dm"
#include "modular_nova\modules\colony_fabricator\code\colony_fabricator.dm"
Expand Down

0 comments on commit 6042720

Please sign in to comment.