From a8b9ae00226bba3d5bed9d6f8499acb806a23740 Mon Sep 17 00:00:00 2001 From: NanakoAC Date: Thu, 15 Jun 2017 10:31:20 +0100 Subject: [PATCH] Window Booping Fix (#2691) A minor issue that's annoyed me for a long time; This PR adds ON_BORDER support for attack animations and atom facing, causing you to face and strike in the correct direction when dealing with border objects on the same tile as you. Previously these things would fail and do no animation/facing change Afaik, border objects really just means single pane windows and windoors right now. --- code/_onclick/click.dm | 9 +++++-- code/modules/mob/animations.dm | 9 ++++++- html/changelogs/Nanako-Windowboop.yml | 36 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/Nanako-Windowboop.yml diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index b9c6692b714..3617507a19e 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -351,10 +351,15 @@ client/verb/set_context_menu_enabled(Enable as num) if(!A || !x || !y || !A.x || !A.y) return var/dx = A.x - x var/dy = A.y - y - if(!dx && !dy) return var/direction - if(abs(dx) < abs(dy)) + if (loc == A.loc) + if (A.flags & ON_BORDER) + direction = A.dir + else + return + + else if(abs(dx) < abs(dy)) if(dy > 0) direction = NORTH else direction = SOUTH else diff --git a/code/modules/mob/animations.dm b/code/modules/mob/animations.dm index d435c369d1c..3e0bd00e181 100644 --- a/code/modules/mob/animations.dm +++ b/code/modules/mob/animations.dm @@ -144,7 +144,12 @@ note dizziness decrements automatically in the mob's Life() proc. var/pixel_x_diff = 0 var/pixel_y_diff = 0 - var/direction = get_dir(src, A) + var/direction + if (loc == A.loc) + if (A.flags & ON_BORDER) + direction = A.dir + else + direction = get_dir(src, A) switch(direction) if(NORTH) pixel_y_diff = 8 @@ -166,6 +171,8 @@ note dizziness decrements automatically in the mob's Life() proc. if(SOUTHWEST) pixel_x_diff = -8 pixel_y_diff = -8 + else + return 0//No valid direction animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2) animate(pixel_x = pixel_x - pixel_x_diff, pixel_y = pixel_y - pixel_y_diff, time = 2) diff --git a/html/changelogs/Nanako-Windowboop.yml b/html/changelogs/Nanako-Windowboop.yml new file mode 100644 index 00000000000..6dec5f92c37 --- /dev/null +++ b/html/changelogs/Nanako-Windowboop.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Nanako + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Facing and attack animations now work properly with windows on your tile"