mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 12:37:50 +01:00
Move all mob movement cooldowns into one proc
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
/mob/living/carbon/human/movement_delay(oldloc, direct)
|
||||
|
||||
var/tally = 0
|
||||
. = ..()
|
||||
|
||||
if(species.slowdown)
|
||||
tally = species.slowdown
|
||||
. = species.slowdown
|
||||
|
||||
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
|
||||
|
||||
@@ -19,23 +19,23 @@
|
||||
if(!isnull(M.haste) && M.haste == TRUE)
|
||||
return HUMAN_LOWEST_SLOWDOWN // Returning -1 will actually result in a slowdown for Teshari.
|
||||
if(!isnull(M.slowdown))
|
||||
tally += M.slowdown
|
||||
. += M.slowdown
|
||||
|
||||
var/health_deficiency = (getMaxHealth() - health)
|
||||
if(health_deficiency >= 40) tally += (health_deficiency / 25)
|
||||
if(health_deficiency >= 40) . += (health_deficiency / 25)
|
||||
|
||||
if(can_feel_pain())
|
||||
if(halloss >= 10) tally += (halloss / 10) //halloss shouldn't slow you down if you can't even feel it
|
||||
if(halloss >= 10) . += (halloss / 10) //halloss shouldn't slow you down if you can't even feel it
|
||||
|
||||
var/hungry = (500 - nutrition) / 5 //VOREStation Edit - Fixed 500 here instead of our huge MAX_NUTRITION
|
||||
if (hungry >= 70) tally += hungry/50
|
||||
if (hungry >= 70) . += hungry/50
|
||||
|
||||
//VOREstation start
|
||||
if (feral >= 10) //crazy feral animals give less and less of a shit about pain and hunger as they get crazier
|
||||
tally = max(species.slowdown, species.slowdown+((tally-species.slowdown)/(feral/10))) // As feral scales to damage, this amounts to an effective +1 slowdown cap
|
||||
if(shock_stage >= 10) tally -= 1.5 //this gets a +3 later, feral critters take reduced penalty
|
||||
. = max(species.slowdown, species.slowdown+((.-species.slowdown)/(feral/10))) // As feral scales to damage, this amounts to an effective +1 slowdown cap
|
||||
if(shock_stage >= 10) . -= 1.5 //this gets a +3 later, feral critters take reduced penalty
|
||||
if(reagents.has_reagent("numbenzyme"))
|
||||
tally += 1.5 //A tad bit of slowdown.
|
||||
. += 1.5 //A tad bit of slowdown.
|
||||
if(riding_datum) //Bit of slowdown for taur rides if rider is bigger or fatter than mount.
|
||||
var/datum/riding/R = riding_datum
|
||||
var/mob/living/L = R.ridden
|
||||
@@ -43,48 +43,48 @@
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.size_multiplier > L.size_multiplier)
|
||||
tally += 1
|
||||
. += 1
|
||||
if(H.weight > L.weight)
|
||||
tally += 1
|
||||
. += 1
|
||||
//VOREstation end
|
||||
|
||||
if(istype(buckled, /obj/structure/bed/chair/wheelchair))
|
||||
for(var/organ_name in list(BP_L_HAND, BP_R_HAND, BP_L_ARM, BP_R_ARM))
|
||||
var/obj/item/organ/external/E = get_organ(organ_name)
|
||||
if(!E || E.is_stump())
|
||||
tally += 4
|
||||
. += 4
|
||||
else if(E.splinted && E.splinted.loc != E)
|
||||
tally += 0.5
|
||||
. += 0.5
|
||||
else if(E.status & ORGAN_BROKEN)
|
||||
tally += 1.5
|
||||
. += 1.5
|
||||
else
|
||||
for(var/organ_name in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT))
|
||||
var/obj/item/organ/external/E = get_organ(organ_name)
|
||||
if(!E || E.is_stump())
|
||||
tally += 4
|
||||
. += 4
|
||||
else if(E.splinted && E.splinted.loc != E)
|
||||
tally += 0.5
|
||||
. += 0.5
|
||||
else if(E.status & ORGAN_BROKEN)
|
||||
tally += 1.5
|
||||
. += 1.5
|
||||
|
||||
if(shock_stage >= 10) tally += 3
|
||||
if(shock_stage >= 10) . += 3
|
||||
|
||||
if(aiming && aiming.aiming_at) tally += 5 // Iron sights make you slower, it's a well-known fact.
|
||||
if(aiming && aiming.aiming_at) . += 5 // Iron sights make you slower, it's a well-known fact.
|
||||
|
||||
if(FAT in src.mutations)
|
||||
tally += 1.5
|
||||
. += 1.5
|
||||
|
||||
if (bodytemperature < species.cold_level_1)
|
||||
tally += (species.cold_level_1 - bodytemperature) / 10 * 1.75
|
||||
. += (species.cold_level_1 - bodytemperature) / 10 * 1.75
|
||||
|
||||
tally += max(2 * stance_damage, 0) //damaged/missing feet or legs is slow
|
||||
. += max(2 * stance_damage, 0) //damaged/missing feet or legs is slow
|
||||
|
||||
if(mRun in mutations)
|
||||
tally = 0
|
||||
. = 0
|
||||
|
||||
// Turf related slowdown
|
||||
var/turf/T = get_turf(src)
|
||||
tally += calculate_turf_slowdown(T, direct)
|
||||
. += calculate_turf_slowdown(T, direct)
|
||||
|
||||
// Item related slowdown.
|
||||
var/item_tally = calculate_item_encumbrance()
|
||||
@@ -101,19 +101,19 @@
|
||||
|
||||
item_tally *= species.item_slowdown_mod
|
||||
|
||||
tally += item_tally
|
||||
. += item_tally
|
||||
|
||||
if(CE_SLOWDOWN in chem_effects)
|
||||
if (tally >= 0 )
|
||||
tally = (tally + tally/4) //Add a quarter of penalties on top.
|
||||
tally += chem_effects[CE_SLOWDOWN]
|
||||
if (. >= 0 )
|
||||
. *= 1.25 //Add a quarter of penalties on top.
|
||||
. += chem_effects[CE_SLOWDOWN]
|
||||
|
||||
if(CE_SPEEDBOOST in chem_effects)
|
||||
if (tally >= 0) // cut any penalties in half
|
||||
tally = tally/2
|
||||
tally -= chem_effects[CE_SPEEDBOOST] // give 'em a buff on top.
|
||||
if (. >= 0) // cut any penalties in half
|
||||
. *= 0.5
|
||||
. -= chem_effects[CE_SPEEDBOOST] // give 'em a buff on top.
|
||||
|
||||
return max(HUMAN_LOWEST_SLOWDOWN, tally+config.human_delay) // Minimum return should be the same as force_max_speed
|
||||
. = max(HUMAN_LOWEST_SLOWDOWN, . + config.human_delay) // Minimum return should be the same as force_max_speed
|
||||
|
||||
// This calculates the amount of slowdown to receive from items worn. This does NOT include species modifiers.
|
||||
// It is in a seperate place to avoid an infinite loop situation with dragging mobs dragging each other.
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
|
||||
//No longer needed, but I'll leave it here incase we plan to re-use it.
|
||||
/mob/living/silicon/robot/movement_delay()
|
||||
var/tally = 0 //Incase I need to add stuff other than "speed" later
|
||||
. = ..()
|
||||
|
||||
tally = speed
|
||||
. += speed
|
||||
|
||||
if(module_active && istype(module_active,/obj/item/borg/combat/mobility))
|
||||
tally-=2 // VOREStation Edit
|
||||
. -= 2 // VOREStation Edit
|
||||
|
||||
return tally+config.robot_delay
|
||||
. += config.robot_delay
|
||||
|
||||
// NEW: Use power while moving.
|
||||
/mob/living/silicon/robot/SelfMove(turf/n, direct)
|
||||
|
||||
@@ -212,9 +212,9 @@
|
||||
return ..()
|
||||
*/
|
||||
/mob/living/simple_mob/movement_delay()
|
||||
var/tally = 0 //Incase I need to add stuff other than "speed" later
|
||||
. = ..()
|
||||
|
||||
tally = movement_cooldown
|
||||
. += movement_cooldown
|
||||
|
||||
if(force_max_speed)
|
||||
return -3
|
||||
@@ -223,25 +223,25 @@
|
||||
if(!isnull(M.haste) && M.haste == TRUE)
|
||||
return -3
|
||||
if(!isnull(M.slowdown))
|
||||
tally += M.slowdown
|
||||
. += M.slowdown
|
||||
|
||||
// Turf related slowdown
|
||||
var/turf/T = get_turf(src)
|
||||
if(T && T.movement_cost && !hovering) // Flying mobs ignore turf-based slowdown. Aquatic mobs ignore water slowdown, and can gain bonus speed in it.
|
||||
if(istype(T,/turf/simulated/floor/water) && aquatic_movement)
|
||||
tally -= aquatic_movement - 1
|
||||
. -= aquatic_movement - 1
|
||||
else
|
||||
tally += T.movement_cost
|
||||
. += T.movement_cost
|
||||
|
||||
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
|
||||
tally *= purge
|
||||
if(. <= 0)
|
||||
. = 1
|
||||
. *= purge
|
||||
|
||||
if(m_intent == "walk")
|
||||
tally *= 1.5
|
||||
. *= 1.5
|
||||
|
||||
return tally+config.animal_delay
|
||||
. += config.animal_delay
|
||||
|
||||
|
||||
/mob/living/simple_mob/Stat()
|
||||
|
||||
+12
-1
@@ -148,7 +148,18 @@
|
||||
return 0
|
||||
|
||||
/mob/proc/movement_delay(oldloc, direct)
|
||||
return 0
|
||||
. = 0
|
||||
if(locate(/obj/item/weapon/grab) in src)
|
||||
. += 7
|
||||
|
||||
// Movespeed delay based on movement mode
|
||||
switch(m_intent)
|
||||
if("run")
|
||||
if(drowsyness > 0)
|
||||
. += 6
|
||||
. += config.run_speed
|
||||
if("walk")
|
||||
. += config.walk_speed
|
||||
|
||||
/mob/proc/Life()
|
||||
// if(organStructure)
|
||||
|
||||
@@ -246,26 +246,9 @@
|
||||
|
||||
// We are now going to move
|
||||
moving = 1
|
||||
var/total_delay = 0
|
||||
var/total_delay = my_mob.movement_delay(n, direct)
|
||||
var/pre_move_loc = loc
|
||||
|
||||
// Start tally'ing when we can next move
|
||||
// Grabs slow you down
|
||||
if(locate(/obj/item/weapon/grab) in my_mob)
|
||||
total_delay += 7
|
||||
|
||||
// Movespeed delay based on movement mode
|
||||
switch(my_mob.m_intent)
|
||||
if("run")
|
||||
if(my_mob.drowsyness > 0)
|
||||
total_delay += 6
|
||||
total_delay += config.run_speed
|
||||
if("walk")
|
||||
total_delay += config.walk_speed
|
||||
|
||||
// A billion other things can slow you down, ask the mob
|
||||
total_delay += my_mob.movement_delay(n, direct)
|
||||
|
||||
// Confused direction randomization
|
||||
if(my_mob.confused)
|
||||
switch(my_mob.m_intent)
|
||||
|
||||
Reference in New Issue
Block a user