mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-08 22:50:51 +01:00
fa56a10149
## About The Pull Request Adds an up that allows you to subscribe to any fax. Heads start with one by default and they are subscribed to their office fax upon joining. Later part involved creation of fax subtype specific to a head. So i decided to also make those as a required map item for the purposes of CI. <details> <summary>UI</summary> <img width="435" height="552" alt="изображение" src="https://github.com/user-attachments/assets/73b814d5-3009-4c76-a829-c01f021aecf4" /> </details> its pretty simplistic, but i am not a UI designer, sorry ## Why It's Good For The Game It really sucks when you wait for someones message but they never respond to it because apparently they never visit their office and never saw a paper over their fax if even if they responded, by the time you get an answer you already forgot about it anyway. In general, it makes paperwork experience relating to faxes more enjoyable (probably) ## Changelog 🆑 add: added a FaxBond app. Everyone can download it and use it on a fax of their choice to be notified when it receives a message. Heads of staff come with it preinstalled and automatically subscribed to a fax inside their office. /🆑
68 lines
2.9 KiB
Plaintext
68 lines
2.9 KiB
Plaintext
/**
|
|
* Tests that all expected items are mapped in roundstart.
|
|
*
|
|
* How to add an item to this test:
|
|
* - Add the typepath(s) to setup_expected_types
|
|
* - In the type's initialize, REGISTER_REQUIRED_MAP_ITEM() a minimum and maximum
|
|
*/
|
|
/datum/unit_test/maptest_required_map_items
|
|
test_flags = UNIT_TEST_MAP_TEST
|
|
/// A list of all typepaths that we expect to be in the required items list
|
|
var/list/expected_types = list()
|
|
|
|
/// Used to fill the expected types list with all the types we look for on the map.
|
|
/// This list will just be full of typepaths that we expect.
|
|
/// More detailed information about each item (mainly, how much of each should exist) is set on a per item basis
|
|
/datum/unit_test/maptest_required_map_items/proc/setup_expected_types()
|
|
expected_types += subtypesof(/obj/item/stamp/head)
|
|
expected_types += subtypesof(/obj/machinery/modular_computer/preset/cargochat)
|
|
expected_types += subtypesof(/obj/machinery/fax/heads)
|
|
|
|
expected_types += /mob/living/basic/parrot/poly
|
|
expected_types += /mob/living/basic/pet/dog/corgi/ian
|
|
expected_types += /mob/living/carbon/human/species/monkey/punpun
|
|
expected_types += /obj/machinery/computer/communications
|
|
expected_types += /obj/machinery/drone_dispenser
|
|
expected_types += /obj/item/piggy_bank/vault
|
|
|
|
/datum/unit_test/maptest_required_map_items/Run()
|
|
setup_expected_types()
|
|
|
|
var/list/required_map_items = GLOB.required_map_items.Copy()
|
|
for(var/got_type in expected_types)
|
|
var/datum/required_item/item = required_map_items[got_type]
|
|
var/items_found = item?.total_amount || 0
|
|
required_map_items -= got_type
|
|
if(items_found <= 0)
|
|
TEST_FAIL("Item [got_type] was not found, but is expected to be mapped in on mapload!")
|
|
continue
|
|
|
|
if(items_found < item.minimum_amount)
|
|
TEST_FAIL("Item [got_type] should have at least [item.minimum_amount] mapped in but only had [items_found] on mapload!")
|
|
continue
|
|
|
|
if(items_found > item.maximum_amount)
|
|
TEST_FAIL("Item [got_type] should have at most [item.maximum_amount] mapped in but had [items_found] on mapload!")
|
|
continue
|
|
|
|
// This primarily serves as a reminder to include the typepath in the expected types list above.
|
|
// However we can easily delete this line in the future if it runs into false positives.
|
|
TEST_ASSERT(length(required_map_items) == 0, "The following paths were found in required map items, but weren't checked: [english_list(required_map_items)]")
|
|
|
|
/// Datum for tracking required map items
|
|
/datum/required_item
|
|
/// Type (exact) being tracked
|
|
var/tracked_type
|
|
/// How many exist in the world
|
|
var/total_amount = 0
|
|
/// Min. amount of this type that should exist roundstart (inclusive)
|
|
var/minimum_amount = 1
|
|
/// Max. amount of this type that should exist roundstart (inclusive)
|
|
var/maximum_amount = 1
|
|
|
|
/datum/required_item/New(tracked_type, minimum_amount = 1, maximum_amount = 1)
|
|
src.tracked_type = tracked_type
|
|
src.minimum_amount = minimum_amount
|
|
src.maximum_amount = maximum_amount
|
|
total_amount += 1
|