Merge pull request #10451 from kevinz000/mobility_flags

Mobility flags + combat rework stuff refactoring, fixes a few edge cases including the Oh Dreaded Xenomorph Hardstuns, etc etc time to break the game
This commit is contained in:
deathride58
2020-03-05 20:03:56 -05:00
committed by GitHub
290 changed files with 2244 additions and 1819 deletions
@@ -168,8 +168,9 @@
set category = "Object"
set src in usr
if(!usr.canmove || usr.stat || usr.restrained())
return 0
var/mob/living/L = usr
if(!istype(L) || !CHECK_MOBILITY(L, MOBILITY_USE))
return FALSE
switch(unbuttoned)
if(0)
@@ -8,16 +8,6 @@
//oh no vore time
var/voremode = FALSE
/mob/living/carbon/CanPass(atom/movable/mover, turf/target)
. = ..()
if(.)
var/mob/living/mobdude = mover
if(istype(mobdude))
if(!resting && mobdude.resting)
if(!(mobdude.pass_flags & PASSMOB))
return FALSE
return .
/mob/living/carbon/proc/toggle_combat_mode(forced, silent)
if(!forced)
if(recoveringstam || stat != CONSCIOUS)
@@ -4,7 +4,7 @@
/mob/living/carbon/human/resist_embedded()
if(handcuffed || legcuffed || (wear_suit && wear_suit.breakouttime))
return
if(canmove && !on_fire)
if(CHECK_MOBILITY(src, MOBILITY_MOVE) && !on_fire)
for(var/obj/item/bodypart/L in bodyparts)
if(istype(L) && L.embedded_objects.len)
for(var/obj/item/I in L.embedded_objects)
@@ -25,4 +25,3 @@
if(!has_embedded_objects())
clear_alert("embeddedobject")
SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "embedded")
return
@@ -1,18 +1,18 @@
/mob/living/carbon/human/Move(NewLoc, direct)
var/oldpseudoheight = pseudo_z_axis
. = ..()
if(. && sprinting && !(movement_type & FLYING) && canmove && !resting && m_intent == MOVE_INTENT_RUN && has_gravity(loc) && !pulledby)
if(. && sprinting && !(movement_type & FLYING) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_MOVE|MOBILITY_STAND) && m_intent == MOVE_INTENT_RUN && has_gravity(loc) && !pulledby)
if(!HAS_TRAIT(src, TRAIT_FREESPRINT))
doSprintLossTiles(1)
if((oldpseudoheight - pseudo_z_axis) >= 8)
to_chat(src, "<span class='warning'>You trip off of the elevated surface!</span>")
for(var/obj/item/I in held_items)
accident(I)
Knockdown(80)
DefaultCombatKnockdown(80)
/mob/living/carbon/human/movement_delay()
. = 0
if(!resting && m_intent == MOVE_INTENT_RUN && sprinting)
if((mobility_flags & MOBILITY_STAND) && m_intent == MOVE_INTENT_RUN && sprinting)
var/static/datum/config_entry/number/movedelay/sprint_speed_increase/SSI
if(!SSI)
SSI = CONFIG_GET_ENTRY(number/movedelay/sprint_speed_increase)
@@ -23,7 +23,7 @@
/mob/living/carbon/human/proc/togglesprint() // If you call this proc outside of hotkeys or clicking the HUD button, I'll be disappointed in you.
sprinting = !sprinting
if(!resting && m_intent == MOVE_INTENT_RUN && canmove)
if((m_intent == MOVE_INTENT_RUN) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND|MOBILITY_MOVE))
if(sprinting)
playsound_local(src, 'sound/misc/sprintactivate.ogg', 50, FALSE, pressure_affected = FALSE)
else
@@ -25,7 +25,7 @@
/mob/living/movement_delay(ignorewalk = 0)
. = ..()
if(resting)
if(!CHECK_MOBILITY(src, MOBILITY_STAND))
. += 6
/atom
@@ -53,85 +53,22 @@
pseudo_z_axis = newloc.get_fake_z()
pixel_z = pseudo_z_axis
/mob/living/proc/lay_down()
set name = "Rest"
set category = "IC"
if(client && client.prefs && client.prefs.autostand)
intentionalresting = !intentionalresting
to_chat(src, "<span class='notice'>You are now attempting to [intentionalresting ? "[!resting ? "lay down and ": ""]stay down" : "[resting ? "get up and ": ""]stay up"].</span>")
if(intentionalresting && !resting)
resting = TRUE
update_canmove()
else
resist_a_rest()
else
if(!resting)
resting = TRUE
to_chat(src, "<span class='notice'>You are now laying down.</span>")
update_canmove()
else
resist_a_rest()
/mob/living/proc/resist_a_rest(automatic = FALSE, ignoretimer = FALSE) //Lets mobs resist out of resting. Major QOL change with combat reworks.
if(!resting || stat || attemptingstandup)
return FALSE
if(ignoretimer)
resting = FALSE
update_canmove()
return TRUE
else
var/totaldelay = 3 //A little bit less than half of a second as a baseline for getting up from a rest
if(getStaminaLoss() >= STAMINA_SOFTCRIT)
to_chat(src, "<span class='warning'>You're too exhausted to get up!")
return FALSE
attemptingstandup = TRUE
var/health_deficiency = max((maxHealth - (health - getStaminaLoss()))*0.5, 0)
if(!has_gravity())
health_deficiency = health_deficiency*0.2
totaldelay += health_deficiency
var/standupwarning = "[src] and everyone around them should probably yell at the dev team"
switch(health_deficiency)
if(-INFINITY to 10)
standupwarning = "[src] stands right up!"
if(10 to 35)
standupwarning = "[src] tries to stand up."
if(35 to 60)
standupwarning = "[src] slowly pushes [p_them()]self upright."
if(60 to 80)
standupwarning = "[src] weakly attempts to stand up."
if(80 to INFINITY)
standupwarning = "[src] struggles to stand up."
var/usernotice = automatic ? "<span class='notice'>You are now getting up. (Auto)</span>" : "<span class='notice'>You are now getting up.</span>"
visible_message("<span class='notice'>[standupwarning]</span>", usernotice, vision_distance = 5)
if(do_after(src, totaldelay, target = src))
resting = FALSE
attemptingstandup = FALSE
update_canmove()
return TRUE
else
visible_message("<span class='notice'>[src] falls right back down.</span>", "<span class='notice'>You fall right back down.</span>")
attemptingstandup = FALSE
if(has_gravity())
playsound(src, "bodyfall", 20, 1)
return FALSE
/mob/living/carbon/update_stamina()
var/total_health = getStaminaLoss()
if(total_health)
if(!recoveringstam && total_health >= STAMINA_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
resting = TRUE
set_resting(TRUE, FALSE, FALSE)
if(combatmode)
toggle_combat_mode(TRUE)
recoveringstam = TRUE
filters += CIT_FILTER_STAMINACRIT
update_canmove()
update_mobility()
if(recoveringstam && total_health <= STAMINA_SOFTCRIT)
to_chat(src, "<span class='notice'>You don't feel nearly as exhausted anymore.</span>")
recoveringstam = FALSE
filters -= CIT_FILTER_STAMINACRIT
update_canmove()
update_mobility()
update_health_hud()
/mob/living/proc/update_hud_sprint_bar()
@@ -54,8 +54,8 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
var/mob/living/M = A
var/cachedstam = M.getStaminaLoss()
var/totalstuntime = cachedstam * stamtostunconversion * (M.lying ? 2 : 1)
if(!M.resting)
M.Knockdown(cachedstam*2) //BORK BORK. GET DOWN.
if(CHECK_MOBILITY(M, MOBILITY_STAND))
M.DefaultCombatKnockdown(cachedstam*2) //BORK BORK. GET DOWN.
M.Stun(totalstuntime)
user.do_attack_animation(A, ATTACK_EFFECT_BITE)
user.start_pulling(M, TRUE) //Yip yip. Come with.
@@ -284,7 +284,7 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
to_chat(R, "Insufficent Power!")
return
L.Stun(4) // normal stunbaton is force 7 gimme a break good sir!
L.Knockdown(80)
L.DefaultCombatKnockdown(80)
L.apply_effect(EFFECT_STUTTER, 4)
L.visible_message("<span class='danger'>[R] has shocked [L] with its tongue!</span>", \
"<span class='userdanger'>[R] has shocked you with its tongue!</span>")
@@ -426,13 +426,13 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
var/mob/living/L = hit_atom
if(!L.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK))
L.visible_message("<span class ='danger'>[src] pounces on [L]!</span>", "<span class ='userdanger'>[src] pounces on you!</span>")
L.Knockdown(iscarbon(L) ? 60 : 45, override_stamdmg = CLAMP(pounce_stamloss, 0, pounce_stamloss_cap-L.getStaminaLoss())) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice.
L.DefaultCombatKnockdown(iscarbon(L) ? 60 : 45, override_stamdmg = CLAMP(pounce_stamloss, 0, pounce_stamloss_cap-L.getStaminaLoss())) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice.
playsound(src, 'sound/weapons/Egloves.ogg', 50, 1)
sleep(2)//Runtime prevention (infinite bump() calls on hulks)
step_towards(src,L)
log_combat(src, L, "borg pounced")
else
Knockdown(15, 1, 1)
DefaultCombatKnockdown(15, 1, 1)
pounce_cooldown = !pounce_cooldown
spawn(pounce_cooldown_time) //3s by default
@@ -440,10 +440,10 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
else if(hit_atom.density && !hit_atom.CanPass(src))
visible_message("<span class ='danger'>[src] smashes into [hit_atom]!</span>", "<span class ='userdanger'>You smash into [hit_atom]!</span>")
playsound(src, 'sound/items/trayhit1.ogg', 50, 1)
Knockdown(15, 1, 1)
DefaultCombatKnockdown(15, 1, 1)
if(leaping)
leaping = 0
pixel_y = initial(pixel_y)
update_icons()
update_canmove()
update_mobility()
@@ -1,6 +1,6 @@
/mob/living/silicon/robot/Move(NewLoc, direct)
. = ..()
if(. && sprinting && !(movement_type & FLYING) && canmove && !resting)
if(. && sprinting && !(movement_type & FLYING) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND | MOBILITY_MOVE))
if(!(cell?.use(25)))
togglesprint(TRUE)
@@ -14,7 +14,7 @@
if(!shutdown && (!cell || cell.charge < 25) || !cansprint)
return FALSE
sprinting = shutdown ? FALSE : !sprinting
if(!resting && canmove)
if(CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND|MOBILITY_MOVE))
if(sprinting)
playsound_local(src, 'sound/misc/sprintactivate.ogg', 50, FALSE, pressure_affected = FALSE)
else
@@ -100,7 +100,7 @@
if(addiction_stage == 11)
to_chat(M, "<span class='userdanger'>You start to convlse violently as you feel your consciousness split and merge across realities as your possessions fly wildy off your body.</span>")
M.Jitter(200)
M.Knockdown(200)
M.DefaultCombatKnockdown(200)
M.Stun(80)
var/items = M.get_contents()
if(!LAZYLEN(items))
@@ -154,7 +154,7 @@
do_sparks(5,FALSE,M)
M.Sleeping(100, 0)
M.Jitter(50)
M.Knockdown(100)
M.DefaultCombatKnockdown(100)
to_chat(M, "<span class='userdanger'>You feel your eigenstate settle, snapping an alternative version of yourself into reality. All your previous memories are lost and replaced with the alternative version of yourself. This version of you feels more [pick("affectionate", "happy", "lusty", "radical", "shy", "ambitious", "frank", "voracious", "sensible", "witty")] than your previous self, sent to god knows what universe.</span>")
M.emote("me",1,"flashes into reality suddenly, gasping as they gaze around in a bewildered and highly confused fashion!",TRUE)
log_game("FERMICHEM: [M] ckey: [M.key] has become an alternative universe version of themselves.")
@@ -40,7 +40,7 @@
M.visible_message("<span class='warning'>A pair of breasts suddenly fly out of the [M]!</b></span>")
var/T2 = get_random_station_turf()
M.adjustBruteLoss(25)
M.Knockdown(50)
M.DefaultCombatKnockdown(50)
M.Stun(50)
B.throw_at(T2, 8, 1)
M.reagents.del_reagent(type)
@@ -196,7 +196,7 @@
M.visible_message("<span class='warning'>A penis suddenly flies out of the [M]!</b></span>")
var/T2 = get_random_station_turf()
M.adjustBruteLoss(25)
M.Knockdown(50)
M.DefaultCombatKnockdown(50)
M.Stun(50)
P.throw_at(T2, 8, 1)
M.reagents.del_reagent(type)
@@ -93,7 +93,7 @@
if(method == INJECT)
var/turf/T = get_turf(M)
M.adjustOxyLoss(15)
M.Knockdown(50)
M.DefaultCombatKnockdown(50)
M.Stun(50)
M.emote("cough")
var/obj/item/toy/plush/P = pick(subtypesof(/obj/item/toy/plush))