Skip to content

Commit

Permalink
[MIRROR] Adds Crutches to Medbay & Crafting (#2792)
Browse files Browse the repository at this point in the history
* Adds Crutches to Medbay & Crafting (#83242)

## About The Pull Request

Added crutches! Wooden ones can be made with wood. Medical ones can be
bought from the medvendor.

Crutches will reduce slowdown from missing a leg by 60%, and they will
remove the limping from fractured bones. They're also a fairly decent
bludgeon. However, they do nothing if both legs are cut off. Canes now
also remove broken bone limping as well

Changed the 'white cane' name to 'probing cane' to better reflect its
function.

Shuffled some wound and mob code around, added signals for limbless
slowdown and limping.

Crutches make you waddle.

SPRITES BY XHORIAN!!!!!!!!!!!!!


![image](https://github.com/tgstation/tgstation/assets/53100513/fe7e5ac8-0e6e-4291-ae64-c96632997607)

![image](https://github.com/tgstation/tgstation/assets/53100513/bde7fd7a-38d4-4036-82f2-01bdb8a6f00b)

![image](https://github.com/tgstation/tgstation/assets/53100513/9d94bc8d-5a80-4199-a044-7c5cf1944f99)

![image](https://github.com/tgstation/tgstation/assets/53100513/b26ecf53-177a-400d-aa5a-f2c0d5560942)



## Why It's Good For The Game

> Added crutches! Wooden ones can be made with wood. Medical ones can be
bought from the medvendor.

> Crutches will reduce slowdown from missing a leg by 60%, and they will
remove the limping from broken bones. They're also a fairly decent
bludgeon. However, they do nothing if both legs are cut off.

Currently there's no way to abate slowdown from a missing leg except
getting on a vehicle, which I think is pretty lame. What if all the
doctors are busy, missing, or dead? What if medbay is a hole? A crutch
helps make up for the loss at the cost of a hand slot.

> Changed the 'white cane' name to 'probing cane' to better reflect its
function.

'White cane' was undescriptive.

> Shuffled some wound and mob code around, added signals for limbless
slowdown and limping.

I dont know where to put the friggin signals

## Changelog

:cl:
Carlarc, Xhorian
add: Added crutches! Wooden ones can be made with wood. Medical ones can
be bought from the medvendor.
add: Crutches will reduce slowdown from missing a leg by 60%, and they
will remove the limping from fractured bones. (canes do that now too)
They're also a fairly decent bludgeon. However, they do nothing if both
legs are cut off.
/:cl:

---------

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

* Adds Crutches to Medbay & Crafting

* Modular things

---------

Co-authored-by: carlarctg <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
Co-authored-by: Mal <[email protected]>
  • Loading branch information
5 people authored and StealsThePRs committed Jun 2, 2024
1 parent e5c22db commit 07d2bf1
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 9 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,7 @@
#define HANDLE_BLOOD_NO_NUTRITION_DRAIN (1<<1)
/// Return to skip oxyloss and similar effecst from blood level
#define HANDLE_BLOOD_NO_EFFECTS (1<<2)

/// from /datum/status_effect/limp/proc/check_step(mob/whocares, OldLoc, Dir, forced) iodk where it shuld go
#define COMSIG_CARBON_LIMPING "mob_limp_check"
#define COMPONENT_CANCEL_LIMP (1<<0)
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#define COMSIG_LIVING_SET_BUCKLED "living_set_buckled"
///from base of mob/living/set_body_position()
#define COMSIG_LIVING_SET_BODY_POSITION "living_set_body_position"
///from base of mob/living/set_usable_legs()
#define COMSIG_LIVING_LIMBLESS_SLOWDOWN "living_limbless_slowdown"
///From post-can inject check of syringe after attack (mob/user)
#define COMSIG_LIVING_TRY_SYRINGE "living_try_syringe"
///From living/Life(). (deltatime, times_fired)
Expand Down
3 changes: 3 additions & 0 deletions code/datums/status_effects/wound_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
// less limping while we have determination still
var/determined_mod = owner.has_status_effect(/datum/status_effect/determined) ? 0.5 : 1

if(SEND_SIGNAL(owner, COMSIG_CARBON_LIMPING) & COMPONENT_CANCEL_LIMP)
return

if(next_leg == left)
if(prob(limp_chance_left * determined_mod))
owner.client.move_delay += slowdown_left * determined_mod
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
new/datum/stack_recipe("ladder", /obj/structure/ladder/crafted, 15, time = 15 SECONDS, crafting_flags = CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE), \
new/datum/stack_recipe("catwalk floor tile", /obj/item/stack/tile/catwalk_tile, 1, 4, 20, category = CAT_TILES), \
new/datum/stack_recipe("stairs frame", /obj/structure/stairs_frame, 10, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE), \
new/datum/stack_recipe("white cane", /obj/item/cane/white, 3, time = 1 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY, category = CAT_TOOLS), \
new/datum/stack_recipe("probing cane", /obj/item/cane/white, 3, time = 1 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY, category = CAT_TOOLS), \
new/datum/stack_recipe("sharpened iron rod", /obj/item/ammo_casing/rebar, 1, time = 0.2 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY, category = CAT_WEAPON_AMMO), \
))

Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("ore box", /obj/structure/ore_box, 4, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_CONTAINERS),\
new/datum/stack_recipe("wooden crate", /obj/structure/closet/crate/wooden, 6, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_FURNITURE),\
new/datum/stack_recipe("baseball bat", /obj/item/melee/baseball_bat, 5, time = 1.5 SECONDS, crafting_flags = NONE, category = CAT_WEAPON_MELEE),\
new/datum/stack_recipe("wooden crutch", /obj/item/cane/crutch/wood, 5, time = 1.5 SECONDS, crafting_flags = NONE, category = CAT_WEAPON_MELEE),\
new/datum/stack_recipe("loom", /obj/structure/loom, 10, time = 1.5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_TOOLS), \
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/cup/mortar, 3, crafting_flags = NONE, category = CAT_CHEMISTRY), \
new/datum/stack_recipe("firebrand", /obj/item/match/firebrand, 2, time = 10 SECONDS, crafting_flags = NONE, category = CAT_TOOLS), \
Expand Down
86 changes: 85 additions & 1 deletion code/game/objects/items/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,90 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
attack_verb_continuous = list("bludgeons", "whacks", "disciplines", "thrashes")
attack_verb_simple = list("bludgeon", "whack", "discipline", "thrash")

/obj/item/cane/examine(mob/user, thats)
. = ..()
. += span_notice("This item can be used to support your weight, preventing limping from any broken bones on your legs you may have.")

/obj/item/cane/equipped(mob/living/user, slot, initial)
..()
if(!(slot & ITEM_SLOT_HANDS))
return
movement_support_add(user)

/obj/item/cane/dropped(mob/living/user, silent = FALSE)
. = ..()
movement_support_del(user)

/obj/item/cane/proc/movement_support_add(mob/living/user)
RegisterSignal(user, COMSIG_CARBON_LIMPING, PROC_REF(handle_limping))
user.set_usable_legs()
return TRUE

/obj/item/cane/proc/movement_support_del(mob/living/user)
UnregisterSignal(user, list(COMSIG_CARBON_LIMPING))
user.set_usable_legs()
return TRUE

/obj/item/cane/proc/handle_limping(mob/living/user)
SIGNAL_HANDLER
return COMPONENT_CANCEL_LIMP

/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"
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")

/obj/item/cane/crutch/examine(mob/user, thats)
. = ..()
// tacked on after the cane string
. += span_notice("As a crutch, it can also help lessen the slowdown incurred by missing a leg.")

/obj/item/cane/crutch/movement_support_add(mob/living/user)
. = ..()
if(!.)
return
RegisterSignal(user, COMSIG_LIVING_LIMBLESS_SLOWDOWN, PROC_REF(handle_slowdown))
user.update_usable_leg_status()
user.AddElementTrait(TRAIT_WADDLING, REF(src), /datum/element/waddling)

/obj/item/cane/crutch/movement_support_del(mob/living/user)
. = ..()
if(!.)
return
user.update_usable_leg_status()
UnregisterSignal(user, list(COMSIG_LIVING_LIMBLESS_SLOWDOWN, COMSIG_CARBON_LIMPING))
REMOVE_TRAIT(user, TRAIT_WADDLING, REF(src))

/obj/item/cane/crutch/proc/handle_slowdown(mob/living/user, limbless_slowdown, list/slowdown_mods)
SIGNAL_HANDLER
var/leg_amount = user.usable_legs
// Don't do anything if the number is equal (or higher) to the usual.
if(leg_amount >= user.default_num_legs)
return
// If we have at least one leg and it's less than the default, reduce slowdown by 60%.
if(leg_amount && (leg_amount < user.default_num_legs))
slowdown_mods += 0.4

/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 = SMALL_MATERIAL_AMOUNT * 0.5)

/obj/item/cane/white
name = "white cane"
desc = "A cane traditionally used by the blind to help them see. Folds down to be easier to transport."
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"
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
Expand All @@ -530,6 +611,9 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
ADD_TRAIT(src, TRAIT_BLIND_TOOL, INNATE_TRAIT)

/obj/item/cane/white/handle_limping(mob/living/user)
return HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE) ? COMPONENT_CANCEL_LIMP : NONE

/*
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
*
Expand Down
15 changes: 14 additions & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2419,8 +2419,14 @@ GLOBAL_LIST_EMPTY(fire_appearances)

. = usable_legs
usable_legs = new_value
update_usable_leg_status()

if(new_value > .) // Gained leg usage.
/**
* Proc that updates the status of the mob's legs without setting its leg value to something else.
*/
/mob/living/proc/update_usable_leg_status()

if(usable_legs > 0) // Gained leg usage.
REMOVE_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
else if(!(movement_type & (FLYING | FLOATING))) //Lost leg usage, not flying.
Expand All @@ -2433,6 +2439,13 @@ GLOBAL_LIST_EMPTY(fire_appearances)
var/limbless_slowdown = (default_num_legs - usable_legs) * 3
if(!usable_legs && usable_hands < default_num_hands)
limbless_slowdown += (default_num_hands - usable_hands) * 3
var/list/slowdown_mods = list()
SEND_SIGNAL(src, COMSIG_LIVING_LIMBLESS_SLOWDOWN, limbless_slowdown, slowdown_mods)
for(var/num in slowdown_mods)
limbless_slowdown *= num
if(limbless_slowdown == 0)
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
return
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, multiplicative_slowdown = limbless_slowdown)
else
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
Expand Down
2 changes: 2 additions & 0 deletions code/modules/vending/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/obj/item/stack/medical/ointment = 2,
/obj/item/stack/medical/suture = 2,
/obj/item/stack/medical/bone_gel = 4,
/obj/item/cane/crutch = 2,
/obj/item/cane/white = 2,
/obj/item/clothing/glasses/eyepatch/medical = 2,
/obj/item/storage/box/bandages = 2,
Expand Down Expand Up @@ -62,6 +63,7 @@
/obj/item/stack/medical/ointment = 0,
/obj/item/stack/medical/suture = 1,
/obj/item/stack/medical/bone_gel = 1,
/obj/item/cane/crutch = 2,
/obj/item/cane/white = 2,
/obj/item/clothing/glasses/eyepatch/medical = 2,
)
Expand Down
Binary file modified icons/mob/inhands/weapons/melee_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/weapons/melee_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/weapons/staff.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
inhand_icon_state = "crutch"
lefthand_file = 'modular_nova/master_files/icons/mob/inhands/melee_lefthand.dmi'
righthand_file = 'modular_nova/master_files/icons/mob/inhands/melee_righthand.dmi'
custom_materials = list(
/datum/material/iron = SMALL_MATERIAL_AMOUNT * 6,
)
attack_verb_continuous = list("bludgeons", "whacks", "thrashes")
attack_verb_simple = list("bludgeon", "whack", "thrash")

// stupid DM inheritance, we have to remove our icon overrides for subtypes
/obj/item/cane/crutch/wood
icon = 'icons/obj/weapons/staff.dmi'
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'

1 change: 0 additions & 1 deletion modular_nova/modules/modular_vending/code/medical.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/obj/machinery/vending/medical
products_nova = list(
/obj/item/ttsdevice = 3,
/obj/item/cane/crutch = 4,
/obj/item/clothing/glasses/blindfold/color = 2,
)

0 comments on commit 07d2bf1

Please sign in to comment.