mobility flags

This commit is contained in:
kevinz000
2020-01-12 11:00:12 -08:00
parent 0fc6d0e891
commit b341818f04
20 changed files with 41 additions and 41 deletions

View File

@@ -103,7 +103,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 use items
/// can use items and interact with world objects like opening closets/etc
#define MOBILITY_USE (1<<3)
/// can use interfaces like consoles
#define MOBILITY_UI (1<<4)

View File

@@ -406,7 +406,7 @@
var/mob/living/user = hud?.mymob
if(!istype(user))
return
if(!user.resting)
if(!user._REFACTORING_resting)
icon_state = "act_rest"
else
icon_state = "act_rest0"

View File

@@ -18,7 +18,7 @@
var/mob/living/LM = parent
var/v = volume
var/e = e_range
if(!T.footstep || LM.buckled || LM.lying || !LM.canmove || LM.resting || LM.buckled || LM.throwing || LM.movement_type & (VENTCRAWLING | FLYING))
if(!T.footstep || LM.buckled || !CHECK_MOBILITY(LM, MOBILITY_STAND) || LM.buckled || LM.throwing || (LM.movement_type & (VENTCRAWLING | FLYING)))
if (LM.lying && !LM.buckled && !(!T.footstep || LM.movement_type & (VENTCRAWLING | FLYING))) //play crawling sound if we're lying
playsound(T, 'sound/effects/footstep/crawl1.ogg', 15 * v)
return

View File

@@ -253,11 +253,11 @@
var/mob/living/M = A.affected_mob
if(HAS_TRAIT(M, TRAIT_DEATHCOMA))
return power
else if(M.IsUnconscious() || M.stat == UNCONSCIOUS)
else if(M._REFACTORING_IsUnconscious() || M.stat == UNCONSCIOUS)
return power * 0.9
else if(M.stat == SOFT_CRIT)
return power * 0.5
else if(M.IsSleeping())
else if(M._REFACTORING_IsSleeping())
return power * 0.25
else if(M.getBruteLoss() + M.getFireLoss() >= 70 && !active_coma)
to_chat(M, "<span class='warning'>You feel yourself slip into a regenerative coma...</span>")
@@ -269,7 +269,7 @@
M.emote("deathgasp")
M.fakedeath("regenerative_coma")
M.update_stat()
M.update_canmove()
M.update_mobility()
addtimer(CALLBACK(src, .proc/uncoma, M), 300)
/datum/symptom/heal/coma/proc/uncoma(mob/living/M)
@@ -278,7 +278,7 @@
active_coma = FALSE
M.cure_fakedeath("regenerative_coma")
M.update_stat()
M.update_canmove()
M.update_mobility()
/datum/symptom/heal/coma/Heal(mob/living/carbon/M, datum/disease/advance/A, actual_power)
var/heal_amt = 4 * actual_power

View File

@@ -136,7 +136,7 @@
A.do_attack_animation(D)
var/picked_hit_type = pick("CQC'd", "Big Bossed")
var/bonus_damage = 13
if(D.IsKnockdown() || D.resting || D.lying)
if(!CHECK_MOBILITY(D, MOBILITY_STAND))
bonus_damage += 5
picked_hit_type = "stomps on"
D.apply_damage(bonus_damage, BRUTE)
@@ -147,7 +147,7 @@
D.visible_message("<span class='danger'>[A] [picked_hit_type] [D]!</span>", \
"<span class='userdanger'>[A] [picked_hit_type] you!</span>")
log_combat(A, D, "[picked_hit_type] (CQC)")
if(A.resting && !D.stat && !D.IsKnockdown())
if(!CHECK_MOBILITY(A, MOBILITY_STAND) && !D.stat && CHECK_MOBILITY(D, MOBILITY_STAND))
D.visible_message("<span class='warning'>[A] leg sweeps [D]!", \
"<span class='userdanger'>[A] leg sweeps you!</span>")
playsound(get_turf(A), 'sound/effects/hit_kick.ogg', 50, 1, -1)
@@ -164,7 +164,7 @@
if(check_streak(A,D))
return TRUE
if(prob(65))
if(!D.stat || !D.IsKnockdown() || !restraining)
if(CHECK_MOBILITY(D, MOBILITY_MOVE) || !restraining)
I = D.get_active_held_item()
D.visible_message("<span class='warning'>[A] strikes [D]'s jaw with their hand!</span>", \
"<span class='userdanger'>[A] strikes your jaw, disorienting you!</span>")

