Files
Bubberstation/code/controllers/subsystem/bitrunning.dm
SmArtKar b7383bc503 Refactors MODsuit slowdown calculations (#90116)
## About The Pull Request

MODsuits now calculate their slowdown by querying modules by sending a
signal on themselves instead of having modules try and keep up with
control unit's speed updates (which broke in a fabulous fashion after
MODsuits were allowed to deploy by piece)
Also added a separate trait to prevent objects from being speed
potion-ed to combat stabilized red crossbreed issues, and removed a
duplicate list helper (40 lines down in the same file lol)

Closes #89979
Closes #90036

## Changelog
🆑
fix: MODsuits should now be affected by stabilized red crossbreeds
fix: MODsuit slowdowns should no longer behave weirdly with ash
accretion/magboots/armor booster modules.
refactor: Refactored MODsuit slowdown calculations to be query-based
instead of modules directly modifying part speed values.
/🆑
2025-03-26 17:55:32 +01: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