Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crutches + Allows mobs with 0 usable legs to walk with 2 canes #558

Merged
merged 5 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -151,3 +151,7 @@

/// Sent at the very end of human character setup
#define COMSIG_HUMAN_CHARACTER_SETUP "after_human_setup"

/// from /datum/status_effect/limp/proc/check_step()
#define COMSIG_CARBON_LIMPING "mob_limp_check"
#define COMPONENT_CANCEL_LIMP (1<<0)
5 changes: 5 additions & 0 deletions code/__DEFINES/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
/// The trait that determines if someone has the robotic limb reattachment quirk.
#define TRAIT_ROBOTIC_LIMBATTACHMENT "trait_robotic_limbattachment"

/// Mob can walk despite having two disabled/missing legs so long as they have two of this trait.
/// Kind of jank, refactor at a later day when I can think of a better solution.
/// Just be sure to call update_limbless_locomotion() after applying / removal
#define TRAIT_NO_LEG_AID "no_leg_aid"

#define COLOR_BLOOD "#c90000"

// Used in ready menu anominity
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 @@ -70,6 +70,9 @@
if(!owner.client || owner.body_position == LYING_DOWN || !owner.has_gravity() || (owner.movement_type & (FLYING|FLOATING)) || forced || owner.buckled)
return

if(SEND_SIGNAL(owner, COMSIG_CARBON_LIMPING, (next_leg || right || left)) & COMPONENT_CANCEL_LIMP)
return

// less limping while we have determination still
var/determined_mod = owner.has_status_effect(/datum/status_effect/determined) ? 0.5 : 1

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 @@ -329,6 +329,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("ore box", /obj/structure/ore_box, 4, time = 5 SECONDS, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_CONTAINERS),\
new/datum/stack_recipe("wooden crate", /obj/structure/closet/crate/wooden, 6, time = 5 SECONDS, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_FURNITURE),\
new/datum/stack_recipe("baseball bat", /obj/item/melee/baseball_bat, 5, time = 1.5 SECONDS, check_density = FALSE, category = CAT_WEAPON_MELEE),\
new/datum/stack_recipe("wooden crutch", /obj/item/cane/crutch/wood, 5, time = 1.5 SECONDS, check_density = FALSE, category = CAT_WEAPON_MELEE),\
new/datum/stack_recipe("loom", /obj/structure/loom, 10, time = 1.5 SECONDS, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_TOOLS), \
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/cup/mortar, 3, check_density = FALSE, category = CAT_CHEMISTRY), \
new/datum/stack_recipe("firebrand", /obj/item/match/firebrand, 2, time = 10 SECONDS, check_density = FALSE, category = CAT_TOOLS), \
Expand Down
22 changes: 22 additions & 0 deletions code/game/objects/items/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,28 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301
playsound(src, 'sound/weapons/batonextend.ogg', 50, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE

/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/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/staff
name = "wizard staff"
desc = "Apparently a staff used by the wizard."
Expand Down
19 changes: 15 additions & 4 deletions code/game/turfs/closed/walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
return
leaner.start_leaning(src)

// NON-MODULE CHANGE START
/mob/living/proc/start_leaning(turf/closed/wall/wall)
var/new_y = base_pixel_y + pixel_y
var/new_x = base_pixel_x + pixel_x
Expand All @@ -65,7 +66,7 @@
new_x -= LEANING_OFFSET

animate(src, 0.2 SECONDS, pixel_x = new_x, pixel_y = new_y)
add_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
add_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV, TRAIT_NO_LEG_AID), LEANING_TRAIT)
visible_message(
span_notice("[src] leans against [wall]."),
span_notice("You lean against [wall]."),
Expand All @@ -75,9 +76,16 @@
COMSIG_LIVING_DISARM_HIT,
COMSIG_LIVING_GET_PULLED,
COMSIG_MOVABLE_TELEPORTING,
COMSIG_ATOM_DIR_CHANGE,
COMSIG_LIVING_RESIST,
), PROC_REF(stop_leaning))
RegisterSignal(src, COMSIG_ATOM_POST_DIR_CHANGE, PROC_REF(stop_leaning_dir))
update_fov()
update_limbless_locomotion()

