Files
Bubberstation/code/modules/unit_tests/projectiles.dm
John Willard b5975bd915 Unit tests now catch decals in walls/space (#75189)
## About The Pull Request

Unit tests will now fail if there's a decal in a wall or open space
turf. Open space turf could be limiting to mappers but I don't think it
makes sense for decals (like dirt, glass shards, etc) to be floating
around in space in the exact same spot.

If there's a decal you want to put in space, decals have a
``turf_loc_check`` var that will bypass this.

**Important note: This is not changing existing behavior. Decals already
delete themselves when they spawn in these incorrect locations, we're
just avoiding them from spawning in the first place.**

### Changes I made

- Ash flora are now lava immune, rivers spawn after flora does, so I
decided that it would be easiest (and more flavorful) to have them be
lava-immune rather than to not have them spawn at all.
- Decals can now be spawned in non-turf locations. This is currently
done by mail, which can give you bones as part of the mail. Currently it
will just delete itself instead.
- Trading Card button is now on the same tile as their display, which
now uses an offset. Before it would spawn it on the tile next to it,
which could be a wall in some instances.
- Mirrors now have floating movement type. They ARE floating since
they're attached to the wall, and it prevents them from burning up due
to lava in the Pride ruin.
- I also added a broken mirror subtype because I thought the icon_state
check was terrible.
- Bubblegum called ``DestroySurroundings`` several times on the same
thing, I hopefully fixed some of that. Their charge ability also
registered ``COMSIG_MOB_STATCHANGE`` despite ``/datum/action`` doing it
by default, so I fixed that too.

## Why It's Good For The Game

Decals in walls is already a bad idea, but currently all it does is
delete it on Initialize. It would be better if we ensured they wouldn't
spawn in the first place.

## Changelog

🆑
fix: Lava will no longer burn 6 of the mirrors in pride ruin
fix: Lava will no longer burn plants that spawn in them.
/🆑
2023-06-15 16:39:22 -07:00

35 lines
2.1 KiB
Plaintext

///Tests all projectiles that none of them are phasing.
/datum/unit_test/projectile_movetypes
/datum/unit_test/projectile_movetypes/Run()
for(var/obj/projectile/projectile as anything in typesof(/obj/projectile))
if(initial(projectile.movement_type) & PHASING)
TEST_FAIL("[projectile] has default movement type PHASING. Piercing projectiles should be done using the projectile piercing system, not movement_types!")
///Shoots a victim with a gun to ensure the gun properly loads and the victim take the correct amount of damage.
/datum/unit_test/gun_go_bang
/datum/unit_test/gun_go_bang/Run()
// test is for a ballistic gun that starts loaded + chambered
var/obj/item/gun/ballistic/test_gun = allocate(/obj/item/gun/ballistic/automatic/pistol)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/gunner = allocate(/mob/living/carbon/human/consistent)
ADD_TRAIT(victim, TRAIT_PIERCEIMMUNE, INNATE_TRAIT) // So the human isn't randomly affected by shrapnel
test_gun.can_misfire = FALSE //just in case
var/obj/item/ammo_casing/loaded_casing = test_gun.chambered
TEST_ASSERT(loaded_casing, "Gun started without round chambered, should be loaded")
var/obj/projectile/loaded_bullet = loaded_casing.loaded_projectile
TEST_ASSERT(loaded_bullet, "Ammo casing has no loaded bullet")
gunner.put_in_hands(test_gun, forced=TRUE)
gunner.set_combat_mode(FALSE) // just to make sure we know we're not trying to pistol-whip them
var/expected_damage = loaded_bullet.damage
loaded_bullet.def_zone = BODY_ZONE_CHEST
var/did_we_shoot = test_gun.afterattack(victim, gunner)
TEST_ASSERT(did_we_shoot, "Gun does not appeared to have successfully fired.")
TEST_ASSERT_EQUAL(victim.getBruteLoss(), expected_damage, "Victim took incorrect amount of damage, expected [expected_damage], got [victim.getBruteLoss()].")
var/obj/item/bodypart/expected_part = victim.get_bodypart(BODY_ZONE_CHEST)
TEST_ASSERT_EQUAL(expected_part.brute_dam, expected_damage, "Intended bodypart took incorrect amount of damage, either it hit another bodypart or armor was incorrectly applied. Expected [expected_damage], got [expected_part.brute_dam].")