From 512d21d7af28e501dbe9aaa57f0c9e50e8eef567 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 20 Sep 2020 17:32:35 +0200 Subject: [PATCH] [MIRROR] Fixes oversight with "tactical combat spinning" and flashes (#897) * Fixes oversight with "tactical combat spinning" and flashes (#53823) Using the spin emote can no longer let you RNG your way out of new flash mechanics. Mobs have a new flag that is set to when they start spinning and unset when they stop. Flashes now use this new flag when calcing deviation. Tactical combat spinning using the spin emote now results in a full deviation flash when it may previously have resulted in a failure or half-deviation flash. Emotes should either not influence combat at all (spin on floor when both players share the same loc, this was already handled by same-loc code), or negatively influence combat for the emote user (spin in all other circumtances, which is what this PR addresses). * Fixes oversight with "tactical combat spinning" and flashes Co-authored-by: Timberpoes --- code/__DEFINES/flags.dm | 2 ++ code/modules/assembly/flash.dm | 7 ++++++- code/modules/mob/mob.dm | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index a664c5cfb2a..e35a4f75aad 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -46,6 +46,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define ALLOW_DARK_PAINTS_1 (1 << 19) /// Should this object be unpaintable? #define UNPAINTABLE_1 (1 << 20) +/// Is the thing currently spinning? +#define IS_SPINNING_1 (1 << 21) /// If the thing can reflect light (lasers/energy) #define RICOCHET_SHINY (1<<0) diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 6a92bb06ce2..3f5d8afcdbc 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -152,7 +152,6 @@ if(deviation == DEVIATION_FULL && !converter) return - if(targeted) if(M.flash_act(1, 1)) if(M.get_confusion() < power) @@ -195,6 +194,12 @@ * * attacker - Attacker */ /obj/item/assembly/flash/proc/calculate_deviation(mob/victim, atom/attacker) + // Tactical combat emote-spinning should not counter intended gameplay mechanics. + // This trumps same-loc checks to discourage floor spinning in general to counter flashes. + // In short, combat spinning is silly and you should feel silly for doing it. + if(victim.flags_1 & IS_SPINNING_1) + return DEVIATION_NONE + // Are they on the same tile? We'll return partial deviation. This may be someone flashing while lying down // or flashing someone they're stood on the same turf as, or a borg flashing someone buckled to them. if(victim.loc == attacker.loc) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 2a6ed01d6f1..55a3302e023 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -601,6 +601,8 @@ var/D = dir if((spintime < 1)||(speed < 1)||!spintime||!speed) return + + flags_1 |= IS_SPINNING_1 while(spintime >= speed) sleep(speed) switch(D) @@ -614,6 +616,7 @@ D = NORTH setDir(D) spintime -= speed + flags_1 &= ~IS_SPINNING_1 ///Update the pulling hud icon /mob/proc/update_pull_hud_icon()