Frame stacking fix and unit test addition. (#56287)

* Reverts #56205

* Allow things without density to bypass checks

* The rest of the owl

* The rest of the owl

* Doc and tweak

* More feex

* RCD machine frame unit test

* I suck

* AAAAA

* Bad at unit tests

* Revert unit tests (for including in another PR)

* Fix windoor_assembly return logic

* Comment /mob/living/proc/PushAM logic

* Windoor assembley logic tweak

* Fix frame stacking

* Unit test

* Better wording from macros?
This commit is contained in:
Timberpoes
2021-01-22 13:18:05 +00:00
committed by GitHub
parent 294a2518fb
commit 1989497576
17 changed files with 242 additions and 194 deletions
+16 -6
View File
@@ -205,13 +205,23 @@
if(!client && (mob_size < MOB_SIZE_SMALL))
return
now_pushing = TRUE
var/t = get_dir(src, AM)
var/dir_to_target = get_dir(src, AM)
// If there's no dir_to_target then the player is on the same turf as the atom they're trying to push.
// This can happen when a player is stood on the same turf as a directional window. All attempts to push
// the window will fail as get_dir will return 0 and the player will be unable to move the window when
// it should be pushable.
// In this scenario, we will use the facing direction of the /mob/living attempting to push the atom as
// a fallback.
if(!dir_to_target)
dir_to_target = dir
var/push_anchored = FALSE
if((AM.move_resist * MOVE_FORCE_CRUSH_RATIO) <= force)
if(move_crush(AM, move_force, t))
if(move_crush(AM, move_force, dir_to_target))
push_anchored = TRUE
if((AM.move_resist * MOVE_FORCE_FORCEPUSH_RATIO) <= force) //trigger move_crush and/or force_push regardless of if we can push it normally
if(force_push(AM, move_force, t, push_anchored))
if(force_push(AM, move_force, dir_to_target, push_anchored))
push_anchored = TRUE
if((AM.anchored && !push_anchored) || (force < (AM.move_resist * MOVE_FORCE_PUSH_RATIO)))
now_pushing = FALSE
@@ -219,7 +229,7 @@
if (istype(AM, /obj/structure/window))
var/obj/structure/window/W = AM
if(W.fulltile)
for(var/obj/structure/window/win in get_step(W,t))
for(var/obj/structure/window/win in get_step(W, dir_to_target))
now_pushing = FALSE
return
if(pulling == AM)
@@ -227,8 +237,8 @@
var/current_dir
if(isliving(AM))
current_dir = AM.dir
if(AM.Move(get_step(AM.loc, t), t, glide_size))
Move(get_step(loc, t), t)
if(AM.Move(get_step(AM.loc, dir_to_target), dir_to_target, glide_size))
Move(get_step(loc, dir_to_target), dir_to_target)
if(current_dir)
AM.setDir(current_dir)
now_pushing = FALSE