mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
## About The Pull Request So I saw someone was adding a limping quirk in https://github.com/tgstation/tgstation/pull/96200 and I had tried to do the same back in https://github.com/tgstation/tgstation/pull/71470 a few years ago. The codebase has evolved enough to support this behavior that was not present initially during my first attempt. One of the big features of my old PR was to add cane-like behavior to a bunch of other pole objects. This PR introduces a new modular `/datum/component/walking_aid` component, moving canes/crutches away from hardcoded object behavior. This component is now attached to the following items: - Brooms - Mops - Staves - Scythes - Spears - Canes - Crutches There are also some notable changes I made to how things work, detailed below: - Walking aid objects must be held on the same side as the affected leg (if your right leg is missing, you need to be holding crutches on your right arm) - Objects lose their ability as a walking aid while being wielded with two hands (ex. spears) - Limping/Limbless are now both affected by a walking aid, where before only crutches helped assist limbless mobs - "Walking Aid" examine tag when the walking aid object is examined All walking aids (except crutches) reduce limbless slowdown by 40%, and completely ignore any limping penalties. Crutches reduce the limbless slowdown by 60% and are much faster. ## Why It's Good For The Game 1. Mah Immersion 2. More modular code 3. Examine tags are peak 4. Assistants can now justify carrying spears as medical equipment 5. Cane/Poles should help with limblessness, but not as helpful as crutches While I wanted pole items to offer mobility support, they needed to remain less effective than dedicated medical crutches. During testing, I found that a 40% reduction is the point where the benefit becomes noticeable. ## Changelog 🆑 add: Pole objects like mops, brooms, staves, scythes, and spears can now be held in a hand to act as walking aids, mitigating limping from fractures and reducing missing-leg slowdowns. balance: Walking aids must be held in the hand on the same side as the injured or missing leg to provide support, and lose their effectiveness if actively wielded with two hands. balance: Objects with the walking aid reduce limbless slowdown by 40%, while dedicated medical crutches reduce it by 60%. refactor: Refactor cane and crutch code logic into a modular walking aid component /🆑
106 lines
3.8 KiB
Plaintext
106 lines
3.8 KiB
Plaintext
/obj/item/cane
|
|
name = "cane"
|
|
desc = "A cane used by a true gentleman. Or a clown."
|
|
icon = 'icons/obj/weapons/staff.dmi'
|
|
icon_state = "cane"
|
|
inhand_icon_state = "stick"
|
|
icon_angle = 135
|
|
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
|
|
force = 5
|
|
throwforce = 5
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
custom_materials = list(/datum/material/iron= SMALL_MATERIAL_AMOUNT * 0.5)
|
|
attack_verb_continuous = list("bludgeons", "whacks", "disciplines", "thrashes")
|
|
attack_verb_simple = list("bludgeon", "whack", "discipline", "thrash")
|
|
/// The amount of slowdown to reduce for a limbless leg
|
|
var/limbless_slowdown_modifier = 0.6 // reduces slowdown by 40%
|
|
/// Does this cause waddling when held
|
|
var/causes_waddling = FALSE
|
|
|
|
/obj/item/cane/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/walking_aid, limbless_slowdown_modifier, get_walking_aid_required_trait(), causes_waddling)
|
|
|
|
/// Determines if a trait is required to be used as a walking aid (ex. foldable canes)
|
|
/obj/item/cane/proc/get_walking_aid_required_trait()
|
|
return null
|
|
|
|
/obj/item/cane/crutch
|
|
name = "medical crutch"
|
|
desc = "A medical crutch used by people missing a leg. Not all that useful if you're missing both of them, though."
|
|
icon = 'icons/obj/weapons/staff.dmi'
|
|
icon_state = "crutch_med"
|
|
inhand_icon_state = "crutch_med"
|
|
icon_angle = 45
|
|
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
|
|
force = 12
|
|
throwforce = 8
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
custom_materials = list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 0.5)
|
|
attack_verb_continuous = list("bludgeons", "whacks", "thrashes")
|
|
attack_verb_simple = list("bludgeon", "whack", "thrash")
|
|
limbless_slowdown_modifier = 0.4 // reduces slowdown by 60%
|
|
causes_waddling = TRUE
|
|
|
|
/obj/item/cane/crutch/Initialize(mapload)
|
|
. = ..()
|
|
AddElement(/datum/element/cuffable_item)
|
|
|
|
/obj/item/cane/crutch/wood
|
|
name = "wooden crutch"
|
|
desc = "A handmade crutch. Also makes a decent bludgeon if you need it."
|
|
icon_state = "crutch_wood"
|
|
inhand_icon_state = "crutch_wood"
|
|
custom_materials = list(/datum/material/wood = SHEET_MATERIAL_AMOUNT * 5)
|
|
|
|
/obj/item/cane/white
|
|
name = "white cane"
|
|
desc = "Traditionally used by the blind to help them see. Folds down to be easier to transport."
|
|
icon_state = "cane_white"
|
|
inhand_icon_state = "cane_white"
|
|
icon_angle = 45
|
|
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
|
|
force = 1
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
custom_materials = list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 6)
|
|
|
|
/obj/item/cane/white/Initialize(mapload)
|
|
. = ..()
|
|
AddElement(/datum/element/cuffable_item)
|
|
AddComponent( \
|
|
/datum/component/transforming, \
|
|
force_on = 7, \
|
|
hitsound_on = hitsound, \
|
|
w_class_on = WEIGHT_CLASS_BULKY, \
|
|
clumsy_check = FALSE, \
|
|
attack_verb_continuous_on = list("smacks", "strikes", "cracks", "beats"), \
|
|
attack_verb_simple_on = list("smack", "strike", "crack", "beat"), \
|
|
)
|
|
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
|
|
|
|
// White canes only provide support while extended
|
|
/obj/item/cane/white/get_walking_aid_required_trait()
|
|
return TRAIT_TRANSFORM_ACTIVE
|
|
|
|
/*
|
|
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
|
*
|
|
* Gives feedback to the user and makes it show up inhand.
|
|
*/
|
|
/obj/item/cane/white/proc/on_transform(obj/item/source, mob/living/user, active)
|
|
SIGNAL_HANDLER
|
|
|
|
if(user)
|
|
balloon_alert(user, active ? "extended" : "collapsed")
|
|
|
|
if(!HAS_TRAIT(src, TRAIT_BLIND_TOOL))
|
|
ADD_TRAIT(src, TRAIT_BLIND_TOOL, INNATE_TRAIT)
|
|
else
|
|
REMOVE_TRAIT(src, TRAIT_BLIND_TOOL, INNATE_TRAIT)
|
|
|
|
playsound(src, 'sound/items/weapons/batonextend.ogg', 50, TRUE)
|
|
return COMPONENT_NO_DEFAULT_MESSAGE
|