Files
Bubberstation/code/modules/unit_tests/interaction_structures.dm
SyncIt21 9740c687de General maintenance for wall mounts (#93534)
## About The Pull Request
- Fixes #93392
- Replaces all custom callbacks with call to `deconstruct()`. The
callbacks weren't necessary as it did the same thing as `deconstruct()`
but in an round about way
- Removed duplicate `Initialize()` procs and the params `building` &
`ndir` from all wall mounts. Makes everything cleaner

## Changelog
🆑
fix: wall mounts placed by player now falls off when the wall they are
mounted on is destroyed
code: cleaned up wall mount code
/🆑
2025-10-23 17:26:19 +02:00

41 lines
2.3 KiB
Plaintext

/// Tests that mobs are able to bash down tables by clicking on them.
/datum/unit_test/structure_table_bash
/datum/unit_test/structure_table_bash/Run()
var/mob/living/carbon/human/consistent/attacker = EASY_ALLOCATE()
var/obj/item/storage/toolbox/toolbox = EASY_ALLOCATE()
var/obj/structure/table/to_smack = EASY_ALLOCATE()
attacker.put_in_active_hand(toolbox, forced = TRUE)
click_wrapper(attacker, to_smack)
TEST_ASSERT_EQUAL(toolbox.loc, to_smack.loc, "The toolbox should have been placed on the table. Instead, its loc is [toolbox.loc].")
TEST_ASSERT_EQUAL(to_smack.get_integrity(), to_smack.max_integrity, "Table took damage despite not being smacked.")
attacker.put_in_active_hand(toolbox, forced = TRUE)
attacker.set_combat_mode(TRUE)
click_wrapper(attacker, to_smack)
TEST_ASSERT_NOTEQUAL(toolbox.loc, to_smack.loc, "The toolbox should not have been placed on the table.")
TEST_ASSERT_NOTEQUAL(to_smack.get_integrity(), to_smack.max_integrity, "Table failed to take damage from being smacked.")
/// Tests that mobs are able to bash down barricades / structures by clicking on them.
/datum/unit_test/structure_generic_bash
/datum/unit_test/structure_generic_bash/Run()
var/mob/living/carbon/human/consistent/attacker = EASY_ALLOCATE()
var/obj/item/storage/toolbox/toolbox = EASY_ALLOCATE()
var/obj/structure/barricade/to_smack = EASY_ALLOCATE()
attacker.put_in_active_hand(toolbox, forced = TRUE)
click_wrapper(attacker, to_smack)
TEST_ASSERT_NOTEQUAL(to_smack.get_integrity(), to_smack.max_integrity, "The barricade should have taken damage a from a non-combat-mode click.")
/// Tests that common tool interactions are possible still, by attempting to open the panel of an techfab.
/datum/unit_test/machinery_tool_interaction
/datum/unit_test/machinery_tool_interaction/Run()
var/mob/living/carbon/human/consistent/attacker = EASY_ALLOCATE()
var/obj/item/screwdriver/screwdriver = EASY_ALLOCATE()
var/obj/machinery/rnd/production/to_smack = EASY_ALLOCATE()
attacker.put_in_active_hand(screwdriver, forced = TRUE)
click_wrapper(attacker, to_smack)
TEST_ASSERT_EQUAL(to_smack.get_integrity(), to_smack.max_integrity, "The techfab took damage when interacted with a screwdriver.")
TEST_ASSERT(to_smack.panel_open, "The techfab should have opened its panel after being interacted with a screwdriver.")