Files
Bubberstation/code/controllers/subsystem/networks/bitrunning.dm
Joshua Kidder 98135b69dc Subsystems meant to represent/handle in-game networks moved under their own subfolder ( no code changes ) (#90561)
## About The Pull Request

While working on another PR, I noticed that there wasn't any real
distinction between subsystems that function as a network for various
logical components/systems in the code, and subsystems that are meant to
represent what is actually an in-game network. As such, I moved what
seemed to be clear representations of the functions of in-game networks
under their own subfolder.

This should have no effects otherwise.
## Why It's Good For The Game

Per an .md I added in the folder, it helps to clearly demarcate what are
backend programmatic networked systems, and what are meant to actually
be a network in the game itself; the radio jammer disrupts your suit
sensors and headset, not your signal relationships with DCS, and I
believe having that distinction be clear at a glance of the file
structure is valuable.
## Changelog
🆑 Bisar
code: Subsystems that are meant to represent a network in-game have been
moved into their own category inside the codebase.
/🆑
2025-04-13 14:19:51 -06:00

62 lines
2.1 KiB
Plaintext

#define REDACTED "???"
SUBSYSTEM_DEF(bitrunning)
name = "Bitrunning"
flags = SS_NO_FIRE
var/list/all_domains = list()
/datum/controller/subsystem/bitrunning/Initialize()
InitializeDomains()
return SS_INIT_SUCCESS
/datum/controller/subsystem/bitrunning/proc/InitializeDomains()
for(var/path in subtypesof(/datum/lazy_template/virtual_domain))
all_domains += new path()
/// Compiles a list of available domains.
/datum/controller/subsystem/bitrunning/proc/get_available_domains(scanner_tier, points)
var/list/levels = list()
for(var/datum/lazy_template/virtual_domain/domain as anything in all_domains)
if(domain.test_only)
continue
var/can_view = domain.difficulty < scanner_tier && domain.cost <= points + 5
var/can_view_reward = domain.difficulty < (scanner_tier + 1) && domain.cost <= points + 3
UNTYPED_LIST_ADD(levels, list(
"announce_ghosts" = domain.announce_to_ghosts,
"cost" = domain.cost,
"desc" = can_view ? domain.desc : "Limited scanning capabilities. Cannot infer domain details.",
"difficulty" = domain.difficulty,
"id" = domain.key,
"is_modular" = domain.is_modular,
"has_secondary_objectives" = counterlist_sum(domain.secondary_loot) ? TRUE : FALSE,
"name" = can_view ? domain.name : REDACTED,
"reward" = can_view_reward ? domain.reward_points : REDACTED,
))
return levels
/datum/controller/subsystem/bitrunning/proc/pick_secondary_loot(completed_domain)
var/datum/lazy_template/virtual_domain/domain = completed_domain
var/choice
if(counterlist_sum(domain.secondary_loot))
choice = pick_weight(domain.secondary_loot)
domain.secondary_loot[choice] -= 1
else
choice = /obj/item/paper/paperslip/bitrunning_error
CRASH("Virtual domain [domain.name] tried to pick secondary objective loot, but secondary_loot list was empty.")
return choice
/obj/item/paper/paperslip/bitrunning_error
name = "Apology Letter"
desc = "Something went wrong here."
/obj/item/paper/paperslip/bitrunning_error/Initialize(mapload)
default_raw_text = "Your reward for collecting the encrypted curiosity failed to arrive, please report this to technical support."
return ..()
#undef REDACTED