Revert "Ports Bay's stamina/sprinting intent system. (#8805)" (#9182)

This shit is just full of issues that keep popping up and frankly I can't be fucked to deal with them.

Note: I'll probably do the same thing again but very simplified later on. This iteration is a mistake in how much of a mess it is, unfortunately.
This commit is contained in:
Matt Atlas
2020-06-23 20:07:06 +03:00
committed by GitHub
parent 8c069a8e9d
commit de38551038
59 changed files with 310 additions and 422 deletions
@@ -25,12 +25,6 @@
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
@@ -82,8 +76,11 @@
/mob/living/carbon/alien/diona/movement_delay()
. = ..()
if(MOVING_QUICKLY(src))
species.handle_sprint_cost(src, . + config.walk_delay)
switch(m_intent)
if("walk")
. += 3
if("run")
species.handle_sprint_cost(src,.+config.walk_speed)
/mob/living/carbon/alien/diona/ex_act(severity)
if(life_tick < 4)
+11 -17
View File
@@ -35,26 +35,20 @@
. = ..()
if(.)
if(src.stat != DEAD)
if((move_intent.flags & MOVE_INTENT_EXERTIVE) && src.bodytemperature <= (species ? species.heat_level_1 - 5 : 360))
bodytemperature += 2
if(src.stat != 2)
if(src.nutrition)
adjustNutritionLoss(nutrition_loss*0.1)
if(src.hydration)
adjustHydrationLoss(hydration_loss*0.1)
var/nut_removed = nutrition_loss
var/hyd_removed = hydration_loss
if(move_intent.flags & MOVE_INTENT_EXERTIVE)
nut_removed *= 2
hyd_removed *= 2
if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360)
src.bodytemperature += 2
if(nutrition)
adjustNutritionLoss(nut_removed*0.1)
if(hydration)
adjustHydrationLoss(hyd_removed*0.1)
// Moving around increases germ_level faster
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
germ_level++
// Moving around increases germ_level faster
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
germ_level++
src.help_up_offer = FALSE
src.help_up_offer = 0
/mob/living/carbon/relaymove(var/mob/living/user, direction)
if((user in contents) && istype(user))
@@ -179,7 +179,7 @@
..()
if(statpanel("Status"))
stat("Intent:", "[a_intent]")
stat("Move Mode:", "[move_intent.name]")
stat("Move Mode:", "[m_intent]")
if(emergency_shuttle)
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
@@ -1484,20 +1484,13 @@
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
@@ -375,7 +375,8 @@
M.do_attack_animation(src)
if(usesStamina)
M.adjust_stamina(-disarm_cost) //attempting to knock something out of someone's hands, or pushing them over, is exhausting!
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)
else
M.nutrition = M.nutrition - disarm_cost
M.nutrition = Clamp(M.nutrition, 0, M.max_nutrition)
@@ -1,42 +1,36 @@
/mob/living/carbon/human
move_intents = list(/decl/move_intent/walk)
/mob/living/carbon/human/movement_delay()
var/tally = ..()
tally += species.slowdown
var/tally = 0
if(species.slowdown)
tally = species.slowdown
var/area/A = get_area(src)
if(A && !(A.has_gravity()))
tally -= 1
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
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++
@@ -64,41 +58,40 @@
tally += 1.5
if (can_feel_pain())
if(shock_stage >= 10 || get_stamina() <= 0)
if(shock_stage >= 10)
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 = round(tally, 1)
tally += config.human_delay
return tally + config.human_delay
tally = round(tally,1)
return tally
/mob/living/carbon/human/Allow_Spacemove(var/check_drift = 0)
@@ -162,7 +155,7 @@
return
last_x = x
last_y = y
if (MOVING_QUICKLY(src))
if (m_intent == "run")
playsound(src, footsound, 70, 1, required_asfx_toggles = ASFX_FOOTSTEPS)
else
footstep++
@@ -176,6 +169,3 @@
/mob/living/carbon/human/mob_negates_gravity()
return (shoes && shoes.negates_gravity())
/mob/living/carbon/human/can_sprint()
return (stamina > 0)
@@ -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.2
H.sprint_cost_factor += -0.1
/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.2
H.sprint_cost_factor -= -0.1
/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.4
H.sprint_cost_factor += 0.2
/datum/modifier/drunk/deactivate()
..()
var/mob/living/carbon/human/H = target
if(istype(H))
H.move_delay_mod -= 2
H.sprint_cost_factor -= -0.4
H.sprint_cost_factor -= -0.2
/datum/modifier/drunk/custom_validity()
var/mob/living/carbon/human/H = target
+34 -25
View File
@@ -74,6 +74,7 @@
handle_medical_side_effects()
//Handles regenerating stamina if we have sufficient air and no oxyloss
handle_stamina()
if (is_diona())
@@ -84,7 +85,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()
@@ -96,30 +97,6 @@
..()
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
@@ -1332,6 +1309,38 @@
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())
@@ -79,6 +79,7 @@
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,
@@ -85,6 +85,7 @@
stamina = 500 //Tireless automatons
stamina_recovery = 1
sprint_speed_factor = 0.3
exhaust_threshold = 0 //No oxyloss, so zero threshold
max_nutrition_factor = -1
@@ -132,6 +133,7 @@
stamina = 500 //Tireless automatons
stamina_recovery = 1
sprint_speed_factor = 0.3
exhaust_threshold = 0 //No oxyloss, so zero threshold
max_nutrition_factor = -1
@@ -208,6 +210,7 @@
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)
@@ -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 = 1.4
sprint_cost_factor = 0.7
cold_level_1 = 80
cold_level_2 = 50
@@ -165,8 +165,6 @@
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
@@ -178,6 +176,7 @@
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
@@ -509,6 +508,53 @@
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
@@ -564,9 +610,3 @@
/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
@@ -111,9 +111,9 @@
reagent_tag = IS_DIONA
stamina = 1 // Diona sprinting uses energy instead of stamina
sprint_speed_factor = 0.6 //Speed gained is minor
sprint_cost_factor = 1.6
stamina = -1 // Diona sprinting uses energy instead of stamina
sprint_speed_factor = 0.5 //Speed gained is minor
sprint_cost_factor = 0.8
climb_coeff = 1.3
vision_organ = BP_HEAD
@@ -122,33 +122,34 @@
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 //Something is very wrong
return 0 //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.set_moving_slowly()
H.m_intent = "walk"
H.hud_used.move_intent.update_move_icon(H)
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
@@ -85,6 +85,7 @@ 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
@@ -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 = 1.25
sprint_cost_factor = 0.5
grab_mod = 1.25 //humans are wily fuckers - geeves
climb_coeff = 1
@@ -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 = 0.8 //Slightly slower than a human.
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
max_hydration_factor = -1
@@ -124,6 +124,21 @@ 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 = ""
@@ -282,22 +297,6 @@ 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
@@ -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 = 1.5
sprint_cost_factor = 0.75
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 \
@@ -36,8 +36,9 @@
stamina = 120 // Unathi have the shortest but fastest sprint of all
stamina_recovery = 5
sprint_cost_factor = 7
sprint_cost_factor = 1.45
sprint_speed_factor = 3.2
exhaust_threshold = 65
rarity_value = 3
breakcuffs = list(MALE)
@@ -89,7 +89,7 @@
stamina = 100 // Long period of sprinting, but relatively low speed gain
sprint_speed_factor = 0.7
sprint_cost_factor = 0.6
sprint_cost_factor = 0.30
stamina_recovery = 2 //slow recovery
has_organ = list(
@@ -31,7 +31,7 @@
stamina = 115
sprint_speed_factor = 1.0
sprint_cost_factor = 0.8
sprint_cost_factor = 0.40
stamina_recovery = 3
@@ -70,7 +70,7 @@
stamina = 175
sprint_speed_factor = 1
sprint_cost_factor = 1.6
sprint_cost_factor = 0.80
stamina_recovery = 3
spawn_flags = IS_RESTRICTED
@@ -126,7 +126,7 @@
stamina = 200
stamina_recovery = 5
sprint_speed_factor = 0.9
sprint_cost_factor = 1.0
sprint_cost_factor = 0.5
heat_level_1 = 1000 //Default 360
heat_level_2 = 4000 //Default 400
@@ -1112,8 +1112,11 @@ There are several things that need to be remembered:
standing = image('icons/mob/mob.dmi', "legcuff1")
overlays_raw[LEGCUFF_LAYER] = standing
if(!MOVING_DELIBERATELY(src))
set_moving_slowly()
if(m_intent != "walk")
m_intent = "walk"
if(hud_used && hud_used.move_intent)
hud_used.move_intent.icon_state = "walking"
else
overlays_raw[LEGCUFF_LAYER] = null
+1 -1
View File
@@ -202,7 +202,7 @@
if((isunathi(src)) || (HULK in mutations))
say(pick("RAAAAAAAARGH!", "HNNNNNNNNNGGGGGGH!", "GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", "AAAAAAARRRGH!" ))
stamina = max(0, (stamina - 100)) //takes a bunch of stamina
stamina -= 100 //takes a bunch of stamina
qdel(handcuffed)
handcuffed = null
+2 -7
View File
@@ -140,12 +140,7 @@ default behaviour is:
now_pushing = FALSE
spawn(0)
. = ..()
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)
if (!istype(AM, /atom/movable))
return
if (!now_pushing)
now_pushing = TRUE
@@ -949,4 +944,4 @@ default behaviour is:
if(auras)
for(var/a in auras)
remove_aura(a)
return ..()
return ..()
+3 -2
View File
@@ -49,12 +49,13 @@
//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.
var/max_stamina = 100//Maximum stamina. We start taking oxyloss when this runs out while sprinting
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/datum/progressbar/stamina_bar
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/move_delay_mod = 0//Added to move delay, used for calculating movement speeds. Provides a centralised value for modifiers to alter
+1 -1
View File
@@ -20,7 +20,7 @@
//First a quick block of code to calculate our normal/best movedelay
var/delay = config.walk_delay + movement_delay()
var/delay = config.walk_speed + 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")
+2 -2
View File
@@ -1,7 +1,7 @@
/mob/living/Logout()
..()
if(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.
+1 -1
View File
@@ -112,7 +112,7 @@
light_wedge = 45
/mob/living/silicon/pai/movement_delay()
return 4
return 0.8
/mob/living/silicon/pai/attack_hand(mob/living/carbon/human/M)
..()
@@ -114,8 +114,6 @@
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
@@ -483,9 +481,9 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
/mob/living/simple_animal/movement_delay()
var/tally = ..()
var/tally = 0 //Incase I need to add stuff other than "speed" later
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
@@ -494,7 +492,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
+2 -7
View File
@@ -74,14 +74,10 @@
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
@@ -211,7 +207,7 @@
return 0
/mob/proc/movement_delay()
. = move_intent.move_delay
return 0
/mob/proc/Life()
return
@@ -219,7 +215,6 @@
#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)
+2 -8
View File
@@ -6,7 +6,7 @@
sight = DEFAULT_SIGHT
var/datum/mind/mind
var/stat = CONSCIOUS //Whether a mob is alive or dead. TODO: Move this to living - Nodrak
var/stat = 0 //Whether a mob is alive or dead. TODO: Move this to living - Nodrak
var/can_buckle = TRUE
var/obj/screen/flash = null
@@ -132,6 +132,7 @@
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
@@ -141,13 +142,6 @@
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
+20 -114
View File
@@ -229,6 +229,9 @@
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)
@@ -242,6 +245,7 @@
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)
@@ -281,27 +285,28 @@
//drunk wheelchair driving
if(mob.confused && prob(25))
direct = pick(cardinal)
move_delay += max((mob.movement_delay() + config.walk_delay) * config.walk_delay_multiplier, min_move_delay)
move_delay += max((mob.movement_delay() + config.walk_speed) * config.walk_delay_multiplier, min_move_delay)
return mob.buckled.relaymove(mob,direct)
var/tally = mob.movement_delay()
var/mob_is_human = ishuman(mob) //Calculate this once to reuse it later.
var/tally = mob.movement_delay() + config.walk_speed
if(mob_is_human)
// Apply human specific modifiers.
var/mob_is_human = ishuman(mob) // Only check this once and just reuse the value.
if (mob_is_human)
var/mob/living/carbon/human/H = mob
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()))
//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
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)
tally = max(tally * config.walk_delay_multiplier, H.min_walk_delay) //clamp walking speed if its limited
else
tally *= config.walk_delay_multiplier
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
@@ -342,10 +347,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
@@ -355,12 +360,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
@@ -369,12 +374,6 @@
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)
@@ -551,96 +550,3 @@
/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