View File

@@ -17,11 +17,11 @@
to_chat(owner, "<span class='userdanger'>You become frozen in a cube!</span>")
cube = icon('icons/effects/freeze.dmi', "ice_cube")
owner.add_overlay(cube)
owner.update_canmove()
owner.update_mobility()
return ..()
/datum/status_effect/freon/tick()
owner.update_canmove()
owner.update_mobility()
if(can_melt && owner.bodytemperature >= BODYTEMP_NORMAL)
qdel(src)
@@ -31,14 +31,14 @@
if(!QDELETED(src))
to_chat(owner, "You break out of the ice cube!")
owner.remove_status_effect(/datum/status_effect/freon)
owner.update_canmove()
owner.update_mobility()
/datum/status_effect/freon/on_remove()
if(!owner.stat)
to_chat(owner, "The cube melts!")
owner.cut_overlay(cube)
owner.adjust_bodytemperature(100)
owner.update_canmove()
owner.update_mobility()
UnregisterSignal(owner, COMSIG_LIVING_RESIST)
/datum/status_effect/freon/watcher

View File

@@ -61,8 +61,8 @@
if(AM in T.affecting)
return
if(ismob(AM))
var/mob/M = AM
if(isliving(AM))
var/mob/living/M = AM
if(immobilize)
ADD_TRAIT(M, TRAIT_MOBILITY_NOMOVE, src)
M.update_mobility()
@@ -99,8 +99,8 @@
affecting.Remove(AM)
if(ismob(AM))
var/mob/M = AM
if(living(AM))
var/mob/living/M = AM
if(immobilize)
REMOVE_TRAIT(M, TRAIT_MOBILITY_NOMOVE, src)
M.update_mobility()

View File

@@ -486,7 +486,8 @@ SLIME SCANNER
set name = "Switch Verbosity"
set category = "Object"
if(usr.stat || !usr.canmove || usr.restrained())
var/mob/living/L = usr
if(!istype(L) || !CHECK_MOBILITY(L, MOBILITY_USE))
return
mode = !mode

View File

@@ -474,8 +474,9 @@
set category = "Object"
set name = "Toggle Open"
if(!usr.canmove || usr.stat || usr.restrained())
return
var/mob/living/L = usr
if(!istype(L) || !CHECK_MOBILITY(L, MOBILITY_USE))
return FALSE
if(iscarbon(usr) || issilicon(usr) || isdrone(usr))
return attack_hand(usr)

View File

@@ -549,12 +549,11 @@
/obj/structure/table/optable/tablepush(mob/living/user, mob/living/pushed_mob)
pushed_mob.forceMove(loc)
pushed_mob.set_resting(TRUE, TRUE)
pushed_mob.update_canmove()
visible_message("<span class='notice'>[user] has laid [pushed_mob] on [src].</span>")
check_patient()
/obj/structure/table/optable/proc/check_patient()
var/mob/M = locate(/mob/living/carbon/human, loc)
var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, loc)
if(M)
if(!CHECK_BITFIELD(M.mobility_flags, MOBILITY_STAND))
patient = M

View File

@@ -43,10 +43,10 @@
//pod insertion
/obj/structure/transit_tube/station/MouseDrop_T(obj/structure/c_transit_tube_pod/R, mob/user)
if(!user.canmove || user.stat || user.restrained())
/obj/structure/transit_tube/station/MouseDrop_T(obj/structure/c_transit_tube_pod/R, mob/living/user)
if(!istype(user) || !CHECK_MOBILLITY(user, MOBILITY_USE))
return
if (!istype(R) || get_dist(user, src) > 1 || get_dist(src,R) > 1)
if(!istype(R) || get_dist(user, src) > 1 || get_dist(src,R) > 1)
return
for(var/obj/structure/transit_tube_pod/pod in loc)
return //no fun allowed

View File

