diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 30a7546f8d..396cf25be1 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -114,6 +114,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define MOBILITY_PULL (1<<6) /// can hold non-nodropped items voluntarily #define MOBILITY_HOLD (1<<7) +/// Can resist out of buckling, grabs, cuffs, etc, in the usual order (buckle --> cuffs --> grab) +#define MOBILITY_RESIST (1<<8) -#define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_PICKUP | MOBILITY_USE | MOBILITY_UI | MOBILITY_STORAGE | MOBILITY_PULL) +#define MOBILITY_FLAGS_DEFAULT (MOBILITY_MOVE | MOBILITY_STAND | MOBILITY_PICKUP | MOBILITY_USE | MOBILITY_UI | MOBILITY_STORAGE | MOBILITY_PULL | MOBILITY_RESIST) #define MOBILITY_FLAGS_ANY_INTERACTION (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_UI | MOBILITY_STORAGE) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index a0139dab83..b4cc682075 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -214,7 +214,7 @@ GLOBAL_LIST_INIT(bitfields, list( "CAN_MASTURBATE_WITH" = CAN_MASTURBATE_WITH, "MASTURBATE_LINKED_ORGAN" = MASTURBATE_LINKED_ORGAN, "CAN_CLIMAX_WITH" = CAN_CLIMAX_WITH - + ), "mob_biotypes" = list ( "MOB_ORGANIC" = MOB_ORGANIC, @@ -227,5 +227,16 @@ GLOBAL_LIST_INIT(bitfields, list( "MOB_EPIC" = MOB_EPIC, "MOB_REPTILE" = MOB_REPTILE, "MOB_SPIRIT" = MOB_SPIRIT + ), + "mobility_flags" = list( + "MOBILITY_MOVE" = MOBILITY_MOVE, + "MOBILITY_STAND" = MOBILITY_STAND, + "MOBILITY_PICKUP" = MOBILITY_PICKUP, + "MOBILITY_USE" = MOBILITY_USE, + "MOBILITY_UI" = MOBILITY_UI, + "MOBILITY_STORAGE" = MOBILITY_STORAGE, + "MOBILITY_PULL" = MOBILITY_PULL, + "MOBILITY_HOLD" = MOBILITY_HOLD, + "MOBILITY_RESIST" = MOBILITY_RESIST ) )) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 99941857e7..1a2001dbc1 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -639,7 +639,7 @@ /atom/movable/CanPass(atom/movable/mover, turf/target) if(mover in buckled_mobs) - return 1 + return TRUE return ..() // called when this atom is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called. diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6045c5aa68..8b61390153 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -290,7 +290,7 @@ buckle_cd = O.breakouttime visible_message("[src] attempts to unbuckle [p_them()]self!", \ "You attempt to unbuckle yourself... (This will take around [round(buckle_cd/600,1)] minute\s, and you need to stay still.)") - if(do_after(src, buckle_cd, 0, target = src)) + if(do_after(src, buckle_cd, 0, target = src, required_mobility_flags = MOBILITY_RESIST)) if(!buckled) return buckled.user_unbuckle_mob(src,src) @@ -341,7 +341,7 @@ if(!cuff_break) visible_message("[src] attempts to remove [I]!") to_chat(src, "You attempt to remove [I]... (This will take around [DisplayTimeText(breakouttime)] and you need to stand still.)") - if(do_after(src, breakouttime, 0, target = src)) + if(do_after(src, breakouttime, 0, target = src, required_mobility_flags = MOBILITY_RESIST)) clear_cuffs(I, cuff_break) else to_chat(src, "You fail to remove [I]!") diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm index 4a99e9c89e..2677de6c2f 100644 --- a/code/modules/mob/living/carbon/carbon_movement.dm +++ b/code/modules/mob/living/carbon/carbon_movement.dm @@ -43,3 +43,12 @@ nutrition -= HUNGER_FACTOR/10 if(m_intent == MOVE_INTENT_RUN) nutrition -= HUNGER_FACTOR/10 + +/mob/living/carbon/CanPass(atom/movable/mover, turf/target) + . = ..() + if(.) + var/mob/living/mobdude = mover + if(istype(mobdude) && !(mobdude in buckled_mobs)) + if(CHECK_BITFIELD(mobility_flags, MOBILITY_STAND) && !CHECK_BITFIELD(mobdude.mobility_flags, MOBILITY_STAND)) + if(!(mobdude.pass_flags & PASSMOB)) + return FALSE diff --git a/code/modules/mob/living/living_mobility.dm b/code/modules/mob/living/living_mobility.dm index 3add61f766..175921efe8 100644 --- a/code/modules/mob/living/living_mobility.dm +++ b/code/modules/mob/living/living_mobility.dm @@ -110,11 +110,18 @@ var/restrained = restrained() var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground var/canmove = !immobilize && !stun && conscious && !paralyze && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && (has_arms || ignore_legs || has_legs) && !pinned && !recoveringstam + var/canresist = !stun && conscious && !stat_softcrit && !paralyze && (has_arms || ignore_legs || has_legs) && !recoveringstam if(canmove) mobility_flags |= MOBILITY_MOVE else mobility_flags &= ~MOBILITY_MOVE + + if(canresist) + mobility_flags |= MOBILITY_RESIST + else + mobility_flags &= !MOBILITY_RESIST + var/canstand_involuntary = conscious && !stat_softcrit && !knockdown && !chokehold && !paralyze && (ignore_legs || has_legs) && !(buckled && buckled.buckle_lying) && !recoveringstam var/canstand = canstand_involuntary && !resting @@ -125,9 +132,6 @@ if(should_be_lying) mobility_flags &= ~MOBILITY_STAND - if(buckled) - if(buckled.buckle_lying != -1) - lying = buckled.buckle_lying if(!lying) //force them on the ground lying = pick(90, 270) else diff --git a/code/modules/mob/living/silicon/silicon_mobility.dm b/code/modules/mob/living/silicon/silicon_mobility.dm new file mode 100644 index 0000000000..8e89242f94 --- /dev/null +++ b/code/modules/mob/living/silicon/silicon_mobility.dm @@ -0,0 +1,4 @@ +/mob/living/silicon/resist_a_rest() + if(!resting) + return FALSE + return set_resting(FALSE) diff --git a/modular_citadel/code/modules/mob/living/carbon/carbon.dm b/modular_citadel/code/modules/mob/living/carbon/carbon.dm index c690925556..44512ac0c7 100644 --- a/modular_citadel/code/modules/mob/living/carbon/carbon.dm +++ b/modular_citadel/code/modules/mob/living/carbon/carbon.dm @@ -8,16 +8,6 @@ //oh no vore time var/voremode = FALSE -/mob/living/carbon/CanPass(atom/movable/mover, turf/target) - . = ..() - if(.) - var/mob/living/mobdude = mover - if(istype(mobdude)) - if(CHECK_BITFIELD(mobility_flags, MOBILITY_STAND) && !CHECK_BITFIELD(mobdude.mobility_flags, MOBILITY_STAND)) - if(!(mobdude.pass_flags & PASSMOB)) - return FALSE - return . - /mob/living/carbon/proc/toggle_combat_mode(forced, silent) if(!forced) if(recoveringstam || stat != CONSCIOUS) diff --git a/tgstation.dme b/tgstation.dme index 05cf6afe28..72f281d29f 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2257,6 +2257,7 @@ #include "code\modules\mob\living\silicon\say.dm" #include "code\modules\mob\living\silicon\silicon.dm" #include "code\modules\mob\living\silicon\silicon_defense.dm" +#include "code\modules\mob\living\silicon\silicon_mobility.dm" #include "code\modules\mob\living\silicon\silicon_movement.dm" #include "code\modules\mob\living\silicon\ai\ai.dm" #include "code\modules\mob\living\silicon\ai\ai_defense.dm"