This commit is contained in:
kevinz000
2020-01-10 13:25:47 -08:00
parent 24c1baddd0
commit 830054c106
20 changed files with 133 additions and 97 deletions
+3 -1
View File
@@ -99,7 +99,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define MOBILITY_STAND (1<<1)
/// can pickup items
#define MOBILITY_PICKUP (1<<2)
/// can hold and use items
/// can use items
#define MOBILITY_USE (1<<3)
/// can use interfaces like consoles
#define MOBILITY_UI (1<<4)
@@ -107,6 +107,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define MOBILITY_STORAGE (1<<5)
/// can pull things
#define MOBILITY_PULL (1<<6)
/// can hold non-nodropped items voluntarily
#define MOBILITY_HOLD (1<<7)
#define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_PICKUP | MOBILITY_USE | MOBILITY_UI | MOBILITY_STORAGE | MOBILITY_PULL)
#define MOBILITY_FLAGS_ANY_INTERACTION (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_UI | MOBILITY_STORAGE)
+5 -2
View File
@@ -37,8 +37,8 @@
/////////////
// DEBUFFS //
/////////////
#define STATUS_EFFECT_STUN /datum/status_effect/incapacitating/stun //the affected is unable to move or use items
/// The affected is unable to move, or to use, hold, or pickup items.
#define STATUS_EFFECT_STUN /datum/status_effect/incapacitating/stun
#define STATUS_EFFECT_KNOCKDOWN /datum/status_effect/incapacitating/knockdown //the affected is unable to stand up
@@ -46,6 +46,9 @@
#define STATUS_EFFECT_PARALYZED /datum/status_effect/incapacitating/paralyzed //the affected is unable to move, use items, or stand up.
/// The affected is unable to use or pickup items
#define STATUS_EFFECT_DAZED /datum/status_effect/incapacitating/dazed
#define STATUS_EFFECT_UNCONSCIOUS /datum/status_effect/incapacitating/unconscious //the affected is unconscious
#define STATUS_EFFECT_SLEEPING /datum/status_effect/incapacitating/sleeping //the affected is asleep
+9
View File
@@ -136,6 +136,15 @@
#define TRAIT_NOPULSE "nopulse" // Your heart doesn't beat.
#define TRAIT_EXEMPT_HEALTH_EVENTS "exempt-health-events"
// mobility flag traits
/// Disallow movement
#define TRAIT_MOBILITY_NOMOVE "mobility_nomove"
/// Disallow pickup
#define TRAIT_MOBILITY_NOPICKUP "mobility_nopickup"
/// Disallow item use
#define TRAIT_MOBILITY_NOUSE "mobility_nouse"
//non-mob traits
#define TRAIT_PARALYSIS "paralysis" //Used for limb-based paralysis, where replacing the limb will fix it
+5
View File
@@ -33,6 +33,7 @@
/datum/status_effect/incapacitating/immobilized
id = "immobilized"
//PARALYZED
/datum/status_effect/incapacitating/paralyzed
id = "paralyzed"
@@ -40,6 +41,10 @@
if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.3) //reduce stamina loss by 0.3 per tick, 6 per 2 seconds
//DAZED
/datum/status_effect/incapacitating/dazed
id = "dazed"
//UNCONSCIOUS
/datum/status_effect/incapacitating/unconscious
id = "unconscious"
@@ -545,7 +545,7 @@
var/obj/item/projectile/A
//any emagged turrets drains 2x power and uses a different projectile?
if(mode == TURRET_STUN)
if(nonlethal_projectile && C && C.resting)
if(nonlethal_projectile && C && C._REFACTORING_resting)
use_power(reqpower*0.5)
A = new nonlethal_projectile(T)
playsound(loc, nonlethal_projectile_sound, 75, 1)
@@ -377,7 +377,10 @@
/obj/item/warpwhistle/proc/end_effect(mob/living/carbon/user)
user.invisibility = initial(user.invisibility)
user.status_flags &= ~GODMODE
user.canmove = TRUE
REMOVE_TRAIT(user, TRAIT_MOBILITY_NOMOVE, src)
REMOVE_TRAIT(user, TRAIT_MOBILITY_NOUSE, src)
REMOVE_TRAIT(user, TRAIT_MOBILITY_NOPICKUP, src)
user.update_mobility()
/obj/item/warpwhistle/attack_self(mob/living/carbon/user)
if(!istype(user) || on_cooldown)
@@ -390,7 +393,10 @@
on_cooldown = TRUE
last_user = user
playsound(T,'sound/magic/warpwhistle.ogg', 200, 1)
user.canmove = FALSE
ADD_TRAIT(user, TRAIT_MOBILITY_NOMOVE, src)
ADD_TRAIT(user, TRAIT_MOBILITY_NOUSE, src)
ADD_TRAIT(user, TRAIT_MOBILITY_NOPICKUP, src)
user.update_mobility()
new /obj/effect/temp_visual/tornado(T)
sleep(20)
if(interrupted(user))
@@ -412,7 +418,6 @@
return
if(T.z != potential_T.z || abs(get_dist_euclidian(potential_T,T)) > 50 - breakout)
do_teleport(user, potential_T, channel = TELEPORT_CHANNEL_MAGIC)
user.canmove = 0
T = potential_T
break
breakout += 1
@@ -83,8 +83,8 @@
/obj/item/soulstone/proc/release_shades(mob/user)
for(var/mob/living/simple_animal/shade/A in src)
A.status_flags &= ~GODMODE
A.canmove = TRUE
A.forceMove(get_turf(user))
A.mobility_flags = MOBILITY_FLAGS_DEFAULT
A.cancel_camera()
icon_state = "soulstone"
name = initial(name)
@@ -173,7 +173,7 @@
else
T.forceMove(src) //put shade in stone
T.status_flags |= GODMODE
T.canmove = FALSE
T.mobility_flags = NONE
T.health = T.maxHealth
icon_state = "soulstone2"
name = "soulstone: Shade of [T.real_name]"
@@ -271,10 +271,10 @@
else
. += "[src] seems empty."
/obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
/obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/living/carbon/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !istype(target) || !user.IsAdvancedToolUser())
return
if (target.IsKnockdown() || target.IsStun() || target.IsSleeping() || target.IsUnconscious())
if(!CHECK_BITFIELD(target.mobility_flags, MOBILITY_MOVE))
close_machine(target)
else
user.visible_message("<b>[user]</b> starts shoving [target] inside [src].", "<span class='notice'>You start shoving [target] inside [src].</span>")
@@ -79,7 +79,7 @@
if(leaping)
leaping = 0
update_icons()
update_canmove()
update_mobility()
/mob/living/carbon/alien/humanoid/float(on)
@@ -22,13 +22,13 @@
if(stat == CONSCIOUS)
stat = UNCONSCIOUS
blind_eyes(1)
update_canmove()
update_mobility()
else
if(stat == UNCONSCIOUS)
stat = CONSCIOUS
if(!recoveringstam)
resting = 0
adjust_blindness(-1)
update_canmove()
update_mobility()
update_damage_hud()
update_health_hud()
@@ -296,7 +296,7 @@
if(M.force > 35) // durand and other heavy mechas
DefaultCombatKnockdown(50)
src.throw_at(throw_target, rand(1,5), 7)
else if(M.force >= 20 && !IsKnockdown()) // lightweight mechas like gygax
else if(M.force >= 20 && CHECK_BITFIELD(mobility_flags, MOBILITY_STAND)) // lightweight mechas like gygax
DefaultCombatKnockdown(30)
src.throw_at(throw_target, rand(1,3), 7)
update |= temp.receive_damage(dmg, 0)
@@ -21,7 +21,7 @@
else if(resisting)
resisting = FALSE
else if((mode == MONKEY_IDLE && !pickupTarget && !prob(MONKEY_SHENANIGAN_PROB)) || !handle_combat())
if(prob(25) && canmove && isturf(loc) && !pulledby)
if(prob(25) && CHECK_BITFIELD(mobility_flags, MOBILITY_MOVE) && isturf(loc) && !pulledby)
step(src, pick(GLOB.cardinals))
else if(prob(1))
emote(pick("scratch","jump","roll","tail"))
+2 -2
View File
@@ -486,7 +486,7 @@
stat = UNCONSCIOUS //the mob starts unconscious,
blind_eyes(1)
updatehealth() //then we check if the mob should wake up.
update_canmove()
update_mobility()
update_sight()
clear_alert("not_enough_oxy")
reload_fullscreen()
@@ -520,7 +520,7 @@
ExtinguishMob()
fire_stacks = 0
confused = 0
update_canmove()
update_mobility()
var/datum/component/mood/mood = GetComponent(/datum/component/mood)
if (mood)
QDEL_LIST_ASSOC_VAL(mood.mood_events)
+22 -68
View File
@@ -92,61 +92,14 @@
var/stun = _MOBILITYFLAGTEMPORARY_IsStun()
var/paralyze = IsParalyzed()
var/knockdown = _MOBILITYFLAGTEMPORARY_IsKnockdown()
var/daze = IsDazed()
var/immobilize = IsImmobilized()
/*
var/ko = IsKnockdown() || IsUnconscious() || (stat && (stat != SOFT_CRIT || pulledby)) || (HAS_TRAIT(src, TRAIT_DEATHCOMA))
var/move_and_fall = stat == SOFT_CRIT && !pulledby
var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK
var/buckle_lying = !(buckled && !buckled.buckle_lying)
var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground
if(ko || move_and_fall || IsStun() || chokehold) // Cit change - makes resting not force you to drop everything
drop_all_held_items()
unset_machine()
if(pulling)
stop_pulling()
else if(resting) //CIT CHANGE - makes resting make you stop pulling and interacting with machines
unset_machine() //CIT CHANGE - Ditto!
if(pulling) //CIT CHANGE - Ditto.
stop_pulling() //CIT CHANGE - Ditto...
else if(has_legs || ignore_legs)
lying = 0
if (pulledby)
var/mob/living/L = pulledby
L.update_pull_movespeed()
if(buckled)
lying = 90*buckle_lying
else if(!lying)
if(resting)
lying = pick(90, 270) // Cit change - makes resting not force you to drop your held items
if(has_gravity()) // Cit change - Ditto
playsound(src, "bodyfall", 50, 1) // Cit change - Ditto!
else if(ko || move_and_fall || (!has_legs && !ignore_legs) || chokehold)
fall(forced = 1)
canmove = !(ko || recoveringstam || pinned || IsStun() || IsFrozen() || chokehold || buckled || (!has_legs && !ignore_legs && !has_arms)) //Cit change - makes it plausible to move while resting, adds pinning and stamina crit
density = !lying
if(lying)
if(layer == initial(layer)) //to avoid special cases like hiding larvas.
layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs
else
if(layer == LYING_MOB_LAYER)
layer = initial(layer)
update_transform()
if(!lying && lying_prev)
if(client)
client.move_delay = world.time + movement_delay()
lying_prev = lying
if(canmove && !intentionalresting && iscarbon(src) && client && client.prefs && client.prefs.autostand)//CIT CHANGE - adds autostanding as a preference
addtimer(CALLBACK(src, .proc/resist_a_rest, TRUE), 0) //CIT CHANGE - ditto
return canmove
*/
/*
var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK
var/restrained = restrained()
var/canmove = !IsImmobilized() && !stun && conscious && !paralyzed && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && !IS_IN_STASIS(src) && (has_arms || ignore_legs || has_legs)
var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground
var/canmove = !IsImmobilized() && !stun && conscious && !paralyzed && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && !IS_IN_STASIS(src) && (has_arms || ignore_legs || has_legs) && !pinned
if(canmove)
mobility_flags |= MOBILITY_MOVE
else
@@ -175,24 +128,27 @@
else
mobility_flags |= MOBILITY_UI|MOBILITY_PULL
var/canitem = !paralyzed && !stun && conscious && !chokehold && !restrained && has_arms
if(canitem)
mobility_flags |= (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE)
else
mobility_flags &= ~(MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE)
if(!(mobility_flags & MOBILITY_USE))
if(!(mobility_flags & MOBILITY_HOLD))
drop_all_held_items()
if(!(mobility_flags & MOBILITY_PULL))
if(pulling)
stop_pulling()
if(!(mobility_flags & MOBILITY_UI))
unset_machine()
if(pulledby)
pulledby.update_pull_movespeed()
//Handle lying down, voluntary or involuntary
density = !lying
if(lying)
if(!lying_prev)
fall(!canstand_involuntary)
set_resting(TRUE, TRUE, FALSE)
if(layer == initial(layer)) //to avoid special cases like hiding larvas.
layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs
else
@@ -201,17 +157,15 @@
update_transform()
lying_prev = lying
// Movespeed mods based on arms/legs quantity
if(!get_leg_ignore())
var/limbless_slowdown = 0
// These checks for <2 should be swapped out for something else if we ever end up with a species with more than 2
if(has_legs < 2)
limbless_slowdown += 6 - (has_legs * 3)
if(!has_legs && has_arms < 2)
limbless_slowdown += 6 - (has_arms * 3)
if(limbless_slowdown)
add_movespeed_modifier(MOVESPEED_ID_LIVING_LIMBLESS, update=TRUE, priority=100, override=TRUE, multiplicative_slowdown=limbless_slowdown, movetypes=GROUND)
else
remove_movespeed_modifier(MOVESPEED_ID_LIVING_LIMBLESS, update=TRUE)
*/
//Handle citadel autoresist
if((mobility_flags & MOBILITY_MOVE) && !intentionalresting && canstand_involuntary && iscarbon(src) && client?.prefs?.autostand)//CIT CHANGE - adds autostanding as a preference
addtimer(CALLBACK(src, .proc/resist_a_rest, TRUE), 0) //CIT CHANGE - ditto
return mobility_flags
if(HAS_TRAIT(src, TRAIT_MOBILITY_NOMOVE))
DISABLE_BITFIELD(mobility_flags, MOBILITY_MOVE)
if(HAS_TRAIT(src, TRAIT_MOBILITY_NOPICKUP))
DISABLE_BITFIELD(mobility_flags, MOBILITY_PICKUP)
if(HAS_TRAIT(src, TRAIT_MOBILITY_NOUSE))
DISABLE_BITFIELD(mobility_flags, MOBILITY_USE)
@@ -755,7 +755,7 @@
else
clear_alert("locked")
locked_down = state
update_canmove()
update_mobility()
/mob/living/silicon/robot/proc/SetEmagged(new_state)
emagged = new_state
@@ -1024,13 +1024,13 @@
if(stat == CONSCIOUS)
stat = UNCONSCIOUS
blind_eyes(1)
update_canmove()
update_mobility()
update_headlamp()
else
if(stat == UNCONSCIOUS)
stat = CONSCIOUS
adjust_blindness(-1)
update_canmove()
update_mobility()
update_headlamp()
diag_hud_set_status()
diag_hud_set_health()
@@ -11,4 +11,4 @@
mobility_flags = newflags
update_transform()
update_action_buttons_icon()
return canmove
return mobility_flags
+59 -1
View File
@@ -234,12 +234,66 @@
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating)
return P
///////////////////////////////// DAZED ////////////////////////////////////
/mob/living/proc/IsDazed() //If we're Dazed
return has_status_effect(STATUS_EFFECT_DAZED)
/mob/living/proc/AmountDazed() //How many deciseconds remain in our Dazed status effect
var/datum/status_effect/incapacitating/dazed/I = IsDazed()
if(I)
return I.duration - world.time
return 0
/mob/living/proc/Daze(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_DAZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
return
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
if(absorb_stun(amount, ignore_canstun))
return
var/datum/status_effect/incapacitating/dazed/I = IsDazed()
if(I)
I.duration = max(world.time + amount, I.duration)
else if(amount > 0)
I = apply_status_effect(STATUS_EFFECT_DAZED, amount, updating)
return I
/mob/living/proc/SetDazed(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_DAZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
return
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
var/datum/status_effect/incapacitating/dazed/I = IsDazed()
if(amount <= 0)
if(I)
qdel(I)
else
if(absorb_stun(amount, ignore_canstun))
return
if(I)
I.duration = world.time + amount
else
I = apply_status_effect(STATUS_EFFECT_DAZED, amount, updating)
return I
/mob/living/proc/AdjustDazed(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_DAZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN)
return
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
if(absorb_stun(amount, ignore_canstun))
return
var/datum/status_effect/incapacitating/dazed/I = IsDazed()
if(I)
I.duration += amount
else if(amount > 0)
I = apply_status_effect(STATUS_EFFECT_DAZED, amount, updating)
return I
//Blanket
/mob/living/proc/AllImmobility(amount, updating, ignore_canstun = FALSE)
Paralyze(amount, FALSE, ignore_canstun)
_MOBILITYFLAGTEMPORARY_Knockdown(amount, FALSE, ignore_canstun)
Stun(amount, FALSE, ignore_canstun)
Immobilize(amount, FALSE, ignore_canstun)
Daze(amount, FALSE, ignore_canstun)
if(updating)
update_mobility()
@@ -248,6 +302,7 @@
_MOBILITYFLAGTEMPORARY_SetKnockdown(amount, FALSE, ignore_canstun)
_MOBILITYFLAGTEMPORARY_SetStun(amount, FALSE, ignore_canstun)
SetImmobilized(amount, FALSE, ignore_canstun)
SetDazed(amount, FALSE, ignore_canstun)
if(updating)
update_mobility()
@@ -256,10 +311,11 @@
_MOBILITYFLAGTEMPORARY_AdjustKnockdown(amount, FALSE, ignore_canstun)
_MOBILITYFLAGTEMPORARY_AdjustStun(amount, FALSE, ignore_canstun)
AdjustImmobilized(amount, FALSE, ignore_canstun)
AdjustDazed(amount, FALSE, ignore_canstun)
if(updating)
update_mobility()
/// Makes sure all 4 of the non-knockout immobilizing status effects are lower or equal to amount.
/// Makes sure all 5 of the non-knockout immobilizing status effects are lower or equal to amount.
/mob/living/proc/HealAllImmobilityUpTo(amount, updating, ignore_canstun = FALSE)
if(_MOBILITYFLAGTEMPORARY_AmountStun() > amount)
_MOBILITYFLAGTEMPORARY_SetStun(amount, FALSE, ignore_canstun)
@@ -269,6 +325,8 @@
SetParalyzed(amount, FALSE, ignore_canstun)
if(AmountImmobilized() > amount)
SetImmobilized(amount, FALSE, ignore_canstun)
if(AmountDazed() > amount)
SetImmobilized(amount, FALSE, ignore_canstun)
if(updating)
update_mobility()
+2 -2
View File
@@ -407,7 +407,7 @@
dropItemToGround(W)
regenerate_icons()
notransform = 1
canmove = 0
Paralyze(INFINITY)
icon = null
invisibility = INVISIBILITY_MAXIMUM
for(var/t in bodyparts)
@@ -440,7 +440,7 @@
dropItemToGround(W)
regenerate_icons()
notransform = 1
canmove = 0
Paralyze(INFINITY)
icon = null
invisibility = INVISIBILITY_MAXIMUM
for(var/t in bodyparts)
@@ -121,7 +121,7 @@
C.update_health_hud() //update the healthdoll
C.update_body()
C.update_hair()
C.update_canmove()
C.update_mobility()
if(!Tsec) // Tsec = null happens when a "dummy human" used for rendering icons on prefs screen gets its limbs replaced.
qdel(src)
@@ -296,7 +296,7 @@
C.update_body()
C.update_hair()
C.update_damage_overlays()
C.update_canmove()
C.update_mobility()
/obj/item/bodypart/head/attach_limb(mob/living/carbon/C, special)