diff --git a/aurorastation.dme b/aurorastation.dme index 2cac56f6da3..71d5cf57ad3 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -111,11 +111,11 @@ #include "code\_onclick\hud\_defines.dm" #include "code\_onclick\hud\action.dm" #include "code\_onclick\hud\ai.dm" -#include "code\_onclick\hud\nymph_hud.dm" #include "code\_onclick\hud\gun_mode.dm" #include "code\_onclick\hud\hud.dm" #include "code\_onclick\hud\human.dm" #include "code\_onclick\hud\movable_screen_objects.dm" +#include "code\_onclick\hud\nymph_hud.dm" #include "code\_onclick\hud\other_mobs.dm" #include "code\_onclick\hud\parallax.dm" #include "code\_onclick\hud\radial.dm" @@ -296,6 +296,7 @@ #include "code\datums\helper_datums\topic_input.dm" #include "code\datums\looping_sounds\_looping_sound.dm" #include "code\datums\looping_sounds\machinery_sounds.dm" +#include "code\datums\move_intent\move_intent.dm" #include "code\datums\observation\_debug.dm" #include "code\datums\observation\destroyed.dm" #include "code\datums\observation\moved.dm" diff --git a/code/__defines/chemistry.dm b/code/__defines/chemistry.dm index ced9d925590..871ab4f581a 100644 --- a/code/__defines/chemistry.dm +++ b/code/__defines/chemistry.dm @@ -63,8 +63,9 @@ #define CE_PACIFIED "pacified" #define CE_PAINKILLER "painkiller" #define CE_PULSE "xcardic" // increases or decreases heartrate -#define CE_UNDEXTROUS "undextrous" // arms no work right -#define CE_HALLUCINATE "hallucinogen" //Makes hallucinations stronger or weaker +#define CE_UNDEXTROUS "undextrous" // arms no work right +#define CE_HALLUCINATE "hallucinogen" // Makes hallucinations stronger or weaker +#define CE_ENERGETIC "energetic" // Speeds up stamina recovery // Apply healing effects #define CE_ANTIBIOTIC "antibiotic" // Thetamycin diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index e0bc53d9219..6dbdaa471b0 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -236,6 +236,10 @@ #define CREW_HYDRATION_VERYTHIRSTY 0.1 #define CREW_HYDRATION_DEHYDRATED 0 +//Movement. +#define MOVING_DELIBERATELY(X) (X.move_intent.flags & MOVE_INTENT_DELIBERATE) +#define MOVING_QUICKLY(X) (X.move_intent.flags & MOVE_INTENT_QUICK) + #define TINT_NONE 0 #define TINT_MODERATE 1 #define TINT_HEAVY 2 @@ -352,4 +356,9 @@ #define AURA_TYPE_BULLET "Bullet" #define AURA_TYPE_WEAPON "Weapon" #define AURA_TYPE_THROWN "Thrown" -#define AURA_TYPE_LIFE "Life" \ No newline at end of file +#define AURA_TYPE_LIFE "Life" + +// Quick and deliberate movements are not necessarily mutually exclusive +#define MOVE_INTENT_DELIBERATE 1 +#define MOVE_INTENT_EXERTIVE 2 +#define MOVE_INTENT_QUICK 4 \ No newline at end of file diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index f76b28159ed..c22f0515e3b 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -136,13 +136,10 @@ var/list/global_huds var/show_intent_icons = 0 var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) - var/obj/screen/lingchemdisplay - var/obj/screen/blobpwrdisplay - var/obj/screen/blobhealthdisplay var/obj/screen/r_hand_hud_object var/obj/screen/l_hand_hud_object var/obj/screen/action_intent - var/obj/screen/movement_intent/move_intent + var/obj/screen/movement/move_intent var/list/adding var/list/other @@ -162,9 +159,6 @@ datum/hud/New(mob/owner) hurt_intent = null disarm_intent = null help_intent = null - lingchemdisplay = null - blobpwrdisplay = null - blobhealthdisplay = null r_hand_hud_object = null l_hand_hud_object = null action_intent = null diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 00cc6c52cae..f845f447c9a 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -125,9 +125,11 @@ //end intent small hud objects if(hud_data.has_m_intent) - using = new /obj/screen/movement_intent() + using = new /obj/screen/movement() + using.name = "movement method" using.icon = ui_style - using.icon_state = (mymob.m_intent == "run" ? "running" : "walking") + using.icon_state = mymob.move_intent.hud_icon_state + using.screen_loc = ui_movi using.color = ui_color using.alpha = ui_alpha src.adding += using diff --git a/code/_onclick/hud/nymph_hud.dm b/code/_onclick/hud/nymph_hud.dm index 57b6db3a798..1a3858c58ac 100644 --- a/code/_onclick/hud/nymph_hud.dm +++ b/code/_onclick/hud/nymph_hud.dm @@ -8,12 +8,12 @@ var/obj/screen/using - using = new /obj/screen/movement_intent() - using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen/alien.dmi' - using.icon_state = (mymob.m_intent == "run" ? "running" : "walking") - src.adding += using + using = new /obj/screen/movement() + adding += using move_intent = using + using.name = "movement method" //holy shit dionae what the fuck + using.icon_state = mymob.move_intent.hud_icon_state + mymob.healths = new /obj/screen() mymob.healths.icon = 'icons/hud/diona_health.dmi' diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm index a6518debceb..09191503e76 100644 --- a/code/_onclick/hud/other_mobs.dm +++ b/code/_onclick/hud/other_mobs.dm @@ -22,24 +22,6 @@ /mob/living/silicon/ai/instantiate_hud(var/datum/hud/HUD) HUD.ai_hud() -/datum/hud/proc/blob_hud(ui_style = 'icons/mob/screen/midnight.dmi') - - blobpwrdisplay = new /obj/screen() - blobpwrdisplay.name = "blob power" - blobpwrdisplay.icon_state = "block" - blobpwrdisplay.screen_loc = ui_health - blobpwrdisplay.layer = SCREEN_LAYER - - blobhealthdisplay = new /obj/screen() - blobhealthdisplay.name = "blob health" - blobhealthdisplay.icon_state = "block" - blobhealthdisplay.screen_loc = ui_internal - blobhealthdisplay.layer = SCREEN_LAYER - - mymob.client.screen = null - - mymob.client.screen += list(blobpwrdisplay, blobhealthdisplay) - /mob/living/carbon/slime/instantiate_hud(var/datum/hud/HUD) HUD.slime_hud() diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index c5912f03146..a9ef115141d 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -376,53 +376,26 @@ usr.update_inv_r_hand(0) return 1 -/obj/screen/movement_intent - name = "mov_intent" +/obj/screen/movement screen_loc = ui_movi layer = SCREEN_LAYER -//This updates the run/walk button on the hud -/obj/screen/movement_intent/proc/update_move_icon(var/mob/living/user) - if (!user.client) +/obj/screen/movement/proc/update_stamina_bar(var/mob/living/user) + if(!user.client) return - - if (user.max_stamina == -1 || user.stamina == user.max_stamina) - if (user.stamina_bar) + + if(user.get_stamina() == user.get_maximum_stamina()) + if(user.stamina_bar) QDEL_NULL(user.stamina_bar) else - if (!user.stamina_bar) - user.stamina_bar = new(user, user.max_stamina, src) + if(!user.stamina_bar) + user.stamina_bar = new(user, user.get_maximum_stamina(), src) + user.stamina_bar.update(user.get_stamina()) - user.stamina_bar.update(user.stamina) - if (user.m_intent == "run") - icon_state = "running" - else - icon_state = "walking" - -/obj/screen/movement_intent/Click(location, control, params) - if(!usr) - return 1 - var/list/modifiers = params2list(params) - - if(iscarbon(usr)) - var/mob/living/carbon/C = usr - if (modifiers["alt"]) - C.set_walk_speed() - return - - if(C.legcuffed) - to_chat(C, "You are legcuffed! You cannot run until you get [C.legcuffed] removed!") - C.m_intent = "walk" //Just incase - C.hud_used.move_intent.icon_state = "walking" - return 1 - switch(usr.m_intent) - if("run") - usr.m_intent = "walk" - if("walk") - usr.m_intent = "run" - - update_move_icon(usr) +/obj/screen/movement/Click(var/location, var/control, var/params) + if(istype(usr)) + usr.set_next_usable_move_intent() // Hand slots are special to handle the handcuffs overlay /obj/screen/inventory/hand diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 76c3a68d5a2..34310ef0f42 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -145,11 +145,16 @@ var/list/gamemode_cache = list() var/no_click_cooldown = 0 //Used for modifying movement speed for mobs. - //Unversal modifiers - var/walk_speed = 0 + //Universal modifiers var/walk_delay_multiplier = 1 var/run_delay_multiplier = 1 var/vehicle_delay_multiplier = 1 + + var/run_delay = 4 + var/walk_delay = 4 + var/creep_delay = 6 + var/minimum_stamina_recovery = 1 + var/maximum_stamina_recovery = 3 //Mob specific modifiers. NOTE: These will affect different mob types in different ways var/human_delay = 0 @@ -982,8 +987,16 @@ var/list/gamemode_cache = list() if("limbs_can_break") config.limbs_can_break = value - if("walk_speed") - config.walk_speed = value + if("run_delay") + config.run_delay = value + if("walk_delay") + config.walk_delay = value + if("creep_delay") + config.creep_delay = value + if("minimum_stamina_recovery") + config.minimum_stamina_recovery = value + if("maximum_stamina_recovery") + config.maximum_stamina_recovery = value // These should never go to 0 or below. So, we clamp them. if("walk_delay_multiplier") diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm index 2161f83e116..0747d76733f 100644 --- a/code/datums/brain_damage/mild.dm +++ b/code/datums/brain_damage/mild.dm @@ -153,8 +153,6 @@ /datum/brain_trauma/mild/muscle_weakness/on_life() var/fall_chance = 5 - if(owner.m_intent == "run") - fall_chance += 15 if(prob(fall_chance) && !owner.lying && !owner.buckled) to_chat(owner, "Your leg gives out!") owner.Weaken(5) diff --git a/code/datums/brain_damage/severe.dm b/code/datums/brain_damage/severe.dm index 64d8c1416aa..4a0cb8300fb 100644 --- a/code/datums/brain_damage/severe.dm +++ b/code/datums/brain_damage/severe.dm @@ -80,8 +80,6 @@ if(owner.stat == UNCONSCIOUS || owner.sleeping > 0) return var/sleep_chance = 5 - if(owner.m_intent == "run") - sleep_chance += 15 if(owner.drowsyness) sleep_chance += owner.drowsyness + 5 if(owner.drowsyness >= 66) diff --git a/code/datums/move_intent/move_intent.dm b/code/datums/move_intent/move_intent.dm new file mode 100644 index 00000000000..15f97d91bd1 --- /dev/null +++ b/code/datums/move_intent/move_intent.dm @@ -0,0 +1,45 @@ +/decl/move_intent + var/name + var/flags = 0 + var/move_delay = 1 + var/hud_icon_state + +/decl/move_intent/proc/can_be_used_by(var/mob/user) + if(flags & MOVE_INTENT_QUICK) + return user.can_sprint() + return TRUE + +/decl/move_intent/creep + name = "Creep" + flags = MOVE_INTENT_DELIBERATE + hud_icon_state = "creeping" + +/decl/move_intent/creep/Initialize() + . = ..() + move_delay = config.creep_delay + +/decl/move_intent/walk + name = "Walk" + flags = MOVE_INTENT_DELIBERATE + hud_icon_state = "walking" + +/decl/move_intent/walk/Initialize() + . = ..() + move_delay = config.walk_delay + +/decl/move_intent/run + name = "Run" + flags = MOVE_INTENT_EXERTIVE | MOVE_INTENT_QUICK + hud_icon_state = "running" + +/decl/move_intent/run/Initialize() + . = ..() + move_delay = config.run_delay + +/decl/move_intent/walk/animal + name = "Fast Walk" + +/decl/move_intent/walk/animal/Initialize() + . = ..() + move_delay = 0 + diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index f0b82ca43f1..559977ee0cc 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -324,7 +324,7 @@ var/list/mob/living/forced_ambiance_list = new L.lastarea = get_area(L.loc) var/area/newarea = get_area(L.loc) var/area/oldarea = L.lastarea - if((oldarea.has_gravity() == 0) && (newarea.has_gravity() == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together. + if((oldarea.has_gravity() == 0) && (newarea.has_gravity() == 1) && (MOVING_QUICKLY(L))) // Being ready when you change areas gives you a chance to avoid falling all together. thunk(L) L.update_floating( L.Check_Dense_Object() ) @@ -379,7 +379,7 @@ var/list/mob/living/forced_ambiance_list = new if(H.Check_Shoegrip(FALSE)) return - if(H.m_intent == "run") + if(MOVING_QUICKLY(H)) H.AdjustStunned(2) H.AdjustWeakened(2) else diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index bfdbd502d1b..95798994b41 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -102,7 +102,7 @@ perp.update_inv_shoes(1) amount-- - if(amount > 2 && prob(perp.slip_chance(perp.m_intent == "run" ? 20 : 5))) + if(amount > 2 && prob(perp.slip_chance(MOVING_QUICKLY(perp) ? 20 : 5))) perp.slip(src, 4) /obj/effect/decal/cleanable/blood/proc/dry() diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index b849e3b5284..c20522d27fe 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -339,8 +339,8 @@ /obj/item/toy/snappop/Crossed(H as mob|obj) if((ishuman(H))) //i guess carp and shit shouldn't set them off var/mob/living/carbon/M = H - if(M.m_intent == "run") - to_chat(M, SPAN_WARNING("You step on the snap pop!")) + if(MOVING_QUICKLY(M)) + to_chat(M, "You step on the snap pop!") do_pop() /obj/item/toy/snappop/proc/do_pop() diff --git a/code/game/objects/items/weapons/material/caltrops.dm b/code/game/objects/items/weapons/material/caltrops.dm index 64d02e1b3ad..a4e5c076eaf 100644 --- a/code/game/objects/items/weapons/material/caltrops.dm +++ b/code/game/objects/items/weapons/material/caltrops.dm @@ -35,7 +35,7 @@ if(H.shoes || H.wear_suit?.body_parts_covered & FEET) damage_coef -= 0.1 - if (H.m_intent == "run") + if(MOVING_QUICKLY(H)) damage_coef += 0.4 diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 8df97c9a342..1feb4f810ce 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -79,7 +79,7 @@ if(istype(A,/mob/living)) var/mob/living/M = A if(src.wet_type && src.wet_amount) - if(M.buckled || (src.wet_type == 1 && M.m_intent == "walk")) + if(M.buckled || (src.wet_type == 1 && MOVING_DELIBERATELY(M))) return //Water diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index faae94076e3..afbcd3108c4 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -253,7 +253,7 @@ var/const/enterloopsanity = 100 if(H.shoes) var/obj/item/clothing/shoes/S = H.shoes if(istype(S)) - S.handle_movement(src, H.m_intent == "run" ? TRUE : FALSE) + S.handle_movement(src, MOVING_QUICKLY(H) ? TRUE : FALSE) if(S.track_footprint) if(S.blood_DNA) footprint_DNA = S.blood_DNA diff --git a/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm b/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm index a9e618f6ed4..c21d055542c 100644 --- a/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm +++ b/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm @@ -25,6 +25,12 @@ maxHealth = 33.3 health = 33.3 pass_flags = PASSTABLE + stamina = 35 + stamina_recovery = 0.5 + move_intents = list( + /decl/move_intent/walk, + /decl/move_intent/run + ) // Decorative head flower. var/flower_color @@ -76,11 +82,8 @@ /mob/living/carbon/alien/diona/movement_delay() . = ..() - switch(m_intent) - if("walk") - . += 3 - if("run") - species.handle_sprint_cost(src,.+config.walk_speed) + if(MOVING_QUICKLY(src)) + species.handle_sprint_cost(src, . + config.walk_delay) /mob/living/carbon/alien/diona/ex_act(severity) if(life_tick < 4) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 00c1af7f503..61b61e49663 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -35,20 +35,26 @@ . = ..() if(.) - if(src.stat != 2) - if(src.nutrition) - adjustNutritionLoss(nutrition_loss*0.1) - if(src.hydration) - adjustHydrationLoss(hydration_loss*0.1) + if(src.stat != DEAD) + if((move_intent.flags & MOVE_INTENT_EXERTIVE) && src.bodytemperature <= (species ? species.heat_level_1 - 5 : 360)) + bodytemperature += 2 - if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360) - src.bodytemperature += 2 + var/nut_removed = nutrition_loss + var/hyd_removed = hydration_loss + if(move_intent.flags & MOVE_INTENT_EXERTIVE) + nut_removed *= 2 + hyd_removed *= 2 - // Moving around increases germ_level faster - if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8)) - germ_level++ + if(nutrition) + adjustNutritionLoss(nut_removed*0.1) + if(hydration) + adjustHydrationLoss(hyd_removed*0.1) - src.help_up_offer = 0 + // Moving around increases germ_level faster + if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8)) + germ_level++ + + src.help_up_offer = FALSE /mob/living/carbon/relaymove(var/mob/living/user, direction) if((user in contents) && istype(user)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9835a97427b..7d1f2bd5085 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -179,7 +179,7 @@ ..() if(statpanel("Status")) stat("Intent:", "[a_intent]") - stat("Move Mode:", "[m_intent]") + stat("Move Mode:", "[move_intent.name]") if(emergency_shuttle) var/eta_status = emergency_shuttle.get_status_panel_eta() if(eta_status) @@ -1484,13 +1484,20 @@ burn_mod = species.burn_mod brute_mod = species.brute_mod + default_walk_intent = null + default_run_intent = null + move_intent = null + move_intents = species.move_intents.Copy() + set_move_intent(decls_repository.get_decl(move_intents[1])) + if(!istype(move_intent)) + set_next_usable_move_intent() + max_stamina = species.stamina stamina = max_stamina sprint_speed_factor = species.sprint_speed_factor sprint_cost_factor = species.sprint_cost_factor stamina_recovery = species.stamina_recovery - exhaust_threshold = species.exhaust_threshold max_nutrition = BASE_MAX_NUTRITION * species.max_nutrition_factor max_hydration = BASE_MAX_HYDRATION * species.max_hydration_factor diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index f9e296587e0..88b2f52d73f 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -375,8 +375,7 @@ M.do_attack_animation(src) if(usesStamina) - M.stamina = M.stamina - disarm_cost //attempting to knock something out of someone's hands, or pushing them over, is exhausting! - M.stamina = Clamp(M.stamina, 0, M.max_stamina) + M.adjust_stamina(-disarm_cost) //attempting to knock something out of someone's hands, or pushing them over, is exhausting! else M.nutrition = M.nutrition - disarm_cost M.nutrition = Clamp(M.nutrition, 0, M.max_nutrition) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 84ac6ff7bda..0f69363cfb8 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -1,36 +1,42 @@ +/mob/living/carbon/human + move_intents = list(/decl/move_intent/walk) + /mob/living/carbon/human/movement_delay() + var/tally = ..() - var/tally = 0 - if(species.slowdown) - tally = species.slowdown + tally += species.slowdown - if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything + var/area/A = get_area(src) + if(A && !(A.has_gravity())) + tally -= 1 - if (isopenturf(loc)) //open space checks + if(isopenturf(loc)) //open space checks if(!(locate(/obj/structure/lattice, loc) || locate(/obj/structure/stairs, loc) || locate(/obj/structure/ladder, loc))) return -1 if(embedded_flag) handle_embedded_objects() //Moving with objects stuck in you can cause bad times. - var/health_deficiency = (100 - health) - if(health_deficiency >= 40) tally += (health_deficiency / 25) - if(can_feel_pain()) - if(get_shock() >= 10) tally += (get_shock() / 10) //pain shouldn't slow you down if you can't even feel it + if(get_shock() >= 10) + tally += (get_shock() / 10) //pain shouldn't slow you down if you can't even feel it for(var/obj/item/I in list(wear_suit, w_uniform, back, gloves, head)) tally += I.slowdown + var/health_deficiency = (maxHealth - health) + if(health_deficiency >= 40) + tally += (health_deficiency / 25) + if(species) tally += species.get_species_tally(src) - if (nutrition < (max_nutrition * 0.2)) + if(nutrition < (max_nutrition * 0.2)) tally++ if (nutrition < (max_nutrition * 0.1)) tally++ - if (hydration < (max_hydration * 0.2)) + if(hydration < (max_hydration * 0.2)) tally++ if (hydration < (max_hydration * 0.1)) tally++ @@ -58,40 +64,41 @@ tally += 1.5 if (can_feel_pain()) - if(shock_stage >= 10) + if(shock_stage >= 10 || get_stamina() <= 0) tally += 3 if(is_asystole()) tally += 10 //heart attacks are kinda distracting - if(aiming && aiming.aiming_at) tally += 5 // Iron sights make you slower, it's a well-known fact. + if(aiming && aiming.aiming_at) + tally += 5 // Iron sights make you slower, it's a well-known fact. - if (drowsyness) tally += 6 + if(drowsyness) + tally += 6 - if (!(species.flags & IS_MECHANICAL)) // Machines don't move slower when cold. + if(!(species.flags & IS_MECHANICAL)) // Machines don't move slower when cold. if(FAT in src.mutations) tally += 1.5 if (bodytemperature < 283.222) tally += (283.222 - bodytemperature) / 10 * 1.75 tally += max(2 * stance_damage, 0) //damaged/missing feet or legs is slow + if(mRun in mutations) tally = 0 tally += move_delay_mod if(tally > 0 && (CE_SPEEDBOOST in chem_effects)) - tally = max(0, tally-3) + tally = max(0, tally - 3) var/turf/T = get_turf(src) if(T) tally += T.movement_cost - tally += config.human_delay + tally = round(tally, 1) - tally = round(tally,1) - - return tally + return tally + config.human_delay /mob/living/carbon/human/Allow_Spacemove(var/check_drift = 0) @@ -155,7 +162,7 @@ return last_x = x last_y = y - if (m_intent == "run") + if (MOVING_QUICKLY(src)) playsound(src, footsound, 70, 1, required_asfx_toggles = ASFX_FOOTSTEPS) else footstep++ @@ -169,3 +176,6 @@ /mob/living/carbon/human/mob_negates_gravity() return (shoes && shoes.negates_gravity()) + +/mob/living/carbon/human/can_sprint() + return (stamina > 0) diff --git a/code/modules/mob/living/carbon/human/intoxication.dm b/code/modules/mob/living/carbon/human/intoxication.dm index 0a4e2ac09e9..9d66ba027bf 100644 --- a/code/modules/mob/living/carbon/human/intoxication.dm +++ b/code/modules/mob/living/carbon/human/intoxication.dm @@ -90,14 +90,14 @@ var/mob/living/carbon/human/H = target if(istype(H)) H.move_delay_mod += -0.75 - H.sprint_cost_factor += -0.1 + H.sprint_cost_factor += -0.2 /datum/modifier/buzzed/deactivate() ..() var/mob/living/carbon/human/H = target if(istype(H)) H.move_delay_mod -= -0.75 - H.sprint_cost_factor -= -0.1 + H.sprint_cost_factor -= -0.2 /datum/modifier/buzzed/custom_validity() var/mob/living/carbon/human/H = target @@ -116,14 +116,14 @@ var/mob/living/carbon/human/H = target if(istype(H)) H.move_delay_mod += 2 - H.sprint_cost_factor += 0.2 + H.sprint_cost_factor += 0.4 /datum/modifier/drunk/deactivate() ..() var/mob/living/carbon/human/H = target if(istype(H)) H.move_delay_mod -= 2 - H.sprint_cost_factor -= -0.2 + H.sprint_cost_factor -= -0.4 /datum/modifier/drunk/custom_validity() var/mob/living/carbon/human/H = target diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 7b881b253b7..1a7c50f6329 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -74,7 +74,6 @@ handle_medical_side_effects() - //Handles regenerating stamina if we have sufficient air and no oxyloss handle_stamina() if (is_diona()) @@ -85,7 +84,7 @@ handle_stasis_bag() if(!handle_some_updates()) - return //We go ahead and process them 5 times for HUD images and other stuff though. + return //We go ahead and process them 5 times for HUD images and other stuff though. //Update our name based on whether our face is obscured/disfigured name = get_visible_name() @@ -97,6 +96,30 @@ ..() species.handle_npc(src) +/mob/living/carbon/human/get_stamina() + return stamina + +/mob/living/carbon/human/get_maximum_stamina() + return max_stamina + +/mob/living/carbon/human/adjust_stamina(var/amt) + var/last_stamina = stamina + if(stat == DEAD) + stamina = 0 + else + stamina = Clamp(stamina + amt, 0, max_stamina) + if(stamina <= 0) + to_chat(src, SPAN_WARNING("You are exhausted!")) + if(MOVING_QUICKLY(src)) + set_moving_slowly() + if(last_stamina != stamina && hud_used) + hud_used.move_intent.update_stamina_bar(src) + +/mob/living/carbon/human/proc/handle_stamina() + if((world.time - last_quick_move_time) > 5 SECONDS) + var/mod = (lying + (nutrition / initial(nutrition))) / 2 + adjust_stamina(max(config.minimum_stamina_recovery, config.maximum_stamina_recovery * mod) * (1+chem_effects[CE_ENERGETIC])) + /mob/living/carbon/human/proc/handle_some_updates() if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle return 0 @@ -1311,38 +1334,6 @@ if(XRAY in mutations) sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS -/mob/living/carbon/human/proc/handle_stamina() - if (species.stamina == -1) //If species stamina is -1, it has special mechanics which will be handled elsewhere - return //so quit this function - - if (!exhaust_threshold) // Also quit if there's no exhaust threshold specified, because division by 0 is amazing. - return - - if (failed_last_breath || (getOxyLoss() + get_shock()) > exhaust_threshold)//Can't catch our breath if we're suffocating - flash_pain() - return - - if (nutrition <= 0) - if (prob(1.5)) - to_chat(src, span("warning", "You feel hungry and exhausted, eat something to regain your energy!")) - return - - if (hydration <= 0) - if (prob(1.5)) - to_chat(src, span("warning", "You feel thirsty and exhausted, drink something to regain your energy!")) - return - - if (stamina != max_stamina) - //Any suffocation damage slows stamina regen. - //This includes oxyloss from low blood levels - var/regen = stamina_recovery * (1 - min(((getOxyLoss()) / exhaust_threshold) + ((get_shock()) / exhaust_threshold), 1)) - if (regen > 0) - stamina = min(max_stamina, stamina+regen) - adjustNutritionLoss(stamina_recovery*0.09) - adjustHydrationLoss(stamina_recovery*0.32) - if (client) - hud_used.move_intent.update_move_icon(src) - /mob/living/carbon/human/proc/update_oxy_overlay() var/new_oxy if(getOxyLoss()) diff --git a/code/modules/mob/living/carbon/human/species/outsider/shadow.dm b/code/modules/mob/living/carbon/human/species/outsider/shadow.dm index 9515a76fc2c..437ec58e99c 100644 --- a/code/modules/mob/living/carbon/human/species/outsider/shadow.dm +++ b/code/modules/mob/living/carbon/human/species/outsider/shadow.dm @@ -79,7 +79,6 @@ stamina = 500 //Tireless automatons stamina_recovery = 1 sprint_speed_factor = 0.3 - exhaust_threshold = 0 //No oxyloss, so zero threshold inherent_verbs = list( /mob/living/carbon/human/proc/shatter_light, diff --git a/code/modules/mob/living/carbon/human/species/outsider/undead.dm b/code/modules/mob/living/carbon/human/species/outsider/undead.dm index af33101bdba..3d45c188491 100644 --- a/code/modules/mob/living/carbon/human/species/outsider/undead.dm +++ b/code/modules/mob/living/carbon/human/species/outsider/undead.dm @@ -85,7 +85,6 @@ stamina = 500 //Tireless automatons stamina_recovery = 1 sprint_speed_factor = 0.3 - exhaust_threshold = 0 //No oxyloss, so zero threshold max_nutrition_factor = -1 @@ -133,7 +132,6 @@ stamina = 500 //Tireless automatons stamina_recovery = 1 sprint_speed_factor = 0.3 - exhaust_threshold = 0 //No oxyloss, so zero threshold max_nutrition_factor = -1 @@ -210,7 +208,6 @@ stamina = 500 //Tireless automatons stamina_recovery = 1 sprint_speed_factor = 0.3 - exhaust_threshold = 0 //No oxyloss, so zero threshold inherent_verbs = list(/mob/living/carbon/human/proc/darkness_eyes) diff --git a/code/modules/mob/living/carbon/human/species/outsider/vox.dm b/code/modules/mob/living/carbon/human/species/outsider/vox.dm index d285c135c93..cfca626dcff 100644 --- a/code/modules/mob/living/carbon/human/species/outsider/vox.dm +++ b/code/modules/mob/living/carbon/human/species/outsider/vox.dm @@ -98,7 +98,7 @@ stamina = 120 // Vox are even faster than unathi and can go longer, but recover slowly sprint_speed_factor = 3 stamina_recovery = 1 - sprint_cost_factor = 0.7 + sprint_cost_factor = 1.4 cold_level_1 = 80 cold_level_2 = 50 diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 197072518dc..0da6d4c41d1 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -165,6 +165,8 @@ var/appearance_flags = 0 // Appearance/display related features. var/spawn_flags = 0 // Flags that specify who can spawn as this species var/slowdown = 0 // Passive movement speed malus (or boost, if negative) + // Move intents. Earlier in list == default for that type of movement. + var/list/move_intents = list(/decl/move_intent/walk, /decl/move_intent/run, /decl/move_intent/creep) var/primitive_form // Lesser form, if any (ie. monkey for humans) var/greater_form // Greater form, if any, ie. human for monkeys. var/holder_type @@ -176,7 +178,6 @@ var/stamina_recovery = 3 // Flat amount of stamina species recovers per proc var/sprint_speed_factor = 0.7 // The percentage of bonus speed you get when sprinting. 0.4 = 40% var/sprint_cost_factor = 0.9 // Multiplier on stamina cost for sprinting - var/exhaust_threshold = 50 // When stamina runs out, the mob takes oxyloss up til this value. Then collapses and drops to walk var/gluttonous = 0 // Can eat some mobs. Values can be GLUT_TINY, GLUT_SMALLER, GLUT_ANYTHING, GLUT_ITEM_TINY, GLUT_ITEM_NORMAL, GLUT_ITEM_ANYTHING, GLUT_PROJECTILE_VOMIT var/stomach_capacity = 5 // How much stuff they can stick in their stomach @@ -501,53 +502,6 @@ return 1 -/datum/species/proc/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) - if (!H.exhaust_threshold) - return 1 // Handled. - - cost *= H.sprint_cost_factor - if (H.stamina == -1) - log_debug("Error: Species with special sprint mechanics has not overridden cost function.") - return 0 - - var/remainder = 0 - if (H.stamina > cost) - H.stamina -= cost - H.hud_used.move_intent.update_move_icon(H) - return 1 - else if (H.stamina > 0) - remainder = cost - H.stamina - H.stamina = 0 - else - remainder = cost - - if(H.disabilities & ASTHMA) - H.adjustOxyLoss(remainder*0.15) - - if(H.disabilities & COUGHING) - H.adjustHalLoss(remainder*0.1) - - if (breathing_organ && has_organ[breathing_organ]) - var/obj/item/organ/O = H.internal_organs_by_name[breathing_organ] - if(O.is_bruised()) - H.adjustOxyLoss(remainder*0.15) - H.adjustHalLoss(remainder*0.25) - - H.adjustHalLoss(remainder*0.25) - H.updatehealth() - if((H.get_shock() >= 10) && prob(H.get_shock() *2)) - H.flash_pain() - - if ((H.get_shock() + H.getOxyLoss()) >= (exhaust_threshold * 0.8)) - H.m_intent = "walk" - H.hud_used.move_intent.update_move_icon(H) - to_chat(H, span("danger", "You're too exhausted to run anymore!")) - H.flash_pain() - return 0 - - H.hud_used.move_intent.update_move_icon(H) - return 1 - /datum/species/proc/get_light_color(mob/living/carbon/human/H) return @@ -603,3 +557,9 @@ /datum/species/proc/handle_despawn() return + +/datum/species/proc/has_special_sprint() + return FALSE + +/datum/species/proc/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/station/diona/diona.dm b/code/modules/mob/living/carbon/human/species/station/diona/diona.dm index 11eec442ecb..1a105d9ae13 100644 --- a/code/modules/mob/living/carbon/human/species/station/diona/diona.dm +++ b/code/modules/mob/living/carbon/human/species/station/diona/diona.dm @@ -111,9 +111,9 @@ reagent_tag = IS_DIONA - stamina = -1 // Diona sprinting uses energy instead of stamina - sprint_speed_factor = 0.5 //Speed gained is minor - sprint_cost_factor = 0.8 + stamina = 1 // Diona sprinting uses energy instead of stamina + sprint_speed_factor = 0.6 //Speed gained is minor + sprint_cost_factor = 1.6 climb_coeff = 1.3 vision_organ = BP_HEAD @@ -122,34 +122,33 @@ allowed_citizenships = list(CITIZENSHIP_BIESEL, CITIZENSHIP_JARGON, CITIZENSHIP_SOL, CITIZENSHIP_COALITION, CITIZENSHIP_DOMINIA, CITIZENSHIP_IZWESKI, CITIZENSHIP_NONE) allowed_religions = list(RELIGION_QEBLAK, RELIGION_WEISHII, RELIGION_MOROZ, RELIGION_THAKH, RELIGION_SKAKH, RELIGION_NONE, RELIGION_OTHER) +/datum/species/diona/has_special_sprint() + return TRUE + /datum/species/diona/handle_sprint_cost(var/mob/living/carbon/H, var/cost) var/datum/dionastats/DS = H.get_dionastats() if (!DS) - return 0 //Something is very wrong + return //Something is very wrong var/remainder = cost * H.sprint_cost_factor if (H.total_radiation && !DS.regening_organ) if (H.total_radiation > (cost*0.5))//Radiation counts as double energy H.apply_radiation(cost*(-0.5)) - return 1 else remainder = cost - (H.total_radiation*2) H.total_radiation = 0 if (DS.stored_energy > remainder) DS.stored_energy -= remainder - return 1 else remainder -= DS.stored_energy DS.stored_energy = 0 H.adjustHalLoss(remainder*5, 1) H.updatehealth() - H.m_intent = "walk" - H.hud_used.move_intent.update_move_icon(H) + H.set_moving_slowly() to_chat(H, span("danger", "We have expended our energy reserves, and cannot continue to move at such a pace. We must find light!")) - return 0 /datum/species/diona/can_understand(var/mob/other) var/mob/living/carbon/alien/diona/D = other diff --git a/code/modules/mob/living/carbon/human/species/station/golem.dm b/code/modules/mob/living/carbon/human/species/station/golem.dm index 75930a9f64f..0742f6cb1b2 100644 --- a/code/modules/mob/living/carbon/human/species/station/golem.dm +++ b/code/modules/mob/living/carbon/human/species/station/golem.dm @@ -85,7 +85,6 @@ var/global/list/golem_types = list("Coal Golem", stamina = 500 //Tireless automatons stamina_recovery = 1 sprint_speed_factor = 0.3 - exhaust_threshold = 0 //No oxyloss, so zero threshold remains_type = /obj/effect/decal/cleanable/ash diff --git a/code/modules/mob/living/carbon/human/species/station/human/human.dm b/code/modules/mob/living/carbon/human/species/station/human/human.dm index f209c99cbf4..998b2ed9c34 100644 --- a/code/modules/mob/living/carbon/human/species/station/human/human.dm +++ b/code/modules/mob/living/carbon/human/species/station/human/human.dm @@ -31,7 +31,7 @@ stamina = 130 // Humans can sprint for longer than any other species stamina_recovery = 5 sprint_speed_factor = 0.9 - sprint_cost_factor = 0.5 + sprint_cost_factor = 1.25 grab_mod = 1.25 //humans are wily fuckers - geeves climb_coeff = 1 diff --git a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm index 726a45a1d2a..fec152c6679 100644 --- a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm +++ b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm @@ -107,8 +107,8 @@ heat_discomfort_strings = list( "Your CPU temperature probes warn you that you are approaching critical heat levels!" ) - stamina = -1 // Machines use power and generate heat, stamina is not a thing - sprint_speed_factor = 1 // About as capable of speed as a human + stamina = 1 // Machines use power and generate heat, stamina is not a thing + sprint_speed_factor = 0.8 //Slightly slower than a human. max_hydration_factor = -1 @@ -124,21 +124,6 @@ datum/species/machine/handle_post_spawn(var/mob/living/carbon/human/H) . = ..() check_tag(H, H.client) -/datum/species/machine/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) - if (H.stat == CONSCIOUS) - H.bodytemperature += cost * sprint_temperature_factor - H.adjustNutritionLoss(cost * sprint_charge_factor) - if(H.nutrition <= 0 && H.max_nutrition > 0) - H.Weaken(15) - H.m_intent = "walk" - H.hud_used.move_intent.update_move_icon(H) - to_chat(H, span("danger", "ERROR: Power reserves depleted, emergency shutdown engaged. Backup power will come online in approximately 30 seconds, initiate charging as primary directive.")) - playsound(H.loc, 'sound/machines/buzz-two.ogg', 100, 0) - else - return 1 - - return 0 - /datum/species/machine/handle_death(var/mob/living/carbon/human/H) ..() H.f_style = "" @@ -297,6 +282,22 @@ datum/species/machine/handle_post_spawn(var/mob/living/carbon/human/H) . = ..() check_tag(H, H.client) +/datum/species/machine/has_special_sprint() + return TRUE + +/datum/species/machine/handle_sprint_cost(var/mob/living/carbon/human/H, var/cost) + if (H.stat == CONSCIOUS) + H.bodytemperature += cost * sprint_temperature_factor + H.adjustNutritionLoss(cost * sprint_charge_factor) + if(H.nutrition <= 0 && H.max_nutrition > 0) + H.Weaken(15) + H.set_moving_slowly() + to_chat(H, span("danger", "ERROR: Power reserves depleted, emergency shutdown engaged. Backup power will come online in approximately 30 seconds, initiate charging as primary directive.")) + playsound(get_turf(H), 'sound/machines/buzz-two.ogg', 100, 0) + else + return + return + /datum/species/machine/handle_death_check(var/mob/living/carbon/human/H) if(H.get_total_health() <= config.health_threshold_dead) return TRUE diff --git a/code/modules/mob/living/carbon/human/species/station/tajara/tajara.dm b/code/modules/mob/living/carbon/human/species/station/tajara/tajara.dm index 236a7c57554..1383178c03b 100644 --- a/code/modules/mob/living/carbon/human/species/station/tajara/tajara.dm +++ b/code/modules/mob/living/carbon/human/species/station/tajara/tajara.dm @@ -32,7 +32,7 @@ stamina = 90 // Tajara evolved to maintain a steady pace in the snow, sprinting wastes energy stamina_recovery = 4 sprint_speed_factor = 0.65 - sprint_cost_factor = 0.75 + sprint_cost_factor = 1.5 blurb = "The Tajaran race is a species of feline-like bipeds hailing from the planet of Adhomai in the S'rendarr \ system. They have been brought up into the space age by the Humans and Skrell, who alledgedly influenced their \ diff --git a/code/modules/mob/living/carbon/human/species/station/unathi/unathi.dm b/code/modules/mob/living/carbon/human/species/station/unathi/unathi.dm index 304f3377c13..de54d35bd60 100644 --- a/code/modules/mob/living/carbon/human/species/station/unathi/unathi.dm +++ b/code/modules/mob/living/carbon/human/species/station/unathi/unathi.dm @@ -36,9 +36,8 @@ stamina = 120 // Unathi have the shortest but fastest sprint of all stamina_recovery = 5 - sprint_cost_factor = 1.45 + sprint_cost_factor = 7 sprint_speed_factor = 3.2 - exhaust_threshold = 65 rarity_value = 3 breakcuffs = list(MALE) diff --git a/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca.dm b/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca.dm index 5e3af7d03e2..c4a6b432150 100644 --- a/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca.dm +++ b/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca.dm @@ -89,7 +89,7 @@ stamina = 100 // Long period of sprinting, but relatively low speed gain sprint_speed_factor = 0.7 - sprint_cost_factor = 0.30 + sprint_cost_factor = 0.6 stamina_recovery = 2 //slow recovery has_organ = list( diff --git a/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca_subspecies.dm b/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca_subspecies.dm index e1a809ee9c1..0955f39a7c1 100644 --- a/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca_subspecies.dm +++ b/code/modules/mob/living/carbon/human/species/station/vaurca/vaurca_subspecies.dm @@ -31,7 +31,7 @@ stamina = 115 sprint_speed_factor = 1.0 - sprint_cost_factor = 0.40 + sprint_cost_factor = 0.8 stamina_recovery = 3 @@ -70,7 +70,7 @@ stamina = 175 sprint_speed_factor = 1 - sprint_cost_factor = 0.80 + sprint_cost_factor = 1.6 stamina_recovery = 3 spawn_flags = IS_RESTRICTED @@ -126,7 +126,7 @@ stamina = 200 stamina_recovery = 5 sprint_speed_factor = 0.9 - sprint_cost_factor = 0.5 + sprint_cost_factor = 1.0 heat_level_1 = 1000 //Default 360 heat_level_2 = 4000 //Default 400 diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index d6b4fd9db91..a676e8aae6a 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -1112,11 +1112,8 @@ There are several things that need to be remembered: standing = image('icons/mob/mob.dmi', "legcuff1") overlays_raw[LEGCUFF_LAYER] = standing - if(m_intent != "walk") - m_intent = "walk" - if(hud_used && hud_used.move_intent) - hud_used.move_intent.icon_state = "walking" - + if(!MOVING_DELIBERATELY(src)) + set_moving_slowly() else overlays_raw[LEGCUFF_LAYER] = null diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm index decc282ae87..652b9cf0341 100644 --- a/code/modules/mob/living/carbon/resist.dm +++ b/code/modules/mob/living/carbon/resist.dm @@ -202,7 +202,7 @@ if((isunathi(src)) || (HULK in mutations)) say(pick("RAAAAAAAARGH!", "HNNNNNNNNNGGGGGGH!", "GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", "AAAAAAARRRGH!" )) - stamina -= 100 //takes a bunch of stamina + stamina = max(0, (stamina - 100)) //takes a bunch of stamina qdel(handcuffed) handcuffed = null diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index cc082c01e0d..bc6c893a5c5 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -123,7 +123,12 @@ default behaviour is: now_pushing = FALSE spawn(0) . = ..() - if (!istype(AM, /atom/movable)) + if (!istype(AM, /atom/movable) || AM.anchored) + if(confused && prob(50) && !MOVING_DELIBERATELY(src)) + Weaken(2) + playsound(loc, "punch", 25, 1, -1) + visible_message(SPAN_WARNING("\The [src] [pick("ran", "slammed")] into \the [AM]!")) + src.apply_damage(5, BRUTE) return if (!now_pushing) now_pushing = TRUE @@ -927,4 +932,4 @@ default behaviour is: if(auras) for(var/a in auras) remove_aura(a) - return ..() \ No newline at end of file + return ..() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 80309f1bc12..c2b97d91887 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -49,13 +49,12 @@ //These values are duplicated from the species datum so we can handle things on a per-mob basis, allows for chemicals to affect them var/stamina = 0 - var/max_stamina = 100//Maximum stamina. We start taking oxyloss when this runs out while sprinting + var/max_stamina = 100 //Maximum stamina. var/sprint_speed_factor = 0.4 var/sprint_cost_factor = 1 var/stamina_recovery = 1 var/min_walk_delay = 0//When move intent is walk, movedelay is clamped to this value as a lower bound - var/exhaust_threshold = 50 - var/datum/progressbar/stamina_bar // Progress bar shown when stamina is not at full, and the mob supports stamina. Deleted on Logout or when stamina is full. + var/datum/progressbar/stamina_bar var/move_delay_mod = 0//Added to move delay, used for calculating movement speeds. Provides a centralised value for modifiers to alter diff --git a/code/modules/mob/living/living_powers.dm b/code/modules/mob/living/living_powers.dm index 35021b6d1dc..b9cda4ce341 100644 --- a/code/modules/mob/living/living_powers.dm +++ b/code/modules/mob/living/living_powers.dm @@ -20,7 +20,7 @@ //First a quick block of code to calculate our normal/best movedelay - var/delay = config.walk_speed + movement_delay() + var/delay = config.walk_delay + movement_delay() var/speed = 1 / (delay/10) var/newspeed var/list/options = list("No limit",speed*0.95,speed*0.9,speed*0.85,speed*0.8,speed*0.7,speed*0.6,speed*0.5, "Custom") diff --git a/code/modules/mob/living/logout.dm b/code/modules/mob/living/logout.dm index b0d5f2f172d..facc6f0976e 100644 --- a/code/modules/mob/living/logout.dm +++ b/code/modules/mob/living/logout.dm @@ -1,7 +1,7 @@ /mob/living/Logout() - if (stamina_bar) - QDEL_NULL(stamina_bar) ..() + if(stamina_bar) + QDEL_NULL(stamina_bar) if (mind) //Per BYOND docs key remains set if the player DCs, becomes null if switching bodies. if(!key) //key and mind have become seperated. diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 132503c27c4..0af846407ab 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -112,7 +112,7 @@ light_wedge = 45 /mob/living/silicon/pai/movement_delay() - return 0.8 + return 4 /mob/living/silicon/pai/attack_hand(mob/living/carbon/human/M) ..() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 6ad435bca6f..b1c0602f4e9 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -114,6 +114,8 @@ var/list/butchering_products //if anything else is created when butchering this creature, like bones and leather + move_intent = /decl/move_intent/walk/animal + /mob/living/simple_animal/proc/update_nutrition_stats() nutrition_step = mob_size * 0.03 * metabolic_factor @@ -481,9 +483,9 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) /mob/living/simple_animal/movement_delay() - var/tally = 0 //Incase I need to add stuff other than "speed" later + var/tally = ..() - tally = speed + tally += speed if(purge)//Purged creatures will move more slowly. The more time before their purge stops, the slower they'll move. if(tally <= 0) tally = 1 @@ -492,7 +494,7 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) if (!nutrition) tally += 4 - return tally+config.animal_delay + return tally + config.animal_delay /mob/living/simple_animal/cat/proc/handle_movement_target() //if our target is neither inside a turf or inside a human(???), stop diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d571f8b477a..0850fd77b72 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -74,10 +74,14 @@ dead_mob_list += src else living_mob_list += src - if (!ckey && mob_thinks) MOB_START_THINKING(src) + if(!move_intent) + move_intent = move_intents[1] + if(ispath(move_intent)) + move_intent = decls_repository.get_decl(move_intent) + /mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2) if(!client) return @@ -207,7 +211,7 @@ return 0 /mob/proc/movement_delay() - return 0 + . = move_intent.move_delay /mob/proc/Life() return @@ -215,6 +219,7 @@ #define UNBUCKLED 0 #define PARTIALLY_BUCKLED 1 #define FULLY_BUCKLED 2 + /mob/proc/buckled() // Preliminary work for a future buckle rewrite, // where one might be fully restrained (like an elecrical chair), or merely secured (shuttle chair, keeping you safe but not otherwise restrained from acting) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index b3135576dbb..5aa5c5839b8 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -6,7 +6,7 @@ sight = DEFAULT_SIGHT var/datum/mind/mind - var/stat = 0 //Whether a mob is alive or dead. TODO: Move this to living - Nodrak + var/stat = CONSCIOUS //Whether a mob is alive or dead. TODO: Move this to living - Nodrak var/can_buckle = TRUE var/obj/screen/flash = null @@ -132,7 +132,6 @@ var/intent = null//Living var/shakecamera = 0 var/a_intent = I_HELP//Living - var/m_intent = "walk"//Living var/lastKnownIP = null var/obj/buckled = null//Living var/obj/item/l_hand = null//Living @@ -142,6 +141,13 @@ var/obj/item/storage/s_active = null//Carbon var/obj/item/clothing/mask/wear_mask = null//Carbon + var/decl/move_intent/move_intent = /decl/move_intent/walk + var/list/move_intents = list(/decl/move_intent/walk) + + var/decl/move_intent/default_walk_intent + var/decl/move_intent/default_run_intent + var/last_quick_move_time = 0 + var/seer = 0 //for cult//Carbon, probably Human var/datum/hud/hud_used = null diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 6d73cefa615..ca6bec730b3 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -229,9 +229,6 @@ if(!mob.canmove) return - //if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV)) - // if(!mob.Process_Spacemove(0)) return 0 - if(!mob.lastarea) mob.lastarea = get_area(mob.loc) @@ -245,7 +242,6 @@ else mob.inertia_dir = 0 //If not then we can reset inertia and move - if(mob.restrained()) //Why being pulled while cuffed prevents you from moving for(var/mob/M in range(mob, 1)) if(M.pulling == mob) @@ -285,28 +281,27 @@ //drunk wheelchair driving if(mob.confused && prob(25)) direct = pick(cardinal) - move_delay += max((mob.movement_delay() + config.walk_speed) * config.walk_delay_multiplier, min_move_delay) + move_delay += max((mob.movement_delay() + config.walk_delay) * config.walk_delay_multiplier, min_move_delay) return mob.buckled.relaymove(mob,direct) - var/tally = mob.movement_delay() + config.walk_speed + var/tally = mob.movement_delay() + var/mob_is_human = ishuman(mob) //Calculate this once to reuse it later. - // Apply human specific modifiers. - var/mob_is_human = ishuman(mob) // Only check this once and just reuse the value. - if (mob_is_human) + if(mob_is_human) var/mob/living/carbon/human/H = mob - //If we're sprinting and able to continue sprinting, then apply the sprint bonus ontop of this - if (H.m_intent == "run" && H.species.handle_sprint_cost(H, tally)) //This will return false if we collapse from exhaustion + if(MOVING_QUICKLY(H)) + if(H.species.has_special_sprint()) + H.species.handle_sprint_cost(H, tally) + else + H.adjust_stamina(-(H.get_stamina_used_per_step())) tally = (tally / (1 + H.sprint_speed_factor)) * config.run_delay_multiplier + H.last_quick_move_time = world.time else - tally = max(tally * config.walk_delay_multiplier, H.min_walk_delay) //clamp walking speed if its limited - else - tally *= config.walk_delay_multiplier - + tally = max(tally * config.walk_delay_multiplier, H.min_walk_delay) move_delay += tally var/tickcomp = 0 //moved this out here so we can use it for vehicles if(config.Tickcomp) - // move_delay -= 1.3 //~added to the tickcomp calculation below tickcomp = ((1/(world.tick_lag))*1.3) - 1.3 move_delay = move_delay + tickcomp @@ -347,10 +342,10 @@ if(mob != M) M.animate_movement = 3 for(var/mob/M in L) - spawn( 0 ) + spawn(0) step(M, direct) return - spawn( 1 ) + spawn(1) M.other_mobs = null M.animate_movement = 2 return @@ -360,12 +355,12 @@ else . = mob.SelfMove(n, direct) - for (var/obj/item/grab/G in list(mob:l_hand, mob:r_hand)) + for(var/obj/item/grab/G in list(mob:l_hand, mob:r_hand)) if (G.state == GRAB_NECK) mob.set_dir(reverse_dir[direct]) G.adjust_position() - for (var/obj/item/grab/G in mob.grabbed_by) + for(var/obj/item/grab/G in mob.grabbed_by) G.adjust_position() moving = 0 @@ -374,6 +369,12 @@ var/atom/O = mob.loc return O.relaymove(mob, direct) +/mob/proc/get_stamina_used_per_step() + return 1 + +/mob/living/carbon/human/get_stamina_used_per_step() + return sprint_cost_factor + /mob/proc/SelfMove(turf/n, direct) return Move(n, direct) @@ -550,3 +551,96 @@ /mob/proc/mob_negates_gravity() return 0 + +/mob/proc/set_next_usable_move_intent() + var/checking_intent = (istype(move_intent) ? move_intent.type : move_intents[1]) + for(var/i = 1 to length(move_intents)) // One full iteration of the move set. + checking_intent = next_in_list(checking_intent, move_intents) + if(set_move_intent(decls_repository.get_decl(checking_intent))) + return + +/mob/proc/set_move_intent(var/decl/move_intent/next_intent) + if(next_intent && move_intent != next_intent && next_intent.can_be_used_by(src)) + move_intent = next_intent + if(hud_used) + hud_used.move_intent.icon_state = move_intent.hud_icon_state + return TRUE + return FALSE + +/mob/proc/get_movement_datum_by_flag(var/move_flag = MOVE_INTENT_DELIBERATE) + for(var/m_intent in move_intents) + var/decl/move_intent/check_move_intent = decls_repository.get_decl(m_intent) + if(check_move_intent.flags & move_flag) + return check_move_intent + +/mob/proc/get_movement_datum_by_missing_flag(var/move_flag = MOVE_INTENT_DELIBERATE) + for(var/m_intent in move_intents) + var/decl/move_intent/check_move_intent = decls_repository.get_decl(m_intent) + if(!(check_move_intent.flags & move_flag)) + return check_move_intent + +/mob/proc/get_movement_datums_by_flag(var/move_flag = MOVE_INTENT_DELIBERATE) + . = list() + for(var/m_intent in move_intents) + var/decl/move_intent/check_move_intent = decls_repository.get_decl(m_intent) + if(check_move_intent.flags & move_flag) + . += check_move_intent + +/mob/proc/get_movement_datums_by_missing_flag(var/move_flag = MOVE_INTENT_DELIBERATE) + . = list() + for(var/m_intent in move_intents) + var/decl/move_intent/check_move_intent = decls_repository.get_decl(m_intent) + if(!(check_move_intent.flags & move_flag)) + . += check_move_intent + +/mob/verb/SetDefaultWalk() + set name = "Set Default Walk" + set desc = "Select your default walking style." + set category = "IC" + var/choice = input(usr, "Select a default walk.", "Set Default Walk") as null|anything in get_movement_datums_by_missing_flag(MOVE_INTENT_QUICK) + if(choice && (choice in get_movement_datums_by_missing_flag(MOVE_INTENT_QUICK))) + default_walk_intent = choice + to_chat(src, "You will now default to [default_walk_intent] when moving deliberately.") + +/mob/verb/SetDefaultRun() + set name = "Set Default Run" + set desc = "Select your default running style." + set category = "IC" + var/choice = input(usr, "Select a default run.", "Set Default Run") as null|anything in get_movement_datums_by_flag(MOVE_INTENT_QUICK) + if(choice && (choice in get_movement_datums_by_flag(MOVE_INTENT_QUICK))) + default_run_intent = choice + to_chat(src, "You will now default to [default_run_intent] when moving quickly.") + +/client/verb/setmovingslowly() + set hidden = 1 + if(mob) + mob.set_moving_slowly() + +/mob/proc/set_moving_slowly() + if(!default_walk_intent) + default_walk_intent = get_movement_datum_by_missing_flag(MOVE_INTENT_QUICK) + if(default_walk_intent && move_intent != default_walk_intent) + set_move_intent(default_walk_intent) + +/client/verb/setmovingquickly() + set hidden = 1 + if(mob) + mob.set_moving_quickly() + +/mob/proc/set_moving_quickly() + if(!default_run_intent) + default_run_intent = get_movement_datum_by_flag(MOVE_INTENT_QUICK) + if(default_run_intent && move_intent != default_run_intent) + set_move_intent(default_run_intent) + +/mob/proc/can_sprint() + return FALSE + +/mob/proc/adjust_stamina(var/amt) + return + +/mob/proc/get_stamina() + return 100 + +/mob/proc/get_maximum_stamina() + return 100 diff --git a/code/modules/tables/interactions.dm b/code/modules/tables/interactions.dm index e586587924a..38a58642ffb 100644 --- a/code/modules/tables/interactions.dm +++ b/code/modules/tables/interactions.dm @@ -61,7 +61,7 @@ ..() if(ishuman(am)) var/mob/living/carbon/human/H = am - if(H.a_intent != I_HELP || H.m_intent == "run") + if(H.a_intent != I_HELP || MOVING_QUICKLY(H)) throw_things(H) else if(H.is_diona() || H.species.get_bodytype() == "Heavy Machine") throw_things(H) @@ -117,7 +117,7 @@ ) if(ishuman(user)) var/mob/living/carbon/human/H = user - if(H.a_intent != I_HELP || H.m_intent == "run") + if(H.a_intent != I_HELP || MOVING_QUICKLY(H)) throw_things(H) else if(H.is_diona() || H.species.get_bodytype() == "Heavy Machine") throw_things(H) diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index 3a750cfd6ec..0fa638a1ed5 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -358,7 +358,7 @@ else move_delay = max(0, (-car_limit * active_engines) + train_length - active_engines) //limits base overweight so you cant overspeed trains move_delay *= (1 / max(1, active_engines)) * 2 //overweight penalty (scaled by the number of engines) - move_delay += config.walk_speed //base reference speed + move_delay += config.walk_delay //base reference speed move_delay *= config.vehicle_delay_multiplier //makes cargo trains 10% slower than running when not overweight /obj/vehicle/train/cargo/trolley/update_car(var/train_length, var/active_engines) diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index fb36598d1b8..d401161dde7 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -356,7 +356,7 @@ // Yes, it's not the full calculation. But it's relatively close, and will make it seamless. /obj/vehicle/post_buckle_mob(var/mob/M) if (M.client) - M.client.move_delay = M.movement_delay() + config.walk_speed + M.client.move_delay = M.movement_delay() + config.walk_delay //------------------------------------------------------- // Stat update procs diff --git a/config/example/game_options.txt b/config/example/game_options.txt index ad019656502..7ef67b463c4 100644 --- a/config/example/game_options.txt +++ b/config/example/game_options.txt @@ -46,7 +46,13 @@ REVIVAL_BRAIN_LIFE -1 ## This will globally modify the movement speed of all mobs. ## Note that it can do so unproportionally, meaning you'll lose the relationships between the different species. As such, modifying the delay multipliers below should be preferred. -WALK_SPEED 4 +RUN_DELAY 4 +WALK_DELAY 4 +CREEP_DELAY 6 + +## The following two values will determine the stamina recovery speed of a mob. +MINIMUM_STAMINA_RECOVERY 1 +MAXIMUM_STAMINA_RECOVERY 3 ## The following two will globally affect all movement speed, while retaining the proportional relationships between the different mob's movement speeds. ## Ideally, you want to modify these. Any value between 0 and 1 will increase speed by decreasing the movement delay, anything above 1 will slow everyone down by increasing the delay. @@ -56,11 +62,11 @@ VEHICLE_DELAY_MULTIPLIER 1 ## The variables below affect the movement of specific mob types. HUMAN_DELAY 0 -ROBOT_DELAY 1 -MONKEY_DELAY 1 -ALIEN_DELAY 1 -METROID_DELAY 1 -ANIMAL_DELAY 1 +ROBOT_DELAY 0 +MONKEY_DELAY 0 +ALIEN_DELAY 0 +METROID_DELAY 0 +ANIMAL_DELAY 0 ### Miscellaneous ### diff --git a/html/changelogs/mattatlas-sprint.yml b/html/changelogs/mattatlas-sprint.yml new file mode 100644 index 00000000000..d111d633f29 --- /dev/null +++ b/html/changelogs/mattatlas-sprint.yml @@ -0,0 +1,44 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Sprint should now work better overall. You can hold shift to sprint. Middle click still examines if you find shiftclick uncomfortable now." + - rscadd: "Added a slower walk mode, Creep." + - experiment: "A new sprint backend means that some simple mobs may have slower speed than usual." + - rscadd: "Running into walls when you're confused will knock you to the ground." diff --git a/icons/mob/screen/midnight.dmi b/icons/mob/screen/midnight.dmi index 2493361c8c3..4fbee45372f 100644 Binary files a/icons/mob/screen/midnight.dmi and b/icons/mob/screen/midnight.dmi differ diff --git a/icons/mob/screen/old-noborder.dmi b/icons/mob/screen/old-noborder.dmi index d6d7775e485..61887ae8ef7 100644 Binary files a/icons/mob/screen/old-noborder.dmi and b/icons/mob/screen/old-noborder.dmi differ diff --git a/icons/mob/screen/old.dmi b/icons/mob/screen/old.dmi index 8cd2cc252cc..4bb38831d48 100644 Binary files a/icons/mob/screen/old.dmi and b/icons/mob/screen/old.dmi differ diff --git a/icons/mob/screen/orange.dmi b/icons/mob/screen/orange.dmi index 8135b9141ec..f1cdf5a75f6 100644 Binary files a/icons/mob/screen/orange.dmi and b/icons/mob/screen/orange.dmi differ diff --git a/icons/mob/screen/white.dmi b/icons/mob/screen/white.dmi index e6438cb60e4..292fc33b5cb 100644 Binary files a/icons/mob/screen/white.dmi and b/icons/mob/screen/white.dmi differ diff --git a/interface/dark.dmf b/interface/dark.dmf index ff55e2ee6b5..bdfb16806d1 100644 --- a/interface/dark.dmf +++ b/interface/dark.dmf @@ -627,6 +627,12 @@ macro "hotkeymode" elem name = "." command = "move-down" + elem + name = "SHIFT" + command = "setmovingquickly" + elem + name = "SHIFT+UP" + command = "setmovingslowly" macro "borgmacro" elem diff --git a/interface/skin.dmf b/interface/skin.dmf index 7796e8d0617..fc2280a1bdb 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -627,6 +627,12 @@ macro "hotkeymode" elem name = "." command = "move-down" + elem + name = "SHIFT" + command = "setmovingquickly" + elem + name = "SHIFT+UP" + command = "setmovingslowly" macro "borgmacro" elem