From af65c90125502f8ccae91622bb8653ba9c76dbe6 Mon Sep 17 00:00:00 2001 From: Rohesie Date: Fri, 9 Oct 2020 20:04:30 -0300 Subject: [PATCH] Mobility refactor: no more update_mobility() (#54183) This is a pretty big change all around. The gist of it is that it moves the mobility_flags into traits or variables that can track the sources, and to which we can append code to react to the events, be it via signals or via on_event-like procs. For example, MOBILITY_STAND could mean, depending on context, that the mob is either already standing or that it may be able to stand, and thus is lying down. There was a lot of snowflakery and redefinitions on top of redefinitions, so this is bound to create bugs I'm willing to fix as I learn them. The end-goal is for every living mob to use the same mobility system, for the traits to mean the same among them, and for no place to just mass-change settings without a way to trace it, such as with mobility_flags = NONE and mobility_flags = ALL Fixes AIs being able to strip nearby people. They've lost their hands usage. --- code/__DEFINES/dcs/signals.dm | 12 +- code/__DEFINES/flags.dm | 1 - code/__DEFINES/living.dm | 3 + code/__DEFINES/mobs.dm | 6 + code/__DEFINES/traits.dm | 19 +- code/__HELPERS/mobs.dm | 9 +- code/__HELPERS/unsorted.dm | 4 +- code/_onclick/hud/pai.dm | 2 +- code/_onclick/hud/screen_objects.dm | 2 +- code/datums/action.dm | 2 +- code/datums/brain_damage/mild.dm | 2 +- code/datums/components/bloodysoles.dm | 2 +- code/datums/components/caltrop.dm | 2 +- code/datums/components/embedded.dm | 6 +- code/datums/components/footstep.dm | 9 +- code/datums/components/omen.dm | 2 +- code/datums/components/slippery.dm | 7 +- code/datums/components/soulstoned.dm | 8 +- code/datums/components/surgery_initiator.dm | 4 +- code/datums/components/tackle.dm | 4 +- code/datums/diseases/advance/symptoms/heal.dm | 5 +- code/datums/diseases/cold.dm | 4 +- code/datums/diseases/flu.dm | 4 +- code/datums/diseases/retrovirus.dm | 8 +- code/datums/elements/cleaning.dm | 2 +- code/datums/elements/squish.dm | 4 +- code/datums/elements/waddling.dm | 4 +- code/datums/keybinding/living.dm | 2 +- code/datums/martial/cqc.dm | 4 +- code/datums/martial/krav_maga.dm | 6 +- code/datums/martial/sleeping_carp.dm | 2 +- code/datums/mutations/body.dm | 2 +- code/datums/status_effects/buffs.dm | 3 +- code/datums/status_effects/debuffs.dm | 23 +-- code/datums/status_effects/gas.dm | 6 +- code/datums/status_effects/wound_effects.dm | 2 +- code/game/atoms_movable.dm | 4 - code/game/machinery/Sleeper.dm | 9 +- code/game/machinery/_machinery.dm | 3 - code/game/machinery/dance_machine.dm | 86 +++++---- code/game/machinery/dna_scanner.dm | 3 +- code/game/machinery/hypnochair.dm | 13 +- code/game/machinery/suit_storage_unit.dm | 2 +- code/game/machinery/transformer.dm | 3 +- code/game/objects/buckling.dm | 29 +-- code/game/objects/effects/step_triggers.dm | 13 +- code/game/objects/items/chrono_eraser.dm | 2 +- code/game/objects/items/cigs_lighters.dm | 2 +- code/game/objects/items/devices/camera_bug.dm | 2 +- .../objects/items/devices/laserpointer.dm | 6 +- code/game/objects/items/handcuffs.dm | 2 +- .../objects/items/implants/implantchair.dm | 4 +- code/game/objects/items/robot/robot_items.dm | 7 +- .../structures/beds_chairs/alien_nest.dm | 4 +- .../objects/structures/beds_chairs/bed.dm | 6 +- .../structures/crates_lockers/closets.dm | 6 +- code/game/objects/structures/maintenance.dm | 4 +- code/game/objects/structures/morgue.dm | 2 +- code/game/objects/structures/plasticflaps.dm | 2 +- code/game/objects/structures/tables_racks.dm | 2 +- code/game/turfs/open/_open.dm | 2 +- .../abductor/machinery/experiment.dm | 3 +- .../changeling/powers/fakedeath.dm | 1 - .../eldritch_cult/knowledge/ash_lore.dm | 4 +- .../antagonists/fugitive/fugitive_ship.dm | 2 +- .../antagonists/revenant/revenant_blight.dm | 2 +- .../antagonists/wizard/equipment/artefact.dm | 2 +- .../components/unary_devices/cryo.dm | 3 - code/modules/clothing/shoes/_shoes.dm | 2 +- code/modules/fields/timestop.dm | 6 +- code/modules/mob/living/brain/MMI.dm | 41 +++- code/modules/mob/living/brain/brain.dm | 8 +- code/modules/mob/living/brain/posibrain.dm | 7 +- code/modules/mob/living/carbon/alien/alien.dm | 10 +- .../carbon/alien/humanoid/caste/hunter.dm | 7 +- .../carbon/alien/humanoid/humanoid_defense.dm | 2 +- .../alien/humanoid/humanoid_update_icons.dm | 6 +- .../carbon/alien/larva/larva_update_icons.dm | 8 +- .../mob/living/carbon/alien/larva/life.dm | 1 - .../carbon/alien/special/alien_embryo.dm | 9 +- .../mob/living/carbon/alien/status_procs.dm | 6 +- code/modules/mob/living/carbon/carbon.dm | 34 ++-- .../mob/living/carbon/carbon_defense.dm | 6 +- code/modules/mob/living/carbon/human/human.dm | 4 +- .../mob/living/carbon/human/human_defense.dm | 2 +- .../mob/living/carbon/human/human_movement.dm | 2 +- .../mob/living/carbon/human/species.dm | 21 ++- .../mob/living/carbon/human/status_procs.dm | 12 +- .../mob/living/carbon/monkey/combat.dm | 16 +- .../mob/living/carbon/monkey/monkey.dm | 2 +- .../modules/mob/living/carbon/status_procs.dm | 2 +- code/modules/mob/living/death.dm | 1 - code/modules/mob/living/init_signals.dm | 20 +- code/modules/mob/living/living.dm | 178 +++++++++++------- code/modules/mob/living/living_defense.dm | 2 - code/modules/mob/living/living_defines.dm | 12 +- code/modules/mob/living/living_movement.dm | 10 +- code/modules/mob/living/silicon/ai/ai.dm | 15 +- code/modules/mob/living/silicon/pai/death.dm | 1 - code/modules/mob/living/silicon/pai/pai.dm | 7 +- .../mob/living/silicon/pai/pai_shell.dm | 6 +- code/modules/mob/living/silicon/robot/life.dm | 8 - .../modules/mob/living/silicon/robot/robot.dm | 4 +- .../mob/living/silicon/robot/robot_defense.dm | 2 +- code/modules/mob/living/silicon/silicon.dm | 12 ++ .../mob/living/simple_animal/bot/bot.dm | 12 +- .../mob/living/simple_animal/bot/cleanbot.dm | 2 +- .../mob/living/simple_animal/bot/medbot.dm | 9 +- .../mob/living/simple_animal/bot/mulebot.dm | 8 +- .../mob/living/simple_animal/friendly/cat.dm | 32 ++-- .../mob/living/simple_animal/hostile/bear.dm | 2 +- .../living/simple_animal/hostile/hostile.dm | 12 +- .../hostile/megafauna/bubblegum.dm | 7 +- .../mob/living/simple_animal/simple_animal.dm | 36 +--- .../mob/living/simple_animal/slime/life.dm | 22 +-- .../mob/living/simple_animal/slime/slime.dm | 7 +- code/modules/mob/living/status_procs.dm | 153 ++++++++------- code/modules/mob/transform_procs.dm | 6 +- .../suit/n_suit_verbs/ninja_adrenaline.dm | 1 - code/modules/projectiles/projectile.dm | 9 +- code/modules/projectiles/projectile/magic.dm | 3 +- code/modules/reagents/chemistry/holder.dm | 1 - .../chemistry/reagents/alcohol_reagents.dm | 6 +- .../chemistry/reagents/drink_reagents.dm | 24 +-- .../chemistry/reagents/drug_reagents.dm | 60 +++--- .../chemistry/reagents/food_reagents.dm | 4 +- .../chemistry/reagents/medicine_reagents.dm | 40 ++-- .../chemistry/reagents/other_reagents.dm | 8 +- .../reagents/pyrotechnic_reagents.dm | 2 +- .../chemistry/reagents/toxin_reagents.dm | 24 +-- .../reagents/reagent_containers/spray.dm | 2 +- .../ruins/spaceruin_code/hilbertshotel.dm | 2 +- .../spells/spell_types/ethereal_jaunt.dm | 4 +- code/modules/surgery/bodyparts/_bodyparts.dm | 7 +- .../surgery/bodyparts/dismemberment.dm | 4 +- code/modules/tgui/states/not_incapacitated.dm | 8 +- code/modules/vehicles/mecha/_mecha.dm | 7 +- code/modules/vehicles/motorized_wheelchair.dm | 19 +- tgstation.dme | 1 + 139 files changed, 771 insertions(+), 687 deletions(-) create mode 100644 code/__DEFINES/living.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 94fac144c1c..b2feaa27107 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -404,17 +404,17 @@ //ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS! -///from base of mob/living/Stun() (amount, update, ignore) +///from base of mob/living/Stun() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_STUN "living_stun" -///from base of mob/living/Knockdown() (amount, update, ignore) +///from base of mob/living/Knockdown() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_KNOCKDOWN "living_knockdown" -///from base of mob/living/Paralyze() (amount, update, ignore) +///from base of mob/living/Paralyze() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_PARALYZE "living_paralyze" -///from base of mob/living/Immobilize() (amount, update, ignore) +///from base of mob/living/Immobilize() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_IMMOBILIZE "living_immobilize" -///from base of mob/living/Unconscious() (amount, update, ignore) +///from base of mob/living/Unconscious() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_UNCONSCIOUS "living_unconscious" -///from base of mob/living/Sleeping() (amount, update, ignore) +///from base of mob/living/Sleeping() (amount, ignore_canstun) #define COMSIG_LIVING_STATUS_SLEEP "living_sleeping" #define COMPONENT_NO_STUN (1<<0) //For all of them ///from base of /mob/living/can_track(): (mob/user) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index e35a4f75aad..60b0f2ec7ae 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -166,7 +166,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define MOBILITY_PULL (1<<6) #define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_PICKUP | MOBILITY_USE | MOBILITY_UI | MOBILITY_STORAGE | MOBILITY_PULL) -#define MOBILITY_FLAGS_INTERACTION (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_UI | MOBILITY_STORAGE) //alternate appearance flags #define AA_TARGET_SEE_APPEARANCE (1<<0) diff --git a/code/__DEFINES/living.dm b/code/__DEFINES/living.dm new file mode 100644 index 00000000000..1f2316e8e12 --- /dev/null +++ b/code/__DEFINES/living.dm @@ -0,0 +1,3 @@ +// living_flags +/// Simple mob trait, indicating it may follow continuous move actions controlled by code instead of by user input. +#define MOVES_ON_ITS_OWN (1<<0) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index fddd4b1722c..73b158328cf 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -375,3 +375,9 @@ /// Returns whether or not the given mob can succumb #define CAN_SUCCUMB(target) (HAS_TRAIT(target, TRAIT_CRITICAL_CONDITION) && !HAS_TRAIT(target, TRAIT_NODEATH)) + +// Body position defines. +/// Mob is standing up, usually associated with lying_angle value of 0. +#define STANDING_UP 0 +/// Mob is lying down, usually associated with lying_angle values of 90 or 270. +#define LYING_DOWN 1 diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 4e498c20cd5..d0eb6b73555 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -76,9 +76,12 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai */ //mob traits -#define TRAIT_KNOCKEDOUT "knockedout" //Forces the user to stay unconscious. -#define TRAIT_IMMOBILIZED "immobilized" //Prevents voluntary movement. -#define TRAIT_FLOORED "floored" //Prevents standing or staying up on its own. +// Forces the user to stay unconscious. +#define TRAIT_KNOCKEDOUT "knockedout" +// Prevents voluntary movement. +#define TRAIT_IMMOBILIZED "immobilized" +// Prevents voluntary standing or staying up on its own. +#define TRAIT_FLOORED "floored" /// Prevents usage of manipulation appendages (picking, holding or using items, manipulating storage). #define TRAIT_HANDS_BLOCKED "handsblocked" /// Inability to access UI hud elements. Turned into a trait from [MOBILITY_UI] to be able to track sources. @@ -349,3 +352,13 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define HANDCUFFED_TRAIT "handcuffed" /// Trait granted by [/obj/item/warpwhistle] #define WARPWHISTLE_TRAIT "warpwhistle" +/// Trait applied by by [/datum/component/soulstoned] +#define SOULSTONE_TRAIT "soulstone" +/// Trait applied to slimes by low temperature +#define SLIME_COLD "slime-cold" +/// Trait applied to bots by being tipped over +#define BOT_TIPPED_OVER "bot-tipped-over" +/// Trait applied to PAIs by being folded +#define PAI_FOLDED "pai-folded" +/// Trait applied to brain mobs when they lack external aid for locomotion, such as being inside a mech. +#define BRAIN_UNAIDED "brain-unaided" diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 9b3d6c90f33..45c78354a1e 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -322,7 +322,7 @@ GLOBAL_LIST_EMPTY(species_list) ///Timed action involving at least one mob user and a list of targets. -/proc/do_after_mob(mob/user, list/targets, time = 3 SECONDS, uninterruptible = FALSE, progress = TRUE, datum/callback/extra_checks, required_mobility_flags = MOBILITY_STAND) +/proc/do_after_mob(mob/user, list/targets, time = 3 SECONDS, uninterruptible = FALSE, progress = TRUE, datum/callback/extra_checks) if(!user) return FALSE if(!islist(targets)) @@ -350,9 +350,6 @@ GLOBAL_LIST_EMPTY(species_list) var/endtime = world.time + time var/starttime = world.time - var/mob/living/L - if(isliving(user)) - L = user . = TRUE mainloop: while(world.time < endtime) @@ -369,10 +366,6 @@ GLOBAL_LIST_EMPTY(species_list) drifting = FALSE user_loc = user.loc - if(L && !((L.mobility_flags & required_mobility_flags) == required_mobility_flags)) - . = FALSE - break - for(var/atom/target in targets) if((!drifting && user_loc != user.loc) || QDELETED(target) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || (extra_checks && !extra_checks.Invoke())) . = FALSE diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c70a88afdf9..0195d942140 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -697,7 +697,7 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list( /*This can be used to add additional effects on interactions between mobs depending on how the mobs are facing each other, such as adding a crit damage to blows to the back of a guy's head. Given how click code currently works (Nov '13), the initiating mob will be facing the target mob most of the time That said, this proc should not be used if the change facing proc of the click code is overridden at the same time*/ - if(!ismob(target) || !(target.mobility_flags & MOBILITY_STAND)) + if(!isliving(target) || target.body_position == LYING_DOWN) //Make sure we are not doing this for things that can't have a logical direction to the players given that the target would be on their side return FALSE if(initator.dir == target.dir) //mobs are facing the same direction @@ -774,7 +774,7 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list( return FALSE if(isliving(A)) var/mob/living/LA = A - if(!(LA.mobility_flags & MOBILITY_STAND)) + if(LA.body_position == LYING_DOWN) return FALSE var/goal_dir = get_dir(A,B) var/clockwise_A_dir = turn(A.dir, -45) diff --git a/code/_onclick/hud/pai.dm b/code/_onclick/hud/pai.dm index ca4bf1a5bc2..9b23ce8fbd6 100644 --- a/code/_onclick/hud/pai.dm +++ b/code/_onclick/hud/pai.dm @@ -54,7 +54,7 @@ if(!..()) return var/mob/living/silicon/pai/pAI = usr - pAI.lay_down() + pAI.toggle_resting() /obj/screen/pai/light name = "Toggle Integrated Lights" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 59ef4c3ba1f..b595809da55 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -423,7 +423,7 @@ /obj/screen/rest/Click() if(isliving(usr)) var/mob/living/L = usr - L.lay_down() + L.toggle_resting() /obj/screen/rest/update_icon_state() var/mob/living/user = hud?.mymob diff --git a/code/datums/action.dm b/code/datums/action.dm index 57e41babc78..b0545e2e41a 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -101,7 +101,7 @@ return FALSE if((check_flags & AB_CHECK_LYING) && isliving(owner)) var/mob/living/action_user = owner - if(!(action_user.mobility_flags & MOBILITY_STAND)) + if(action_user.body_position == LYING_DOWN) return FALSE if((check_flags & AB_CHECK_CONSCIOUS) && owner.stat != CONSCIOUS) return FALSE diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm index d6ae576e181..0b9dd89cae1 100644 --- a/code/datums/brain_damage/mild.dm +++ b/code/datums/brain_damage/mild.dm @@ -134,7 +134,7 @@ var/fall_chance = 1 if(owner.m_intent == MOVE_INTENT_RUN) fall_chance += 2 - if(prob(fall_chance) && (owner.mobility_flags & MOBILITY_STAND)) + if(prob(fall_chance) && owner.body_position == STANDING_UP) to_chat(owner, "Your leg gives out!") owner.Paralyze(35) diff --git a/code/datums/components/bloodysoles.dm b/code/datums/components/bloodysoles.dm index c3627cc80dc..227e41e50f7 100644 --- a/code/datums/components/bloodysoles.dm +++ b/code/datums/components/bloodysoles.dm @@ -127,7 +127,7 @@ return if(QDELETED(wielder) || is_obscured()) return - if(!(wielder.mobility_flags & MOBILITY_STAND) || !wielder.has_gravity(wielder.loc)) + if(wielder.body_position == LYING_DOWN || !wielder.has_gravity(wielder.loc)) return var/half_our_blood = bloody_shoes[last_blood_state] / 2 diff --git a/code/datums/components/caltrop.dm b/code/datums/components/caltrop.dm index dd3f6c547a7..b6275ac7393 100644 --- a/code/datums/components/caltrop.dm +++ b/code/datums/components/caltrop.dm @@ -33,7 +33,7 @@ return //gravity checking only our parent would prevent us from triggering they're using magboots / other gravity assisting items that would cause them to still touch us. if(H.buckled) //if they're buckled to something, that something should be checked instead. return - if(!(H.mobility_flags & MOBILITY_STAND)) //if were not standing we cant step on the caltrop + if(H.body_position == LYING_DOWN) //if were not standing we cant step on the caltrop return var/picked_def_zone = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) diff --git a/code/datums/components/embedded.dm b/code/datums/components/embedded.dm index bba33c6a9f2..a1aade5615e 100644 --- a/code/datums/components/embedded.dm +++ b/code/datums/components/embedded.dm @@ -136,7 +136,7 @@ if(pain_stam_pct && HAS_TRAIT_FROM(victim, TRAIT_INCAPACITATED, STAMINA)) //if it's a less-lethal embed, give them a break if they're already stamcritted pain_chance_current *= 0.2 damage *= 0.5 - else if(victim.mobility_flags & ~MOBILITY_STAND) + else if(victim.body_position == LYING_DOWN) pain_chance_current *= 0.2 if(harmful && prob(pain_chance_current)) @@ -144,7 +144,7 @@ to_chat(victim, "[weapon] embedded in your [limb.name] hurts!") var/fall_chance_current = DT_PROB_RATE(fall_chance / 100, delta_time) * 100 - if(victim.mobility_flags & ~MOBILITY_STAND) + if(victim.body_position == LYING_DOWN) fall_chance_current *= 0.2 if(prob(fall_chance_current)) @@ -161,7 +161,7 @@ var/mob/living/carbon/victim = parent var/chance = jostle_chance - if(victim.m_intent == MOVE_INTENT_WALK || !(victim.mobility_flags & MOBILITY_STAND)) + if(victim.m_intent == MOVE_INTENT_WALK || victim.body_position == LYING_DOWN) chance *= 0.5 if(harmful && prob(chance)) diff --git a/code/datums/components/footstep.dm b/code/datums/components/footstep.dm index 78c798ef20b..830364f6af9 100644 --- a/code/datums/components/footstep.dm +++ b/code/datums/components/footstep.dm @@ -42,9 +42,12 @@ return var/mob/living/LM = parent - if(!T.footstep || LM.buckled || !((LM.mobility_flags & (MOBILITY_STAND | MOBILITY_MOVE)) == (MOBILITY_STAND | MOBILITY_MOVE)) || LM.throwing || LM.movement_type & (VENTCRAWLING | FLYING)) - if (!(LM.mobility_flags & MOBILITY_STAND) && !LM.buckled && !(!T.footstep || LM.movement_type & (VENTCRAWLING | FLYING))) //play crawling sound if we're lying - playsound(T, 'sound/effects/footstep/crawl1.ogg', 15 * volume) + + if(!T.footstep || LM.buckled || LM.throwing || LM.movement_type & (VENTCRAWLING | FLYING) || HAS_TRAIT(LM, TRAIT_IMMOBILIZED)) + return + + if(LM.body_position == LYING_DOWN) //play crawling sound if we're lying + playsound(T, 'sound/effects/footstep/crawl1.ogg', 15 * volume) return if(iscarbon(LM)) diff --git a/code/datums/components/omen.dm b/code/datums/components/omen.dm index d065530f679..779f45b8c93 100644 --- a/code/datums/components/omen.dm +++ b/code/datums/components/omen.dm @@ -65,7 +65,7 @@ if(istype(turf_content, /obj/machinery/door/airlock)) to_chat(living_guy, "A malevolent force launches your body to the floor...") var/obj/machinery/door/airlock/darth_airlock = turf_content - living_guy.apply_status_effect(STATUS_EFFECT_PARALYZED, 10, TRUE) + living_guy.apply_status_effect(STATUS_EFFECT_PARALYZED, 10) darth_airlock.close(force_crush = TRUE) if(!permanent) qdel(src) diff --git a/code/datums/components/slippery.dm b/code/datums/components/slippery.dm index 4e026547d05..5f9aa29d083 100644 --- a/code/datums/components/slippery.dm +++ b/code/datums/components/slippery.dm @@ -25,16 +25,17 @@ /datum/component/slippery/proc/Slip_on_wearer(datum/source, atom/movable/AM, mob/living/crossed) SIGNAL_HANDLER - if(!(crossed.mobility_flags & MOBILITY_STAND) && !crossed.buckle_lying) + if(crossed.body_position == LYING_DOWN && !crossed.buckled) Slip(source, AM) + /datum/component/slippery/clowning //used for making the clown PDA only slip if the clown is wearing his shoes and the elusive banana-skin belt + /datum/component/slippery/clowning/Slip_on_wearer(datum/source, atom/movable/AM, mob/living/crossed) var/obj/item/I = crossed.get_item_by_slot(ITEM_SLOT_FEET) - if(!(crossed.mobility_flags & MOBILITY_STAND) && !crossed.buckle_lying) + if(crossed.body_position == LYING_DOWN && !crossed.buckled) if(istype(I, /obj/item/clothing/shoes/clown_shoes)) Slip(source, AM) else to_chat(crossed,"[parent] failed to slip anyone. Perhaps I shouldn't have abandoned my legacy...") - diff --git a/code/datums/components/soulstoned.dm b/code/datums/components/soulstoned.dm index 15d512cb094..584f76cbc25 100644 --- a/code/datums/components/soulstoned.dm +++ b/code/datums/components/soulstoned.dm @@ -12,7 +12,8 @@ S.forceMove(container) S.status_flags |= GODMODE - S.mobility_flags = NONE + ADD_TRAIT(S, TRAIT_IMMOBILIZED, SOULSTONE_TRAIT) + ADD_TRAIT(S, TRAIT_HANDS_BLOCKED, SOULSTONE_TRAIT) S.health = S.maxHealth S.bruteloss = 0 @@ -28,6 +29,5 @@ /datum/component/soulstoned/UnregisterFromParent() var/mob/living/simple_animal/S = parent S.status_flags &= ~GODMODE - S.mobility_flags = MOBILITY_FLAGS_DEFAULT - - + REMOVE_TRAIT(S, TRAIT_IMMOBILIZED, SOULSTONE_TRAIT) + REMOVE_TRAIT(S, TRAIT_HANDS_BLOCKED, SOULSTONE_TRAIT) diff --git a/code/datums/components/surgery_initiator.dm b/code/datums/components/surgery_initiator.dm index 77decef154a..e7c07bae450 100644 --- a/code/datums/components/surgery_initiator.dm +++ b/code/datums/components/surgery_initiator.dm @@ -69,7 +69,7 @@ continue else if(carbontarget && surgeryloop_two.requires_bodypart) //mob with no limb in surgery zone when we need a limb continue - if(surgeryloop_two.lying_required && (livingtarget.mobility_flags & MOBILITY_STAND)) + if(surgeryloop_two.lying_required && livingtarget.body_position != LYING_DOWN) continue if(!surgeryloop_two.can_start(user, livingtarget)) continue @@ -100,7 +100,7 @@ return else if(carbontarget && surgeryinstance_notonmob.requires_bodypart) return - if(surgeryinstance_notonmob.lying_required && (livingtarget.mobility_flags & MOBILITY_STAND)) + if(surgeryinstance_notonmob.lying_required && livingtarget.body_position != LYING_DOWN) return if(!surgeryinstance_notonmob.can_start(user, livingtarget)) return diff --git a/code/datums/components/tackle.dm b/code/datums/components/tackle.dm index 5f2acde6955..f42502d1dec 100644 --- a/code/datums/components/tackle.dm +++ b/code/datums/components/tackle.dm @@ -85,7 +85,7 @@ to_chat(user, "You need free use of your hands to tackle!") return - if(!(user.mobility_flags & MOBILITY_STAND)) + if(user.body_position == LYING_DOWN) to_chat(user, "You must be standing to tackle!") return @@ -116,7 +116,7 @@ if(get_dist(user, A) < min_distance) A = get_ranged_target_turf(user, get_dir(user, A), min_distance) //TODO: this only works in cardinals/diagonals, make it work with in-betweens too! - user.Knockdown(base_knockdown, TRUE, TRUE) + user.Knockdown(base_knockdown, ignore_canstun = TRUE) user.adjustStaminaLoss(stamina_cost) user.throw_at(A, range, speed, user, FALSE) addtimer(CALLBACK(src, .proc/resetTackle), base_knockdown, TIMER_STOPPABLE) diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 24328abdcf1..2fa5016f9d7 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -279,17 +279,18 @@ active_coma = TRUE addtimer(CALLBACK(src, .proc/coma, M), 60) + /datum/symptom/heal/coma/proc/coma(mob/living/M) M.fakedeath("regenerative_coma", !deathgasp) - M.update_mobility() addtimer(CALLBACK(src, .proc/uncoma, M), 300) + /datum/symptom/heal/coma/proc/uncoma(mob/living/M) if(QDELETED(M) || !active_coma) return active_coma = FALSE M.cure_fakedeath("regenerative_coma") - 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/diseases/cold.dm b/code/datums/diseases/cold.dm index aa2c9a50734..628ceeeb32f 100644 --- a/code/datums/diseases/cold.dm +++ b/code/datums/diseases/cold.dm @@ -17,7 +17,7 @@ switch(stage) if(2) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(40)) //changed FROM prob(10) until sleeping is fixed + if(affected_mob.body_position == LYING_DOWN && prob(40)) //changed FROM prob(10) until sleeping is fixed to_chat(affected_mob, "You feel better.") cure() return FALSE @@ -34,7 +34,7 @@ if(prob(1)) to_chat(affected_mob, "Mucous runs down the back of your throat.") if(3) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(25)) //changed FROM prob(5) until sleeping is fixed + if(affected_mob.body_position == LYING_DOWN && prob(25)) //changed FROM prob(5) until sleeping is fixed to_chat(affected_mob, "You feel better.") cure() return FALSE diff --git a/code/datums/diseases/flu.dm b/code/datums/diseases/flu.dm index 26972299dc9..c9a84c0f7dc 100644 --- a/code/datums/diseases/flu.dm +++ b/code/datums/diseases/flu.dm @@ -19,7 +19,7 @@ switch(stage) if(2) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(20)) + if(affected_mob.body_position == LYING_DOWN && prob(20)) to_chat(affected_mob, "You feel better.") stage-- return @@ -37,7 +37,7 @@ affected_mob.adjustToxLoss(1, FALSE) if(3) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(15)) + if(affected_mob.body_position == LYING_DOWN && prob(15)) to_chat(affected_mob, "You feel better.") stage-- return diff --git a/code/datums/diseases/retrovirus.dm b/code/datums/diseases/retrovirus.dm index 05e26a14863..c0a4aeb7b2c 100644 --- a/code/datums/diseases/retrovirus.dm +++ b/code/datums/diseases/retrovirus.dm @@ -34,7 +34,7 @@ switch(stage) if(1) if(restcure) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(30)) + if(affected_mob.body_position == LYING_DOWN && prob(30)) to_chat(affected_mob, "You feel better.") cure() return FALSE @@ -46,7 +46,7 @@ to_chat(affected_mob, "You feel angry.") if(2) if(restcure) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(20)) + if(affected_mob.body_position == LYING_DOWN && prob(20)) to_chat(affected_mob, "You feel better.") cure() return FALSE @@ -61,7 +61,7 @@ to_chat(affected_mob, "Your stomach churns.") if(3) if(restcure) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(20)) + if(affected_mob.body_position == LYING_DOWN && prob(20)) to_chat(affected_mob, "You feel better.") cure() return FALSE @@ -76,7 +76,7 @@ if(4) if(restcure) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(5)) + if(affected_mob.body_position == LYING_DOWN && prob(5)) to_chat(affected_mob, "You feel better.") cure() return FALSE diff --git a/code/datums/elements/cleaning.dm b/code/datums/elements/cleaning.dm index acf3749b437..6845e9e1dec 100644 --- a/code/datums/elements/cleaning.dm +++ b/code/datums/elements/cleaning.dm @@ -26,7 +26,7 @@ // Clean humans that are lying down else if(ishuman(A)) var/mob/living/carbon/human/cleaned_human = A - if(!(cleaned_human.mobility_flags & MOBILITY_STAND)) + if(cleaned_human.body_position == LYING_DOWN) cleaned_human.wash(CLEAN_SCRUB) cleaned_human.regenerate_icons() to_chat(cleaned_human, "[AM] cleans your face!") diff --git a/code/datums/elements/squish.dm b/code/datums/elements/squish.dm index ee2c38f3315..af85294aa3f 100644 --- a/code/datums/elements/squish.dm +++ b/code/datums/elements/squish.dm @@ -17,7 +17,7 @@ return ELEMENT_INCOMPATIBLE var/mob/living/carbon/C = target - var/was_lying = !(C.mobility_flags & MOBILITY_STAND) + var/was_lying = C.body_position == LYING_DOWN addtimer(CALLBACK(src, .proc/Detach, C, was_lying, reverse), duration) if(reverse) @@ -28,7 +28,7 @@ /datum/element/squish/Detach(mob/living/carbon/C, was_lying, reverse) . = ..() if(istype(C)) - var/is_lying = !(C.mobility_flags & MOBILITY_STAND) + var/is_lying = C.body_position == LYING_DOWN if(reverse) is_lying = !is_lying diff --git a/code/datums/elements/waddling.dm b/code/datums/elements/waddling.dm index dcdbdb258dc..04a44d85f26 100644 --- a/code/datums/elements/waddling.dm +++ b/code/datums/elements/waddling.dm @@ -13,13 +13,15 @@ . = ..() UnregisterSignal(source, COMSIG_MOVABLE_MOVED) + /datum/element/waddling/proc/LivingWaddle(mob/living/target) SIGNAL_HANDLER - if(target.incapacitated() || !(target.mobility_flags & MOBILITY_STAND)) + if(target.incapacitated() || target.body_position == LYING_DOWN) return Waddle(target) + /datum/element/waddling/proc/Waddle(atom/movable/target) SIGNAL_HANDLER diff --git a/code/datums/keybinding/living.dm b/code/datums/keybinding/living.dm index 801326f36e7..38e324e9769 100644 --- a/code/datums/keybinding/living.dm +++ b/code/datums/keybinding/living.dm @@ -72,5 +72,5 @@ if(.) return var/mob/living/living_mob = user.mob - living_mob.lay_down() + living_mob.toggle_resting() return TRUE diff --git a/code/datums/martial/cqc.dm b/code/datums/martial/cqc.dm index 8bfc6465096..1ecdbde0fcf 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -44,7 +44,7 @@ /datum/martial_art/cqc/proc/Slam(mob/living/carbon/human/A, mob/living/carbon/human/D) if(!can_use(A)) return FALSE - if(D.mobility_flags & MOBILITY_STAND) + if(D.body_position == STANDING_UP) D.visible_message("[A] slams [D] into the ground!", \ "You're slammed into the ground by [A]!", "You hear a sickening sound of flesh hitting flesh!", null, A) to_chat(A, "You slam [D] into the ground!") @@ -147,7 +147,7 @@ A.do_attack_animation(D) var/picked_hit_type = pick("CQC", "Big Boss") var/bonus_damage = 13 - if(!(D.mobility_flags & MOBILITY_STAND)) + if(D.body_position == LYING_DOWN) bonus_damage += 5 picked_hit_type = "stomp" D.apply_damage(bonus_damage, BRUTE) diff --git a/code/datums/martial/krav_maga.dm b/code/datums/martial/krav_maga.dm index 7406723cb93..722fa0a8203 100644 --- a/code/datums/martial/krav_maga.dm +++ b/code/datums/martial/krav_maga.dm @@ -136,7 +136,7 @@ var/armor_block = D.run_armor_check(affecting, MELEE) var/picked_hit_type = pick("punch", "kick") var/bonus_damage = 0 - if(!(D.mobility_flags & MOBILITY_STAND)) + if(D.body_position == LYING_DOWN) bonus_damage += 5 picked_hit_type = "stomp" D.apply_damage(rand(5,10) + bonus_damage, A.dna.species.attack_type, affecting, armor_block) @@ -157,7 +157,7 @@ return TRUE var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected)) var/armor_block = D.run_armor_check(affecting, MELEE) - if((D.mobility_flags & MOBILITY_STAND)) + if(D.body_position == STANDING_UP) D.visible_message("[A] reprimands [D]!", \ "You're slapped by [A]!", "You hear a sickening sound of flesh hitting flesh!", COMBAT_MESSAGE_RANGE, A) to_chat(A, "You jab [D]!") @@ -165,7 +165,7 @@ playsound(D, 'sound/effects/hit_punch.ogg', 50, TRUE, -1) D.apply_damage(rand(5,10), STAMINA, affecting, armor_block) log_combat(A, D, "punched nonlethally") - if(!(D.mobility_flags & MOBILITY_STAND)) + if(D.body_position == LYING_DOWN) D.visible_message("[A] reprimands [D]!", \ "You're manhandled by [A]!", "You hear a sickening sound of flesh hitting flesh!", COMBAT_MESSAGE_RANGE, A) to_chat(A, "You stomp [D]!") diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index 52fd050d515..22d446ea53e 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -53,7 +53,7 @@ /datum/martial_art/the_sleeping_carp/proc/dropKick(mob/living/carbon/human/A, mob/living/carbon/human/D) A.do_attack_animation(D, ATTACK_EFFECT_KICK) playsound(get_turf(A), 'sound/effects/hit_kick.ogg', 50, TRUE, -1) - if((D.mobility_flags & MOBILITY_STAND)) + if(D.body_position == STANDING_UP) D.apply_damage(10, A.dna.species.attack_type, BODY_ZONE_HEAD, wound_bonus = CANT_WOUND) D.apply_damage(40, STAMINA, BODY_ZONE_HEAD) D.Knockdown(40) diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index 8d1a4402bc6..8bcb68f3311 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -410,7 +410,7 @@ if(prob(99.5)) //The brawl mutation return - if(owner.buckled || !(owner.mobility_flags & MOBILITY_STAND) || !((owner.mobility_flags & (MOBILITY_STAND | MOBILITY_MOVE)) == (MOBILITY_STAND | MOBILITY_MOVE)) || owner.throwing || owner.movement_type & (VENTCRAWLING | FLYING | FLOATING)) + if(owner.buckled || owner.body_position == LYING_DOWN || HAS_TRAIT(owner, TRAIT_IMMOBILIZED) || owner.throwing || owner.movement_type & (VENTCRAWLING | FLYING | FLOATING)) return //remove the 'edge' cases to_chat(owner, "You trip over your own feet.") owner.Knockdown(30) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 0fe0f081657..434b63106cd 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -60,10 +60,11 @@ to_chat(owner, "Death is not your end! The Wish Granter's energy suffuses you, and you begin to rise...") return ..() + /datum/status_effect/wish_granters_gift/on_remove() owner.revive(full_heal = TRUE, admin_revive = TRUE) owner.visible_message("[owner] appears to wake from the dead, having healed all wounds!", "You have regenerated.") - owner.update_mobility() + /obj/screen/alert/status_effect/wish_granters_gift name = "Wish Granter's Immortality" diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index f57925ba461..249a9c710d9 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -8,18 +8,15 @@ alert_type = null var/needs_update_stat = FALSE -/datum/status_effect/incapacitating/on_creation(mob/living/new_owner, set_duration, updating_canmove) +/datum/status_effect/incapacitating/on_creation(mob/living/new_owner, set_duration) if(isnum(set_duration)) duration = set_duration . = ..() - if(.) - if(updating_canmove) - owner.update_mobility() - if(needs_update_stat || issilicon(owner)) - owner.update_stat() + if(. && (needs_update_stat || issilicon(owner))) + owner.update_stat() + /datum/status_effect/incapacitating/on_remove() - owner.update_mobility() if(needs_update_stat || issilicon(owner)) //silicons need stat updates in addition to normal canmove updates owner.update_stat() return ..() @@ -124,7 +121,7 @@ var/mob/living/carbon/carbon_owner var/mob/living/carbon/human/human_owner -/datum/status_effect/incapacitating/sleeping/on_creation(mob/living/new_owner, updating_canmove) +/datum/status_effect/incapacitating/sleeping/on_creation(mob/living/new_owner) . = ..() if(.) if(iscarbon(owner)) //to avoid repeated istypes @@ -215,7 +212,7 @@ if(owner.stat == DEAD) last_dead_time = world.time -/datum/status_effect/grouped/stasis/on_creation(mob/living/new_owner, set_duration, updating_canmove) +/datum/status_effect/grouped/stasis/on_creation(mob/living/new_owner, set_duration) . = ..() if(.) update_time_of_death() @@ -231,7 +228,6 @@ return ADD_TRAIT(owner, TRAIT_IMMOBILIZED, TRAIT_STATUS_EFFECT(id)) ADD_TRAIT(owner, TRAIT_HANDS_BLOCKED, TRAIT_STATUS_EFFECT(id)) - owner.update_mobility() /datum/status_effect/grouped/stasis/tick() update_time_of_death() @@ -239,7 +235,6 @@ /datum/status_effect/grouped/stasis/on_remove() REMOVE_TRAIT(owner, TRAIT_IMMOBILIZED, TRAIT_STATUS_EFFECT(id)) REMOVE_TRAIT(owner, TRAIT_HANDS_BLOCKED, TRAIT_STATUS_EFFECT(id)) - owner.update_mobility() update_time_of_death() return ..() @@ -656,7 +651,7 @@ /datum/status_effect/trance/tick() if(stun) - owner.Stun(60, TRUE, TRUE) + owner.Stun(60, TRUE) owner.dizziness = 20 /datum/status_effect/trance/on_apply() @@ -780,7 +775,7 @@ alert_type = /obj/screen/alert/status_effect/dna_melt var/kill_either_way = FALSE //no amount of removing mutations is gonna save you now -/datum/status_effect/dna_melt/on_creation(mob/living/new_owner, set_duration, updating_canmove) +/datum/status_effect/dna_melt/on_creation(mob/living/new_owner, set_duration) . = ..() to_chat(new_owner, "My body can't handle the mutations! I need to get my mutations removed fast!") @@ -804,7 +799,7 @@ alert_type = /obj/screen/alert/status_effect/go_away var/direction -/datum/status_effect/go_away/on_creation(mob/living/new_owner, set_duration, updating_canmove) +/datum/status_effect/go_away/on_creation(mob/living/new_owner, set_duration) . = ..() direction = pick(NORTH, SOUTH, EAST, WEST) new_owner.setDir(direction) diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index e4094529d31..8519fc99a03 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -21,10 +21,9 @@ to_chat(owner, "You become frozen in a cube!") cube = icon('icons/effects/freeze.dmi', "ice_cube") owner.add_overlay(cube) - owner.update_mobility() + /datum/status_effect/freon/tick() - owner.update_mobility() if(can_melt && owner.bodytemperature >= owner.get_body_temp_normal()) qdel(src) @@ -36,14 +35,13 @@ if(!QDELETED(src)) to_chat(owner, "You break out of the ice cube!") owner.remove_status_effect(/datum/status_effect/freon) - 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_mobility() UnregisterSignal(owner, COMSIG_LIVING_RESIST) REMOVE_TRAIT(owner, TRAIT_IMMOBILIZED, TRAIT_STATUS_EFFECT(id)) return ..() diff --git a/code/datums/status_effects/wound_effects.dm b/code/datums/status_effects/wound_effects.dm index 51db0a3038b..1d9892764f1 100644 --- a/code/datums/status_effects/wound_effects.dm +++ b/code/datums/status_effects/wound_effects.dm @@ -55,7 +55,7 @@ /datum/status_effect/limp/proc/check_step(mob/whocares, OldLoc, Dir, forced) SIGNAL_HANDLER - if(!owner.client || !(owner.mobility_flags & MOBILITY_STAND) || !owner.has_gravity() || (owner.movement_type & FLYING) || forced) + if(!owner.client || owner.body_position == LYING_DOWN || !owner.has_gravity() || (owner.movement_type & FLYING) || forced) return var/determined_mod = 1 if(owner.has_status_effect(STATUS_EFFECT_DETERMINED)) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index f09166b4172..5dda5fe4ed4 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -243,12 +243,8 @@ /atom/movable/proc/stop_pulling() if(pulling) pulling.set_pulledby(null) - var/mob/living/ex_pulled = pulling setGrabState(GRAB_PASSIVE) pulling = null - if(isliving(ex_pulled)) - var/mob/living/L = ex_pulled - L.update_mobility()// mob gets up if it was lyng down in a chokehold ///Reports the event of the change in value of the pulledby variable. diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 67d5bb67284..459737fd1cc 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -92,15 +92,14 @@ if(is_operational && occupant) open_machine() + /obj/machinery/sleeper/MouseDrop_T(mob/target, mob/user) - if(user.stat || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) + if(HAS_TRAIT(user, TRAIT_UI_BLOCKED) || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) return - if(isliving(user)) - var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) - return + close_machine(target) + /obj/machinery/sleeper/screwdriver_act(mob/living/user, obj/item/I) . = TRUE if(..()) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index b2a419a8505..197ee705acc 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -254,9 +254,6 @@ Class Procs: continue movable_atom.forceMove(this_turf) - if(isliving(movable_atom)) - var/mob/living/living_mob = movable_atom - living_mob.update_mobility() if(occupant == movable_atom) occupant = null diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index be0b11d260d..69aff36992f 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -22,6 +22,9 @@ anchored = FALSE var/list/spotlights = list() var/list/sparkles = list() + /// Precentage change per process of the mob dancing. + var/dance_chance = 20 + /obj/machinery/jukebox/disco/indestructible name = "radiant dance machine mark V" @@ -315,31 +318,40 @@ #undef DISCO_INFENO_RANGE -/obj/machinery/jukebox/disco/proc/dance(mob/living/M) //Show your moves - set waitfor = FALSE - switch(rand(0,9)) - if(0 to 1) - dance2(M) - if(2 to 3) - dance3(M) - if(4 to 6) - dance4(M) - if(7 to 9) - dance5(M) -/obj/machinery/jukebox/disco/proc/dance2(mob/living/M) - for(var/i in 0 to 9) - dance_rotate(M, CALLBACK(M, /mob.proc/dance_flip)) - sleep(20) +/obj/machinery/jukebox/disco/proc/dance(mob/living/dancer) //Show your moves + set waitfor = FALSE + switch(rand(0, 9)) + if(0 to 1) + dance2(dancer) + if(2 to 3) + dance3(dancer) + if(4 to 6) + dance4(dancer) + if(7 to 9) + dance5(dancer) + + +/obj/machinery/jukebox/disco/proc/dance2(mob/living/dancer) + set waitfor = FALSE + for(var/i in 1 to 10) + if(QDELETED(dancer)) + return + if(!active) + break + dancer.emote("flip") + sleep(2 SECONDS) + /mob/proc/dance_flip() - if(dir == WEST) - emote("flip") + emote("flip") + /obj/machinery/jukebox/disco/proc/dance3(mob/living/M) + set waitfor = FALSE var/matrix/initial_matrix = matrix(M.transform) for (var/i in 1 to 75) - if (!M) + if(QDELETED(M)) return switch(i) if (1 to 15) @@ -383,24 +395,28 @@ sleep(1) M.lying_fix() -/obj/machinery/jukebox/disco/proc/dance4(mob/living/M) - var/speed = rand(1,3) - set waitfor = 0 - var/time = 30 - while(time) - sleep(speed) - for(var/i in 1 to speed) - M.setDir(pick(GLOB.cardinals)) - for(var/mob/living/carbon/NS in rangers) - NS.set_resting(!NS.resting, TRUE) - time-- + +/obj/machinery/jukebox/disco/proc/dance4(mob/living/dancer) + set waitfor = FALSE + for(var/i in 1 to 29) + if(QDELETED(dancer)) + return + if(!active) + break + sleep(rand(1, 3)) + dancer.setDir(pick(GLOB.cardinals)) + dancer.set_resting(FALSE, TRUE, TRUE) // Last pass gets us up. + /obj/machinery/jukebox/disco/proc/dance5(mob/living/M) + set waitfor = FALSE animate(M, transform = matrix(180, MATRIX_ROTATE), time = 1, loop = 0) var/matrix/initial_matrix = matrix(M.transform) for (var/i in 1 to 60) - if (!M) + if(QDELETED(M)) return + if(!active) + break if (i<31) initial_matrix = matrix(M.transform) initial_matrix.Translate(0,1) @@ -473,6 +489,10 @@ /obj/machinery/jukebox/disco/process() . = ..() if(active) - for(var/mob/living/M in rangers) - if(prob(5+(allowed(M)*4)) && (M.mobility_flags & MOBILITY_MOVE)) - dance(M) + for(var/mob/living/dancer in rangers) + if(QDELETED(dancer)) + rangers -= dancer + continue + if(!prob(dance_chance) || HAS_TRAIT(dancer, TRAIT_IMMOBILIZED)) + continue + dance(dancer) diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 242c96ce354..d710851ec5e 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -140,8 +140,7 @@ toggle_open(user) /obj/machinery/dna_scannernew/MouseDrop_T(mob/target, mob/user) - var/mob/living/L = user - if(user.stat || (isliving(user) && (!(L.mobility_flags & MOBILITY_STAND) || !(L.mobility_flags & MOBILITY_UI))) || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) + if(user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_UI_BLOCKED) || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) return close_machine(target) diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 130f2408a83..7cf233e950b 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -195,12 +195,9 @@ message_cooldown = world.time + 50 to_chat(user, "[src]'s door won't budge!") -/obj/machinery/hypnochair/MouseDrop_T(mob/target, mob/user) - if(user.stat || !Adjacent(user) || !user.Adjacent(target) || !isliving(target) || !user.IsAdvancedToolUser()) - return - if(isliving(user)) - var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) - return - close_machine(target) +/obj/machinery/hypnochair/MouseDrop_T(mob/target, mob/user) + if(HAS_TRAIT(user, TRAIT_UI_BLOCKED) || !Adjacent(user) || !user.Adjacent(target) || !isliving(target) || !user.IsAdvancedToolUser()) + return + + close_machine(target) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index b46bedb071d..6f1d744a091 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -310,7 +310,7 @@ return if(isliving(user)) var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) + if(L.body_position == LYING_DOWN) return var/mob/living/target = A if(!state_open) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 5cb65ab29a5..0d306693df8 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -49,10 +49,11 @@ // Only humans can enter from the west side, while lying down. var/move_dir = get_dir(loc, AM.loc) var/mob/living/carbon/human/H = AM - if((transform_standing || !(H.mobility_flags & MOBILITY_STAND)) && move_dir == EAST)// || move_dir == WEST) + if((transform_standing || H.body_position == LYING_DOWN) && move_dir == EAST)// || move_dir == WEST) AM.forceMove(drop_location()) do_transform(AM) + /obj/machinery/transformer/CanAllowThrough(atom/movable/mover, turf/target) . = ..() // Allows items to go through, diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index bb3db37c6e1..e765a4f8c38 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -93,7 +93,6 @@ M.set_buckled(src) M.setDir(dir) buckled_mobs |= M - M.update_mobility() M.throw_alert("buckled", /obj/screen/alert/restrained/buckled) M.set_glide_size(glide_size) post_buckle_mob(M) @@ -108,18 +107,24 @@ M.adjust_fire_stacks(1) M.IgniteMob() -/atom/movable/proc/unbuckle_mob(mob/living/buckled_mob, force=FALSE) - if(istype(buckled_mob) && buckled_mob.buckled == src && (buckled_mob.can_unbuckle() || force)) - . = buckled_mob - buckled_mob.set_buckled(null) - buckled_mob.set_anchored(initial(buckled_mob.anchored)) - buckled_mob.update_mobility() - buckled_mob.clear_alert("buckled") - buckled_mob.set_glide_size(DELAY_TO_GLIDE_SIZE(buckled_mob.total_multiplicative_slowdown())) - buckled_mobs -= buckled_mob - SEND_SIGNAL(src, COMSIG_MOVABLE_UNBUCKLE, buckled_mob, force) - post_unbuckle_mob(.) +/atom/movable/proc/unbuckle_mob(mob/living/buckled_mob, force = FALSE) + if(!isliving(buckled_mob)) + CRASH("Non-living [buckled_mob] thing called unbuckle_mob() for source.") + if(buckled_mob.buckled != src) + CRASH("[buckled_mob] called unbuckle_mob() for source while having buckled as [buckled_mob.buckled].") + if(!force && !buckled_mob.can_unbuckle()) + return + . = buckled_mob + buckled_mob.set_buckled(null) + buckled_mob.set_anchored(initial(buckled_mob.anchored)) + buckled_mob.clear_alert("buckled") + buckled_mob.set_glide_size(DELAY_TO_GLIDE_SIZE(buckled_mob.total_multiplicative_slowdown())) + buckled_mobs -= buckled_mob + SEND_SIGNAL(src, COMSIG_MOVABLE_UNBUCKLE, buckled_mob, force) + + post_unbuckle_mob(.) + /atom/movable/proc/unbuckle_all_mobs(force=FALSE) if(!has_buckled_mobs()) diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index be6e574d656..322b13285fe 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -61,10 +61,8 @@ if(AM in T.affecting) return - if(isliving(AM)) - var/mob/living/M = AM - if(immobilize) - M.mobility_flags &= ~MOBILITY_MOVE + if(immobilize) + ADD_TRAIT(AM, TRAIT_IMMOBILIZED, src) affecting.Add(AM) while(AM && !stopthrow) @@ -98,11 +96,8 @@ affecting.Remove(AM) - if(isliving(AM)) - var/mob/living/M = AM - if(immobilize) - M.mobility_flags |= MOBILITY_MOVE - M.update_mobility() + REMOVE_TRAIT(AM, TRAIT_IMMOBILIZED, src) + /* Stops things thrown by a thrower, doesn't do anything */ diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index 3bcdb4442de..fc58d986335 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -111,7 +111,7 @@ if(field == F) var/turf/currentpos = get_turf(src) var/mob/living/user = loc - if((currentpos == startpos) && (field in view(CHRONO_BEAM_RANGE, currentpos)) && (user.mobility_flags & MOBILITY_STAND) && (user.stat == CONSCIOUS)) + if(currentpos == startpos && isliving(user) && user.body_position == STANDING_UP && !HAS_TRAIT(user, TRAIT_INCAPACITATED) && (field in view(CHRONO_BEAM_RANGE, currentpos))) return TRUE field_disconnect(F) return FALSE diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 57bb55e13c6..1962e10690b 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -996,7 +996,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(prob(5))//small chance for the vape to break and deal damage if it's emagged playsound(get_turf(src), 'sound/effects/pop_expl.ogg', 50, FALSE) M.apply_damage(20, BURN, BODY_ZONE_HEAD) - M.Paralyze(300, 1, 0) + M.Paralyze(300) var/datum/effect_system/spark_spread/sp = new /datum/effect_system/spark_spread sp.set_up(5, 1, src) sp.start() diff --git a/code/game/objects/items/devices/camera_bug.dm b/code/game/objects/items/devices/camera_bug.dm index 49d1e5fc838..b6d152d7983 100644 --- a/code/game/objects/items/devices/camera_bug.dm +++ b/code/game/objects/items/devices/camera_bug.dm @@ -180,7 +180,7 @@ else names[M.name] = 1 dat += "[M.name]" - if(!(M.mobility_flags & MOBILITY_STAND)) + if(M.body_position == LYING_DOWN) if(M.buckled) dat += " (Sitting)" else diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index 44cb3c09154..736b766c9a6 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -137,7 +137,7 @@ for(var/mob/living/carbon/human/H in view(1,targloc)) if(!isfelinid(H) || H.incapacitated() || H.is_blind()) continue - if(user.mobility_flags & MOBILITY_STAND) + if(user.body_position == STANDING_UP) H.setDir(get_dir(H,targloc)) // kitty always looks at the light if(prob(effectchance * diode.rating)) H.visible_message("[H] makes a grab for the light!","LIGHT!") @@ -151,9 +151,11 @@ //cats! for(var/mob/living/simple_animal/pet/cat/C in view(1,targloc)) if(prob(effectchance * diode.rating)) + if(C.resting) + C.set_resting(FALSE, instant = TRUE) C.visible_message("[C] pounces on the light!","LIGHT!") C.Move(targloc) - C.set_resting(TRUE, FALSE) + C.Immobilize(1 SECONDS) else C.visible_message("[C] looks uninterested in your games.","You spot [user] shining [src] at you. How insulting!") diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index 2ae89187c5e..4e39932b2cf 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -268,7 +268,7 @@ var/def_zone = BODY_ZONE_CHEST if(snap && iscarbon(L)) var/mob/living/carbon/C = L - if(C.mobility_flags & MOBILITY_STAND) + if(C.body_position == STANDING_UP) def_zone = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) if(!C.legcuffed && C.num_legs >= 2) //beartrap can't cuff your leg if there's already a beartrap or legcuffs, or you don't have two legs. C.legcuffed = src diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index 11f31c3688e..12e32a9c55e 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -140,15 +140,17 @@ message_cooldown = world.time + 50 to_chat(user, "[src]'s door won't budge!") + /obj/machinery/implantchair/MouseDrop_T(mob/target, mob/user) if(user.stat || !Adjacent(user) || !user.Adjacent(target) || !isliving(target) || !user.IsAdvancedToolUser()) return if(isliving(user)) var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) + if(L.body_position == LYING_DOWN) return close_machine(target) + /obj/machinery/implantchair/close_machine(mob/living/user) if((isnull(user) || istype(user)) && state_open) ..(user) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 8de6efa9492..5ae9f0cf78a 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -79,7 +79,7 @@ user.do_attack_animation(M, ATTACK_EFFECT_BOOP) playsound(loc, 'sound/weapons/tap.ogg', 50, TRUE, -1) else if(ishuman(M)) - if(!(user.mobility_flags & MOBILITY_STAND)) + if(user.body_position == LYING_DOWN) user.visible_message("[user] shakes [M] trying to get [M.p_them()] up!", \ "You shake [M] trying to get [M.p_them()] up!") else @@ -94,7 +94,7 @@ if(1) if(M.health >= 0) if(ishuman(M)) - if(!(M.mobility_flags & MOBILITY_STAND)) + if(M.body_position == LYING_DOWN) user.visible_message("[user] shakes [M] trying to get [M.p_them()] up!", \ "You shake [M] trying to get [M.p_them()] up!") else if(user.zone_selected == BODY_ZONE_HEAD) @@ -117,7 +117,6 @@ M.electrocute_act(5, "[user]", flags = SHOCK_NOGLOVES) user.visible_message("[user] electrocutes [M] with [user.p_their()] touch!", \ "You electrocute [M] with your touch!") - M.update_mobility() else if(!iscyborg(M)) M.adjustFireLoss(10) @@ -563,7 +562,7 @@ /obj/item/cautery/prt //it's a subtype of cauteries so that it inherits the cautery sprites and behavior and stuff, because I'm too lazy to make sprites for this thing name = "plating repair tool" desc = "A tiny heating device that's powered by a cyborg's excess heat. Its intended purpose is to repair burnt or damaged hull platings, but it can also be used as a crude lighter or cautery." - toolspeed = 1.5 //it's not designed to be used as a cautery (although it's close enough to one to be considered to be a proper cautery instead of just a hot object for the purposes of surgery) + toolspeed = 1.5 //it's not designed to be used as a cautery (although it's close enough to one to be considered to be a proper cautery instead of just a hot object for the purposes of surgery) heat = 3800 //this thing is intended for metal-shaping, so it's the same temperature as a lit welder resistance_flags = FIRE_PROOF //if it's channeling a cyborg's excess heat, it's probably fireproof force = 5 diff --git a/code/game/objects/structures/beds_chairs/alien_nest.dm b/code/game/objects/structures/beds_chairs/alien_nest.dm index 80cd0f3f25b..589eac4b4b7 100644 --- a/code/game/objects/structures/beds_chairs/alien_nest.dm +++ b/code/game/objects/structures/beds_chairs/alien_nest.dm @@ -71,8 +71,8 @@ add_overlay(nest_overlay) /obj/structure/bed/nest/post_unbuckle_mob(mob/living/M) - M.pixel_x = M.get_standard_pixel_x_offset(!(M.mobility_flags & MOBILITY_STAND)) - M.pixel_y = M.get_standard_pixel_y_offset(!(M.mobility_flags & MOBILITY_STAND)) + M.pixel_x = M.get_standard_pixel_x_offset(M.body_position == LYING_DOWN) + M.pixel_y = M.get_standard_pixel_y_offset(M.body_position == LYING_DOWN) M.layer = initial(M.layer) cut_overlay(nest_overlay) diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index ef079d1270b..09c4f239e50 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -97,11 +97,13 @@ if(has_gravity()) playsound(src, 'sound/effects/roll.ogg', 100, TRUE) + /obj/structure/bed/roller/post_unbuckle_mob(mob/living/M) density = FALSE icon_state = "down" - M.pixel_x = M.get_standard_pixel_x_offset(!(M.mobility_flags & MOBILITY_STAND)) - M.pixel_y = M.get_standard_pixel_y_offset(!(M.mobility_flags & MOBILITY_STAND)) + M.pixel_x = M.get_standard_pixel_x_offset(M.body_position == LYING_DOWN) + M.pixel_y = M.get_standard_pixel_y_offset(M.body_position == LYING_DOWN) + /obj/item/roller name = "roller bed" diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 252f6a35454..e4f8c2d603d 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -304,7 +304,7 @@ /obj/structure/closet/MouseDrop_T(atom/movable/O, mob/living/user) if(!istype(O) || O.anchored || istype(O, /obj/screen)) return - if(!istype(user) || user.incapacitated() || !(user.mobility_flags & MOBILITY_STAND)) + if(!istype(user) || user.incapacitated() || user.body_position == LYING_DOWN) return if(!Adjacent(user) || !user.Adjacent(O)) return @@ -353,16 +353,18 @@ return container_resist_act(user) + /obj/structure/closet/attack_hand(mob/living/user) . = ..() if(.) return - if(!(user.mobility_flags & MOBILITY_STAND) && get_dist(src, user) > 0) + if(user.body_position == LYING_DOWN && get_dist(src, user) > 0) return if(!toggle(user)) togglelock(user) + /obj/structure/closet/attack_paw(mob/user) return attack_hand(user) diff --git a/code/game/objects/structures/maintenance.dm b/code/game/objects/structures/maintenance.dm index 51d1941e1fb..78c9e88a4ac 100644 --- a/code/game/objects/structures/maintenance.dm +++ b/code/game/objects/structures/maintenance.dm @@ -42,15 +42,17 @@ at the cost of risking a vicious bite.**/ QDEL_NULL(hidden_item) return ..() + ///This proc checks if we are able to reach inside the trap to interact with it. /obj/structure/moisture_trap/proc/CanReachInside(mob/user) if(!isliving(user)) return FALSE var/mob/living/living_user = user - if((living_user.mobility_flags & MOBILITY_STAND) && ishuman(living_user)) //I dont think monkeys can crawl on command. + if(living_user.body_position == STANDING_UP && ishuman(living_user)) //I dont think monkeys can crawl on command. return FALSE return TRUE + /obj/structure/moisture_trap/attack_hand(mob/user) . = ..() if(iscyborg(user) || isalien(user)) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 72683962f1a..2959a53ab58 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -366,7 +366,7 @@ GLOBAL_LIST_EMPTY(crematoriums) return if(isliving(user)) var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) + if(L.body_position == LYING_DOWN) return O.forceMove(src.loc) if (user != O) diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index 3e2d9db9607..bdc10a18279 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -93,7 +93,7 @@ return TRUE if(M.buckled && istype(M.buckled, /mob/living/simple_animal/bot/mulebot)) // mulebot passenger gets a free pass. return TRUE - if((M.mobility_flags & MOBILITY_STAND) && !M.ventcrawler && M.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass. + if(M.body_position == STANDING_UP && !M.ventcrawler && M.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass. return FALSE /obj/structure/plasticflaps/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 5cbb76503b6..fd4e5e02c7a 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -649,7 +649,7 @@ . = ..() if(.) return - if(!(user.mobility_flags & MOBILITY_STAND) || user.usable_legs < 2) + if(user.body_position == LYING_DOWN || user.usable_legs < 2) return user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src, ATTACK_EFFECT_KICK) diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm index 008c9ec4943..959782a36e6 100644 --- a/code/game/turfs/open/_open.dm +++ b/code/game/turfs/open/_open.dm @@ -215,7 +215,7 @@ if(!(lube&GALOSHES_DONT_HELP)) //can't slip while buckled unless it's lube. return FALSE else - if(!(lube&SLIP_WHEN_CRAWLING) && (!(C.mobility_flags & MOBILITY_STAND) || !(C.status_flags & CANKNOCKDOWN))) // can't slip unbuckled mob if they're lying or can't fall. + if(!(lube & SLIP_WHEN_CRAWLING) && (C.body_position == LYING_DOWN || !(C.status_flags & CANKNOCKDOWN))) // can't slip unbuckled mob if they're lying or can't fall. return FALSE if(C.m_intent == MOVE_INTENT_WALK && (lube&NO_SLIP_WHEN_WALKING)) return FALSE diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index d3f5baeaa5c..07d09f41b1e 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -16,8 +16,7 @@ var/breakout_time = 450 /obj/machinery/abductor/experiment/MouseDrop_T(mob/target, mob/user) - var/mob/living/L = user - if(user.stat || (isliving(user) && (!(L.mobility_flags & MOBILITY_STAND) || !(L.mobility_flags & MOBILITY_UI))) || !Adjacent(user) || !target.Adjacent(user) || !ishuman(target)) + if(user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_UI_BLOCKED) || !Adjacent(user) || !target.Adjacent(user) || !ishuman(target)) return if(isabductor(target)) return diff --git a/code/modules/antagonists/changeling/powers/fakedeath.dm b/code/modules/antagonists/changeling/powers/fakedeath.dm index 4de311ca75f..5ed65b97369 100644 --- a/code/modules/antagonists/changeling/powers/fakedeath.dm +++ b/code/modules/antagonists/changeling/powers/fakedeath.dm @@ -24,7 +24,6 @@ else to_chat(user, "We begin our stasis, preparing energy to arise once more.") user.fakedeath("changeling") //play dead - user.update_mobility() addtimer(CALLBACK(src, .proc/ready_to_regenerate, user), LING_FAKEDEATH_TIME, TIMER_UNIQUE) return TRUE diff --git a/code/modules/antagonists/eldritch_cult/knowledge/ash_lore.dm b/code/modules/antagonists/eldritch_cult/knowledge/ash_lore.dm index 81a94e2a436..ebc7ff6b5ab 100644 --- a/code/modules/antagonists/eldritch_cult/knowledge/ash_lore.dm +++ b/code/modules/antagonists/eldritch_cult/knowledge/ash_lore.dm @@ -149,13 +149,13 @@ . = ..() ADD_TRAIT(chosen_mob,TRAIT_PARALYSIS_L_LEG,MAGIC_TRAIT) ADD_TRAIT(chosen_mob,TRAIT_PARALYSIS_R_LEG,MAGIC_TRAIT) - chosen_mob.update_mobility() + /datum/eldritch_knowledge/curse/paralysis/uncurse(mob/living/chosen_mob) . = ..() REMOVE_TRAIT(chosen_mob,TRAIT_PARALYSIS_L_LEG,MAGIC_TRAIT) REMOVE_TRAIT(chosen_mob,TRAIT_PARALYSIS_R_LEG,MAGIC_TRAIT) - chosen_mob.update_mobility() + /datum/eldritch_knowledge/spell/cleave name = "Blood Cleave" diff --git a/code/modules/antagonists/fugitive/fugitive_ship.dm b/code/modules/antagonists/fugitive/fugitive_ship.dm index 674b40503b3..c9f57bcc87b 100644 --- a/code/modules/antagonists/fugitive/fugitive_ship.dm +++ b/code/modules/antagonists/fugitive/fugitive_ship.dm @@ -16,7 +16,7 @@ var/mob/living/fugitive_hunter = user if(!isliving(fugitive_hunter)) return - if(fugitive_hunter.stat || (!(fugitive_hunter.mobility_flags & MOBILITY_STAND) || !(fugitive_hunter.mobility_flags & MOBILITY_UI)) || !Adjacent(fugitive_hunter) || !target.Adjacent(fugitive_hunter) || !ishuman(target)) + if(HAS_TRAIT(fugitive_hunter, TRAIT_UI_BLOCKED) || !Adjacent(fugitive_hunter) || !target.Adjacent(fugitive_hunter) || !ishuman(target)) return var/mob/living/carbon/human/fugitive = target var/datum/antagonist/fugitive/fug_antag = fugitive.mind.has_antag_datum(/datum/antagonist/fugitive) diff --git a/code/modules/antagonists/revenant/revenant_blight.dm b/code/modules/antagonists/revenant/revenant_blight.dm index 62ac7486a55..7a0e1062cc5 100644 --- a/code/modules/antagonists/revenant/revenant_blight.dm +++ b/code/modules/antagonists/revenant/revenant_blight.dm @@ -31,7 +31,7 @@ return if(!finalstage) - if(!(affected_mob.mobility_flags & MOBILITY_STAND) && prob(stage * 6)) + if(affected_mob.body_position == LYING_DOWN && prob(stage * 6)) cure() return FALSE if(prob(stage * 3)) diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 84a892b2f88..c940cfc54f2 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -420,7 +420,7 @@ user.invisibility = initial(user.invisibility) user.status_flags &= ~GODMODE REMOVE_TRAIT(user, TRAIT_IMMOBILIZED, WARPWHISTLE_TRAIT) - user.update_mobility() + /obj/item/warpwhistle/attack_self(mob/living/carbon/user) if(!istype(user) || on_cooldown) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 7da5274bf7f..4eff30ab19a 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -298,9 +298,6 @@ on = FALSE for(var/mob/M in contents) //only drop mobs M.forceMove(get_turf(src)) - if(isliving(M)) - var/mob/living/L = M - L.update_mobility() occupant = null flick("pod-open-anim", src) reagent_transfer = efficiency * 10 - 5 // wait before injecting the next occupant diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index 1c1b8e46140..afc738d4ac3 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -155,7 +155,7 @@ else // if they're someone else's shoes, go knot-wards var/mob/living/L = user - if(istype(L) && (L.mobility_flags & MOBILITY_STAND)) + if(istype(L) && L.body_position == STANDING_UP) to_chat(user, "You must be on the floor to interact with [src]!") return if(tied == SHOES_KNOTTED) diff --git a/code/modules/fields/timestop.dm b/code/modules/fields/timestop.dm index ec4cc4d2d36..40014d2f157 100644 --- a/code/modules/fields/timestop.dm +++ b/code/modules/fields/timestop.dm @@ -164,7 +164,7 @@ /datum/proximity_monitor/advanced/timestop/process() for(var/i in frozen_mobs) var/mob/living/m = i - m.Stun(20, 1, 1) + m.Stun(20, ignore_canstun = TRUE) /datum/proximity_monitor/advanced/timestop/setup_field_turf(turf/T) for(var/i in T.contents) @@ -181,7 +181,7 @@ /datum/proximity_monitor/advanced/timestop/proc/freeze_mob(mob/living/L) frozen_mobs += L - L.Stun(20, 1, 1) + L.Stun(20, ignore_canstun = TRUE) ADD_TRAIT(L, TRAIT_MUTE, TIMESTOP_TRAIT) walk(L, 0) //stops them mid pathing even if they're stunimmune if(isanimal(L)) @@ -192,7 +192,7 @@ H.LoseTarget() /datum/proximity_monitor/advanced/timestop/proc/unfreeze_mob(mob/living/L) - L.AdjustStun(-20, 1, 1) + L.AdjustStun(-20, ignore_canstun = TRUE) REMOVE_TRAIT(L, TRAIT_MUTE, TIMESTOP_TRAIT) frozen_mobs -= L if(isanimal(L)) diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 6473a2c1509..c939738f5cb 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -24,7 +24,7 @@ if(iscyborg(loc)) var/mob/living/silicon/robot/borg = loc borg.mmi = null - mecha = null + set_mecha(null) QDEL_NULL(brainmob) QDEL_NULL(brain) QDEL_NULL(radio) @@ -67,7 +67,7 @@ B.notify_ghost_cloning("Someone has put your brain in a MMI!", source = src) user.visible_message("[user] sticks \a [newbrain] into [src].", "[src]'s indicator light turn on as you insert [newbrain].") - brainmob = newbrain.brainmob + set_brainmob(newbrain.brainmob) newbrain.brainmob = null brainmob.forceMove(src) brainmob.container = src @@ -133,7 +133,7 @@ /obj/item/mmi/proc/transfer_identity(mob/living/L) //Same deal as the regular brain proc. Used for human-->robot people. if(!brainmob) - brainmob = new(src) + set_brainmob(new /mob/living/brain(src)) brainmob.name = L.real_name brainmob.real_name = L.real_name if(L.has_dna()) @@ -160,6 +160,41 @@ else braintype = "Cyborg" + +/// Proc to hook behavior associated to the change in value of the [/obj/item/mmi/var/brainmob] variable. +/obj/item/mmi/proc/set_brainmob(mob/living/brain/new_brainmob) + if(brainmob == new_brainmob) + return FALSE + . = brainmob + brainmob = new_brainmob + if(new_brainmob) + if(mecha) + REMOVE_TRAIT(new_brainmob, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + REMOVE_TRAIT(new_brainmob, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) + else + ADD_TRAIT(new_brainmob, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + ADD_TRAIT(new_brainmob, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) + if(.) + var/mob/living/brain/old_brainmob = . + ADD_TRAIT(old_brainmob, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + ADD_TRAIT(old_brainmob, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) + + +/// Proc to hook behavior associated to the change in value of the [obj/vehicle/sealed/var/mecha] variable. +/obj/item/mmi/proc/set_mecha(obj/vehicle/sealed/mecha/new_mecha) + if(mecha == new_mecha) + return FALSE + . = mecha + mecha = new_mecha + if(new_mecha) + if(!. && brainmob) // There was no mecha, there now is, and we have a brain mob that is no longer unaided. + REMOVE_TRAIT(brainmob, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + REMOVE_TRAIT(brainmob, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) + else if(. && brainmob) // There was a mecha, there no longer is one, and there is a brain mob that is now again unaided. + ADD_TRAIT(brainmob, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + ADD_TRAIT(brainmob, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) + + /obj/item/mmi/proc/replacement_ai_name() return brainmob.name diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index 587d28c2513..6b89f3ddd37 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -16,6 +16,9 @@ var/obj/item/organ/brain/OB = new(loc) //we create a new brain organ for it. OB.brainmob = src forceMove(OB) + if(!container?.mecha) //Unless inside a mecha, brains are rather helpless. + ADD_TRAIT(src, TRAIT_IMMOBILIZED, BRAIN_UNAIDED) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, BRAIN_UNAIDED) /mob/living/brain/proc/create_dna() @@ -34,11 +37,6 @@ container = null return ..() -/mob/living/brain/update_mobility() - if(in_contents_of(/obj/vehicle/sealed/mecha)) - mobility_flags = MOBILITY_FLAGS_DEFAULT - else - mobility_flags = NONE /mob/living/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up. return diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 9a8f9f227c0..5d82400b04f 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -10,9 +10,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) var/next_ask ///World time tick when ghost polling will be available again var/askDelay = 600 ///Delay after polling ghosts var/searching = FALSE - brainmob = null req_access = list(ACCESS_ROBOTICS) - mecha = null//This does not appear to be used outside of reference in mecha.dm. braintype = "Android" var/autoping = TRUE ///If it pings on creation immediately ///Message sent to the user when polling ghosts @@ -47,7 +45,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/mmi/posibrain/attack_self(mob/user) if(!brainmob) - brainmob = new(src) + set_brainmob(new /mob/living/brain(src)) if(!(GLOB.ghost_role_flags & GHOSTROLE_SILICONS)) to_chat(user, "Central Command has temporarily outlawed posibrain sentience in this sector...") if(is_occupied()) @@ -176,7 +174,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/mmi/posibrain/Initialize() . = ..() - brainmob = new(src) + set_brainmob(new /mob/living/brain(src)) var/new_name if(!LAZYLEN(possible_names)) new_name = pick(GLOB.posibrain_names) @@ -189,6 +187,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) if(autoping) ping_ghosts("created", TRUE) + /obj/item/mmi/posibrain/attackby(obj/item/O, mob/user) return diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 29ceb8fa462..69cad88162d 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -27,7 +27,7 @@ /mob/living/carbon/alien/Initialize() add_verb(src, /mob/living/proc/mob_sleep) - add_verb(src, /mob/living/proc/lay_down) + add_verb(src, /mob/living/proc/toggle_resting) create_bodyparts() //initialize bodyparts @@ -139,3 +139,11 @@ Des: Removes all infected images from the alien. /mob/living/carbon/alien/can_hold_items() return has_fine_manipulation + +/mob/living/carbon/alien/on_lying_down(new_lying_angle) + . = ..() + update_icons() + +/mob/living/carbon/alien/on_standing_up() + . = ..() + update_icons() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index bac9260e7c7..6b1f04bcf61 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -31,7 +31,7 @@ #define MAX_ALIEN_LEAP_DIST 7 /mob/living/carbon/alien/humanoid/hunter/proc/leap_at(atom/A) - if((mobility_flags & (MOBILITY_MOVE | MOBILITY_STAND)) != (MOBILITY_MOVE | MOBILITY_STAND) || leaping) + if(body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_IMMOBILIZED) || leaping) return if(pounce_cooldown > world.time) @@ -74,17 +74,16 @@ sleep(2)//Runtime prevention (infinite bump() calls on hulks) step_towards(src,L) else - Paralyze(40, 1, 1) + Paralyze(40, ignore_canstun = TRUE) toggle_leap(0) else if(hit_atom.density && !hit_atom.CanPass(src)) visible_message("[src] smashes into [hit_atom]!", "[src] smashes into [hit_atom]!") - Paralyze(40, 1, 1) + Paralyze(40, ignore_canstun = TRUE) if(leaping) leaping = FALSE update_icons() - update_mobility() /mob/living/carbon/alien/humanoid/float(on) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index 79de360e1b0..ca84d8aa729 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -39,7 +39,7 @@ to_chat(M, "Your punch misses [src]!") if ("disarm") - if (!(mobility_flags & MOBILITY_STAND)) + if (body_position == STANDING_UP) if (prob(5)) Unconscious(40) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_update_icons.dm index 6ca74172a48..28357dfea4a 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_update_icons.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_update_icons.dm @@ -17,7 +17,7 @@ else if(leap_on_click) icon_state = "alien[caste]_pounce" - else if(!(mobility_flags & MOBILITY_STAND)) + else if(body_position == LYING_DOWN) icon_state = "alien[caste]_sleep" else if(mob_size == MOB_SIZE_LARGE) icon_state = "alien[caste]" @@ -41,8 +41,8 @@ var/old_icon = icon icon = alt_icon alt_icon = old_icon - pixel_x = get_standard_pixel_x_offset(mobility_flags & MOBILITY_STAND) - pixel_y = get_standard_pixel_y_offset(mobility_flags & MOBILITY_STAND) + pixel_x = get_standard_pixel_x_offset(body_position == LYING_DOWN) + pixel_y = get_standard_pixel_y_offset(body_position == LYING_DOWN) update_inv_hands() update_inv_handcuffed() diff --git a/code/modules/mob/living/carbon/alien/larva/larva_update_icons.dm b/code/modules/mob/living/carbon/alien/larva/larva_update_icons.dm index 983544e8c72..4a939d61e6a 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_update_icons.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_update_icons.dm @@ -14,10 +14,10 @@ icon_state = "larva[state]_dead" else if(handcuffed || legcuffed) //This should be an overlay. Who made this an icon_state? icon_state = "larva[state]_cuff" - else if(!(mobility_flags & MOBILITY_STAND)) - icon_state = "larva[state]_sleep" - else if(IsStun()) + else if(HAS_TRAIT(src, TRAIT_INCAPACITATED)) icon_state = "larva[state]_stun" + else if(body_position == LYING_DOWN) + icon_state = "larva[state]_sleep" else icon_state = "larva[state]" @@ -29,3 +29,5 @@ update_icons() //larva icon_state changes if cuffed/uncuffed. +/mob/living/carbon/alien/larva/lying_angle_on_lying_down(new_lying_angle) + return // Larvas don't rotate on lying down, they have their own custom icons. diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 4b7bd676771..ef9e640b89e 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -23,6 +23,5 @@ if(stat == UNCONSCIOUS) set_resting(FALSE) set_stat(CONSCIOUS) - update_mobility() update_damage_hud() update_health_hud() diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index 40e2fc5c8b9..d48a980d2e1 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -85,17 +85,20 @@ var/mob/living/carbon/alien/larva/new_xeno = new(xeno_loc) new_xeno.key = ghost.key SEND_SOUND(new_xeno, sound('sound/voice/hiss5.ogg',0,0,0,100)) //To get the player's attention - new_xeno.mobility_flags = NONE //so we don't move during the bursting animation + ADD_TRAIT(new_xeno, TRAIT_IMMOBILIZED, type) //so we don't move during the bursting animation + ADD_TRAIT(new_xeno, TRAIT_HANDS_BLOCKED, type) new_xeno.notransform = 1 new_xeno.invisibility = INVISIBILITY_MAXIMUM sleep(6) if(QDELETED(src) || QDELETED(owner)) - return + qdel(new_xeno) + CRASH("AttemptGrow failed due to the early qdeletion of source or owner.") if(new_xeno) - new_xeno.mobility_flags = MOBILITY_FLAGS_DEFAULT + REMOVE_TRAIT(new_xeno, TRAIT_IMMOBILIZED, type) + REMOVE_TRAIT(new_xeno, TRAIT_HANDS_BLOCKED, type) new_xeno.notransform = 0 new_xeno.invisibility = 0 diff --git a/code/modules/mob/living/carbon/alien/status_procs.dm b/code/modules/mob/living/carbon/alien/status_procs.dm index 0affc187a12..cd8ada8bd7a 100644 --- a/code/modules/mob/living/carbon/alien/status_procs.dm +++ b/code/modules/mob/living/carbon/alien/status_procs.dm @@ -4,17 +4,17 @@ /////////////////////////////////// STUN //////////////////////////////////// -/mob/living/carbon/alien/Stun(amount, updating = 1, ignore_canstun = 0) +/mob/living/carbon/alien/Stun(amount, ignore_canstun = FALSE) . = ..() if(!.) move_delay_add = min(move_delay_add + round(amount / 2), 10) //a maximum delay of 10 -/mob/living/carbon/alien/SetStun(amount, updating = 1, ignore_canstun = 0) +/mob/living/carbon/alien/SetStun(amount, ignore_canstun = FALSE) . = ..() if(!.) move_delay_add = min(move_delay_add + round(amount / 2), 10) -/mob/living/carbon/alien/AdjustStun(amount, updating = 1, ignore_canstun = 0) +/mob/living/carbon/alien/AdjustStun(amount, ignore_canstun = FALSE) . = ..() if(!.) move_delay_add = clamp(move_delay_add + round(amount/2), 0, 10) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 7e662fb0c27..2eacebc179f 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -61,7 +61,7 @@ /mob/living/carbon/attackby(obj/item/I, mob/user, params) for(var/datum/surgery/S in surgeries) - if(!(mobility_flags & MOBILITY_STAND) || !S.lying_required) + if(body_position == LYING_DOWN || !S.lying_required) if((S.self_operable || user != src) && (user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM)) if(S.next_step(user,user.a_intent)) return 1 @@ -287,7 +287,7 @@ /mob/living/carbon/resist_fire() adjust_fire_stacks(-5) - Paralyze(60, TRUE, TRUE) + Paralyze(60, ignore_canstun = TRUE) spin(32,2) visible_message("[src] rolls on the floor, trying to put [p_them()]self out!", \ "You stop, drop, and roll!") @@ -543,15 +543,14 @@ dna.real_name = real_name -/mob/living/carbon/set_lying_angle(new_lying) +/mob/living/carbon/set_body_position(new_value) . = ..() if(isnull(.)) return - switch(lying_angle) - if(90, 270) - add_movespeed_modifier(/datum/movespeed_modifier/carbon_crawling) - else - remove_movespeed_modifier(/datum/movespeed_modifier/carbon_crawling) + if(new_value == LYING_DOWN) + add_movespeed_modifier(/datum/movespeed_modifier/carbon_crawling) + else + remove_movespeed_modifier(/datum/movespeed_modifier/carbon_crawling) //Updates the mob's health from bodyparts and mob damage variables @@ -569,7 +568,6 @@ set_health(round(maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute, DAMAGE_PRECISION)) staminaloss = round(total_stamina, DAMAGE_PRECISION) update_stat() - update_mobility() if(((maxHealth - total_burn) < HEALTH_THRESHOLD_DEAD*2) && stat == DEAD ) become_husk(BURN) @@ -826,7 +824,6 @@ REMOVE_TRAIT(src, TRAIT_SIXTHSENSE, "near-death") - /mob/living/carbon/update_stat() if(status_flags & GODMODE) return @@ -842,7 +839,6 @@ set_stat(SOFT_CRIT) else set_stat(CONSCIOUS) - update_mobility() update_damage_hud() update_health_hud() med_hud_set_status() @@ -861,7 +857,7 @@ update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed. update_inv_handcuffed() update_hud_handcuffed() - update_mobility() + /mob/living/carbon/fully_heal(admin_revive = FALSE) for(var/O in internal_organs) @@ -1288,3 +1284,17 @@ REMOVE_TRAIT(src, TRAIT_RESTRAINED, HANDCUFFED_TRAIT) else if(handcuffed) ADD_TRAIT(src, TRAIT_RESTRAINED, HANDCUFFED_TRAIT) + + +/mob/living/carbon/on_lying_down(new_lying_angle) + . = ..() + if(!buckled || buckled.buckle_lying != 0) + lying_angle_on_lying_down(new_lying_angle) + + +/// Special carbon interaction on lying down, to transform its sprite by a rotation. +/mob/living/carbon/proc/lying_angle_on_lying_down(new_lying_angle) + if(!new_lying_angle) + set_lying_angle(pick(90, 270)) + else + set_lying_angle(new_lying_angle) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index a5fc62dd763..c9897282148 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -72,7 +72,7 @@ affecting = get_bodypart(check_zone(user.zone_selected)) //we're self-mutilating! yay! else var/zone_hit_chance = 80 - if(!(mobility_flags & MOBILITY_STAND)) // half as likely to hit a different zone if they're on the ground + if(body_position == LYING_DOWN) // half as likely to hit a different zone if they're on the ground zone_hit_chance += 10 affecting = get_bodypart(ran_zone(user.zone_selected, zone_hit_chance)) if(!affecting) //missing limb? we select the first bodypart (you can never have zero, because of chest) @@ -153,7 +153,7 @@ ContactContractDisease(D) for(var/datum/surgery/S in surgeries) - if(!(mobility_flags & MOBILITY_STAND) || !S.lying_required) + if(body_position == LYING_DOWN || !S.lying_required) if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM) if(S.next_step(user, user.a_intent)) return TRUE @@ -421,7 +421,7 @@ if(M == src && check_self_for_injuries()) return - if(!(mobility_flags & MOBILITY_STAND)) + if(body_position == LYING_DOWN) if(buckled) to_chat(M, "You need to unbuckle [src] first to do that!") return diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 8ebd68b16b3..ddf619f3534 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1,6 +1,6 @@ /mob/living/carbon/human/Initialize() add_verb(src, /mob/living/proc/mob_sleep) - add_verb(src, /mob/living/proc/lay_down) + add_verb(src, /mob/living/proc/toggle_resting) icon_state = "" //Remove the inherent human icon that is visible on the map editor. We're rendering ourselves limb by limb, having it still be there results in a bug where the basic human icon appears below as south in all directions and generally looks nasty. @@ -1075,7 +1075,7 @@ return (istype(target) && target.stat == CONSCIOUS) /mob/living/carbon/human/proc/can_be_firemanned(mob/living/carbon/target) - return (ishuman(target) && !(target.mobility_flags & MOBILITY_STAND)) + return ishuman(target) && target.body_position == LYING_DOWN /mob/living/carbon/human/proc/fireman_carry(mob/living/carbon/target) var/carrydelay = 50 //if you have latex you are faster at grabbing diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 255af90baa1..f56c11bb09f 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -174,7 +174,7 @@ affecting = get_bodypart(check_zone(user.zone_selected)) //stabbing yourself always hits the right target else var/zone_hit_chance = 80 - if(!(mobility_flags & MOBILITY_STAND)) // half as likely to hit a different zone if they're on the ground + if(body_position == LYING_DOWN) // half as likely to hit a different zone if they're on the ground zone_hit_chance += 10 affecting = get_bodypart(ran_zone(user.zone_selected, zone_hit_chance)) var/target_area = parse_zone(check_zone(user.zone_selected)) //our intended target diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 5948b7fa931..2551cef7ee6 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -45,7 +45,7 @@ /mob/living/carbon/human/Move(NewLoc, direct) . = ..() - if(shoes && (mobility_flags & MOBILITY_STAND) && loc == NewLoc && has_gravity(loc)) + if(shoes && body_position == STANDING_UP && loc == NewLoc && has_gravity(loc)) var/obj/item/clothing/shoes/S = shoes S.step_action() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 5678b32b10e..f30ec2344d2 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1264,14 +1264,16 @@ GLOBAL_LIST_EMPTY(roundstart_races) /datum/species/proc/spec_fully_heal(mob/living/carbon/human/H) return + /datum/species/proc/help(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) - if(!((target.health < 0 || HAS_TRAIT(target, TRAIT_FAKEDEATH)) && !(target.mobility_flags & MOBILITY_STAND))) + if(target.body_position == STANDING_UP || (target.health >= 0 && !HAS_TRAIT(target, TRAIT_FAKEDEATH))) target.help_shake_act(user) if(target != user) log_combat(user, target, "shaken") - return 1 - else - user.do_cpr(target) + return TRUE + + user.do_cpr(target) + /datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) if(target.check_block()) @@ -1283,7 +1285,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) return TRUE else //Steal them shoes - if(!(target.mobility_flags & MOBILITY_STAND) && (user.zone_selected == BODY_ZONE_L_LEG || user.zone_selected == BODY_ZONE_R_LEG) && user.a_intent == INTENT_GRAB && target.shoes) + if(target.body_position == LYING_DOWN && (user.zone_selected == BODY_ZONE_L_LEG || user.zone_selected == BODY_ZONE_R_LEG) && user.a_intent == INTENT_GRAB && target.shoes) var/obj/item/I = target.shoes user.visible_message("[user] starts stealing [target]'s [I.name]!", "You start stealing [target]'s [I.name]...", null, null, target) @@ -1312,7 +1314,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) else var/atk_verb = user.dna.species.attack_verb - if(!(target.mobility_flags & MOBILITY_STAND)) + if(target.body_position == LYING_DOWN) atk_verb = ATTACK_EFFECT_KICK switch(atk_verb)//this code is really stupid but some genius apparently made "claw" and "slash" two attack types but also the same one so it's needed i guess @@ -1449,8 +1451,8 @@ GLOBAL_LIST_EMPTY(roundstart_races) armor_block = min(90,armor_block) //cap damage reduction at 90% var/Iwound_bonus = I.wound_bonus - // this way, you can't wound with a surgical tool on help intent if they have a surgery active and are laying down, so a misclick with a circular saw on the wrong limb doesn't bleed them dry (they still get hit tho) - if((I.item_flags & SURGICAL_TOOL) && user.a_intent == INTENT_HELP && (H.mobility_flags & ~MOBILITY_STAND) && (LAZYLEN(H.surgeries) > 0)) + // this way, you can't wound with a surgical tool on help intent if they have a surgery active and are lying down, so a misclick with a circular saw on the wrong limb doesn't bleed them dry (they still get hit tho) + if((I.item_flags & SURGICAL_TOOL) && user.a_intent == INTENT_HELP && H.body_position == LYING_DOWN && (LAZYLEN(H.surgeries) > 0)) Iwound_bonus = CANT_WOUND var/weakness = check_species_weakness(I, user) @@ -1924,7 +1926,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) return FALSE /datum/species/proc/CanFly(mob/living/carbon/human/H) - if(H.stat || !(H.mobility_flags & MOBILITY_STAND)) + if(H.stat || H.body_position == LYING_DOWN) return FALSE if(H.wear_suit && ((H.wear_suit.flags_inv & HIDEJUMPSUIT) && (!H.wear_suit.species_exception || !is_type_in_list(src, H.wear_suit.species_exception)))) //Jumpsuits have tail holes, so it makes sense they have wing holes too to_chat(H, "Your suit blocks your wings from extending!") @@ -1971,7 +1973,6 @@ GLOBAL_LIST_EMPTY(roundstart_races) override_float = TRUE passtable_on(H, SPECIES_TRAIT) H.OpenWings() - H.update_mobility() else stunmod *= 0.5 speedmod += 0.35 diff --git a/code/modules/mob/living/carbon/human/status_procs.dm b/code/modules/mob/living/carbon/human/status_procs.dm index c6739294886..8e191a7c963 100644 --- a/code/modules/mob/living/carbon/human/status_procs.dm +++ b/code/modules/mob/living/carbon/human/status_procs.dm @@ -1,27 +1,27 @@ -/mob/living/carbon/human/Stun(amount, updating = TRUE, ignore_canstun = FALSE) +/mob/living/carbon/human/Stun(amount, ignore_canstun = FALSE) amount = dna.species.spec_stun(src,amount) return ..() -/mob/living/carbon/human/Knockdown(amount, updating = TRUE, ignore_canstun = FALSE) +/mob/living/carbon/human/Knockdown(amount, ignore_canstun = FALSE) amount = dna.species.spec_stun(src,amount) return ..() -/mob/living/carbon/human/Paralyze(amount, updating = TRUE, ignore_canstun = FALSE) +/mob/living/carbon/human/Paralyze(amount, ignore_canstun = FALSE) amount = dna.species.spec_stun(src, amount) return ..() -/mob/living/carbon/human/Immobilize(amount, updating = TRUE, ignore_canstun = FALSE) +/mob/living/carbon/human/Immobilize(amount, ignore_canstun = FALSE) amount = dna.species.spec_stun(src, amount) return ..() -/mob/living/carbon/human/Unconscious(amount, updating = 1, ignore_canstun = 0) +/mob/living/carbon/human/Unconscious(amount, ignore_canstun = FALSE) amount = dna.species.spec_stun(src,amount) if(HAS_TRAIT(src, TRAIT_HEAVY_SLEEPER)) amount *= (rand(125, 130) * 0.01) return ..() -/mob/living/carbon/human/Sleeping(amount, updating = 1) +/mob/living/carbon/human/Sleeping(amount) if(HAS_TRAIT(src, TRAIT_HEAVY_SLEEPER)) amount *= (rand(125, 130) * 0.01) return ..() diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index add4c5e30f2..535893c147f 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -48,17 +48,11 @@ return FALSE + // taken from /mob/living/carbon/human/interactive/ -/mob/living/carbon/monkey/proc/IsDeadOrIncap(checkDead = TRUE) - if(!(mobility_flags & MOBILITY_FLAGS_INTERACTION)) - return TRUE - if(health <= 0 && checkDead) - return TRUE - if(IsStun() || IsParalyzed()) - return TRUE - if(stat) - return TRUE - return FALSE +/mob/living/carbon/monkey/proc/IsDeadOrIncap() + return HAS_TRAIT(src, TRAIT_INCAPACITATED) || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED) + /mob/living/carbon/monkey/proc/battle_screech() if(next_battle_screech < world.time) @@ -129,7 +123,7 @@ /mob/living/carbon/monkey/proc/handle_combat() if(pickupTarget) - if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED) || IsDeadOrIncap() || blacklistItems[pickupTarget] || HAS_TRAIT(pickupTarget, TRAIT_NODROP)) + if(IsDeadOrIncap() || blacklistItems[pickupTarget] || HAS_TRAIT(pickupTarget, TRAIT_NODROP)) pickupTarget = null else pickupTimer++ diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 16119d82cef..6098fa92f03 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -26,7 +26,7 @@ /mob/living/carbon/monkey/Initialize(mapload, cubespawned=FALSE, mob/spawner) add_verb(src, /mob/living/proc/mob_sleep) - add_verb(src, /mob/living/proc/lay_down) + add_verb(src, /mob/living/proc/toggle_resting) if(unique_name) //used to exclude pun pun gender = pick(MALE, FEMALE) diff --git a/code/modules/mob/living/carbon/status_procs.dm b/code/modules/mob/living/carbon/status_procs.dm index 92bcd7685ce..47073befbf9 100644 --- a/code/modules/mob/living/carbon/status_procs.dm +++ b/code/modules/mob/living/carbon/status_procs.dm @@ -19,7 +19,7 @@ ADD_TRAIT(src, TRAIT_FLOORED, STAMINA) if(getStaminaLoss() < 120) // Puts you a little further into the initial stamcrit, makes stamcrit harder to outright counter with chems. adjustStaminaLoss(30, FALSE) - update_mobility() + /mob/living/carbon/adjust_drugginess(amount) druggy = max(druggy+amount, 0) diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 188c2d4b3c9..7bc8514d515 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -70,7 +70,6 @@ update_action_buttons_icon() update_damage_hud() update_health_hud() - update_mobility() med_hud_set_health() med_hud_set_status() stop_pulling() diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index 586ff858031..8bc89b7ce70 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -64,6 +64,8 @@ /mob/living/proc/on_immobilized_trait_gain(datum/source) SIGNAL_HANDLER mobility_flags &= ~MOBILITY_MOVE + if(living_flags & MOVES_ON_ITS_OWN) + walk(src, 0) //stop mid walk /// Called when [TRAIT_IMMOBILIZED] is removed from the mob. /mob/living/proc/on_immobilized_trait_loss(datum/source) @@ -77,33 +79,27 @@ if(buckled && buckled.buckle_lying != NO_BUCKLE_LYING) return // Handled by the buckle. mobility_flags &= ~MOBILITY_STAND - if(lying_angle == 0) //force them on the ground - set_lying_angle(pick(90, 270)) - on_fall() + on_floored_start() /// Called when [TRAIT_FLOORED] is removed from the mob. /mob/living/proc/on_floored_trait_loss(datum/source) SIGNAL_HANDLER mobility_flags |= MOBILITY_STAND - if(!resting) - get_up() + on_floored_end() /// Called when [TRAIT_HANDS_BLOCKED] is added to the mob. /mob/living/proc/on_handsblocked_trait_gain(datum/source) SIGNAL_HANDLER mobility_flags &= ~(MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE) - drop_all_held_items() - ADD_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_HANDS_BLOCKED) - ADD_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED) + on_handsblocked_start() /// Called when [TRAIT_HANDS_BLOCKED] is removed from the mob. /mob/living/proc/on_handsblocked_trait_loss(datum/source) SIGNAL_HANDLER mobility_flags |= (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE) - REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_HANDS_BLOCKED) - REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED) + on_handsblocked_end() /// Called when [TRAIT_UI_BLOCKED] is added to the mob. @@ -111,11 +107,13 @@ SIGNAL_HANDLER mobility_flags &= ~(MOBILITY_UI) unset_machine() + update_action_buttons_icon() /// Called when [TRAIT_UI_BLOCKED] is removed from the mob. /mob/living/proc/on_ui_blocked_trait_loss(datum/source) SIGNAL_HANDLER mobility_flags |= MOBILITY_UI + update_action_buttons_icon() /// Called when [TRAIT_PULL_BLOCKED] is added to the mob. @@ -136,12 +134,14 @@ SIGNAL_HANDLER ADD_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_INCAPACITATED) ADD_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_INCAPACITATED) + update_icon() /// Called when [TRAIT_INCAPACITATED] is removed from the mob. /mob/living/proc/on_incapacitated_trait_loss(datum/source) SIGNAL_HANDLER REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_INCAPACITATED) REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_INCAPACITATED) + update_icon() /// Called when [TRAIT_RESTRAINED] is added to the mob. diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index c9323cd0d43..4c3e66cd097 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -423,12 +423,12 @@ else if(alert(src, "You sure you want to sleep for a while?", "Sleep", "Yes", "No") == "Yes") SetSleeping(400) //Short nap - update_mobility() + /mob/proc/get_contents() -/mob/living/proc/lay_down() +/mob/living/proc/toggle_resting() set name = "Rest" set category = "IC" @@ -436,13 +436,13 @@ ///Proc to hook behavior to the change of value in the resting variable. -/mob/living/proc/set_resting(new_resting, silent = TRUE) +/mob/living/proc/set_resting(new_resting, silent = TRUE, instant = FALSE) if(new_resting == resting) return . = resting resting = new_resting if(new_resting) - if(lying_angle == 90 || lying_angle == 270) + if(body_position == LYING_DOWN) if(!silent) to_chat(src, "You will now try to stay lying down on the floor.") else if(buckled && buckled.buckle_lying != NO_BUCKLE_LYING) @@ -453,7 +453,7 @@ to_chat(src, "You lay down.") set_lying_down() else - if(lying_angle == 0) + if(body_position == STANDING_UP) if(!silent) to_chat(src, "You will now try to remain standing up.") else if(HAS_TRAIT(src, TRAIT_FLOORED) || (buckled && buckled.buckle_lying != NO_BUCKLE_LYING)) @@ -462,39 +462,57 @@ else if(!silent) to_chat(src, "You stand up.") - get_up() + get_up(instant) update_resting() +/// Proc to append and redefine behavior to the change of the [/mob/living/var/resting] variable. /mob/living/proc/update_resting() update_rest_hud_icon() - update_mobility() -/mob/living/proc/get_up() +/mob/living/proc/get_up(instant = FALSE) set waitfor = FALSE var/static/datum/callback/rest_checks = CALLBACK(src, .proc/rest_checks_callback) - if(!do_mob(src, src, 2 SECONDS, uninterruptible = TRUE, extra_checks = rest_checks)) + if(!instant && !do_mob(src, src, 2 SECONDS, uninterruptible = TRUE, extra_checks = rest_checks)) return - if(resting || lying_angle == 0 || HAS_TRAIT(src, TRAIT_FLOORED)) + if(resting || body_position == STANDING_UP || HAS_TRAIT(src, TRAIT_FLOORED)) return set_lying_angle(0) + set_body_position(STANDING_UP) /mob/living/proc/rest_checks_callback() - if(resting || lying_angle == 0 || HAS_TRAIT(src, TRAIT_FLOORED)) + if(resting || body_position == STANDING_UP || HAS_TRAIT(src, TRAIT_FLOORED)) return FALSE return TRUE +/// Change the [body_position] to [LYING_DOWN] and update associated behavior. /mob/living/proc/set_lying_down(new_lying_angle) - if(buckled && buckled.buckle_lying == 0) - return - if(!new_lying_angle) - set_lying_angle(pick(90, 270)) - else - set_lying_angle(new_lying_angle) + set_body_position(LYING_DOWN) + + +/// Proc to append behavior related to lying down. +/mob/living/proc/on_lying_down(new_lying_angle) + if(layer == initial(layer)) //to avoid things like hiding larvas. + layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs + ADD_TRAIT(src, TRAIT_UI_BLOCKED, LYING_DOWN_TRAIT) + ADD_TRAIT(src, TRAIT_PULL_BLOCKED, LYING_DOWN_TRAIT) + density = FALSE // We lose density and stop bumping passable dense things. + if(HAS_TRAIT(src, TRAIT_FLOORED) && !(dir & (NORTH|SOUTH))) + setDir(pick(NORTH, SOUTH)) // We are and look helpless. + + +/// Proc to append behavior related to lying down. +/mob/living/proc/on_standing_up() + if(layer == LYING_MOB_LAYER) + layer = initial(layer) + density = initial(density) // We were prone before, so we become dense and things can bump into us again. + REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, LYING_DOWN_TRAIT) + REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, LYING_DOWN_TRAIT) + //Recursive function to find everything a mob is holding. Really shitty proc tbh. @@ -596,7 +614,6 @@ set_suicide(FALSE) set_stat(UNCONSCIOUS) //the mob starts unconscious, updatehealth() //then we check if the mob should wake up. - update_mobility() update_sight() clear_alert("not_enough_oxy") reload_fullscreen() @@ -609,16 +626,15 @@ INVOKE_ASYNC(src, .proc/emote, "gasp") log_combat(src, src, "revived") -/mob/living/proc/remove_CC(should_update_mobility = TRUE) - SetStun(0, FALSE) - SetKnockdown(0, FALSE) - SetImmobilized(0, FALSE) - SetParalyzed(0, FALSE) - SetSleeping(0, FALSE) +/mob/living/proc/remove_CC() + SetStun(0) + SetKnockdown(0) + SetImmobilized(0) + SetParalyzed(0) + SetSleeping(0) setStaminaLoss(0) - SetUnconscious(0, FALSE) - if(should_update_mobility) - update_mobility() + SetUnconscious(0) + /mob/living/Crossed(atom/movable/AM) . = ..() @@ -635,7 +651,7 @@ setToxLoss(0, 0) //zero as second argument not automatically call updatehealth(). setOxyLoss(0, 0) setCloneLoss(0, 0) - remove_CC(FALSE) + remove_CC() set_disgust(0) losebreath = 0 radiation = 0 @@ -657,9 +673,9 @@ stuttering = 0 slurring = 0 jitteriness = 0 - update_mobility() stop_sound_channel(CHANNEL_HEARTBEAT) + //proc called by revive(), to check if we can actually ressuscitate the mob (we don't want to revive him and have him instantly die again) /mob/living/proc/can_be_revived() . = TRUE @@ -696,9 +712,10 @@ if(active_storage && !(CanReach(active_storage.parent,view_only = TRUE))) active_storage.close(src) - if(!(mobility_flags & MOBILITY_STAND) && !buckled && prob(getBruteLoss()*200/maxHealth)) + if(body_position == LYING_DOWN && !buckled && prob(getBruteLoss()*200/maxHealth)) makeTrail(newloc, T, old_direction) + ///Called by mob Move() when the lying_angle is different than zero, to better visually simulate crawling. /mob/living/proc/lying_angle_on_movement(direct) if(direct & EAST) @@ -985,8 +1002,8 @@ var/amplitude = min(4, (jitteriness/100) + 1) var/pixel_x_diff = rand(-amplitude, amplitude) var/pixel_y_diff = rand(-amplitude/3, amplitude/3) - var/final_pixel_x = get_standard_pixel_x_offset(!(mobility_flags & MOBILITY_STAND)) - var/final_pixel_y = get_standard_pixel_y_offset(!(mobility_flags & MOBILITY_STAND)) + var/final_pixel_x = get_standard_pixel_x_offset(body_position == LYING_DOWN) + var/final_pixel_y = get_standard_pixel_y_offset(body_position == LYING_DOWN) animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6) animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2) setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life(). @@ -1215,12 +1232,7 @@ return ..() && !(buckled && buckled.buckle_prevents_pull) -//Updates lying and icons on robots, animals and brains. Needs to be refactored to use traits and update based on events. -/mob/living/proc/update_mobility() - return - - -///Called when mob changes from a standing position into a prone while lacking the ability to stand up at the moment, through update_mobility() +/// Called when mob changes from a standing position into a prone while lacking the ability to stand up at the moment. /mob/living/proc/on_fall() return @@ -1263,7 +1275,7 @@ if(.) if(client) reset_perspective() - update_mobility() //if the mob was asleep inside a container and then got forceMoved out we need to make them fall. + /mob/living/proc/update_z(new_z) // 1+ to register, null to unregister if (registered_z != new_z) @@ -1428,22 +1440,6 @@ if(lying_angle != lying_prev) update_transform() lying_prev = lying_angle - if(lying_angle != 0) //We are not standing up. - if(layer == initial(layer)) //to avoid things like hiding larvas. - layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs - if(. == 0) // We became prone and were not before. - ADD_TRAIT(src, TRAIT_UI_BLOCKED, LYING_DOWN_TRAIT) - ADD_TRAIT(src, TRAIT_PULL_BLOCKED, LYING_DOWN_TRAIT) - density = FALSE // We lose density and stop bumping passable dense things. - if(HAS_TRAIT(src, TRAIT_FLOORED) && !(dir & (NORTH|SOUTH))) - setDir(pick(NORTH, SOUTH)) // We are and look helpless. - else //We are prone. - if(layer == LYING_MOB_LAYER) - layer = initial(layer) - if(.) //We were prone before, so we become dense and things can bump into us again. - density = initial(density) - REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, LYING_DOWN_TRAIT) - REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, LYING_DOWN_TRAIT) /** @@ -1607,6 +1603,7 @@ ADD_TRAIT(src, TRAIT_FLOORED, UNCONSCIOUS_TRAIT) if(SOFT_CRIT) if(stat >= UNCONSCIOUS) + ADD_TRAIT(src, TRAIT_INCAPACITATED, TRAIT_KNOCKEDOUT) ADD_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_KNOCKEDOUT) //adding trait sources should come before removing to avoid unnecessary updates ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, TRAIT_KNOCKEDOUT) if(pulledby) @@ -1629,6 +1626,7 @@ if(pulledby) ADD_TRAIT(src, TRAIT_IMMOBILIZED, PULLED_WHILE_SOFTCRIT_TRAIT) //adding trait sources should come before removing to avoid unnecessary updates if(. >= UNCONSCIOUS) + REMOVE_TRAIT(src, TRAIT_INCAPACITATED, TRAIT_KNOCKEDOUT) REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_KNOCKEDOUT) REMOVE_TRAIT(src, TRAIT_HANDS_BLOCKED, TRAIT_KNOCKEDOUT) ADD_TRAIT(src, TRAIT_CRITICAL_CONDITION, STAT_TRAIT) @@ -1655,23 +1653,24 @@ . = buckled buckled = new_buckled if(buckled) - if(!.) - ADD_TRAIT(src, TRAIT_IMMOBILIZED, BUCKLED_TRAIT) - switch(buckled.buckle_lying) - if(NO_BUCKLE_LYING) // The buckle doesn't force a lying angle. - REMOVE_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) - return - if(0) // Forcing to a standing position. - REMOVE_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) - else // Forcing to a lying position. - ADD_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) - set_lying_angle(buckled.buckle_lying) - else if(.) // We unbuckled from something. + ADD_TRAIT(src, TRAIT_IMMOBILIZED, BUCKLED_TRAIT) + switch(buckled.buckle_lying) + if(NO_BUCKLE_LYING) // The buckle doesn't force a lying angle. + REMOVE_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) + if(0) // Forcing to a standing position. + REMOVE_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) + set_lying_angle(0) + else // Forcing to a lying position. + ADD_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) + set_body_position(LYING_DOWN) + set_lying_angle(buckled.buckle_lying) + else REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, BUCKLED_TRAIT) REMOVE_TRAIT(src, TRAIT_FLOORED, BUCKLED_TRAIT) - var/atom/movable/old_buckled = . - if(old_buckled.buckle_lying == 0 && resting) // The buckle forced us to stay up (like a chair) and our preference is set to resting... - set_lying_down() // ...so let's drop on the ground. + if(.) // We unbuckled from something. + var/atom/movable/old_buckled = . + if(old_buckled.buckle_lying == 0 && (resting || HAS_TRAIT(src, TRAIT_FLOORED))) // The buckle forced us to stay up (like a chair) + set_lying_down() // We want to rest or are otherwise floored, so let's drop on the ground. /mob/living/set_pulledby(new_pulledby) @@ -1781,3 +1780,42 @@ // Reset overeat duration. overeatduration = 0 + + +/// Changes the value of the [living/body_position] variable. +/mob/living/proc/set_body_position(new_value) + if(body_position == new_value) + return + . = body_position + body_position = new_value + if(new_value == LYING_DOWN) // From standing to lying down. + on_lying_down() + else // From lying down to standing up. + on_standing_up() + + +/// Proc to append behavior to the condition of being floored. Called when the condition starts. +/mob/living/proc/on_floored_start() + if(body_position == STANDING_UP) //force them on the ground + set_lying_angle(pick(90, 270)) + set_body_position(LYING_DOWN) + on_fall() + + +/// Proc to append behavior to the condition of being floored. Called when the condition ends. +/mob/living/proc/on_floored_end() + if(!resting) + get_up() + + +/// Proc to append behavior to the condition of being handsblocked. Called when the condition starts. +/mob/living/proc/on_handsblocked_start() + drop_all_held_items() + ADD_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_HANDS_BLOCKED) + ADD_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED) + + +/// Proc to append behavior to the condition of being handsblocked. Called when the condition ends. +/mob/living/proc/on_handsblocked_end() + REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_HANDS_BLOCKED) + REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 41bc32c042c..7b29c5570a3 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -168,7 +168,6 @@ visible_message("[user] grabs [src] by the neck!",\ "[user] grabs you by the neck!", "You hear aggressive shuffling!", null, user) to_chat(user, "You grab [src] by the neck!") - update_mobility() //we fall down if(!buckled && !density) Move(user.loc) if(GRAB_KILL) @@ -176,7 +175,6 @@ visible_message("[user] is strangling [src]!", \ "[user] is strangling you!", "You hear aggressive shuffling!", null, user) to_chat(user, "You're strangling [src]!") - update_mobility() //we fall down if(!buckled && !density) Move(user.loc) user.set_pull_offsets(src, grab_state) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 95a9589658c..a623846f0af 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -28,12 +28,20 @@ ///When the mob enters hard critical state and is fully incapacitated. var/hardcrit_threshold = HEALTH_THRESHOLD_FULLCRIT + /// Generic bitflags for boolean conditions at the [/mob/living] level. Keep this for inherent traits of living types, instead of runtime-changeable ones. + var/living_flags = NONE + + /// Flags that determine the potential of a mob to perform certain actions. Do not change this directly. var/mobility_flags = MOBILITY_FLAGS_DEFAULT var/resting = FALSE - VAR_PROTECTED/lying_angle = 0 ///number of degrees. DO NOT USE THIS IN CHECKS. CHECK FOR MOBILITY FLAGS INSTEAD!! - var/lying_prev = 0 ///last value of lying on update_mobility + /// Variable to track the body position of a mob, regardgless of the actual angle of rotation (usually matching it, but not necessarily). + var/body_position = STANDING_UP + /// Number of degrees of rotation of a mob. 0 means no rotation, up-side facing NORTH. 90 means up-side rotated to face EAST, and so on. + VAR_PROTECTED/lying_angle = 0 + /// Value of lying lying_angle before last change. TODO: Remove the need for this. + var/lying_prev = 0 var/hallucination = 0 ///Directly affects how long a mob will hallucinate for diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 7de2ecb3be0..fa809b563c6 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -2,6 +2,7 @@ . = ..() update_turf_movespeed(loc) + /mob/living/CanAllowThrough(atom/movable/mover, turf/target) . = ..() if((mover.pass_flags & PASSMOB)) @@ -10,12 +11,13 @@ var/obj/projectile/P = mover return !P.can_hit_target(src, P.permutated, src == P.original, TRUE) if(mover.throwing) - return (!density || !(mobility_flags & MOBILITY_STAND) || (mover.throwing.thrower == src && !ismob(mover))) + return (!density || body_position == LYING_DOWN || (mover.throwing.thrower == src && !ismob(mover))) if(buckled == mover) return TRUE if(ismob(mover) && (mover in buckled_mobs)) return TRUE - return (!mover.density || . || !(mobility_flags & MOBILITY_STAND)) + return . || !mover.density || body_position == LYING_DOWN + /mob/living/toggle_move_intent() . = ..() @@ -34,11 +36,12 @@ else remove_movespeed_modifier(/datum/movespeed_modifier/turf_slowdown) + /mob/living/proc/update_pull_movespeed() if(pulling) if(isliving(pulling)) var/mob/living/L = pulling - if(!slowed_by_drag || (L.mobility_flags & MOBILITY_STAND) || L.buckled || grab_state >= GRAB_AGGRESSIVE) + if(!slowed_by_drag || L.body_position == STANDING_UP || L.buckled || grab_state >= GRAB_AGGRESSIVE) remove_movespeed_modifier(/datum/movespeed_modifier/bulky_drag) return add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/bulky_drag, multiplicative_slowdown = PULL_PRONE_SLOWDOWN) @@ -52,6 +55,7 @@ return remove_movespeed_modifier(/datum/movespeed_modifier/bulky_drag) + /mob/living/can_zFall(turf/T, levels) return ..() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 1ef24f3fb43..7f399c67eb1 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -19,7 +19,6 @@ icon_state = "ai" move_resist = MOVE_FORCE_OVERPOWERING density = TRUE - mobility_flags = ALL status_flags = CANSTUN|CANPUSH a_intent = INTENT_HARM //so we always get pushed instead of trying to swap sight = SEE_TURFS | SEE_MOBS | SEE_OBJS @@ -171,6 +170,7 @@ builtInCamera.network = list("ss13") ADD_TRAIT(src, TRAIT_PULL_BLOCKED, ROUNDSTART_TRAIT) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, ROUNDSTART_TRAIT) /mob/living/silicon/ai/key_down(_key, client/user) @@ -378,12 +378,6 @@ to_chat(src, "You are now [is_anchored ? "" : "un"]anchored.") // the message in the [] will change depending whether or not the AI is anchored -/mob/living/silicon/ai/update_mobility() //If the AI dies, mobs won't go through it anymore - if(stat != CONSCIOUS) - mobility_flags = NONE - else - mobility_flags = ALL - /mob/living/silicon/ai/Topic(href, href_list) ..() @@ -1044,3 +1038,10 @@ ADD_TRAIT(src, TRAIT_INCAPACITATED, POWER_LACK_TRAIT) else if(.) REMOVE_TRAIT(src, TRAIT_INCAPACITATED, POWER_LACK_TRAIT) + + +/mob/living/silicon/on_handsblocked_start() + return // AIs have no hands + +/mob/living/silicon/on_handsblocked_end() + return // AIs have no hands diff --git a/code/modules/mob/living/silicon/pai/death.dm b/code/modules/mob/living/silicon/pai/death.dm index fd5e049e67f..6adcb4949cd 100644 --- a/code/modules/mob/living/silicon/pai/death.dm +++ b/code/modules/mob/living/silicon/pai/death.dm @@ -2,7 +2,6 @@ if(stat == DEAD) return set_stat(DEAD) - mobility_flags = NONE update_sight() clear_fullscreens() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index d7b8b0bc1b7..b2d06b70d9b 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -149,6 +149,11 @@ emittersemicd = TRUE addtimer(CALLBACK(src, .proc/emittercool), 600) + if(!holoform) + ADD_TRAIT(src, TRAIT_IMMOBILIZED, PAI_FOLDED) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, PAI_FOLDED) + + /mob/living/silicon/pai/proc/pdaconfig() //PDA aiPDA = new/obj/item/pda/ai(src) @@ -265,7 +270,7 @@ /datum/action/innate/pai/rest/Trigger() ..() - P.lay_down() + P.toggle_resting() /datum/action/innate/pai/light name = "Toggle Integrated Lights" diff --git a/code/modules/mob/living/silicon/pai/pai_shell.dm b/code/modules/mob/living/silicon/pai/pai_shell.dm index 6c399f052d3..4150f4bb037 100644 --- a/code/modules/mob/living/silicon/pai/pai_shell.dm +++ b/code/modules/mob/living/silicon/pai/pai_shell.dm @@ -18,7 +18,8 @@ emittersemicd = TRUE addtimer(CALLBACK(src, .proc/emittercool), emittercd) - mobility_flags = MOBILITY_FLAGS_DEFAULT + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, PAI_FOLDED) + REMOVE_TRAIT(src, TRAIT_HANDS_BLOCKED, PAI_FOLDED) density = TRUE if(istype(card.loc, /obj/item/pda)) var/obj/item/pda/P = card.loc @@ -64,7 +65,8 @@ var/turf/T = drop_location() card.forceMove(T) forceMove(card) - mobility_flags = NONE + ADD_TRAIT(src, TRAIT_IMMOBILIZED, PAI_FOLDED) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, PAI_FOLDED) density = FALSE set_light(0) holoform = FALSE diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 161201a4ed0..48fdc82d8d6 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -88,11 +88,3 @@ add_overlay(fire_overlay) else cut_overlay(fire_overlay) - -/mob/living/silicon/robot/update_mobility() - if(HAS_TRAIT(src, TRAIT_IMMOBILIZED)) - mobility_flags &= ~MOBILITY_MOVE - else - mobility_flags = MOBILITY_FLAGS_DEFAULT - update_transform() - update_action_buttons_icon() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ecc1933cf30..aa34e4346f2 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -164,7 +164,7 @@ mmi.brain.organ_flags |= ORGAN_FROZEN mmi.brain.name = "[real_name]'s brain" mmi.name = "[initial(mmi.name)]: [real_name]" - mmi.brainmob = new(mmi) + mmi.set_brainmob(new /mob/living/brain(mmi)) mmi.brainmob.name = src.real_name mmi.brainmob.real_name = src.real_name mmi.brainmob.container = mmi @@ -510,7 +510,6 @@ ADD_TRAIT(src, TRAIT_IMMOBILIZED, LOCKED_BORG_TRAIT) else if(.) REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, LOCKED_BORG_TRAIT) - update_mobility() logevent("System lockdown [lockcharge?"triggered":"released"].") @@ -812,7 +811,6 @@ set_stat(UNCONSCIOUS) else set_stat(CONSCIOUS) - update_mobility() diag_hud_set_status() diag_hud_set_health() diag_hud_set_aishell() diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index c5a6e2e05fc..d9e841d5f69 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -249,7 +249,7 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) if (M.a_intent == INTENT_DISARM) - if(mobility_flags & MOBILITY_STAND) + if(body_position == STANDING_UP) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) var/obj/item/I = get_active_held_item() if(I) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 8dabac31912..6c9de851325 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -425,3 +425,15 @@ /mob/living/silicon/rust_heretic_act() adjustBruteLoss(500) + +/mob/living/silicon/on_floored_start() + return // Silicons are always standing by default. + +/mob/living/silicon/on_floored_end() + return // Silicons are always standing by default. + +/mob/living/silicon/on_lying_down() + return // Silicons are always standing by default. + +/mob/living/silicon/on_standing_up() + return // Silicons are always standing by default. diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 8bdfab537d7..b439c4b9a58 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -129,7 +129,9 @@ if(stat) return FALSE on = TRUE - update_mobility() + REMOVE_TRAIT(src, TRAIT_INCAPACITATED, POWER_LACK_TRAIT) + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, POWER_LACK_TRAIT) + REMOVE_TRAIT(src, TRAIT_HANDS_BLOCKED, POWER_LACK_TRAIT) set_light_on(on) update_icon() to_chat(src, "You turned on!") @@ -138,7 +140,9 @@ /mob/living/simple_animal/bot/proc/turn_off() on = FALSE - update_mobility() + ADD_TRAIT(src, TRAIT_INCAPACITATED, POWER_LACK_TRAIT) + ADD_TRAIT(src, TRAIT_IMMOBILIZED, POWER_LACK_TRAIT) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, POWER_LACK_TRAIT) set_light_on(on) bot_reset() //Resets an AI's call, should it exist. to_chat(src, "You turned off!") @@ -176,10 +180,6 @@ path_hud.add_to_hud(src) path_hud.add_hud_to(src) -/mob/living/simple_animal/bot/update_mobility() - . = ..() - if(!on) - mobility_flags = NONE /mob/living/simple_animal/bot/Destroy() if(path_hud) diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 04a816e098a..9061f4680cb 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -190,7 +190,7 @@ /mob/living/simple_animal/bot/cleanbot/process_scan(atom/A) if(iscarbon(A)) var/mob/living/carbon/C = A - if(C.stat != DEAD && !(C.mobility_flags & MOBILITY_STAND)) + if(C.stat != DEAD && C.body_position == LYING_DOWN) return C else if(is_type_in_typecache(A, target_types)) return A diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index fba1b774c05..aba6b6c0644 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -93,7 +93,7 @@ if(!on) icon_state = "medibot0" return - if(IsStun() || IsParalyzed()) + if(HAS_TRAIT(src, TRAIT_INCAPACITATED)) icon_state = "medibota" return if(mode == BOT_HEALING) @@ -116,9 +116,6 @@ if(damagetype_healer == "all") return -/mob/living/simple_animal/bot/medbot/update_mobility() - . = ..() - update_icon() /mob/living/simple_animal/bot/medbot/bot_reset() ..() @@ -245,7 +242,7 @@ return /mob/living/simple_animal/bot/medbot/proc/tip_over(mob/user) - mobility_flags &= ~MOBILITY_MOVE + ADD_TRAIT(src, TRAIT_IMMOBILIZED, BOT_TIPPED_OVER) playsound(src, 'sound/machines/warning-buzzer.ogg', 50) user.visible_message("[user] tips over [src]!", "You tip [src] over!") mode = BOT_TIPPED @@ -254,7 +251,7 @@ tipper_name = user.name /mob/living/simple_animal/bot/medbot/proc/set_right(mob/user) - mobility_flags |= MOBILITY_MOVE + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, BOT_TIPPED_OVER) var/list/messagevoice if(user) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 63420e2d0f4..7101a2f1920 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -122,10 +122,6 @@ /mob/living/simple_animal/bot/mulebot/proc/has_power(bypass_open_check) return (!open || bypass_open_check) && cell && cell.charge > 0 && (!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2)) -/mob/living/simple_animal/bot/mulebot/update_mobility() - . = ..() - if(!on) - mobility_flags |= MOBILITY_STAND //base bots removes all mobility flags when turned off, resulting in the bot becoming passable. we don't want this since it's a large device that should block things. /mob/living/simple_animal/bot/mulebot/proc/set_id(new_id) id = new_id @@ -419,7 +415,7 @@ if (!istype(L)) return - if(user.incapacitated() || (istype(L) && !(L.mobility_flags & MOBILITY_STAND))) + if(user.incapacitated() || (istype(L) && L.body_position == LYING_DOWN)) return if(!istype(AM) || isdead(AM) || iscameramob(AM) || istype(AM, /obj/effect/dummy/phased_mob)) @@ -834,7 +830,7 @@ /mob/living/simple_animal/bot/mulebot/paranormal/MouseDrop_T(atom/movable/AM, mob/user) var/mob/living/L = user - if(user.incapacitated() || (istype(L) && !(L.mobility_flags & MOBILITY_STAND))) + if(user.incapacitated() || (istype(L) && L.body_position == LYING_DOWN)) return if(!istype(AM) || iscameramob(AM) || istype(AM, /obj/effect/dummy/phased_mob)) //allows ghosts! diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 6c84c10106b..4408bfcb707 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -47,22 +47,12 @@ /mob/living/simple_animal/pet/cat/Initialize() . = ..() - add_verb(src, /mob/living/proc/lay_down) + add_verb(src, /mob/living/proc/toggle_resting) add_cell_sample() /mob/living/simple_animal/pet/cat/add_cell_sample() AddElement(/datum/element/swabable, CELL_LINE_TABLE_CAT, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) -/mob/living/simple_animal/pet/cat/update_mobility() - ..() - if(client && stat != DEAD) - if (resting) - icon_state = "[icon_living]_rest" - collar_type = "[initial(collar_type)]_rest" - else - icon_state = "[icon_living]" - collar_type = "[initial(collar_type)]" - regenerate_icons() /mob/living/simple_animal/pet/cat/space name = "space cat" @@ -198,23 +188,33 @@ gold_core_spawnable = NO_SPAWN unique_pet = TRUE + +/mob/living/simple_animal/pet/cat/update_resting() + . = ..() + if(stat == DEAD) + return + if (resting) + icon_state = "[icon_living]_rest" + collar_type = "[initial(collar_type)]_rest" + else + icon_state = "[icon_living]" + collar_type = "[initial(collar_type)]" + regenerate_icons() + + /mob/living/simple_animal/pet/cat/Life() if(!stat && !buckled && !client) if(prob(1)) manual_emote(pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) - icon_state = "[icon_living]_rest" - collar_type = "[initial(collar_type)]_rest" set_resting(TRUE) else if (prob(1)) manual_emote(pick("sits down.", "crouches on its hind legs.", "looks alert.")) + set_resting(TRUE) icon_state = "[icon_living]_sit" collar_type = "[initial(collar_type)]_sit" - set_resting(TRUE) else if (prob(1)) if (resting) manual_emote(pick("gets up and meows.", "walks around.", "stops resting.")) - icon_state = "[icon_living]" - collar_type = "[initial(collar_type)]" set_resting(FALSE) else manual_emote(pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index 51577f9bae0..a15a3d4216c 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -183,7 +183,7 @@ /mob/living/simple_animal/hostile/bear/butter/AttackingTarget() //Makes some attacks by the butter bear slip those who dare cross its path. if(isliving(target)) var/mob/living/L = target - if((L.mobility_flags & MOBILITY_STAND)) + if((L.body_position == STANDING_UP)) L.Knockdown(20) playsound(loc, 'sound/misc/slip.ogg', 15) L.visible_message("[L] slips on butter!") diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index fc8a73f62a4..8c74539e102 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -596,8 +596,8 @@ /** * Proc that handles a charge attack windup for a mob. */ -/mob/living/simple_animal/hostile/proc/enter_charge(var/atom/target) - if((mobility_flags & (MOBILITY_MOVE | MOBILITY_STAND)) != (MOBILITY_MOVE | MOBILITY_STAND) || charge_state) +/mob/living/simple_animal/hostile/proc/enter_charge(atom/target) + if(charge_state || body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_IMMOBILIZED)) return FALSE if(!(COOLDOWN_FINISHED(src, charge_cooldown)) || !has_gravity() || !target.has_gravity()) @@ -608,7 +608,7 @@ /** * Proc that throws the mob at the target after the windup. */ -/mob/living/simple_animal/hostile/proc/handle_charge_target(var/atom/target) +/mob/living/simple_animal/hostile/proc/handle_charge_target(atom/target) charge_state = TRUE throw_at(target, charge_distance, 1, src, FALSE, TRUE, callback = CALLBACK(src, .proc/charge_end)) COOLDOWN_START(src, charge_cooldown, charge_frequency) @@ -639,14 +639,12 @@ L.visible_message("[src] charges on [L]!", "[src] charges into you!") L.Knockdown(knockdown_time) else - Stun((knockdown_time * 2), 1, 1) + Stun((knockdown_time * 2), ignore_canstun = TRUE) charge_end() else if(hit_atom.density && !hit_atom.CanPass(src)) visible_message("[src] smashes into [hit_atom]!") - Stun((knockdown_time * 2), 1, 1) + Stun((knockdown_time * 2), ignore_canstun = TRUE) if(charge_state) charge_state = FALSE update_icons() - update_mobility() - diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 1ba16102b3c..44f1e6bc64d 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -321,13 +321,12 @@ Difficulty: Hard return TRUE return FALSE + /mob/living/simple_animal/hostile/megafauna/bubblegum/proc/be_aggressive() if(BUBBLEGUM_IS_ENRAGED) return TRUE - if(isliving(target)) - var/mob/living/livingtarget = target - return (livingtarget.stat != CONSCIOUS || !(livingtarget.mobility_flags & MOBILITY_STAND)) - return FALSE + return isliving(target) && HAS_TRAIT(target, TRAIT_INCAPACITATED) + /mob/living/simple_animal/hostile/megafauna/bubblegum/proc/get_retreat_distance() return (be_aggressive() ? null : initial(retreat_distance)) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 01e4ba71320..0b1d96dd814 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -4,7 +4,7 @@ health = 20 maxHealth = 20 gender = PLURAL //placeholder - + living_flags = MOVES_ON_ITS_OWN status_flags = CANPUSH var/icon_living = "" @@ -481,15 +481,16 @@ /mob/living/simple_animal/extinguish_mob() return + /mob/living/simple_animal/revive(full_heal = FALSE, admin_revive = FALSE) - if(..()) //successfully ressuscitated from death - icon = initial(icon) - icon_state = icon_living - density = initial(density) - mobility_flags = MOBILITY_FLAGS_DEFAULT - update_mobility() - . = TRUE - setMovetype(initial(movement_type)) + . = ..() + if(!.) + return + icon = initial(icon) + icon_state = icon_living + density = initial(density) + setMovetype(initial(movement_type)) + /mob/living/simple_animal/proc/make_babies() // <3 <3 <3 if(gender != FEMALE || stat || next_scan_time > world.time || !childtype || !animal_species || !SSticker.IsRoundInProgress()) @@ -552,23 +553,6 @@ return ..() -/mob/living/simple_animal/update_mobility(value_otherwise = TRUE) - if(HAS_TRAIT_NOT_FROM(src, TRAIT_IMMOBILIZED, BUCKLED_TRAIT)) - drop_all_held_items() - mobility_flags = NONE - else if(buckled) - mobility_flags = MOBILITY_FLAGS_INTERACTION - else - if(value_otherwise) - mobility_flags = MOBILITY_FLAGS_DEFAULT - else - mobility_flags = NONE - if(!(mobility_flags & MOBILITY_MOVE)) - walk(src, 0) //stop mid walk - - update_transform() - update_action_buttons_icon() - /mob/living/simple_animal/update_transform() var/matrix/ntransform = matrix(transform) //aka transform.Copy() var/changed = FALSE diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 539787a6827..4aeba9b5cda 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -2,7 +2,6 @@ /mob/living/simple_animal/slime var/AIproc = 0 // determines if the AI loop is activated var/Atkcool = 0 // attack cooldown - var/Tempstun = 0 // temporary temperature stuns var/Discipline = 0 // if a slime has been hit with a freeze gun, or wrestled/attacked off a human, they become disciplined and don't attack anymore for a while var/SStun = 0 // stun variable @@ -75,7 +74,7 @@ if(Target.Adjacent(src)) Target.attack_slime(src) break - if((Target.mobility_flags & MOBILITY_STAND) && prob(80)) + if((Target.body_position == STANDING_UP) && prob(80)) if(Target.client && Target.health >= 20) if(!Atkcool) @@ -125,7 +124,9 @@ if(bodytemperature < (T0C + 5)) // start calculating temperature damage etc if(bodytemperature <= (T0C - 40)) // stun temperature - Tempstun = 1 + ADD_TRAIT(src, TRAIT_IMMOBILIZED, SLIME_COLD) + else + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, SLIME_COLD) if(bodytemperature <= (T0C - 50)) // hurt temperature if(bodytemperature <= 50) // sqrting negative numbers is bad @@ -133,7 +134,7 @@ else adjustBruteLoss(round(sqrt(bodytemperature)) * 2) else - Tempstun = 0 + REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, SLIME_COLD) if(stat != DEAD) var/bz_percentage =0 @@ -148,13 +149,11 @@ set_stat(UNCONSCIOUS) powerlevel = 0 rabid = FALSE - update_mobility() regenerate_icons() if(UNCONSCIOUS, HARD_CRIT) if(!stasis) to_chat(src, "You wake up from the stasis.") set_stat(CONSCIOUS) - update_mobility() regenerate_icons() updatehealth() @@ -266,11 +265,6 @@ /mob/living/simple_animal/slime/proc/handle_targets() - update_mobility() - if(Tempstun) - if(!buckled) // not while they're eating! - mobility_flags &= ~MOBILITY_MOVE - if(attacked > 50) attacked = 50 @@ -367,13 +361,13 @@ if (Leader) if(holding_still) holding_still = max(holding_still - 1, 0) - else if((mobility_flags & MOBILITY_MOVE) && isturf(loc)) + else if(!HAS_TRAIT(src, TRAIT_IMMOBILIZED) && isturf(loc)) step_to(src, Leader) else if(hungry) if (holding_still) holding_still = max(holding_still - hungry, 0) - else if((mobility_flags & MOBILITY_MOVE) && isturf(loc) && prob(50)) + else if(!HAS_TRAIT(src, TRAIT_IMMOBILIZED) && isturf(loc) && prob(50)) step(src, pick(GLOB.cardinals)) else @@ -381,7 +375,7 @@ holding_still = max(holding_still - 1, 0) else if (docile && pulledby) holding_still = 10 - else if((mobility_flags & MOBILITY_MOVE) && isturf(loc) && prob(33)) + else if(!HAS_TRAIT(src, TRAIT_IMMOBILIZED) && isturf(loc) && prob(33)) step(src, pick(GLOB.cardinals)) else if(!AIproc) INVOKE_ASYNC(src, .proc/AIprocess) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index fa72346f07a..790445b9d55 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -463,16 +463,17 @@ SStun = world.time + rand(20,60) - mobility_flags &= ~MOBILITY_MOVE + Stun(3) if(user) step_away(src,user,15) - addtimer(CALLBACK(src, .proc/slime_move, user), 3) + addtimer(CALLBACK(src, .proc/slime_move, user), 0.3 SECONDS) + /mob/living/simple_animal/slime/proc/slime_move(mob/user) if(user) step_away(src,user,15) - update_mobility() + /mob/living/simple_animal/slime/pet docile = 1 diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index c6b839e52dc..4fe6209c98e 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -14,8 +14,8 @@ return S.duration - world.time return 0 -/mob/living/proc/Stun(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/Stun(amount, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -24,11 +24,11 @@ if(S) S.duration = max(world.time + amount, S.duration) else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating) + S = apply_status_effect(STATUS_EFFECT_STUN, amount) return S -/mob/living/proc/SetStun(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/SetStun(amount, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/stun/S = IsStun() @@ -41,11 +41,11 @@ if(S) S.duration = world.time + amount else - S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating) + S = apply_status_effect(STATUS_EFFECT_STUN, amount) return S -/mob/living/proc/AdjustStun(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustStun(amount, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -54,7 +54,7 @@ if(S) S.duration += amount else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating) + S = apply_status_effect(STATUS_EFFECT_STUN, amount) return S ///////////////////////////////// KNOCKDOWN ///////////////////////////////////// @@ -68,8 +68,8 @@ return K.duration - world.time return 0 -/mob/living/proc/Knockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/Knockdown(amount, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -78,11 +78,11 @@ if(K) K.duration = max(world.time + amount, K.duration) else if(amount > 0) - K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) + K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount) return K -/mob/living/proc/SetKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/SetKnockdown(amount, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() @@ -95,11 +95,11 @@ if(K) K.duration = world.time + amount else - K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) + K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount) return K -/mob/living/proc/AdjustKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustKnockdown(amount, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -108,7 +108,7 @@ if(K) K.duration += amount else if(amount > 0) - K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) + K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount) return K ///////////////////////////////// IMMOBILIZED //////////////////////////////////// @@ -121,8 +121,8 @@ return I.duration - world.time return 0 -/mob/living/proc/Immobilize(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/Immobilize(amount, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -131,11 +131,11 @@ if(I) I.duration = max(world.time + amount, I.duration) else if(amount > 0) - I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount) return I -/mob/living/proc/SetImmobilized(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/SetImmobilized(amount, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized() @@ -148,11 +148,11 @@ if(I) I.duration = world.time + amount else - I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount) return I -/mob/living/proc/AdjustImmobilized(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustImmobilized(amount, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -161,7 +161,7 @@ if(I) I.duration += amount else if(amount > 0) - I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount) return I ///////////////////////////////// PARALYZED ////////////////////////////////// @@ -174,8 +174,8 @@ return P.duration - world.time return 0 -/mob/living/proc/Paralyze(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/Paralyze(amount, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -184,11 +184,11 @@ if(P) P.duration = max(world.time + amount, P.duration) else if(amount > 0) - P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount) return P -/mob/living/proc/SetParalyzed(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/SetParalyzed(amount, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE) @@ -201,11 +201,11 @@ if(P) P.duration = world.time + amount else - P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount) return P -/mob/living/proc/AdjustParalyzed(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustParalyzed(amount, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) @@ -214,33 +214,30 @@ if(P) P.duration += amount else if(amount > 0) - P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount) return P //Blanket -/mob/living/proc/AllImmobility(amount, updating) - Paralyze(amount, FALSE) - Knockdown(amount, FALSE) - Stun(amount, FALSE) - Immobilize(amount, FALSE) - if(updating) - update_mobility() +/mob/living/proc/AllImmobility(amount) + Paralyze(amount) + Knockdown(amount) + Stun(amount) + Immobilize(amount) -/mob/living/proc/SetAllImmobility(amount, updating) - SetParalyzed(amount, FALSE) - SetKnockdown(amount, FALSE) - SetStun(amount, FALSE) - SetImmobilized(amount, FALSE) - if(updating) - update_mobility() -/mob/living/proc/AdjustAllImmobility(amount, updating) - AdjustParalyzed(amount, FALSE) - AdjustKnockdown(amount, FALSE) - AdjustStun(amount, FALSE) - AdjustImmobilized(amount, FALSE) - if(updating) - update_mobility() +/mob/living/proc/SetAllImmobility(amount) + SetParalyzed(amount) + SetKnockdown(amount) + SetStun(amount) + SetImmobilized(amount) + + +/mob/living/proc/AdjustAllImmobility(amount) + AdjustParalyzed(amount) + AdjustKnockdown(amount) + AdjustStun(amount) + AdjustImmobilized(amount) + //////////////////UNCONSCIOUS /mob/living/proc/IsUnconscious() //If we're unconscious @@ -252,19 +249,19 @@ return U.duration - world.time return 0 -/mob/living/proc/Unconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/Unconscious(amount, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() if(U) U.duration = max(world.time + amount, U.duration) else if(amount > 0) - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount) return U -/mob/living/proc/SetUnconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/SetUnconscious(amount, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() @@ -274,18 +271,18 @@ else if(U) U.duration = world.time + amount else - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount) return U -/mob/living/proc/AdjustUnconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustUnconscious(amount, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, ignore_canstun) & COMPONENT_NO_STUN) return if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() if(U) U.duration += amount else if(amount > 0) - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount) return U /////////////////////////////////// SLEEPING //////////////////////////////////// @@ -300,18 +297,18 @@ return S.duration - world.time return 0 -/mob/living/proc/Sleeping(amount, updating = TRUE) //Can't go below remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating) & COMPONENT_NO_STUN) +/mob/living/proc/Sleeping(amount) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount) & COMPONENT_NO_STUN) return var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() if(S) S.duration = max(world.time + amount, S.duration) else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount) return S -/mob/living/proc/SetSleeping(amount, updating = TRUE) //Sets remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating) & COMPONENT_NO_STUN) +/mob/living/proc/SetSleeping(amount) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount) & COMPONENT_NO_STUN) return var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() if(amount <= 0) @@ -320,28 +317,28 @@ else if(S) S.duration = world.time + amount else - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount) return S -/mob/living/proc/AdjustSleeping(amount, updating = TRUE) //Adds to remaining duration - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating) & COMPONENT_NO_STUN) +/mob/living/proc/AdjustSleeping(amount) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount) & COMPONENT_NO_STUN) return var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() if(S) S.duration += amount else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount) return S ///Allows us to set a permanent sleep on a player (use with caution and remember to unset it with SetSleeping() after the effect is over) -/mob/living/proc/PermaSleeping(updating = TRUE) - if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, -1, updating) & COMPONENT_NO_STUN) +/mob/living/proc/PermaSleeping() + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, -1) & COMPONENT_NO_STUN) return var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() if(S) S.duration = -1 else - S = apply_status_effect(STATUS_EFFECT_SLEEPING, -1, updating) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, -1) return S ///////////////////////////////// FROZEN ///////////////////////////////////// diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index c12c980a82f..2f4db366c67 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -441,7 +441,8 @@ if (notransform) return notransform = TRUE - mobility_flags = NONE + ADD_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_GENERIC) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, TRAIT_GENERIC) for(var/obj/item/W in src) dropItemToGround(W) regenerate_icons() @@ -472,7 +473,8 @@ if (notransform) return notransform = TRUE - mobility_flags = NONE + ADD_TRAIT(src, TRAIT_IMMOBILIZED, TRAIT_GENERIC) + ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, TRAIT_GENERIC) for(var/obj/item/W in src) dropItemToGround(W) regenerate_icons() diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm index 0a6f35a8cd7..4f5c69e5fb0 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm @@ -11,7 +11,6 @@ H.SetParalyzed(0) H.adjustStaminaLoss(-75) H.stuttering = 0 - H.update_mobility() H.reagents.add_reagent(/datum/reagent/medicine/stimulants, 5) H.say(pick("A CORNERED FOX IS MORE DANGEROUS THAN A JACKAL!","HURT ME MOOORRREEE!","IMPRESSIVE!"), forced = "ninjaboost") a_boost-- diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index a6116729221..8c844b6ef0a 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -629,10 +629,11 @@ return FALSE else var/mob/living/L = target - if(!direct_target) - var/checking = MOBILITY_USE | MOBILITY_STAND | MOBILITY_MOVE - if((!hit_stunned_targets && !(L.mobility_flags & checking)) || L.stat == DEAD) // If target not able to use items, move and stand - or if they're just dead, pass over. - return FALSE + if(direct_target) + return TRUE + // If target not able to use items, move and stand - or if they're just dead, pass over. + if(L.stat == DEAD || (!hit_stunned_targets && HAS_TRAIT(L, TRAIT_IMMOBILIZED) && HAS_TRAIT(L, TRAIT_FLOORED) && HAS_TRAIT(L, TRAIT_HANDS_BLOCKED))) + return FALSE return TRUE //Spread is FORCED! diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index ce02ded8ea7..1deb8067f8e 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -159,7 +159,8 @@ return M.notransform = TRUE - M.mobility_flags = NONE + ADD_TRAIT(M, TRAIT_IMMOBILIZED, MAGIC_TRAIT) + ADD_TRAIT(M, TRAIT_HANDS_BLOCKED, MAGIC_TRAIT) M.icon = null M.cut_overlays() M.invisibility = INVISIBILITY_ABSTRACT diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index d99994847a5..98a691fdb6c 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -428,7 +428,6 @@ addiction_tick++ if(C && need_mob_update) //some of the metabolized reagents had effects on the mob that requires some updates. C.updatehealth() - C.update_mobility() C.update_stamina() update_total() diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 9113550bcd3..0c301f0b8ff 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -144,7 +144,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/kahlua/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) if(!HAS_TRAIT(M, TRAIT_ALCOHOL_TOLERANCE)) M.Jitter(5) ..() @@ -1325,10 +1325,10 @@ All effects don't start immediately, but rather get worse over time; the rate is M.slurring += 3 switch(current_cycle) if(51 to 200) - M.Sleeping(100, FALSE) + M.Sleeping(100) . = 1 if(201 to INFINITY) - M.AdjustSleeping(40, FALSE) + M.AdjustSleeping(40) M.adjustToxLoss(2, 0) . = 1 ..() diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index d0df0ce2222..e357d188650 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -263,7 +263,7 @@ /datum/reagent/consumable/coffee/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) //310.15 is the normal bodytemp. M.adjust_bodytemperature(25 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, M.get_body_temp_normal()) if(M.has_reagent(/datum/reagent/consumable/frostoil)) @@ -285,7 +285,7 @@ M.dizziness = max(0,M.dizziness-2) M.drowsyness = max(0,M.drowsyness-1) M.jitteriness = max(0,M.jitteriness-3) - M.AdjustSleeping(-20, FALSE) + M.AdjustSleeping(-20) if(M.getToxLoss() && prob(20)) M.adjustToxLoss(-1, 0) M.adjust_bodytemperature(20 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, M.get_body_temp_normal()) @@ -332,7 +332,7 @@ /datum/reagent/consumable/icecoffee/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) M.Jitter(5) ..() @@ -351,7 +351,7 @@ /datum/reagent/consumable/hot_ice_coffee/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.AdjustSleeping(-60, FALSE) + M.AdjustSleeping(-60) M.adjust_bodytemperature(-7 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) M.Jitter(5) M.adjustToxLoss(1*REM, 0) @@ -371,7 +371,7 @@ /datum/reagent/consumable/icetea/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-2) M.drowsyness = max(0,M.drowsyness-1) - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) if(M.getToxLoss() && prob(20)) M.adjustToxLoss(-1, 0) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) @@ -415,7 +415,7 @@ M.set_drugginess(30) M.dizziness +=1.5 M.drowsyness = 0 - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) ..() . = 1 @@ -442,7 +442,7 @@ M.Jitter(20) M.dizziness +=1 M.drowsyness = 0 - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) ..() @@ -457,7 +457,7 @@ /datum/reagent/consumable/spacemountainwind/on_mob_life(mob/living/carbon/M) M.drowsyness = max(0,M.drowsyness-7) - M.AdjustSleeping(-20, FALSE) + M.AdjustSleeping(-20) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) M.Jitter(5) ..() @@ -576,7 +576,7 @@ /datum/reagent/consumable/tonic/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) ..() . = 1 @@ -595,7 +595,7 @@ M.Jitter(20) M.dizziness +=1 M.drowsyness = 0 - M.AdjustSleeping(-40, FALSE) + M.AdjustSleeping(-40) M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal()) ..() @@ -640,7 +640,7 @@ /datum/reagent/consumable/soy_latte/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.SetSleeping(0, FALSE) + M.SetSleeping(0) M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, M.get_body_temp_normal()) M.Jitter(5) if(M.getBruteLoss() && prob(20)) @@ -661,7 +661,7 @@ /datum/reagent/consumable/cafe_latte/on_mob_life(mob/living/carbon/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - M.SetSleeping(0, FALSE) + M.SetSleeping(0) M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, M.get_body_temp_normal()) M.Jitter(5) if(M.getBruteLoss() && prob(20)) diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 383714fdbea..e0bf63862ab 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -17,7 +17,7 @@ /datum/reagent/drug/space_drugs/on_mob_life(mob/living/carbon/M) M.set_drugginess(15) if(isturf(M.loc) && !isspaceturf(M.loc)) - if(M.mobility_flags & MOBILITY_MOVE) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED)) if(prob(10)) step(M, pick(GLOB.cardinals)) if(prob(7)) @@ -56,11 +56,11 @@ var/smoke_message = pick("You feel relaxed.", "You feel calmed.","You feel alert.","You feel rugged.") to_chat(M, "[smoke_message]") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "smoked", /datum/mood_event/smoked, name) - M.AdjustStun(-5, FALSE) - M.AdjustKnockdown(-5, FALSE) - M.AdjustUnconscious(-5, FALSE) - M.AdjustParalyzed(-5, FALSE) - M.AdjustImmobilized(-5, FALSE) + M.AdjustStun(-5) + M.AdjustKnockdown(-5) + M.AdjustUnconscious(-5) + M.AdjustParalyzed(-5) + M.AdjustImmobilized(-5) ..() . = 1 @@ -83,11 +83,11 @@ var/high_message = pick("You feel jittery.", "You feel like you gotta go fast.", "You feel like you need to step it up.") to_chat(M, "[high_message]") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "tweaking", /datum/mood_event/stimulant_medium, name) - M.AdjustStun(-20, FALSE) - M.AdjustKnockdown(-20, FALSE) - M.AdjustUnconscious(-20, FALSE) - M.AdjustImmobilized(-20, FALSE) - M.AdjustParalyzed(-20, FALSE) + M.AdjustStun(-20) + M.AdjustKnockdown(-20) + M.AdjustUnconscious(-20) + M.AdjustImmobilized(-20) + M.AdjustParalyzed(-20) ..() . = 1 @@ -192,11 +192,11 @@ if(prob(5)) to_chat(M, "[high_message]") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "tweaking", /datum/mood_event/stimulant_medium, name) - M.AdjustStun(-40, FALSE) - M.AdjustKnockdown(-40, FALSE) - M.AdjustUnconscious(-40, FALSE) - M.AdjustParalyzed(-40, FALSE) - M.AdjustImmobilized(-40, FALSE) + M.AdjustStun(-40) + M.AdjustKnockdown(-40) + M.AdjustUnconscious(-40) + M.AdjustParalyzed(-40) + M.AdjustImmobilized(-40) M.adjustStaminaLoss(-2, 0) M.Jitter(2) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, rand(1,4)) @@ -206,7 +206,7 @@ . = 1 /datum/reagent/drug/methamphetamine/overdose_process(mob/living/M) - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i in 1 to 4) step(M, pick(GLOB.cardinals)) if(prob(20)) @@ -233,7 +233,7 @@ ..() /datum/reagent/drug/methamphetamine/addiction_act_stage3(mob/living/M) - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 4, i++) step(M, pick(GLOB.cardinals)) M.Jitter(15) @@ -243,7 +243,7 @@ ..() /datum/reagent/drug/methamphetamine/addiction_act_stage4(mob/living/carbon/human/M) - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 8, i++) step(M, pick(GLOB.cardinals)) M.Jitter(20) @@ -288,7 +288,7 @@ M.adjustStaminaLoss(-5, 0) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 4) M.hallucination += 5 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) step(M, pick(GLOB.cardinals)) step(M, pick(GLOB.cardinals)) ..() @@ -296,7 +296,7 @@ /datum/reagent/drug/bath_salts/overdose_process(mob/living/M) M.hallucination += 5 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i in 1 to 8) step(M, pick(GLOB.cardinals)) if(prob(20)) @@ -307,7 +307,7 @@ /datum/reagent/drug/bath_salts/addiction_act_stage1(mob/living/M) M.hallucination += 10 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 8, i++) step(M, pick(GLOB.cardinals)) M.Jitter(5) @@ -318,7 +318,7 @@ /datum/reagent/drug/bath_salts/addiction_act_stage2(mob/living/M) M.hallucination += 20 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 8, i++) step(M, pick(GLOB.cardinals)) M.Jitter(10) @@ -330,7 +330,7 @@ /datum/reagent/drug/bath_salts/addiction_act_stage3(mob/living/M) M.hallucination += 30 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 12, i++) step(M, pick(GLOB.cardinals)) M.Jitter(15) @@ -342,7 +342,7 @@ /datum/reagent/drug/bath_salts/addiction_act_stage4(mob/living/carbon/human/M) M.hallucination += 30 - if((M.mobility_flags & MOBILITY_MOVE) && !ismovable(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc)) for(var/i = 0, i < 16, i++) step(M, pick(GLOB.cardinals)) M.Jitter(50) @@ -598,11 +598,11 @@ /datum/reagent/drug/maint/tar/on_mob_life(mob/living/carbon/M) . = ..() - M.AdjustStun(-10, FALSE) - M.AdjustKnockdown(-10, FALSE) - M.AdjustUnconscious(-10, FALSE) - M.AdjustParalyzed(-10, FALSE) - M.AdjustImmobilized(-10, FALSE) + M.AdjustStun(-10) + M.AdjustKnockdown(-10) + M.AdjustUnconscious(-10) + M.AdjustParalyzed(-10) + M.AdjustImmobilized(-10) M.adjustOrganLoss(ORGAN_SLOT_LIVER,1.5) /datum/reagent/drug/maint/tar/overdose_process(mob/living/M) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 9f300581222..f88572ea1bb 100755 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -188,11 +188,11 @@ /datum/reagent/consumable/sugar/overdose_start(mob/living/M) to_chat(M, "You go into hyperglycaemic shock! Lay off the twinkies!") - M.AdjustSleeping(600, FALSE) + M.AdjustSleeping(600) . = 1 /datum/reagent/consumable/sugar/overdose_process(mob/living/M) - M.AdjustSleeping(40, FALSE) + M.AdjustSleeping(40) ..() . = 1 diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 3564e0f8930..5b01025640a 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -65,11 +65,11 @@ REMOVE_TRAITS_NOT_IN(M, list(SPECIES_TRAIT, ROUNDSTART_TRAIT, ORGAN_TRAIT)) M.set_blurriness(0) M.set_blindness(0) - M.SetKnockdown(0, FALSE) - M.SetStun(0, FALSE) - M.SetUnconscious(0, FALSE) - M.SetParalyzed(0, FALSE) - M.SetImmobilized(0, FALSE) + M.SetKnockdown(0) + M.SetStun(0) + M.SetUnconscious(0) + M.SetParalyzed(0) + M.SetImmobilized(0) M.silent = FALSE M.dizziness = 0 M.disgust = 0 @@ -77,7 +77,7 @@ M.stuttering = 0 M.slurring = 0 M.set_confusion(0) - M.SetSleeping(0, 0) + M.SetSleeping(0) M.jitteriness = 0 if(M.blood_volume < BLOOD_VOLUME_NORMAL) M.blood_volume = BLOOD_VOLUME_NORMAL @@ -106,11 +106,11 @@ /datum/reagent/medicine/synaptizine/on_mob_life(mob/living/carbon/M) M.drowsyness = max(M.drowsyness-5, 0) - M.AdjustStun(-20, FALSE) - M.AdjustKnockdown(-20, FALSE) - M.AdjustUnconscious(-20, FALSE) - M.AdjustImmobilized(-20, FALSE) - M.AdjustParalyzed(-20, FALSE) + M.AdjustStun(-20) + M.AdjustKnockdown(-20) + M.AdjustUnconscious(-20) + M.AdjustImmobilized(-20) + M.AdjustParalyzed(-20) if(M.has_reagent(/datum/reagent/toxin/mindbreaker)) M.remove_reagent(/datum/reagent/toxin/mindbreaker, 5) M.hallucination = max(0, M.hallucination - 10) @@ -490,7 +490,7 @@ to_chat(M, "Your hands spaz out and you drop what you were holding!") M.Jitter(10) - M.AdjustAllImmobility(-20, FALSE) + M.AdjustAllImmobility(-20) M.adjustStaminaLoss(-1*REM, FALSE) ..() return TRUE @@ -599,7 +599,7 @@ if(12 to 24) M.drowsyness += 1 if(24 to INFINITY) - M.Sleeping(40, 0) + M.Sleeping(40) . = 1 ..() @@ -744,7 +744,7 @@ M.losebreath = 0 M.adjustStaminaLoss(-0.5*REM, 0) if(prob(20)) - M.AdjustAllImmobility(-20, FALSE) + M.AdjustAllImmobility(-20) ..() /datum/reagent/medicine/epinephrine/overdose_process(mob/living/M) @@ -885,7 +885,7 @@ M.adjustToxLoss(-1*REM, 0) M.adjustBruteLoss(-1*REM, 0) M.adjustFireLoss(-1*REM, 0) - M.AdjustAllImmobility(-60, FALSE) + M.AdjustAllImmobility(-60) M.adjustStaminaLoss(-5*REM, 0) ..() . = 1 @@ -906,7 +906,7 @@ metabolization_rate = 0.5 * REAGENTS_METABOLISM /datum/reagent/medicine/insulin/on_mob_life(mob/living/carbon/M) - if(M.AdjustSleeping(-20, FALSE)) + if(M.AdjustSleeping(-20)) . = 1 M.remove_reagent(/datum/reagent/consumable/sugar, 3) ..() @@ -1054,7 +1054,7 @@ /datum/reagent/medicine/changelingadrenaline/on_mob_life(mob/living/carbon/M as mob) ..() - M.AdjustAllImmobility(-20, FALSE) + M.AdjustAllImmobility(-20) M.adjustStaminaLoss(-10, 0) M.Jitter(10) M.Dizzy(10) @@ -1161,7 +1161,7 @@ /datum/reagent/medicine/modafinil/on_mob_life(mob/living/carbon/M) if(!overdosed) // We do not want any effects on OD overdose_threshold = overdose_threshold + rand(-10,10)/10 // for extra fun - M.AdjustAllImmobility(-5, FALSE) + M.AdjustAllImmobility(-5) M.adjustStaminaLoss(-0.5*REM, 0) M.Jitter(1) metabolization_rate = 0.01 * REAGENTS_METABOLISM * rand(5,20) // randomizes metabolism between 0.02 and 0.08 per tick @@ -1192,13 +1192,13 @@ if(prob(20)) to_chat(M, "You have a sudden fit!") M.emote("moan") - M.Paralyze(20, 1, 0) // you should be in a bad spot at this point unless epipen has been used + M.Paralyze(20) // you should be in a bad spot at this point unless epipen has been used if(81) to_chat(M, "You feel too exhausted to continue!") // at this point you will eventually die unless you get charcoal M.adjustOxyLoss(0.1*REM, 0) M.adjustStaminaLoss(0.1*REM, 0) if(82 to INFINITY) - M.Sleeping(100, FALSE) + M.Sleeping(100) M.adjustOxyLoss(1.5*REM, 0) M.adjustStaminaLoss(1.5*REM, 0) ..() diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 7f62d5a0dd8..06781fb8c03 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -340,7 +340,7 @@ /datum/reagent/fuel/unholywater/on_mob_life(mob/living/carbon/M) if(iscultist(M)) M.drowsyness = max(M.drowsyness-5, 0) - M.AdjustAllImmobility(-40, FALSE) + M.AdjustAllImmobility(-40) M.adjustStaminaLoss(-10, 0) M.adjustToxLoss(-2, 0) M.adjustOxyLoss(-2, 0) @@ -782,7 +782,7 @@ taste_mult = 0 // apparently tasteless. /datum/reagent/mercury/on_mob_life(mob/living/carbon/M) - if((M.mobility_flags & MOBILITY_MOVE) && !isspaceturf(M.loc)) + if(!HAS_TRAIT(src, TRAIT_IMMOBILIZED) && !isspaceturf(M.loc)) step(M, pick(GLOB.cardinals)) if(prob(5)) M.emote(pick("twitch","drool","moan")) @@ -887,7 +887,7 @@ taste_description = "metal" /datum/reagent/lithium/on_mob_life(mob/living/carbon/M) - if((M.mobility_flags & MOBILITY_MOVE) && !isspaceturf(M.loc)) + if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !isspaceturf(M.loc)) step(M, pick(GLOB.cardinals)) if(prob(5)) M.emote(pick("twitch","drool","moan")) @@ -2393,7 +2393,7 @@ /datum/reagent/eldritch/on_mob_life(mob/living/carbon/M) if(IS_HERETIC(M)) M.drowsyness = max(M.drowsyness-5, 0) - M.AdjustAllImmobility(-40, FALSE) + M.AdjustAllImmobility(-40) M.adjustStaminaLoss(-10, FALSE) M.adjustToxLoss(-2, FALSE) M.adjustOxyLoss(-2, FALSE) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 8d3a5385cfd..e48c7a83295 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -277,7 +277,7 @@ /datum/reagent/teslium/energized_jelly/on_mob_life(mob/living/carbon/M) if(isjellyperson(M)) shock_timer = 0 //immune to shocks - M.AdjustAllImmobility(-40, FALSE) + M.AdjustAllImmobility(-40) M.adjustStaminaLoss(-2, 0) if(isluminescent(M)) var/mob/living/carbon/human/H = M diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 34aae23aa07..47eb8958c89 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -378,10 +378,10 @@ M.add_confusion(2) M.drowsyness += 2 if(10 to 50) - M.Sleeping(40, 0) + M.Sleeping(40) . = 1 if(51 to INFINITY) - M.Sleeping(40, 0) + M.Sleeping(40) M.adjustToxLoss((current_cycle - 50)*REM, 0) . = 1 ..() @@ -399,9 +399,9 @@ /datum/reagent/toxin/fakebeer/on_mob_life(mob/living/carbon/M) switch(current_cycle) if(1 to 50) - M.Sleeping(40, 0) + M.Sleeping(40) if(51 to INFINITY) - M.Sleeping(40, 0) + M.Sleeping(40) M.adjustToxLoss((current_cycle - 50)*REM, 0) return ..() @@ -541,7 +541,7 @@ if(current_cycle >= 4) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "smacked out", /datum/mood_event/narcotic_heavy, name) if(current_cycle >= 18) - M.Sleeping(40, 0) + M.Sleeping(40) ..() return TRUE @@ -558,7 +558,7 @@ M.losebreath += 1 if(prob(8)) to_chat(M, "You feel horrendously weak!") - M.Stun(40, 0) + M.Stun(40) M.adjustToxLoss(2*REM, 0) return ..() @@ -614,7 +614,7 @@ var/picked_option = rand(1,3) switch(picked_option) if(1) - C.Paralyze(60, 0) + C.Paralyze(60) . = TRUE if(2) C.losebreath += 10 @@ -643,7 +643,7 @@ /datum/reagent/toxin/pancuronium/on_mob_life(mob/living/carbon/M) if(current_cycle >= 10) - M.Stun(40, 0) + M.Stun(40) . = TRUE if(prob(20)) M.losebreath += 4 @@ -660,7 +660,7 @@ /datum/reagent/toxin/sodium_thiopental/on_mob_life(mob/living/carbon/M) if(current_cycle >= 10) - M.Sleeping(40, 0) + M.Sleeping(40) M.adjustStaminaLoss(10*REM, 0) ..() return TRUE @@ -676,7 +676,7 @@ /datum/reagent/toxin/sulfonal/on_mob_life(mob/living/carbon/M) if(current_cycle >= 22) - M.Sleeping(40, 0) + M.Sleeping(40) return ..() /datum/reagent/toxin/amanitin @@ -758,7 +758,7 @@ /datum/reagent/toxin/curare/on_mob_life(mob/living/carbon/M) if(current_cycle >= 11) - M.Paralyze(60, 0) + M.Paralyze(60) M.adjustOxyLoss(1*REM, 0) . = 1 ..() @@ -909,7 +909,7 @@ holder.remove_reagent(type, actual_metaboliztion_rate * M.metabolism_efficiency) M.adjustToxLoss(actual_toxpwr*REM, 0) if(prob(10)) - M.Paralyze(20, 0) + M.Paralyze(20) . = 1 ..() diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index a42895061ce..82e20643649 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -93,7 +93,7 @@ var/mob/living/M = T if(!M.can_inject()) continue - if((M.mobility_flags & MOBILITY_STAND) || !range_left) + if((M.body_position == STANDING_UP) || !range_left) D.reagents.expose(M, VAPOR) puff_reagent_left -= 1 var/contained = D.reagents.log_list() // looks like more copypasta but now the reagents are in a different place fuck you old coder diff --git a/code/modules/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/ruins/spaceruin_code/hilbertshotel.dm index 021aa1c24ef..15c0e2a856b 100644 --- a/code/modules/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/ruins/spaceruin_code/hilbertshotel.dm @@ -244,7 +244,7 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) 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.mobility_flags & MOBILITY_MOVE) || (get_dist(get_turf(src), get_turf(user)) > 1)) //no teleporting around if they're dead or moved away during the prompt. + if(HAS_TRAIT(user, TRAIT_IMMOBILIZED) || (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/spells/spell_types/ethereal_jaunt.dm b/code/modules/spells/spell_types/ethereal_jaunt.dm index 1c890f1a0dc..ac951200b91 100644 --- a/code/modules/spells/spell_types/ethereal_jaunt.dm +++ b/code/modules/spells/spell_types/ethereal_jaunt.dm @@ -40,7 +40,7 @@ return mobloc = get_turf(target.loc) jaunt_steam(mobloc) - target.mobility_flags &= ~MOBILITY_MOVE + ADD_TRAIT(target, TRAIT_IMMOBILIZED, type) holder.reappearing = 1 play_sound("exit",target) sleep(25 - jaunt_in_time) @@ -55,7 +55,7 @@ if(T) if(target.Move(T)) break - target.mobility_flags |= MOBILITY_MOVE + REMOVE_TRAIT(target, TRAIT_IMMOBILIZED, type) /obj/effect/proc_holder/spell/targeted/ethereal_jaunt/proc/jaunt_steam(mobloc) var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread() diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 0d917f937af..63f8ee271ba 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -584,11 +584,6 @@ if(!owner) return - if(bodypart_disabled) - if(!.) - owner.update_mobility() - else if (.) - owner.update_mobility() owner.update_health_hud() //update the healthdoll owner.update_body() @@ -947,7 +942,7 @@ var/datum/wound/W = thing bleed_rate += W.blood_flow - if(owner.mobility_flags & ~MOBILITY_STAND) + if(owner.body_position == LYING_DOWN) bleed_rate *= 0.75 if(grasped_by) diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index bed922e49e5..c7f2c778f07 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -136,7 +136,6 @@ phantom_owner.update_health_hud() //update the healthdoll phantom_owner.update_body() phantom_owner.update_hair() - phantom_owner.update_mobility() if(!Tsec) // Tsec = null happens when a "dummy human" used for rendering icons on prefs screen gets its limbs replaced. qdel(src) @@ -378,7 +377,6 @@ C.update_body() C.update_hair() C.update_damage_overlays() - C.update_mobility() /obj/item/bodypart/head/attach_limb(mob/living/carbon/C, special = FALSE, abort = FALSE) @@ -435,7 +433,7 @@ C.update_body() C.update_hair() C.update_damage_overlays() - C.update_mobility() + //Regenerates all limbs. Returns amount of limbs regenerated /mob/living/proc/regenerate_limbs(noheal = FALSE, list/excluded_zones = list()) diff --git a/code/modules/tgui/states/not_incapacitated.dm b/code/modules/tgui/states/not_incapacitated.dm index 16dcb7881ed..4d38c62392f 100644 --- a/code/modules/tgui/states/not_incapacitated.dm +++ b/code/modules/tgui/states/not_incapacitated.dm @@ -25,12 +25,8 @@ GLOBAL_DATUM_INIT(not_incapacitated_turf_state, /datum/ui_state/not_incapacitate turf_check = no_turfs /datum/ui_state/not_incapacitated_state/can_use_topic(src_object, mob/user) - if(user.stat) + if(user.stat != CONSCIOUS) return UI_CLOSE - if(user.incapacitated() || (turf_check && !isturf(user.loc))) + if(HAS_TRAIT(src, TRAIT_UI_BLOCKED) || user.incapacitated() || (turf_check && !isturf(user.loc))) return UI_DISABLED - if(isliving(user)) - var/mob/living/L = user - if(!(L.mobility_flags & MOBILITY_STAND)) - return UI_DISABLED return UI_INTERACTIVE diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 85f0b63aa61..549790ca537 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -850,7 +850,6 @@ AI.cancel_camera() AI.controlled_mech = src AI.remote_control = src - AI.mobility_flags = ALL //Much easier than adding AI checks! Be sure to set this back to 0 if you decide to allow an AI to leave a mech somehow. to_chat(AI, AI.can_dominate_mechs ? "Takeover of [name] complete! You are now loaded onto the onboard computer. Do not attempt to leave the station sector!" :\ "You have been uploaded to a mech's onboard computer.") to_chat(AI, "Use Middle-Mouse to activate mech functions and equipment. Click normally for AI interactions.") @@ -1004,12 +1003,11 @@ to_chat(user, "\the [M] is stuck to your hand, you cannot put it in \the [src]!") return FALSE - M.mecha = src + M.set_mecha(src) add_occupant(B)//Note this forcemoves the brain into the mech to allow relaymove mecha_flags |= SILICON_PILOT B.reset_perspective(src) B.remote_control = src - B.update_mobility() B.update_mouse_pointer() setDir(dir_in) log_message("[M] moved in as pilot.", LOG_MECHA) @@ -1077,9 +1075,8 @@ L.forceMove(mmi) L.reset_perspective() remove_occupant(L) - mmi.mecha = null + mmi.set_mecha(null) mmi.update_icon() - L.mobility_flags = NONE setDir(dir_in) return ..() diff --git a/code/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index 2a7b7b40f3f..44b5c6bf11c 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -31,12 +31,11 @@ /obj/vehicle/ridden/wheelchair/motorized/obj_destruction(damage_flag) var/turf/T = get_turf(src) - for(var/atom/movable/A in contents) - A.forceMove(T) - if(isliving(A)) - var/mob/living/L = A - L.update_mobility() - ..() + for(var/c in contents) + var/atom/movable/thing = c + thing.forceMove(T) + return ..() + /obj/vehicle/ridden/wheelchair/motorized/driver_move(mob/living/user, direction) if(istype(user)) @@ -121,11 +120,9 @@ new /obj/item/stack/rods(drop_location(), 8) new /obj/item/stack/sheet/metal(drop_location(), 10) var/turf/T = get_turf(src) - for(var/atom/movable/A in contents) - A.forceMove(T) - if(isliving(A)) - var/mob/living/L = A - L.update_mobility() + for(var/c in contents) + var/atom/movable/thing = c + thing.forceMove(T) qdel(src) return TRUE diff --git a/tgstation.dme b/tgstation.dme index bfa32c9aae2..573098d8063 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -66,6 +66,7 @@ #include "code\__DEFINES\language.dm" #include "code\__DEFINES\layers.dm" #include "code\__DEFINES\lighting.dm" +#include "code\__DEFINES\living.dm" #include "code\__DEFINES\logging.dm" #include "code\__DEFINES\machines.dm" #include "code\__DEFINES\maps.dm"