Files
Bubberstation/code/modules/unit_tests/mob_chains.dm
SkyratBot 9c6432247a [MIRROR] Basic Mob Flesh Worm [MDB IGNORE] (#24122)
* Basic Mob Flesh Worm (#78744)

## About The Pull Request

Fixes #68614

Converts the Flesh Worm (Armsy) into a Basic Mob.
Most of its behaviour has been moved into a component which we can use
to make arbitrary mobs into linked lists of mobs.
To accomplish this I added a signal which is sent when you call any
`adjustXLoss` proc, let me know if my implementation is "calling the
same signal from several places" by a backdoor, I wanted to avoid
registering to 6 signals but I'll change it if I must.

While I was here I killed the unused "lesser" variant because we stopped
using it. Resultingly, Ascended Armsy doesn't need to distinguish itself
by inflating the sprite, so it doesn't. This means that now flesh worms
are using their sprites as intended to be displayed, but if people
really miss all of its segments being poorly scaled by the byond engine
then I guess I can restore it.

## Why It's Good For The Game

![dreamseeker_p8vOpZGXII](https://github.com/tgstation/tgstation/assets/7483112/3389d3a9-16cd-4e1e-938e-dfa18d0da0af)

## Changelog

🆑
refactor: Flesh Worms are now basic mobs. Please report any unexpected
behaviour.
sprite: Flesh Worms are a little bit slimmer.
/🆑

* Basic Mob Flesh Worm

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-10-06 14:43:47 -07:00

32 lines
1.4 KiB
Plaintext

/// Checks if mobs who are linked together with the mob chain component react as expected
/datum/unit_test/mob_chains
/datum/unit_test/mob_chains/Run()
var/mob/living/centipede_head = allocate(/mob/living/basic/pet/dog)
var/list/segments = list(centipede_head)
centipede_head.AddComponent(/datum/component/mob_chain)
var/mob/living/centipede_tail = centipede_head
for (var/i in 1 to 2)
var/mob/living/new_segment = allocate(/mob/living/basic/pet/dog)
new_segment.AddComponent(/datum/component/mob_chain, front = centipede_tail)
segments += new_segment
centipede_tail = new_segment
var/test_damage = 15
centipede_head.apply_damage(test_damage, BRUTE)
TEST_ASSERT_EQUAL(centipede_head.bruteloss, 0, "Centipede head took damage which should have been passed to its tail.")
TEST_ASSERT_EQUAL(centipede_tail.bruteloss, test_damage, "Centipede tail did not take damage which should have originated from its head.")
var/expected_damage = 5
for (var/mob/living/segment as anything in segments)
segment.combat_mode = TRUE
segment.melee_damage_lower = expected_damage
segment.melee_damage_upper = expected_damage
var/mob/living/victim = allocate(/mob/living/basic/pet/dog)
centipede_head.ClickOn(victim)
TEST_ASSERT_EQUAL(victim.bruteloss, expected_damage * 3, "Centipede failed to do damage with all of its segments.")
centipede_head.death()
TEST_ASSERT_EQUAL(centipede_tail.stat, DEAD, "Centipede tail failed to die with head.")