@@ -58,7 +58,7 @@
// Did I get knocked down?
if(owner && owner.incapacitated(ignore_restraints=TRUE, ignore_grab=TRUE))// owner.incapacitated())
// We're gonna cancel. But am I on the ground? Spin me!
if(!CHECK_MOBILTIY(user, MOBILITY_STAND))
if(!CHECK_MOBILITY(user, MOBILITY_STAND))
var/send_dir = get_dir(owner, T)
new /datum/forced_movement(owner, get_ranged_target_turf(owner, send_dir, 1), 1, FALSE)
owner.spin(10)
@@ -71,7 +71,7 @@
if (rand(0, 5) < level_current)
playsound(get_turf(newtarget), "sound/weapons/punch[rand(1,4)].ogg", 15, 1, -1)
newtarget.DefaultCombatKnockdown(10 + level_current * 5)
if(_REFACTORING_newtarget.IsStun())
if(newtarget._REFACTORING_IsStun())
newtarget.spin(10,1)
if (rand(0,4))
newtarget.drop_all_held_items()

View File

@@ -74,7 +74,7 @@
target.adjustStaminaLoss(40 + 10 * level_current)
// Cancel Walk (we were close enough to contact them)
walk(owner, 0)
target._REFACTORING_Stun(10,1) //Without this the victim can just walk away
target.Stun(10,1) //Without this the victim can just walk away
target.grabbedby(owner) // Taken from mutations.dm under changelings
target.grippedby(owner, instant = TRUE) //instant aggro grab

View File

@@ -113,14 +113,14 @@
return ..()
/obj/structure/bookcase/attack_hand(mob/user)
/obj/structure/bookcase/attack_hand(mob/living/user)
. = ..()
if(.)
if(. || !istype(user))
return
if(contents.len)
var/obj/item/book/choice = input("Which book would you like to remove from the shelf?") as null|obj in contents
if(choice)
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
if(!CHECK_MOBILITY(user, MOBILITY_USE) || !in_range(loc, user))
return
if(ishuman(user))
if(!user.get_active_held_item())

View File

@@ -10,7 +10,6 @@
density = FALSE
stat = DEAD
canmove = FALSE
anchored = TRUE // don't get pushed around

View File

@@ -1195,8 +1195,7 @@
if(scale_stamina_loss_recovery)
adjustStaminaLoss(min(-((getStaminaLoss() - stamina_loss_recovery_bypass) * scale_stamina_loss_recovery), 0))
if(put_on_feet)
resting = FALSE
lying = FALSE
set_resting(FALSE, TRUE, FALSE)
if(reset_misc)
stuttering = 0
updatehealth()

View File

@@ -2,9 +2,9 @@
//Force-set resting variable, without needing to resist/etc.
/mob/living/proc/set_resting(new_resting, silent = FALSE, updating = TRUE)
resting = new_resting
_REFACTORING_resting = new_resting
if(!silent)
to_chat(src, "<span class='notice'>You are now [resting? "resting" : "getting up"].</span>")
to_chat(src, "<span class='notice'>You are now [_REFACTORING_resting? "resting" : "getting up"].</span>")
update_resting(updating)
/mob/living/proc/update_resting(update_mobility = TRUE)

View File

@@ -239,7 +239,7 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337)
to_chat(user, "<span class='warning'>The door seems to be malfunctioning and refuses to operate!</span>")
return
if(alert(user, "Hilbert's Hotel would like to remind you that while we will do everything we can to protect the belongings you leave behind, we make no guarantees of their safety while you're gone, especially that of the health of any living creatures. With that in mind, are you ready to leave?", "Exit", "Leave", "Stay") == "Leave")
if(!user.canmove || (get_dist(get_turf(src), get_turf(user)) > 1)) //no teleporting around if they're dead or moved away during the prompt.
if(!CHECK_MOBILITY(user, MOBILITY_MOVE) || (get_dist(get_turf(src), get_turf(user)) > 1)) //no teleporting around if they're dead or moved away during the prompt.
return
user.forceMove(get_turf(parentSphere))
do_sparks(3, FALSE, get_turf(user))

View File

@@ -252,7 +252,7 @@
disabled = new_disabled
owner.update_health_hud() //update the healthdoll
owner.update_body()
owner.update_canmove()
owner.update_mobility()
return TRUE
//Updates an organ's brute/burn states for use by update_damage_overlays()

View File

@@ -171,8 +171,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)