diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 37d1a619c71..88d584bbe4b 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -127,4 +127,12 @@ #define FLASH_PROTECTION_MAJOR 2 #define ANIMAL_SPAWN_DELAY round(config.respawn_delay / 6) -#define DRONE_SPAWN_DELAY round(config.respawn_delay / 3) \ No newline at end of file +#define DRONE_SPAWN_DELAY round(config.respawn_delay / 3) + +// Incapacitation flags, used by the mob/proc/incapacitated() proc +#define INCAPACITATION_RESTRAINED 1 +#define INCAPACITATION_BUCKLED_PARTIALLY 2 +#define INCAPACITATION_BUCKLED_FULLY 4 + +#define INCAPACITATION_DEFAULT (INCAPACITATION_RESTRAINED|INCAPACITATION_BUCKLED_FULLY) +#define INCAPACITATION_ALL (INCAPACITATION_RESTRAINED|INCAPACITATION_BUCKLED_PARTIALLY|INCAPACITATION_BUCKLED_FULLY) diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm index a5b4cd20925..7ddbe6bc6eb 100644 --- a/code/modules/mob/living/carbon/resist.dm +++ b/code/modules/mob/living/carbon/resist.dm @@ -29,8 +29,8 @@ /mob/living/carbon/proc/escape_handcuffs() //if(!(last_special <= world.time)) return - //These two lines represent a significant buff to grabs... - if(!canClick()) return + //This line represent a significant buff to grabs... + // We don't have to check the click cooldown because /mob/living/verb/resist() has done it for us, we can simply set the delay setClickCooldown(100) if(can_break_cuffs()) //Don't want to do a lot of logic gating here. @@ -53,7 +53,7 @@ displaytime /= 2 visible_message( - "[src] attempts to remove \the [HC]!", + "\The [src] attempts to remove \the [HC]!", "You attempt to remove \the [HC]. (This will take around [displaytime] minutes and you need to stand still)" ) @@ -61,7 +61,7 @@ if(!handcuffed || buckled) return visible_message( - "[src] manages to remove \the [handcuffed]!", + "\The [src] manages to remove \the [handcuffed]!", "You successfully remove \the [handcuffed]." ) drop_from_inventory(handcuffed) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 19fc5c953a3..eb70f478392 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -85,8 +85,7 @@ // blind_message (optional) is what blind people will hear e.g. "You hear something!" /mob/visible_message(var/message, var/self_message, var/blind_message) - - var/list/see = get_mobs_or_objects_in_view(world.view,src) | viewers(get_turf(src), null) + var/list/see = get_mobs_or_objects_in_view(world.view,src) | viewers(world.view,src) for(var/I in see) if(isobj(I)) @@ -152,8 +151,33 @@ //handle_typing_indicator() //You said the typing indicator would be fine. The test determined that was a lie. return -/mob/proc/incapacitated() - return (stat || paralysis || stunned || weakened || restrained()) +#define UNBUCKLED 0 +#define PARTIALLY_BUCKLED 1 +#define FULLY_BUCKLED 2 +/mob/proc/buckled() + // Preliminary work for a future buckle rewrite, + // where one might be fully restrained (like an elecrical chair), or merely secured (shuttle chair, keeping you safe but not otherwise restrained from acting) + return buckled ? FULLY_BUCKLED : UNBUCKLED + +/mob/proc/incapacitated(var/incapacitation_flags = INCAPACITATION_DEFAULT) + if (stat || paralysis || stunned || weakened || resting || sleeping || (status_flags & FAKEDEATH)) + return 1 + + if((incapacitation_flags & INCAPACITATION_RESTRAINED) && restrained()) + return 1 + + if((incapacitation_flags & (INCAPACITATION_BUCKLED_PARTIALLY|INCAPACITATION_BUCKLED_FULLY))) + var/buckling = buckled() + if(buckling >= PARTIALLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_PARTIALLY)) + return 1 + if(buckling == FULLY_BUCKLED && (incapacitation_flags & INCAPACITATION_BUCKLED_FULLY)) + return 1 + + return 0 + +#undef UNBUCKLED +#undef PARTIALLY_BUCKLED +#undef FULLY_BUCKLED /mob/proc/restrained() return @@ -675,7 +699,7 @@ return 0 /mob/proc/cannot_stand() - return incapacitated() || restrained() || resting || sleeping || (status_flags & FAKEDEATH) + return incapacitated(INCAPACITATION_DEFAULT & (~INCAPACITATION_RESTRAINED)) //Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. /mob/proc/update_canmove()