Files
Bubberstation/code/modules/bitrunning/server/_parent.dm
SkyratBot 0a693b9dfa [MIRROR] Bitrunning 1.5: Secondary Objectives (#26821)
* 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.
/🆑

* Bitrunning 1.5: Secondary Objectives

* Update virtual_domain.dm

---------

Co-authored-by: Thunder12345 <Thunder12345@users.noreply.github.com>
Co-authored-by: Pinta <68373373+softcerv@users.noreply.github.com>
2024-03-22 12:17:51 -04:00

164 lines
5.2 KiB
Plaintext

/**
* The base object for the quantum server
*/
/obj/machinery/quantum_server
name = "quantum server"
circuit = /obj/item/circuitboard/machine/quantum_server
density = TRUE
desc = "A hulking computational machine designed to fabricate virtual domains."
icon = 'icons/obj/machines/bitrunning.dmi'
base_icon_state = "qserver"
icon_state = "qserver"
/// Affects server cooldown efficiency
var/capacitor_coefficient = 1
/// The loaded map template, map_template/virtual_domain
var/datum/lazy_template/virtual_domain/generated_domain
/// If the current domain was a random selection
var/domain_randomized = FALSE
/// Prevents multiple user actions. Handled by loading domains and cooldowns
var/is_ready = TRUE
/// Chance multipled by threat to spawn a glitch
var/glitch_chance = 0.05
/// Current plugged in users
var/list/datum/weakref/avatar_connection_refs = list()
/// Cached list of mutable mobs in zone for cybercops
var/list/datum/weakref/mutation_candidate_refs = list()
/// Any ghosts that have spawned in
var/list/datum/weakref/spawned_threat_refs = list()
/// Scales loot with extra players
var/multiplayer_bonus = 1.1
///The radio the console can speak into
var/obj/item/radio/radio
/// The amount of points in the system, used to purchase maps
var/points = 0
/// Keeps track of the number of times someone has built a hololadder
var/retries_spent = 0
/// Changes how much info is available on the domain
var/scanner_tier = 1
/// Length of time it takes for the server to cool down after resetting. Here to give runners downtime so their faces don't get stuck like that
var/server_cooldown_time = 3 MINUTES
/// Applies bonuses to rewards etc
var/servo_bonus = 0
/// Determines the glitches available to spawn, builds with completion
var/threat = 0
/// The turfs we can place a hololadder on.
var/turf/exit_turfs = list()
/obj/machinery/quantum_server/Initialize(mapload)
. = ..()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/quantum_server/LateInitialize()
. = ..()
radio = new(src)
radio.keyslot = new /obj/item/encryptionkey/headset_cargo()
radio.set_listening(FALSE)
radio.recalculateChannels()
RegisterSignals(src, list(COMSIG_MACHINERY_BROKEN, COMSIG_MACHINERY_POWER_LOST), PROC_REF(on_broken))
RegisterSignal(src, COMSIG_QDELETING, PROC_REF(on_delete))
/obj/machinery/quantum_server/Destroy(force)
. = ..()
mutation_candidate_refs.Cut()
avatar_connection_refs.Cut()
spawned_threat_refs.Cut()
QDEL_NULL(exit_turfs)
QDEL_NULL(generated_domain)
QDEL_NULL(radio)
/obj/machinery/quantum_server/examine(mob/user)
. = ..()
. += span_infoplain("Can be resource intensive to run. Ensure adequate power supply.")
if(capacitor_coefficient < 1)
. += span_infoplain("Its coolant capacity reduces cooldown time by [(1 - capacitor_coefficient) * 100]%.")
if(servo_bonus > 0.2)
. += span_infoplain("Its manipulation potential is increasing rewards by [servo_bonus]x.")
. += span_infoplain("Injury from unsafe ejection reduced [servo_bonus * 100]%.")
if(!is_ready)
. += span_notice("It is currently cooling down. Give it a few moments.")
/obj/machinery/quantum_server/emag_act(mob/user, obj/item/card/emag/emag_card)
. = ..()
obj_flags |= EMAGGED
glitch_chance = 0.09
add_overlay(mutable_appearance('icons/obj/machines/bitrunning.dmi', "emag_overlay"))
balloon_alert(user, "bzzzt...")
playsound(src, 'sound/effects/sparks1.ogg', 35, vary = TRUE)
/obj/machinery/quantum_server/update_appearance(updates)
if(isnull(generated_domain) || !is_operational)
set_light(l_on = FALSE)
return ..()
set_light(l_range = 2, l_power = 1.5, l_color = is_ready ? LIGHT_COLOR_BABY_BLUE : LIGHT_COLOR_FIRE, l_on = TRUE)
return ..()
/obj/machinery/quantum_server/update_icon_state()
if(isnull(generated_domain) || !is_operational)
icon_state = base_icon_state
return ..()
icon_state = "[base_icon_state]_[is_ready ? "on" : "off"]"
return ..()
/obj/machinery/quantum_server/attackby(obj/item/weapon, mob/user, params)
. = ..()
if(istype(weapon, /obj/item/bitrunning_debug))
obj_flags |= EMAGGED
glitch_chance = 0.5
capacitor_coefficient = 0.01
points = 100
/obj/machinery/quantum_server/crowbar_act(mob/living/user, obj/item/crowbar)
. = ..()
if(!is_ready)
balloon_alert(user, "it's scalding hot!")
return TRUE
if(length(avatar_connection_refs))
balloon_alert(user, "all clients must disconnect!")
return TRUE
if(default_deconstruction_crowbar(crowbar))
return TRUE
return FALSE
/obj/machinery/quantum_server/screwdriver_act(mob/living/user, obj/item/screwdriver)
. = ..()
if(!is_ready)
balloon_alert(user, "it's scalding hot!")
return TRUE
if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", icon_state, screwdriver))
return TRUE
return FALSE
/obj/machinery/quantum_server/RefreshParts()
var/capacitor_rating = 1.15
var/datum/stock_part/capacitor/cap = locate() in component_parts
capacitor_rating -= cap.tier * 0.15
capacitor_coefficient = capacitor_rating
var/datum/stock_part/scanning_module/scanner = locate() in component_parts
if(scanner)
scanner_tier = scanner.tier
var/servo_rating = 0
for(var/datum/stock_part/servo/servo in component_parts)
servo_rating += servo.tier * 0.1
servo_bonus = servo_rating
return ..()