/mob/living/proc/stop_leaning_dir(datum/source, old_dir, new_dir)
SIGNAL_HANDLER
if(new_dir != old_dir)
stop_leaning()

/mob/living/proc/stop_leaning()
SIGNAL_HANDLER
Expand All @@ -86,11 +94,14 @@
COMSIG_LIVING_DISARM_HIT,
COMSIG_LIVING_GET_PULLED,
COMSIG_MOVABLE_TELEPORTING,
COMSIG_ATOM_DIR_CHANGE,
COMSIG_ATOM_POST_DIR_CHANGE,
COMSIG_LIVING_RESIST,
))
animate(src, 0.2 SECONDS, pixel_x = base_pixel_x, pixel_y = base_pixel_y)
remove_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
remove_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV, TRAIT_NO_LEG_AID), LEANING_TRAIT)
update_fov()
update_limbless_locomotion()
// NON-MODULE CHANGE END

/turf/closed/wall/Initialize(mapload)
. = ..()
Expand Down
39 changes: 6 additions & 33 deletions code/modules/mob/living/carbon/carbon_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,25 @@
has_momentum = FALSE
// NON-MODULE CHANGE END

/mob/living/carbon/set_usable_legs(new_value)
. = ..()
if(isnull(.))
return
if(. == 0)
if(usable_legs != 0) //From having no usable legs to having some.
REMOVE_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
else if(usable_legs == 0 && !(movement_type & (FLYING | FLOATING))) //From having usable legs to no longer having them.
ADD_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(!usable_hands)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)


// NON-MODULE CHANGE START
/mob/living/carbon/set_usable_hands(new_value)
. = ..()
if(isnull(.))
return
if(. == 0)
REMOVE_TRAIT(src, TRAIT_HANDS_BLOCKED, LACKING_MANIPULATION_APPENDAGES_TRAIT)
if(usable_hands != 0) //From having no usable hands to having some.
REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
else if(usable_hands == 0 && default_num_hands > 0) //From having usable hands to no longer having them.
ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, LACKING_MANIPULATION_APPENDAGES_TRAIT)
if(!usable_legs && !(movement_type & (FLYING | FLOATING)))
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)

/mob/living/carbon/on_movement_type_flag_enabled(datum/source, flag, old_movement_type)
. = ..()
if(movement_type & (FLYING | FLOATING) && !(old_movement_type & (FLYING | FLOATING)))
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
remove_traits(list(TRAIT_FLOORED, TRAIT_IMMOBILIZED), LACKING_LOCOMOTION_APPENDAGES_TRAIT)
update_limbless_locomotion()
update_limbless_movespeed_mod()

/mob/living/carbon/on_movement_type_flag_disabled(datum/source, flag, old_movement_type)
. = ..()
if(old_movement_type & (FLYING | FLOATING) && !(movement_type & (FLYING | FLOATING)))
var/limbless_slowdown = 0
if(usable_legs < default_num_legs)
limbless_slowdown += (default_num_legs - usable_legs) * 3
if(!usable_legs)
ADD_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(usable_hands < default_num_hands)
limbless_slowdown += (default_num_hands - usable_hands) * 3
if(!usable_hands)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(limbless_slowdown)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, multiplicative_slowdown = limbless_slowdown)
else
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
update_limbless_locomotion()
update_limbless_movespeed_mod()
// NON-MODULE CHANGE END
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
damage_text = "limp and lifeless"
else
damage_text = (body_part.brute_dam >= body_part.burn_dam) ? body_part.heavy_brute_msg : body_part.heavy_burn_msg
msg += "<B>[capitalize(t_his)] [body_part.name] is [damage_text]!</B>\n"
msg += "<B>[capitalize(t_his)] [body_part.plaintext_zone] is [damage_text]!</B>\n"

