Files
Bubberstation/code/modules/bitrunning/server/map_handling.dm
Jeremiah ba5ae73dac Adds more bitrunning antagonists + fixes (READY) (#79522)
## About The Pull Request
Reopened #78997
Larger patch for bitrunning that addresses a few issues.

- Two new antagonists: cyber tac and netguardian
- Quantum server emag opportunity
- Modular mob packs: Like random spawners, but for groups
- Antag spawning fixed: vdom antags now have up to a 10% chance to spawn
based on domains loaded
- Virtual domains are no longer all fullbright by default, only the
outdoorsy ones
- Actually deletes legion map file, since it was removed in #79424

<details>
<summary>images</summary>

The netguardian prime

![dreamseeker_eKi7Mhv45s](https://github.com/tgstation/tgstation/assets/42397676/099a0982-d6f8-4c93-a64c-8c7d45d9204e)


![robot_48_animation](https://github.com/tgstation/tgstation/assets/42397676/a2147195-61e6-4584-8645-56333ecd3e07)

The glitch effect - this mob is being mutated

![dreamseeker_NE4j4rCoez](https://github.com/tgstation/tgstation/assets/42397676/273892c7-e396-417b-8a9d-3709a210e3ff)

Cyber tac (t2 antagonist)
![Screenshot 2023-10-27
211732](https://github.com/tgstation/tgstation/assets/42397676/6ff79337-cb0d-4a1f-80cf-dce99a4991d5)

</details>

## Why It's Good For The Game
- Bitrunning antagonists are so incredibly rare that it's underwhelming
to play as one for the solid second they offer if you even get the role
- Bitrunners had basically no traitor route to follow, they became
assistants with black outfits

Fixes #79465

<details>
<summary>More info</summary>

Bitrunners don't have any type of traitor options. If they're made into
traitors, there's nothing bitrunner related they can do, and their
access is particularly bad so it's like they're a worse assistant. I've
coupled this with the bitrunning antagonist system, which is now
fixed.\. Bitrunners can now attempt to coax these entities to come onto
the station, however they are not given any form of allegiance for doing
so (and are quite counterable).

Previously, vdom antagonists relied on so many factors to spawn that it
basically wouldn't happen. Now, it runs on the server each time there is
a map loaded, with increasing probability as the round progresses. This
builds up the list of spawnable antagonists, of which two are new,
including an entirely new giant mech megafauna. This is the first
"megafauna-esque" basic mob in the game. Its AI is bad, it's really only
meant to be player controlled, but this does mean an admin can spawn
them. Being mech, they are very counterable with ion rifles and the
like.

Several refactors, rewrites, and overall bug fixes are included in this
PR.

Lastly, I added a framework for making bitrunner maps more random, the
modular mob spawning system, which works in conjunction with random
crate locations.
</details>

## Changelog
jlsnow301, infraredbaron
🆑
add: Bitrunning Patch 1 features a host of changes!
add: Added randomized mobs to virtual domains, which will be indicated
with a unique icon.
add: New emag interaction with the quantum server. Antags will spawn
more frequently, and they can hack themselves onto the station. You have
been warned.
add: Both living and dead players can now see which mob is going to
spawn an antagonist in the vdom.
add: Two new vdom antagonists: Cyber Tac and the NetGuardian. These
unlock at specific thresholds.
balance: You can no longer stack copies of the same ability with
bitrunning disks.
balance: Some of the disk items have been replaced with stronger
versions.
fix: You can no longer spy on crew using the advanced camera console on
syndicate assault.
fix: Fixed the spawning mechanism of virtual domain antagonists. You
should now have a chance of playing as one. This chance increases as
more domains are completed.
fix: Vdom antagonists shouldn't spawn at the end of the run any longer.
fix: The preference for vdom antagonists has been changed to factor in
the new types. Check your preferences!
fix: The quantum server will now show its balloon alerts to all
observers.
fix: Random domains should be fully random again.
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-11-17 11:56:17 +13:00

174 lines
5.6 KiB
Plaintext

/// Gives all current occupants a notification that the server is going down
/obj/machinery/quantum_server/proc/begin_shutdown(mob/user)
if(isnull(generated_domain))
return
if(!length(avatar_connection_refs))
balloon_alert_to_viewers("powering down domain...")
playsound(src, 'sound/machines/terminal_off.ogg', 40, vary = TRUE)
reset()
return
balloon_alert_to_viewers("notifying clients...")
playsound(src, 'sound/machines/terminal_alert.ogg', 100, vary = TRUE)
user.visible_message(
span_danger("[user] begins depowering the server!"),
span_notice("You start disconnecting clients..."),
span_danger("You hear frantic keying on a keyboard."),
)
SEND_SIGNAL(src, COMSIG_BITRUNNER_SHUTDOWN_ALERT, user)
if(!do_after(user, 20 SECONDS, src))
return
reset()
/// Links all the loading processes together - does validation for booting a map
/obj/machinery/quantum_server/proc/cold_boot_map(map_key)
if(!is_ready)
return FALSE
if(isnull(map_key))
balloon_alert_to_viewers("no domain specified.")
return FALSE
if(generated_domain)
balloon_alert_to_viewers("stop the current domain first.")
return FALSE
if(length(avatar_connection_refs))
balloon_alert_to_viewers("all clients must disconnect!")
return FALSE
is_ready = FALSE
playsound(src, 'sound/machines/terminal_processing.ogg', 30, 2)
/// If any one of these fail, it reverts the entire process
if(!load_domain(map_key) || !load_safehouse() || !load_map_items() || !load_mob_segments())
balloon_alert_to_viewers("initialization failed.")
scrub_vdom()
is_ready = TRUE
return FALSE
is_ready = TRUE
if(prob(clamp((threat * glitch_chance), 1, 10)))
setup_glitch()
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 30, vary = TRUE)
balloon_alert_to_viewers("domain loaded.")
generated_domain.start_time = world.time
points -= generated_domain.cost
update_use_power(ACTIVE_POWER_USE)
update_appearance()
return TRUE
/// Initializes a new domain if the given key is valid and the user has enough points
/obj/machinery/quantum_server/proc/load_domain(map_key)
for(var/datum/lazy_template/virtual_domain/available as anything in subtypesof(/datum/lazy_template/virtual_domain))
if(map_key == initial(available.key) && points >= initial(available.cost))
generated_domain = new available()
RegisterSignal(generated_domain, COMSIG_LAZY_TEMPLATE_LOADED, PROC_REF(on_template_loaded))
generated_domain.lazy_load()
return TRUE
return FALSE
/// Loads in necessary map items like hololadder spawns, caches, etc
/obj/machinery/quantum_server/proc/load_map_items()
var/turf/goal_turfs = list()
var/turf/cache_turfs = list()
for(var/obj/effect/landmark/bitrunning/thing in GLOB.landmarks_list)
if(istype(thing, /obj/effect/landmark/bitrunning/hololadder_spawn))
exit_turfs += get_turf(thing)
qdel(thing) // i'm worried about multiple servers getting confused so lets clean em up
continue
if(istype(thing, /obj/effect/landmark/bitrunning/cache_goal_turf))
var/turf/tile = get_turf(thing)
goal_turfs += tile
RegisterSignal(tile, COMSIG_ATOM_ENTERED, PROC_REF(on_goal_turf_entered))
RegisterSignal(tile, COMSIG_ATOM_EXAMINE, PROC_REF(on_goal_turf_examined))
qdel(thing)
continue
if(istype(thing, /obj/effect/landmark/bitrunning/cache_spawn))
cache_turfs += get_turf(thing)
qdel(thing)
continue
if(istype(thing, /obj/effect/landmark/bitrunning/loot_signal))
var/turf/signaler_turf = get_turf(thing)
signaler_turf.AddComponent(/datum/component/bitrunning_points, generated_domain)
qdel(thing)
if(!length(exit_turfs))
CRASH("Failed to find exit turfs on generated domain.")
if(!length(goal_turfs))
CRASH("Failed to find send turfs on generated domain.")
if(!attempt_spawn_cache(cache_turfs))
return FALSE
return TRUE
/// Loads the safehouse
/obj/machinery/quantum_server/proc/load_safehouse()
var/obj/effect/landmark/bitrunning/safehouse_spawn/landmark = locate() in GLOB.landmarks_list
if(isnull(landmark))
CRASH("vdom: failed to find safehouse spawn landmark")
var/turf/spawn_loc = get_turf(landmark)
qdel(landmark)
var/datum/map_template/safehouse/new_safehouse = new generated_domain.safehouse_path()
if(!new_safehouse.load(spawn_loc))
CRASH("vdom: failed to load safehouse")
return TRUE
/// Stops the current virtual domain and disconnects all users
/obj/machinery/quantum_server/proc/reset(fast = FALSE)
is_ready = FALSE
sever_connections()
if(!fast)
notify_spawned_threats()
addtimer(CALLBACK(src, PROC_REF(scrub_vdom)), 15 SECONDS, TIMER_UNIQUE|TIMER_STOPPABLE)
else
scrub_vdom() // used in unit testing, no need to wait for callbacks
addtimer(CALLBACK(src, PROC_REF(cool_off)), ROUND_UP(server_cooldown_time * capacitor_coefficient), TIMER_UNIQUE|TIMER_STOPPABLE|TIMER_DELETE_ME)
update_appearance()
update_use_power(IDLE_POWER_USE)
domain_randomized = FALSE
retries_spent = 0
/// Tries to clean up everything in the domain
/obj/machinery/quantum_server/proc/scrub_vdom()
sever_connections() /// just in case someone's connected
SEND_SIGNAL(src, COMSIG_BITRUNNER_DOMAIN_SCRUBBED) // avatar cleanup just in case
if(length(generated_domain.reservations))
var/datum/turf_reservation/res = generated_domain.reservations[1]
res.Release()
var/list/creatures = spawned_threat_refs + mutation_candidate_refs
for(var/datum/weakref/creature_ref as anything in creatures)
var/mob/living/creature = creature_ref?.resolve()
if(isnull(creature))
continue
creature.dust(just_ash = TRUE, force = TRUE) // sometimes mobs just don't die
avatar_connection_refs.Cut()
exit_turfs = list()
generated_domain = null
mutation_candidate_refs.Cut()
spawned_threat_refs.Cut()