Files
Bubberstation/code/modules/bitrunning/netpod/utils.dm
Jeremiah 5dc1d36ee4 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. -->
2024-07-02 23:03:12 -04:00

145 lines
4.4 KiB
Plaintext

/// Puts the occupant in netpod stasis, basically short-circuiting environmental conditions
/obj/machinery/netpod/proc/add_healing(mob/living/target)
if(target != occupant)
return
target.AddComponent(/datum/component/netpod_healing, pod = src)
target.playsound_local(src, 'sound/effects/submerge.ogg', 20, vary = TRUE)
target.extinguish_mob()
update_use_power(ACTIVE_POWER_USE)
/// Disconnects the occupant after a certain time so they aren't just hibernating in netpod stasis. A balance change
/obj/machinery/netpod/proc/auto_disconnect()
if(isnull(occupant) || state_open || connected)
return
var/mob/player = occupant
player.playsound_local(src, 'sound/effects/splash.ogg', 60, TRUE)
to_chat(player, span_notice("The machine disconnects itself and begins to drain."))
open_machine()
/// Handles occupant post-disconnection effects like damage, sounds, etc
/obj/machinery/netpod/proc/disconnect_occupant(cause_damage = FALSE)
connected = FALSE
var/mob/living/mob_occupant = occupant
if(isnull(occupant) || mob_occupant.stat == DEAD)
open_machine()
return
mob_occupant.playsound_local(src, 'sound/magic/blink.ogg', 25, TRUE)
mob_occupant.set_static_vision(2 SECONDS)
mob_occupant.set_temp_blindness(1 SECONDS)
mob_occupant.Paralyze(2 SECONDS)
if(!is_operational)
open_machine()
return
var/heal_time = 1
if(mob_occupant.health < mob_occupant.maxHealth)
heal_time = (mob_occupant.stat + 2) * 5
addtimer(CALLBACK(src, PROC_REF(auto_disconnect)), heal_time SECONDS, TIMER_UNIQUE|TIMER_STOPPABLE|TIMER_DELETE_ME)
if(!cause_damage)
return
mob_occupant.flash_act(override_blindness_check = TRUE, visual = TRUE)
mob_occupant.adjustOrganLoss(ORGAN_SLOT_BRAIN, disconnect_damage)
INVOKE_ASYNC(mob_occupant, TYPE_PROC_REF(/mob/living, emote), "scream")
to_chat(mob_occupant, span_danger("You've been forcefully disconnected from your avatar! Your thoughts feel scrambled!"))
/**
* ### Enter Matrix
* Finds any current avatars from this chair - or generates a new one
*
* New avatars cost 1 attempt, and this will eject if there's none left
*
* Connects the mind to the avatar if everything is ok
*/
/obj/machinery/netpod/proc/enter_matrix()
var/mob/living/carbon/human/neo = occupant
if(!ishuman(neo) || neo.stat == DEAD || isnull(neo.mind))
balloon_alert(neo, "invalid occupant.")
return
var/obj/machinery/quantum_server/server = find_server()
if(isnull(server))
balloon_alert(neo, "no server connected!")
return
var/datum/lazy_template/virtual_domain/generated_domain = server.generated_domain
if(isnull(generated_domain) || !server.is_ready)
balloon_alert(neo, "nothing loaded!")
return
var/mob/living/carbon/current_avatar = avatar_ref?.resolve()
if(isnull(current_avatar) || current_avatar.stat != CONSCIOUS) // We need a viable avatar
current_avatar = server.start_new_connection(neo, netsuit)
if(isnull(current_avatar))
balloon_alert(neo, "out of bandwidth!")
return
neo.set_static_vision(2 SECONDS)
add_healing(occupant)
if(!validate_entry(neo, current_avatar))
open_machine()
return
current_avatar.AddComponent( \
/datum/component/avatar_connection, \
old_mind = neo.mind, \
old_body = neo, \
server = server, \
pod = src, \
help_text = generated_domain.help_text, \
)
connected = TRUE
/// Finds a server and sets the server_ref
/obj/machinery/netpod/proc/find_server()
var/obj/machinery/quantum_server/server = server_ref?.resolve()
if(server)
return server
server = locate(/obj/machinery/quantum_server) in oview(4, src)
if(isnull(server))
return
server_ref = WEAKREF(server)
RegisterSignal(server, COMSIG_MACHINERY_REFRESH_PARTS, PROC_REF(on_server_upgraded))
RegisterSignal(server, COMSIG_BITRUNNER_DOMAIN_COMPLETE, PROC_REF(on_domain_complete))
RegisterSignal(server, COMSIG_BITRUNNER_DOMAIN_SCRUBBED, PROC_REF(on_domain_scrubbed))
return server
/// Severs the connection with the current avatar
/obj/machinery/netpod/proc/sever_connection()
if(isnull(occupant) || !connected)
return
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_SEVER)
/// Checks for cases to eject/fail connecting an avatar
/obj/machinery/netpod/proc/validate_entry(mob/living/neo, mob/living/avatar)
if(!do_after(neo, 2 SECONDS, src))
return FALSE
// Very invalid
if(QDELETED(neo) || QDELETED(avatar) || QDELETED(src) || !is_operational)
return FALSE
// Invalid
if(occupant != neo || isnull(neo.mind) || neo.stat > SOFT_CRIT || avatar.stat == DEAD)
return FALSE
return TRUE