Files
Bubberstation/code/controllers/subsystem/bitrunning.dm
Thunder12345 058cb039eb Bitrunning 1.5: Secondary Objectives (#81828)
## About The Pull Request

Added secondary objective lockboxes to bitrunning. These pull from a
list of secondary objective loot on the domain, with a limited quantity
of items. Once there are no items left to pull, the secondary objective
disappears. If multiple secondary objective markers are placed, they
will be placed until all markers have been used, or all the items in the
loot pool are already spoken for.

To support this functionality, adds SSbitrunning, which stores all
domains as instances, instead of checking the hardcoded types as
previously. SSbitrunning manages listing domains for the quantum
console, and rolling secondary loot.

As an example of this functionality, added a side path to Glacier Grind
with a polar bear and some loot.

## Why It's Good For The Game

Secondary objectives give mappers ways to encourage players to venture
into a wider range of domains by offering non-trivial loot beyond the
fluff items given in the main caches. The absolute limit on the number
of items available ensures these items can't be farmed.

As well as supporting secondary objectives, SSbitrunning allows for
future support of features relying on mid-round modification of domains,
for instance adding custom domains.

## Changelog
🆑
add: Added secondary objectives to bitrunning!
add: Pick up encrypted curiosities and return them to the safehouse to
claim their contents.
add: Glacier Grind has been given a secondary objective, look out for
the limited edition hat.
add: Bitrunning domains can now be modified during the round by admins.
/🆑
2024-03-09 22:42:23 +01:00

61 lines
2.0 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
levels += list(list(
"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" = assoc_value_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(assoc_value_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