Files
Bubberstation/code/modules/unit_tests/spell_timestop.dm
MrMelbert 2e468646b9 Fix advanced proximity monitors being 1 tile too small (again...) (#84307)
## About The Pull Request

Fixes #84301 

Right here, 


d1051ec8a8/code/datums/proximity_monitor/field.dm (L129-L132)

We get the inner turfs and then use them to find the outer turfs

But

We subtract the inner turfs from the outer turfs instead of subtracting
the outer turfs from the inner turfs...

(also adds a unit test and updates the field debugger for better field
debugging)

## Changelog

🆑 Melbert
fix: Fix timestop being 1 tile too small again, and fixes a lot of other
field effects from being 1-small as well
/🆑
2024-06-26 23:30:27 -04:00

31 lines
1.3 KiB
Plaintext

/// Regression test for timestop being a 3x3 instead of a 5x5
/datum/unit_test/timestop
/datum/unit_test/timestop/Run()
var/mob/living/carbon/human/dio = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/kakyoin = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/jotaro = allocate(/mob/living/carbon/human/consistent)
var/turf/center = run_loc_floor_bottom_left
var/turf/in_range = locate(center.x + 2, center.y + 2, center.z)
var/turf/out_of_range = locate(in_range.x + 1, in_range.y + 1, in_range.z)
dio.forceMove(center)
kakyoin.forceMove(in_range)
jotaro.forceMove(out_of_range)
var/datum/action/cooldown/spell/timestop/timestop = new(dio)
timestop.spell_requirements = NONE
timestop.Grant(dio)
timestop.Trigger()
var/obj/effect/timestop/time_effect = locate() in center
TEST_ASSERT(time_effect, "Failed to create timestop effect")
sleep(0.1 SECONDS) // timestop is invoked async so let's just wait
TEST_ASSERT(!dio.IsStun(), "Timestopper should not have frozen themselves when using timestop")
TEST_ASSERT(kakyoin.IsStun(), "Timestopper should have frozen the target within 2 tiles of range when using timestop")
TEST_ASSERT(!jotaro.IsStun(), "Timestopper should not have frozen the target outside of 2 tiles of range when using timestop")
// cleanup
qdel(time_effect)