Files
Bubberstation/code/modules/bitrunning/server/signal_handlers.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

106 lines
3.6 KiB
Plaintext

/// If broken via signal, disconnects all users
/obj/machinery/quantum_server/proc/on_broken(datum/source)
SIGNAL_HANDLER
sever_connections()
/// Whenever a corpse spawner makes a new corpse, add it to the list of potential mutations
/obj/machinery/quantum_server/proc/on_corpse_spawned(datum/source, mob/living/corpse)
SIGNAL_HANDLER
mutation_candidate_refs.Add(WEAKREF(corpse))
/// Being qdeleted - make sure the circuit and connected mobs go with it
/obj/machinery/quantum_server/proc/on_delete(datum/source)
SIGNAL_HANDLER
sever_connections()
if(generated_domain)
scrub_vdom()
if(is_ready)
return
// in case they're trying to cheese cooldown
var/obj/item/circuitboard/machine/quantum_server/circuit = locate(/obj/item/circuitboard/machine/quantum_server) in contents
if(circuit)
qdel(circuit)
/// Whenever something enters the send tiles, check if it's a loot crate. If so, alert players.
/obj/machinery/quantum_server/proc/on_goal_turf_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
var/obj/machinery/byteforge/chosen_forge = get_random_nearby_forge()
if(isnull(chosen_forge))
return
if((obj_flags & EMAGGED) && isliving(arrived))
var/mob/living/creature = arrived
if(!creature.mind?.has_antag_datum(/datum/antagonist/bitrunning_glitch, check_subtypes = TRUE))
return
INVOKE_ASYNC(src, PROC_REF(station_spawn), arrived, chosen_forge)
return
if(istype(arrived, /obj/structure/closet/crate/secure/bitrunning/encrypted))
generate_loot(arrived, chosen_forge)
return
if(istype(arrived, /obj/item/storage/lockbox/bitrunning/encrypted))
generate_secondary_loot(arrived, chosen_forge, generated_domain)
return
/// Handles examining the server. Shows cooldown time and efficiency.
/obj/machinery/quantum_server/proc/on_goal_turf_examined(datum/source, mob/examiner, list/examine_text)
SIGNAL_HANDLER
examine_text += span_info("Beneath your gaze, the floor pulses subtly with streams of encoded data.")
examine_text += span_info("It seems to be part of the location designated for retrieving encrypted payloads.")
/// Scans over the inbound created_atoms from lazy templates
/obj/machinery/quantum_server/proc/on_template_loaded(datum/lazy_template/source, list/created_atoms)
SIGNAL_HANDLER
for(var/thing in created_atoms)
if(isliving(thing)) // so we can mutate them
var/mob/living/creature = thing
if(ismegafauna(creature))
var/mob/living/simple_animal/hostile/megafauna/boss = creature
boss.make_virtual_megafauna()
continue
mutation_candidate_refs.Add(WEAKREF(creature))
continue
if(istype(thing, /obj/effect/mob_spawn/ghost_role)) // so we get threat alerts
RegisterSignal(thing, COMSIG_GHOSTROLE_SPAWNED, PROC_REF(on_threat_created))
continue
if(istype(thing, /obj/effect/mob_spawn/corpse)) // corpses are valid targets too
var/obj/effect/mob_spawn/corpse/spawner = thing
mutation_candidate_refs.Add(spawner.spawned_mob_ref)
continue
if(istype(thing, /obj/machinery/suit_storage_unit))
var/obj/machinery/suit_storage_unit/storage = thing
storage.disable_modlink()
continue
if(istype(thing, /obj/item/mod/control))
var/obj/item/mod/control/modsuit = thing
modsuit.disable_modlink()
UnregisterSignal(source, COMSIG_LAZY_TEMPLATE_LOADED)
/// Just in case there's any special handling for the domain
generated_domain.setup_domain(created_atoms)
/// Handles when cybercops are summoned into the area or ghosts click a ghost role spawner
/obj/machinery/quantum_server/proc/on_threat_created(datum/source, mob/living/threat)
SIGNAL_HANDLER
add_threats(threat)