mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-17 12:20:09 +01:00
f4bf017921
* Unit Test rework & Master/Ticker update * Fixes and working unit testing * Fixes * Test fixes and FA update * Fixed runtimes * Radio subsystem * move that glob wherever later * ident * CIBUILDING compile option * Fixed runtimes * Some changes to the workflow * CI Split * More split * Pathing * Linters and Annotators * ci dir fix * Missing undef fixed * Enable grep checks * More test conversions * More split * Correct file * Removes unneeded inputs * oop * More dependency changes * More conversions * Conversion fixes * Fixes * Some assert fixes * Corrects start gate * Converted some README.dms to README.mds * Removes duplicate proc * Removes unused defines * Example configs * fix dll access viol by double calling * Post-rebase fixes * Cleans up names global list * Undef restart counter * More code/game/ cleanup * Statpanel update * Skybox * add * Fix ticker * Roundend fix * Persistence dependency update * Reordering * Reordering * Reordering * Initstage fix * . * . * Reorder * Reorder * Circle * Mobs * Air * Test fix * CI Script Fix * Configs * More ticker stuff * This is now in 'reboot world' * Restart world announcements * no glob in PreInit * to define * Update * Removed old include * Make this file normal again * moved * test * shared unit testing objects * Updates batched_spritesheets and universal_icon * . * job data debug * rm that * init order * show us * . * i wonder * . * . * urg * do we not have a job ID? * . * rm sleep for now * updated rust-g linux binaries * binaries update 2 * binaries update 3 * testing something * change that * test something * . * . * . * locavar * test * move that * . * debug * don't run this test * strack trace it * cleaner * . * . * cras again * also comment this out * return to official rust g * Update robot_icons.dm * monitor the generation * . --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
69 lines
3.0 KiB
Plaintext
69 lines
3.0 KiB
Plaintext
// Some defines for tracking if the correct cinematic / animation is playing.
|
|
#define PLAYING_CORRECT_ANIMATION 2
|
|
#define PLAYING_INCORRECT_NUKE_ANIMATION 1
|
|
#define NOT_PLAYING_ANIMATION 0
|
|
|
|
/**
|
|
* Unit tests that a nuke going off plays a cinematic,
|
|
* and that it actually kills people.
|
|
*/
|
|
/datum/unit_test/nuke_cinematic
|
|
/// Used to track via signal if the correct cinematic / animation is playing.
|
|
var/cinematic_playing = NOT_PLAYING_ANIMATION
|
|
/// Tracks what typepath of cinematic is being played.
|
|
var/cinematic_playing_type
|
|
|
|
/datum/unit_test/nuke_cinematic/Run()
|
|
var/obj/machinery/nuclearbomb/syndicate/nuke = allocate(/obj/machinery/nuclearbomb/syndicate)
|
|
var/mob/living/carbon/human/nuked = allocate(/mob/living/carbon/human/consistent)
|
|
var/datum/client_interface/mock_client = new
|
|
nuked.mock_client = mock_client
|
|
mock_client.mob = nuked
|
|
|
|
var/obj/effect/landmark/observer_start/observer_point = locate(/obj/effect/landmark/observer_start) in landmarks_list
|
|
TEST_ASSERT_NOTNULL(observer_point, "Nuke cinematic test couldn't find observer spawn to place the nuke.")
|
|
|
|
var/turf/turf_on_station = get_turf(observer_point)
|
|
TEST_ASSERT(is_station_level(turf_on_station.z), "Nuke cinematic test didn't get a turf which was located on the station.")
|
|
|
|
nuke.forceMove(turf_on_station)
|
|
nuked.forceMove(turf_on_station)
|
|
|
|
// Pause the check so we don't, y'know, end the round
|
|
SSticker.roundend_check_paused = TRUE
|
|
RegisterSignal(SSdcs, COMSIG_GLOB_PLAY_CINEMATIC, PROC_REF(check_cinematic))
|
|
// actually_explode calls really_actually_explode which sleeps, so this will take a moment.
|
|
var/nuke_result = nuke.actually_explode()
|
|
|
|
TEST_ASSERT_EQUAL(nuke_result, DETONATION_HIT_STATION, "A nuke went off on station, but didn't return DETONATION_HIT_STATION (4). (Got: [nuke_result])")
|
|
TEST_ASSERT(GLOB.station_was_nuked, "A nuke went off on station, but didn't set station_was_nuked.")
|
|
// Reset the nuke var back so we don't end the round
|
|
GLOB.station_was_nuked = FALSE
|
|
SSticker.roundend_check_paused = FALSE
|
|
|
|
switch(cinematic_playing)
|
|
if(NOT_PLAYING_ANIMATION)
|
|
TEST_FAIL("No nuke cinematic was played when a nuke was detonated.")
|
|
|
|
if(PLAYING_INCORRECT_NUKE_ANIMATION)
|
|
TEST_FAIL("An incorrect cinematic was played on nuke detonation. (Expected: /datum/cinematic/nuke/self_destruct, Got: [cinematic_playing_type])")
|
|
|
|
TEST_ASSERT(QDELETED(nuked), "The nuke victim next to the nuke wasn't gibbed by the nuke.")
|
|
TEST_ASSERT(QDELETED(nuke), "The nuke itself was not deleted after successfully exploding.")
|
|
mock_client.mob = null
|
|
|
|
/// Used to track whenever a cinematic starts playing, so we can check if it's the right one.
|
|
/datum/unit_test/nuke_cinematic/proc/check_cinematic(datum/source, datum/cinematic/playing)
|
|
SIGNAL_HANDLER
|
|
|
|
cinematic_playing_type = playing.type
|
|
if(istype(playing, /datum/cinematic/nuke/self_destruct))
|
|
cinematic_playing = PLAYING_CORRECT_ANIMATION
|
|
|
|
else if(istype(playing, /datum/cinematic/nuke))
|
|
cinematic_playing = PLAYING_INCORRECT_NUKE_ANIMATION
|
|
|
|
#undef PLAYING_CORRECT_ANIMATION
|
|
#undef PLAYING_INCORRECT_NUKE_ANIMATION
|
|
#undef NOT_PLAYING_ANIMATION
|