mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Adds accessory stripping to the strip-menu (#93177)
## About The Pull Request The strip-menu can now support THREE alternate actions instead of two! Adds stripping of accessories with a tgui input list. https://github.com/user-attachments/assets/ab436b5a-751d-42b6-8e2c-1d83c7c7e081 ## Why It's Good For The Game Lets you take off accessories without stripping the person of their uniform first. ## Changelog 🆑 add: Adds a button to the strip-menu to remove somebody's uniform accessories /🆑
This commit is contained in:
@@ -377,8 +377,8 @@
|
||||
result["name"] = item.name
|
||||
result["alternate"] = item_data.get_alternate_actions(owner, user)
|
||||
var/static/list/already_cried = list()
|
||||
if(length(result["alternate"]) > 2 && !(type in already_cried))
|
||||
stack_trace("Too many alternate actions for [type]! Only two are supported at the moment! This will look bad!")
|
||||
if(length(result["alternate"]) > 3 && !(type in already_cried))
|
||||
stack_trace("Too many alternate actions for [type]! Only three are supported at the moment! This will look bad!")
|
||||
already_cried += type
|
||||
|
||||
items[strippable_key] = result
|
||||
|
||||
@@ -55,6 +55,8 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
|
||||
actions += "adjust_sensor"
|
||||
if(jumpsuit.can_adjust)
|
||||
actions += "adjust_jumpsuit"
|
||||
if(length(jumpsuit.attached_accessories))
|
||||
actions += "strip_accessory"
|
||||
|
||||
return actions
|
||||
|
||||
@@ -70,6 +72,8 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
|
||||
do_adjust_jumpsuit(source, user, jumpsuit)
|
||||
if("adjust_sensor")
|
||||
do_adjust_sensor(source, user, jumpsuit)
|
||||
if("strip_accessory")
|
||||
do_strip_accessory(source, user, jumpsuit)
|
||||
else
|
||||
stack_trace("Unknown action key: [action_key] for [type]")
|
||||
|
||||
@@ -124,6 +128,38 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
|
||||
var/mob/living/carbon/human/humano = source
|
||||
humano.update_suit_sensors()
|
||||
|
||||
/datum/strippable_item/mob_item_slot/jumpsuit/proc/do_strip_accessory(atom/source, mob/user, obj/item/clothing/under/jumpsuit)
|
||||
var/list/accessory_choices = list()
|
||||
for(var/obj/item/clothing/accessory/jumpsuit_accessory as anything in jumpsuit.attached_accessories)
|
||||
if(!istype(jumpsuit_accessory))
|
||||
continue
|
||||
accessory_choices[jumpsuit_accessory.name] += jumpsuit_accessory
|
||||
|
||||
var/chosen_accessory_name = tgui_input_list(user, "Select which accessory to strip", "Select Accessory", accessory_choices)
|
||||
var/obj/item/clothing/accessory/chosen_accessory = accessory_choices[chosen_accessory_name]
|
||||
if(isnull(chosen_accessory))
|
||||
return
|
||||
|
||||
if(!user.Adjacent(source))
|
||||
source.balloon_alert(user, "can't reach!")
|
||||
return
|
||||
|
||||
to_chat(source, span_notice("[user] is trying to take [chosen_accessory] off of [jumpsuit]!"))
|
||||
if(!do_after(user, chosen_accessory.strip_delay, source))
|
||||
source.balloon_alert(user, "failed!")
|
||||
return
|
||||
|
||||
to_chat(source, span_notice("[user] has taken [chosen_accessory] off of [jumpsuit]."))
|
||||
jumpsuit.remove_accessory(chosen_accessory)
|
||||
jumpsuit.update_appearance()
|
||||
chosen_accessory.forceMove(jumpsuit.drop_location())
|
||||
|
||||
if(!ismob(source))
|
||||
return
|
||||
|
||||
var/mob/mob_source = source
|
||||
mob_source.update_worn_undersuit()
|
||||
|
||||
/datum/strippable_item/mob_item_slot/suit
|
||||
key = STRIPPABLE_ITEM_SUIT
|
||||
item_slot = ITEM_SLOT_OCLOTHING
|
||||
|
||||
@@ -78,6 +78,11 @@ const ALTERNATE_ACTIONS: Record<string, AlternateAction> = {
|
||||
icon: 'microchip',
|
||||
text: 'Adjust sensors',
|
||||
},
|
||||
|
||||
strip_accessory: {
|
||||
icon: 'ribbon',
|
||||
text: 'Strip accessory',
|
||||
},
|
||||
};
|
||||
|
||||
const SLOTS: Record<
|
||||
@@ -328,6 +333,7 @@ export const StripMenu = (props) => {
|
||||
zIndex: '2',
|
||||
left: `${idx === 0 ? '0' : undefined}`,
|
||||
right: `${idx === 1 ? '0' : undefined}`,
|
||||
top: `${idx === 2 ? '0' : undefined}`,
|
||||
bottom: '0',
|
||||
padding: '0',
|
||||
textAlign: 'center',
|
||||
|
||||
Reference in New Issue
Block a user