Files
Mike LongandGitHub c7c61ec373 Enhance bitrunner domain creation blackbox logging (#94913)
## About The Pull Request

Improves some blackbox logging for bitrunner domain creation, by also
logging how much information they had when they chose it.

Also some minor code improvements, by making methods for whether the
name/reward of a domain is visible.

## Why It's Good For The Game

Right now, if we just look at blackbox logs, we cannot easily tell if a
domain is being deliberately avoided when possible, as we cannot tell if
it's run unintentionally or intentionally. Now we will record that
information, so we can act on it, and hopefully perform actions to
improve the domains that people attempt to avoid.
2026-01-28 11:40:33 -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.domain_flags & DOMAIN_TEST_ONLY)
continue
var/can_view = domain.can_view_name(scanner_tier, points)
var/can_view_reward = domain.can_view_reward(scanner_tier, points)
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