Files
Bubberstation/code/modules/bitrunning/server/_parent.dm
SkyratBot d6f7d2609d [MIRROR] Bitrunning: Combat domain [READY] (#28573)
* Bitrunning: Combat domain [READY] (#84196)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Finally dusts off this project to make a deathmatch style bitrunning
map.
Don't be too intimidated by the file diff, lots of code organization +
resized a large map.

Changes:

1. Reuses the gateway beach map as a combat zone (99% of the file diff)
(maptainers: i just added spawners and areas)
2. Alters how bitrunning handles spawning: Custom spawns are now
available, which can be anything

Misc organization:

- Splits netpod.dm into separate files.
- Fixes some wording in vdom map documentation.
- Organizes vdom variables a bit.
- Adds a permanent hololadder spawn.

How bitrunning deathmatch works:

- Temporary spawners are offered to both ghosts and bitrunners.
- Runners spawn in like usual. Ghost can use the spawner menu.
- Ghosts work to prevent avatars from collecting side objectives or try
to cause mass brain damage.
- The domain completes after a number of deaths accrue. Any faction.
Blood for the blood god, etc.
- This map can be played solo. ANY deaths.

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
I've been toying with the idea of a deathmatch style map for some time.
I liked syndicate assault, the spawners were intentionally left there,
and the possibility of player-controlled players made the experience
more tense and challenging.

This PR leans into this idea: The virtual world is dangerous. Players
get a chance to compete on both sides here. It offers a lot of variety
to bitrunning other than "run for box". It's also very lucrative if
ghosts join in.

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
add: Added a bitrunning deathmatch map: Island Brawl. Both ghosts and
runners get many more spawns than normal.
fix: Lowered the static vision time in domain load in.
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Bitrunning: Combat domain [READY]

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
2024-07-03 21:42:44 +05:30

181 lines
5.8 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.2
/// 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 = 2 MINUTES
/// Applies bonuses to rewards etc
var/servo_bonus = 0
/// Determines the glitches available to spawn, builds with completion
var/threat = 0
/// Maximum rate at which a glitch can spawn
var/threat_prob_max = 15
/// The turfs we can place a hololadder on.
var/turf/exit_turfs = list()
/// Determines if we broadcast to entertainment monitors or not
var/broadcasting = FALSE
/// Cooldown between being able to toggle broadcasting
COOLDOWN_DECLARE(broadcast_toggle_cd)
/obj/machinery/quantum_server/post_machine_initialize()
. = ..()
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.")
var/upgraded = FALSE
if(capacitor_coefficient < 1)
. += span_infoplain("- Its coolant capacity reduces cooldown time by [(1 - capacitor_coefficient) * 100]%.")
upgraded = TRUE
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]%.")
upgraded = TRUE
if(!upgraded)
. += span_notice("Its output is suboptimal. Improved components will grant domain information, reduce cooldowns and increase rewards.")
if(!is_ready)
. += span_notice("It is currently cooling down. Give it a few moments.")
if(isobserver(user) && (obj_flags & EMAGGED))
. += span_notice("Ominous warning lights are blinking red. This server has been tampered with.")
/obj/machinery/quantum_server/emag_act(mob/user, obj/item/card/emag/emag_card)
. = ..()
if(obj_flags & EMAGGED)
return
obj_flags |= EMAGGED
glitch_chance *= 2
threat_prob_max *= 2
add_overlay(mutable_appearance('icons/obj/machines/bitrunning.dmi', "emag_overlay"))
balloon_alert(user, "system jailbroken...")
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))
return
obj_flags |= EMAGGED
glitch_chance = 0.5
capacitor_coefficient = 0.1
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 ..()