From b341818f04e4d6d7a3812d8a9e905dfeadca15a6 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 12 Jan 2020 11:00:12 -0800 Subject: [PATCH] mobility flags --- code/__DEFINES/flags.dm | 2 +- code/_onclick/hud/screen_objects.dm | 2 +- code/datums/components/footstep.dm | 2 +- code/datums/diseases/advance/symptoms/heal.dm | 8 ++++---- code/datums/martial/cqc.dm | 6 +++--- code/datums/status_effects/gas.dm | 8 ++++---- code/game/objects/effects/step_triggers.dm | 8 ++++---- code/game/objects/items/devices/scanners.dm | 3 ++- code/game/objects/structures/crates_lockers/closets.dm | 5 +++-- code/game/objects/structures/tables_racks.dm | 3 +-- code/game/objects/structures/transit_tubes/station.dm | 6 +++--- code/modules/antagonists/bloodsucker/powers/bs_haste.dm | 4 ++-- code/modules/antagonists/bloodsucker/powers/bs_lunge.dm | 2 +- code/modules/library/lib_items.dm | 6 +++--- code/modules/mob/dead/new_player/new_player.dm | 1 - code/modules/mob/living/living.dm | 3 +-- code/modules/mob/living/living_mobility.dm | 4 ++-- code/modules/ruins/spaceruin_code/hilbertshotel.dm | 2 +- code/modules/surgery/bodyparts/bodyparts.dm | 2 +- modular_citadel/code/modules/clothing/under/trek_under.dm | 5 +++-- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 3db9c5a70b..2a9b1abb17 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -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) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index dec743d35c..d9413b177a 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -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" diff --git a/code/datums/components/footstep.dm b/code/datums/components/footstep.dm index c4e65ea120..fbf559fe35 100644 --- a/code/datums/components/footstep.dm +++ b/code/datums/components/footstep.dm @@ -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 diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 8b205db756..5bd48b132b 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -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, "You feel yourself slip into a regenerative coma...") @@ -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 diff --git a/code/datums/martial/cqc.dm b/code/datums/martial/cqc.dm index a4b55607bb..793c43bd80 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -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("[A] [picked_hit_type] [D]!", \ "[A] [picked_hit_type] you!") 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("[A] leg sweeps [D]!", \ "[A] leg sweeps you!") 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("[A] strikes [D]'s jaw with their hand!", \ "[A] strikes your jaw, disorienting you!") diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index 0041799314..608dbb2d7a 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -17,11 +17,11 @@ to_chat(owner, "You become frozen in a cube!") 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 diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index e81c00afb5..b4c3345146 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -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() diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 00381b9838..3b7db190b9 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -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 diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 729e81750d..5334b49ddb 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -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) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 3d4e731899..e19229a41f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -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("[user] has laid [pushed_mob] on [src].") 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 diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index f821041894..cdae11c066 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -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 diff --git a/code/modules/antagonists/bloodsucker/powers/bs_haste.dm b/code/modules/antagonists/bloodsucker/powers/bs_haste.dm index 7c6ae4f426..0b666baaa3 100644 --- a/code/modules/antagonists/bloodsucker/powers/bs_haste.dm +++ b/code/modules/antagonists/bloodsucker/powers/bs_haste.dm @@ -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() diff --git a/code/modules/antagonists/bloodsucker/powers/bs_lunge.dm b/code/modules/antagonists/bloodsucker/powers/bs_lunge.dm index 3d1e054826..d6f3d87461 100644 --- a/code/modules/antagonists/bloodsucker/powers/bs_lunge.dm +++ b/code/modules/antagonists/bloodsucker/powers/bs_lunge.dm @@ -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 diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 06a988d109..e079943bf5 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -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()) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index d789fc6f5a..5b2215b190 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -10,7 +10,6 @@ density = FALSE stat = DEAD - canmove = FALSE anchored = TRUE // don't get pushed around diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 48ae6eefc2..d27e4ad644 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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() diff --git a/code/modules/mob/living/living_mobility.dm b/code/modules/mob/living/living_mobility.dm index 5c9a8ad092..97cb0c67b1 100644 --- a/code/modules/mob/living/living_mobility.dm +++ b/code/modules/mob/living/living_mobility.dm @@ -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, "You are now [resting? "resting" : "getting up"].") + to_chat(src, "You are now [_REFACTORING_resting? "resting" : "getting up"].") update_resting(updating) /mob/living/proc/update_resting(update_mobility = TRUE) diff --git a/code/modules/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/ruins/spaceruin_code/hilbertshotel.dm index f64b5e4d01..48c1b8b7df 100644 --- a/code/modules/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/ruins/spaceruin_code/hilbertshotel.dm @@ -239,7 +239,7 @@ GLOBAL_VAR_INIT(hhmysteryRoomNumber, 1337) to_chat(user, "The door seems to be malfunctioning and refuses to operate!") 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)) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index a1b74942e0..169a64e380 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -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() diff --git a/modular_citadel/code/modules/clothing/under/trek_under.dm b/modular_citadel/code/modules/clothing/under/trek_under.dm index 5cd0620a9d..ca27c9a0bf 100644 --- a/modular_citadel/code/modules/clothing/under/trek_under.dm +++ b/modular_citadel/code/modules/clothing/under/trek_under.dm @@ -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)