diff --git a/code/datums/elements/footstep.dm b/code/datums/elements/footstep.dm index 0d107ae3e318..c3c4397a8f4f 100644 --- a/code/datums/elements/footstep.dm +++ b/code/datums/elements/footstep.dm @@ -75,8 +75,8 @@ var/mob/living/carbon/carbon_source = source if(!carbon_source.get_bodypart(BODY_ZONE_L_LEG) && !carbon_source.get_bodypart(BODY_ZONE_R_LEG)) return - if(carbon_source.m_intent == MOVE_INTENT_WALK) - return// stealth + // if(carbon_source.m_intent == MOVE_INTENT_WALK) // NON-MODULE CHANGE + // return// stealth // NON-MODULE CHANGE steps_for_living[source] += 1 var/steps = steps_for_living[source] diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm index b54559333c75..1021778cd8cc 100644 --- a/code/modules/mob/living/carbon/carbon_movement.dm +++ b/code/modules/mob/living/carbon/carbon_movement.dm @@ -16,6 +16,19 @@ if(m_intent == MOVE_INTENT_RUN) adjust_nutrition(-(HUNGER_FACTOR/10)) + // NON-MODULE CHANGE START + if(m_intent == MOVE_INTENT_RUN && !(movement_type & FLYING) && (mobility_flags & (MOBILITY_MOVE|MOBILITY_STAND)) && !pulledby) + drain_sprint() + if(momentum_dir & direct) + momentum_distance++ + if(!has_momentum && momentum_distance >= 4 && add_movespeed_modifier(/datum/movespeed_modifier/momentum)) + has_momentum = TRUE + else + momentum_dir = direct + momentum_distance = 0 + if(has_momentum && remove_movespeed_modifier(/datum/movespeed_modifier/momentum)) + has_momentum = FALSE + // NON-MODULE CHANGE END /mob/living/carbon/set_usable_legs(new_value) . = ..() diff --git a/config/game_options.txt b/config/game_options.txt index 4d68cadbf1f3..405f637f9d0d 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -34,7 +34,7 @@ COMMENDATION_PERCENT_POLL 0.05 ## These modify the run/walk speed of all mobs before the mob-specific modifiers are applied. RUN_DELAY 1.5 -WALK_DELAY 4 +WALK_DELAY 2.5 ## The variables below affect the movement of specific mob types. THIS AFFECTS ALL SUBTYPES OF THE TYPE YOU CHOOSE! ## Entries completely override all subtypes. Later entries have precedence over earlier entries. diff --git a/maplestation.dme b/maplestation.dme index 4ad6a9b5db9d..3b90db3873a2 100644 --- a/maplestation.dme +++ b/maplestation.dme @@ -5630,6 +5630,7 @@ #include "maplestation_modules\code\modules\mob\living\living.dm" #include "maplestation_modules\code\modules\mob\living\living_movement.dm" #include "maplestation_modules\code\modules\mob\living\speech_and_radio_sounds.dm" +#include "maplestation_modules\code\modules\mob\living\sprint.dm" #include "maplestation_modules\code\modules\mob\living\carbon\human\human.dm" #include "maplestation_modules\code\modules\mob\living\carbon\human\modular_sechud_icons.dm" #include "maplestation_modules\code\modules\mob\living\carbon\human\skrell_hair.dm" diff --git a/maplestation_modules/code/datums/quirks/good.dm b/maplestation_modules/code/datums/quirks/good.dm index 4d03a40a513b..432729ad6fd9 100644 --- a/maplestation_modules/code/datums/quirks/good.dm +++ b/maplestation_modules/code/datums/quirks/good.dm @@ -90,3 +90,26 @@ carbon_holder.unset_pain_mod(PAIN_MOD_QUIRK) #undef LANGUAGE_QUIRK_RANDOM_BLACKLIST + +/// You can sprint for longer +/// (Maybe tie this to the mob's lungs? An idea) +/datum/quirk/marthon_runner + name = "Marathon Runner" + desc = "You can run for longer without getting tired." + icon = FA_ICON_LUNGS + value = 6 + gain_text = span_notice("You feel like you can run for miles (or kilometers).") + lose_text = span_danger("You feel winded.") + medical_record_text = "Patient can run for longer than most." + +/datum/quirk/marthon_runner/add_unique(client/client_source) + var/mob/living/carbon/human/human_holder = quirk_holder + if(istype(human_holder)) + human_holder.sprint_length_max *= 1.5 + human_holder.sprint_length = human_holder.sprint_length_max + +/datum/quirk/marthon_runner/remove(client/client_source) + var/mob/living/carbon/human/human_holder = quirk_holder + if(istype(human_holder)) + human_holder.sprint_length_max /= 1.5 + human_holder.sprint_length = human_holder.sprint_length_max diff --git a/maplestation_modules/code/modules/mob/living/sprint.dm b/maplestation_modules/code/modules/mob/living/sprint.dm new file mode 100644 index 000000000000..684bfa1abd9a --- /dev/null +++ b/maplestation_modules/code/modules/mob/living/sprint.dm @@ -0,0 +1,99 @@ +/atom/movable/screen/mov_intent + var/mutable_appearance/sprint_bar + +/atom/movable/screen/mov_intent/update_overlays() + . = ..() + if(!ishuman(hud?.mymob)) + return + + if(isnull(sprint_bar)) + sprint_bar = mutable_appearance( + icon = 'icons/effects/progessbar.dmi', + icon_state = "prog_bar_100", + ) + sprint_bar.pixel_y -= 2 + + var/mob/living/carbon/human/runner = hud.mymob + sprint_bar.icon_state = "prog_bar_[round(((runner.sprint_length / runner.sprint_length_max) * 100), 5)]" + . += sprint_bar + +/datum/movespeed_modifier/momentum + movetypes = GROUND + flags = IGNORE_NOSLOW + multiplicative_slowdown = -0.1 + +/mob/living/carbon + /// If TRUE, we are being affected by run momentum + var/has_momentum = FALSE + /// Our last move direction, used for tracking momentum + var/momentum_dir = NONE + /// How many tiles we've moved in the momentum direction + var/momentum_distance = 0 + +/mob/living/carbon/human + m_intent = MOVE_INTENT_WALK + /// How many tiles left in your sprint + var/sprint_length = 100 + /// How many tiles you can sprint before spending stamina + var/sprint_length_max = 100 + /// How many tiles you get back per second + var/sprint_regen_per_second = 0.75 + +/mob/living/carbon/human/toggle_move_intent() + . = ..() + if(!client?.prefs.read_preference(/datum/preference/toggle/sound_combatmode)) + return + if(m_intent == MOVE_INTENT_RUN) + playsound_local(get_turf(src), 'maplestation_modules/sound/sprintactivate.ogg', 75, vary = FALSE, pressure_affected = FALSE) + else + playsound_local(get_turf(src), 'maplestation_modules/sound/sprintdeactivate.ogg', 75, vary = FALSE, pressure_affected = FALSE) + +/mob/living/carbon/human/Life(seconds_per_tick, times_fired) + . = ..() + if(!.) + return + if(m_intent == MOVE_INTENT_RUN || sprint_length >= sprint_length_max) + return + + adjust_sprint_left(sprint_regen_per_second * seconds_per_tick * (body_position == LYING_DOWN ? 2 : 1)) + +/mob/living/carbon/proc/adjust_sprint_left(amount) + return + +/mob/living/carbon/human/adjust_sprint_left(amount) + sprint_length = clamp(sprint_length + amount, 0, sprint_length_max) + for(var/atom/movable/screen/mov_intent/selector in hud_used?.static_inventory) + selector.update_appearance(UPDATE_OVERLAYS) + +/mob/living/carbon/proc/drain_sprint() + return + +/mob/living/carbon/human/drain_sprint() + adjust_sprint_left(-1) + // Sprinting when out of sprint will cost stamina + if(sprint_length > 0) + return + + // Okay you're gonna stamcrit yourself, slow your roll + if(getStaminaLoss() >= maxHealth * 0.9) + toggle_move_intent() + return + + adjustStaminaLoss(1) + +/mob/living/carbon/human/fully_heal(heal_flags) + . = ..() + if(heal_flags & (HEAL_ADMIN|HEAL_STAM|HEAL_CC_STATUS)) + adjust_sprint_left(INFINITY) + +// Minor stamina regeneration effects, such as stimulants, will replenish sprint capacity +/mob/living/carbon/human/adjustStaminaLoss(amount, updating_stamina, forced, required_biotype) + . = ..() + if(amount < 0 && amount >= -20) + adjust_sprint_left(amount * 0.25) + +// Entering stamina critical will drain your sprint capacity entirely +/mob/living/carbon/human/enter_stamcrit() + . = ..() + if(HAS_TRAIT_FROM(src, TRAIT_FLOORED, STAMINA)) + adjust_sprint_left(-INFINITY) diff --git a/maplestation_modules/sound/sprintactivate.ogg b/maplestation_modules/sound/sprintactivate.ogg new file mode 100644 index 000000000000..f499765dc228 Binary files /dev/null and b/maplestation_modules/sound/sprintactivate.ogg differ diff --git a/maplestation_modules/sound/sprintdeactivate.ogg b/maplestation_modules/sound/sprintdeactivate.ogg new file mode 100644 index 000000000000..c22587ace000 Binary files /dev/null and b/maplestation_modules/sound/sprintdeactivate.ogg differ