//stores missing limbs
var/l_limbs_missing = 0
Expand Down
40 changes: 26 additions & 14 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,7 @@ GLOBAL_LIST_EMPTY(fire_appearances)
num_legs = new_value


// NON-MODULE CHANGE START
///Proc to modify the value of usable_legs and hook behavior associated to this event.
/mob/living/proc/set_usable_legs(new_value)
if(usable_legs == new_value)
Expand All @@ -2277,19 +2278,23 @@ GLOBAL_LIST_EMPTY(fire_appearances)
stack_trace("[src] had set_usable_legs() called on them with a negative value!")
new_value = 0

. = usable_legs
var/old_value = usable_legs
usable_legs = new_value

if(new_value > .) // Gained leg usage.
update_limbless_locomotion()
update_limbless_movespeed_mod()

return old_value

/// Updates whether the mob is floored or immobilized based on how many limbs they have or are missing.
/mob/living/proc/update_limbless_locomotion()
if(usable_legs > 0 || (movement_type & (FLYING|FLOATING)) || COUNT_TRAIT_SOURCES(src, TRAIT_NO_LEG_AID) >= 2)
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.
if(!usable_legs)
ADD_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(!usable_hands)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)

update_limbless_movespeed_mod()
return
ADD_TRAIT(src, TRAIT_FLOORED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(usable_hands == 0)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)

/// Updates the mob's movespeed based on how many limbs they have or are missing.
/mob/living/proc/update_limbless_movespeed_mod()
Expand All @@ -2305,6 +2310,7 @@ GLOBAL_LIST_EMPTY(fire_appearances)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/limbless, multiplicative_slowdown = limbless_slowdown)
else
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
// NON-MODULE CHANGE END

///Proc to modify the value of num_hands and hook behavior associated to this event.
/mob/living/proc/set_num_hands(new_value)
Expand All @@ -2314,18 +2320,24 @@ GLOBAL_LIST_EMPTY(fire_appearances)
num_hands = new_value


// NON-MODULE CHANGE START
///Proc to modify the value of usable_hands and hook behavior associated to this event.
/mob/living/proc/set_usable_hands(new_value)
if(usable_hands == new_value)
return
. = usable_hands
if(new_value < 0) // Sanity check
stack_trace("[src] had set_usable_hands() called on them with a negative value!")
new_value = 0

var/old_value = usable_hands
usable_hands = new_value

if(new_value > .) // Gained hand usage.
REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
else if(!(movement_type & (FLYING | FLOATING)) && !usable_hands && !usable_legs) //Lost a hand, not flying, no hands left, no legs.
ADD_TRAIT(src, TRAIT_IMMOBILIZED, LACKING_LOCOMOTION_APPENDAGES_TRAIT)
if(usable_legs < default_num_legs)
update_limbless_locomotion()
update_limbless_movespeed_mod()

return old_value
// NON-MODULE CHANGE END

/// Whether or not this mob will escape from storages while being picked up/held.
/mob/living/proc/will_escape_storage()
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.
1 change: 1 addition & 0 deletions maplestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6258,6 +6258,7 @@
#include "maplestation_modules\code\modules\client\preferences\loadout_preference.dm"
#include "maplestation_modules\code\modules\client\preferences\multiline_preferences.dm"
#include "maplestation_modules\code\modules\client\preferences\name_preferences.dm"
#include "maplestation_modules\code\modules\client\preferences\paraplegic_aid.dm"
#include "maplestation_modules\code\modules\client\preferences\ready_anominity.dm"
#include "maplestation_modules\code\modules\client\preferences\runechat_color.dm"
#include "maplestation_modules\code\modules\client\preferences\sound_frequency.dm"
Expand Down
Loading
Loading