mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 19:11:51 +00:00
* Fixes dragons not dropping their consumed mobs on despawn (#71537) ## About The Pull Request This was fixed a while back, but was accidentally reverted / regressed due to a refactor Basically, the dragon needs to be killed before being deleted, being killed will drop all of their stuff and handle "dragon is dead" events, then it can be fully deleted and removed as expected Unit tests it, since this is a regression Fixes #71536 ## Why It's Good For The Game Having a lot of mobs deleted is kinda really bad ## Changelog 🆑 Melbert fix: Fixes dragon despawn deleting all the people they consumed /🆑 Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * Fixes dragons not dropping their consumed mobs on despawn Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> Co-authored-by: Tastyfish <crazychris32@gmail.com>
29 lines
1.8 KiB
Plaintext
29 lines
1.8 KiB
Plaintext
/// Unit test for the contents barfer element
|
|
/datum/unit_test/contents_barfer
|
|
|
|
/datum/unit_test/contents_barfer/Run()
|
|
var/mob/living/simple_animal/hostile/space_dragon/dragon_time = allocate(/mob/living/simple_animal/hostile/space_dragon)
|
|
var/mob/living/carbon/human/to_be_consumed = allocate(/mob/living/carbon/human/consistent)
|
|
TEST_ASSERT(dragon_time.eat(to_be_consumed), "The space dragon failed to consume the dummy!")
|
|
TEST_ASSERT_EQUAL(to_be_consumed.loc, dragon_time, "The dummy's location, after being successfuly consumed, was not within the space dragon's contents!")
|
|
dragon_time.death()
|
|
TEST_ASSERT(isturf(to_be_consumed.loc), "After dying, the space dragon did not eject the consumed dummy content barfer element.")
|
|
|
|
/// Unit tests that the space dragon - when its rift expires and it gets qdel'd - doesn't delete all the mobs it has eaten
|
|
/datum/unit_test/space_dragon_expiration
|
|
|
|
/datum/unit_test/space_dragon_expiration/Run()
|
|
var/mob/living/simple_animal/hostile/space_dragon/dragon_time = allocate(/mob/living/simple_animal/hostile/space_dragon)
|
|
var/mob/living/carbon/human/to_be_consumed = allocate(/mob/living/carbon/human/consistent)
|
|
|
|
dragon_time.mind_initialize()
|
|
var/datum/antagonist/space_dragon/dragon_antag_datum = dragon_time.mind.add_antag_datum(/datum/antagonist/space_dragon)
|
|
dragon_time.eat(to_be_consumed)
|
|
|
|
dragon_antag_datum.riftTimer = dragon_antag_datum.maxRiftTimer + 1
|
|
dragon_antag_datum.rift_checks()
|
|
|
|
TEST_ASSERT(QDELETED(dragon_time), "The space dragon wasn't deleted after having its rift timer exceeded!")
|
|
TEST_ASSERT(!QDELETED(to_be_consumed), "After having its rift timer exceeded, the dragon deleted the dummy instead! The dragon should be dead prior to being deleted!")
|
|
TEST_ASSERT(isturf(to_be_consumed.loc), "After having its rift timer exceeded, the dragon did not eject the dummy! (Dummy's loc: [to_be_consumed.loc])")
|