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. -->
This commit is contained in:
Jeremiah
2024-07-02 23:03:12 -04:00
committed by GitHub
parent 23837b3e59
commit 5dc1d36ee4
30 changed files with 13139 additions and 584 deletions
@@ -5,6 +5,7 @@
/// A special condition limits this from spawning a crate
var/points_received = 0
/datum/component/bitrunning_points/Initialize(datum/lazy_template/virtual_domain/domain)
. = ..()
if(!isturf(parent))
@@ -12,6 +13,7 @@
RegisterSignal(domain, COMSIG_BITRUNNER_GOAL_POINT, PROC_REF(on_add_points))
/// Listens for points to be added which will eventually spawn a crate.
/datum/component/bitrunning_points/proc/on_add_points(datum/source, points_to_add)
SIGNAL_HANDLER
@@ -23,12 +25,14 @@
reveal()
/// Spawns the crate with some effects
/datum/component/bitrunning_points/proc/reveal()
playsound(src, 'sound/magic/blink.ogg', 50, TRUE)
var/turf/tile = parent
new /obj/structure/closet/crate/secure/bitrunning/encrypted(tile)
var/obj/structure/closet/crate/secure/bitrunning/encrypted/crate = new()
crate.forceMove(tile) // Triggers any on-move effects on that turf
var/datum/effect_system/spark_spread/quantum/sparks = new(tile)
sparks.set_up(number = 5, location = tile)
+137
View File
@@ -0,0 +1,137 @@
#define BASE_DISCONNECT_DAMAGE 40
/obj/machinery/netpod
name = "netpod"
base_icon_state = "netpod"
circuit = /obj/item/circuitboard/machine/netpod
desc = "A link to the netverse. It has an assortment of cables to connect yourself to a virtual domain."
icon = 'icons/obj/machines/bitrunning.dmi'
icon_state = "netpod"
max_integrity = 300
obj_flags = BLOCKS_CONSTRUCTION
state_open = TRUE
interaction_flags_mouse_drop = NEED_HANDS | NEED_DEXTERITY
/// Whether we have an ongoing connection
var/connected = FALSE
/// A player selected outfit by clicking the netpod
var/datum/outfit/netsuit = /datum/outfit/job/bitrunner
/// Holds this to see if it needs to generate a new one
var/datum/weakref/avatar_ref
/// The linked quantum server
var/datum/weakref/server_ref
/// The amount of brain damage done from force disconnects
var/disconnect_damage
/// Static list of outfits to select from
var/list/cached_outfits = list()
/obj/machinery/netpod/post_machine_initialize()
. = ..()
disconnect_damage = BASE_DISCONNECT_DAMAGE
find_server()
RegisterSignal(src, COMSIG_ATOM_TAKE_DAMAGE, PROC_REF(on_damage_taken))
RegisterSignal(src, COMSIG_MACHINERY_POWER_LOST, PROC_REF(on_power_loss))
RegisterSignals(src, list(COMSIG_QDELETING, COMSIG_MACHINERY_BROKEN),PROC_REF(on_broken))
register_context()
update_appearance()
/obj/machinery/netpod/Destroy()
. = ..()
QDEL_LIST(cached_outfits)
/obj/machinery/netpod/examine(mob/user)
. = ..()
if(isnull(server_ref?.resolve()))
. += span_infoplain("It's not connected to anything.")
. += span_infoplain("Netpods must be built within 4 tiles of a server.")
return
if(!isobserver(user))
. += span_infoplain("Drag yourself into the pod to engage the link.")
. += span_infoplain("It has limited resuscitation capabilities. Remaining in the pod can heal some injuries.")
. += span_infoplain("It has a security system that will alert the occupant if it is tampered with.")
if(isnull(occupant))
. += span_infoplain("It's currently unoccupied.")
return
. += span_infoplain("It's currently occupied by [occupant].")
if(isobserver(user))
. += span_notice("As an observer, you can click this netpod to jump to its avatar.")
return
. += span_notice("It can be pried open with a crowbar, but its safety mechanisms will alert the occupant.")
/obj/machinery/netpod/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if(isnull(held_item))
context[SCREENTIP_CONTEXT_LMB] = "Select Outfit"
return CONTEXTUAL_SCREENTIP_SET
if(istype(held_item, /obj/item/crowbar) && occupant)
context[SCREENTIP_CONTEXT_LMB] = "Pry Open"
return CONTEXTUAL_SCREENTIP_SET
/obj/machinery/netpod/update_icon_state()
if(!is_operational)
icon_state = base_icon_state
return ..()
if(state_open)
icon_state = base_icon_state + "_open_active"
return ..()
if(panel_open)
icon_state = base_icon_state + "_panel"
return ..()
icon_state = base_icon_state + "_closed"
if(occupant)
icon_state += "_active"
return ..()
/obj/machinery/netpod/mouse_drop_receive(mob/target, mob/user, params)
var/mob/living/carbon/player = user
if(!iscarbon(player) || !is_operational || !state_open || player.buckled)
return
close_machine(target)
/obj/machinery/netpod/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(!state_open && user == occupant)
container_resist_act(user)
/obj/machinery/netpod/attack_ghost(mob/dead/observer/our_observer)
var/our_target = avatar_ref?.resolve()
if(isnull(our_target) || !our_observer.orbit(our_target))
return ..()
/// When the server is upgraded, drops brain damage a little
/obj/machinery/netpod/proc/on_server_upgraded(obj/machinery/quantum_server/source)
SIGNAL_HANDLER
disconnect_damage = BASE_DISCONNECT_DAMAGE * (1 - source.servo_bonus)
#undef BASE_DISCONNECT_DAMAGE
@@ -0,0 +1,74 @@
/obj/machinery/netpod/Exited(atom/movable/gone, direction)
. = ..()
if(!state_open && gone == occupant)
container_resist_act(gone)
/obj/machinery/netpod/relaymove(mob/living/user, direction)
if(!state_open)
container_resist_act(user)
/obj/machinery/netpod/container_resist_act(mob/living/user)
user.visible_message(span_notice("[occupant] emerges from [src]!"),
span_notice("You climb out of [src]!"),
span_notice("With a hiss, you hear a machine opening."))
open_machine()
/obj/machinery/netpod/open_machine(drop = TRUE, density_to_set = FALSE)
playsound(src, 'sound/machines/tramopen.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_opening", src)
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_OPENED)
update_use_power(IDLE_POWER_USE)
return ..()
/obj/machinery/netpod/close_machine(mob/user, density_to_set = TRUE)
if(!state_open || panel_open || !is_operational || !iscarbon(user))
return
playsound(src, 'sound/machines/tramclose.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_closing", src)
..()
enter_matrix()
/obj/machinery/netpod/default_pry_open(obj/item/crowbar, mob/living/pryer)
if(isnull(occupant) || !iscarbon(occupant))
if(!state_open)
if(panel_open)
return FALSE
open_machine()
else
shut_pod()
return TRUE
pryer.visible_message(
span_danger("[pryer] starts prying open [src]!"),
span_notice("You start to pry open [src]."),
span_notice("You hear loud prying on metal.")
)
playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, TRUE)
SEND_SIGNAL(src, COMSIG_BITRUNNER_CROWBAR_ALERT, pryer)
if(do_after(pryer, 15 SECONDS, src))
if(!state_open)
sever_connection()
open_machine()
return TRUE
/// Closes the machine without shoving in an occupant
/obj/machinery/netpod/proc/shut_pod()
state_open = FALSE
playsound(src, 'sound/machines/tramclose.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_closing", src)
set_density(TRUE)
update_appearance()
@@ -0,0 +1,30 @@
/// Creates a list of outfit entries for the UI.
/obj/machinery/netpod/proc/make_outfit_collection(identifier, list/outfit_list)
var/list/collection = list(
"name" = identifier,
"outfits" = list()
)
for(var/datum/outfit/outfit as anything in outfit_list)
var/outfit_name = initial(outfit.name)
if(findtext(outfit_name, "(") != 0 || findtext(outfit_name, "-") != 0) // No special variants please
continue
collection["outfits"] += list(list("path" = outfit, "name" = outfit_name))
return list(collection)
/// Resolves a path to an outfit.
/obj/machinery/netpod/proc/resolve_outfit(text)
var/path = text2path(text)
if(!ispath(path, /datum/outfit))
return
for(var/wardrobe in cached_outfits)
for(var/outfit in wardrobe["outfits"])
if(path == outfit["path"])
return path
message_admins("[usr]:[usr.ckey] attempted to select an unavailable outfit from a netpod")
return
+64
View File
@@ -0,0 +1,64 @@
/// Machine has been broken - handles signals and reverting sprites
/obj/machinery/netpod/proc/on_broken(datum/source)
SIGNAL_HANDLER
sever_connection()
/// Checks the integrity, alerts occupants
/obj/machinery/netpod/proc/on_damage_taken(datum/source, damage_amount)
SIGNAL_HANDLER
if(isnull(occupant) || !connected)
return
var/total = max_integrity - damage_amount
var/integrity = (atom_integrity / total) * 100
if(integrity > 50)
return
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_INTEGRITY)
/// Puts points on the current occupant's card account
/obj/machinery/netpod/proc/on_domain_complete(datum/source, atom/movable/crate, reward_points)
SIGNAL_HANDLER
if(isnull(occupant) || !connected)
return
var/mob/living/player = occupant
var/datum/bank_account/account = player.get_bank_account()
if(isnull(account))
return
account.bitrunning_points += reward_points * 100
/// The domain has been fully purged, so we should double check our avatar is deleted
/obj/machinery/netpod/proc/on_domain_scrubbed(datum/source)
SIGNAL_HANDLER
var/mob/avatar = avatar_ref?.resolve()
if(isnull(avatar))
return
QDEL_NULL(avatar)
/// Boots out anyone in the machine && opens it
/obj/machinery/netpod/proc/on_power_loss(datum/source)
SIGNAL_HANDLER
if(state_open)
return
if(isnull(occupant) || !connected)
connected = FALSE
open_machine()
return
sever_connection()
+22
View File
@@ -0,0 +1,22 @@
/obj/machinery/netpod/crowbar_act(mob/living/user, obj/item/tool)
if(user.combat_mode)
attack_hand(user)
return ITEM_INTERACT_SUCCESS
if(default_pry_open(tool, user) || default_deconstruction_crowbar(tool))
return ITEM_INTERACT_SUCCESS
/obj/machinery/netpod/screwdriver_act(mob/living/user, obj/item/tool)
if(occupant)
balloon_alert(user, "in use!")
return ITEM_INTERACT_SUCCESS
if(state_open)
balloon_alert(user, "close first.")
return ITEM_INTERACT_SUCCESS
if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", "[base_icon_state]_closed", tool))
update_appearance() // sometimes icon doesnt properly update during flick()
ui_close(user)
return ITEM_INTERACT_SUCCESS
+41
View File
@@ -0,0 +1,41 @@
/obj/machinery/netpod/ui_interact(mob/user, datum/tgui/ui)
if(!is_operational || occupant)
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "NetpodOutfits")
ui.set_autoupdate(FALSE)
ui.open()
/obj/machinery/netpod/ui_data()
var/list/data = list()
data["netsuit"] = netsuit
return data
/obj/machinery/netpod/ui_static_data()
var/list/data = list()
if(!length(cached_outfits))
cached_outfits += make_outfit_collection("Jobs", subtypesof(/datum/outfit/job))
data["collections"] = cached_outfits
return data
/obj/machinery/netpod/ui_act(action, params)
. = ..()
if(.)
return TRUE
switch(action)
if("select_outfit")
var/datum/outfit/new_suit = resolve_outfit(params["outfit"])
if(new_suit)
netsuit = new_suit
return TRUE
return FALSE
+144
View File
@@ -0,0 +1,144 @@
/// 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
@@ -12,6 +12,11 @@
name = "Bitrunning hololadder spawn"
icon_state = "hololadder"
/// A permanent exit for the domain
/obj/effect/landmark/bitrunning/permanent_exit
name = "Bitrunning permanent exit"
icon_state = "perm_exit"
/// Where the crates need to be taken
/obj/effect/landmark/bitrunning/cache_goal_turf
name = "Bitrunning goal turf"
-490
View File
@@ -1,490 +0,0 @@
#define BASE_DISCONNECT_DAMAGE 40
/obj/machinery/netpod
name = "netpod"
base_icon_state = "netpod"
circuit = /obj/item/circuitboard/machine/netpod
desc = "A link to the netverse. It has an assortment of cables to connect yourself to a virtual domain."
icon = 'icons/obj/machines/bitrunning.dmi'
icon_state = "netpod"
max_integrity = 300
obj_flags = BLOCKS_CONSTRUCTION
state_open = TRUE
interaction_flags_mouse_drop = NEED_HANDS | NEED_DEXTERITY
/// Whether we have an ongoing connection
var/connected = FALSE
/// A player selected outfit by clicking the netpod
var/datum/outfit/netsuit = /datum/outfit/job/bitrunner
/// Holds this to see if it needs to generate a new one
var/datum/weakref/avatar_ref
/// The linked quantum server
var/datum/weakref/server_ref
/// The amount of brain damage done from force disconnects
var/disconnect_damage
/// Static list of outfits to select from
var/list/cached_outfits = list()
/obj/machinery/netpod/post_machine_initialize()
. = ..()
disconnect_damage = BASE_DISCONNECT_DAMAGE
find_server()
RegisterSignal(src, COMSIG_ATOM_TAKE_DAMAGE, PROC_REF(on_damage_taken))
RegisterSignal(src, COMSIG_MACHINERY_POWER_LOST, PROC_REF(on_power_loss))
RegisterSignals(src, list(COMSIG_QDELETING, COMSIG_MACHINERY_BROKEN),PROC_REF(on_broken))
register_context()
update_appearance()
/obj/machinery/netpod/Destroy()
. = ..()
QDEL_LIST(cached_outfits)
/obj/machinery/netpod/examine(mob/user)
. = ..()
if(isnull(server_ref?.resolve()))
. += span_infoplain("It's not connected to anything.")
. += span_infoplain("Netpods must be built within 4 tiles of a server.")
return
if(!isobserver(user))
. += span_infoplain("Drag yourself into the pod to engage the link.")
. += span_infoplain("It has limited resuscitation capabilities. Remaining in the pod can heal some injuries.")
. += span_infoplain("It has a security system that will alert the occupant if it is tampered with.")
if(isnull(occupant))
. += span_infoplain("It's currently unoccupied.")
return
. += span_infoplain("It's currently occupied by [occupant].")
if(isobserver(user))
. += span_notice("As an observer, you can click this netpod to jump to its avatar.")
return
. += span_notice("It can be pried open with a crowbar, but its safety mechanisms will alert the occupant.")
/obj/machinery/netpod/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if(isnull(held_item))
context[SCREENTIP_CONTEXT_LMB] = "Select Outfit"
return CONTEXTUAL_SCREENTIP_SET
if(istype(held_item, /obj/item/crowbar) && occupant)
context[SCREENTIP_CONTEXT_LMB] = "Pry Open"
return CONTEXTUAL_SCREENTIP_SET
/obj/machinery/netpod/update_icon_state()
if(!is_operational)
icon_state = base_icon_state
return ..()
if(state_open)
icon_state = base_icon_state + "_open_active"
return ..()
if(panel_open)
icon_state = base_icon_state + "_panel"
return ..()
icon_state = base_icon_state + "_closed"
if(occupant)
icon_state += "_active"
return ..()
/obj/machinery/netpod/mouse_drop_receive(mob/target, mob/user, params)
var/mob/living/carbon/player = user
if(!iscarbon(player) || !is_operational || !state_open || player.buckled)
return
close_machine(target)
/obj/machinery/netpod/crowbar_act(mob/living/user, obj/item/tool)
if(user.combat_mode)
attack_hand(user)
return ITEM_INTERACT_SUCCESS
if(default_pry_open(tool, user) || default_deconstruction_crowbar(tool))
return ITEM_INTERACT_SUCCESS
/obj/machinery/netpod/screwdriver_act(mob/living/user, obj/item/tool)
if(occupant)
balloon_alert(user, "in use!")
return ITEM_INTERACT_SUCCESS
if(state_open)
balloon_alert(user, "close first.")
return ITEM_INTERACT_SUCCESS
if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", "[base_icon_state]_closed", tool))
update_appearance() // sometimes icon doesnt properly update during flick()
ui_close(user)
return ITEM_INTERACT_SUCCESS
/obj/machinery/netpod/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(!state_open && user == occupant)
container_resist_act(user)
/obj/machinery/netpod/Exited(atom/movable/gone, direction)
. = ..()
if(!state_open && gone == occupant)
container_resist_act(gone)
/obj/machinery/netpod/relaymove(mob/living/user, direction)
if(!state_open)
container_resist_act(user)
/obj/machinery/netpod/container_resist_act(mob/living/user)
user.visible_message(span_notice("[occupant] emerges from [src]!"),
span_notice("You climb out of [src]!"),
span_notice("With a hiss, you hear a machine opening."))
open_machine()
/obj/machinery/netpod/open_machine(drop = TRUE, density_to_set = FALSE)
playsound(src, 'sound/machines/tramopen.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_opening", src)
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_OPENED)
update_use_power(IDLE_POWER_USE)
return ..()
/obj/machinery/netpod/close_machine(mob/user, density_to_set = TRUE)
if(!state_open || panel_open || !is_operational || !iscarbon(user))
return
playsound(src, 'sound/machines/tramclose.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_closing", src)
..()
enter_matrix()
/obj/machinery/netpod/default_pry_open(obj/item/crowbar, mob/living/pryer)
if(isnull(occupant) || !iscarbon(occupant))
if(!state_open)
if(panel_open)
return FALSE
open_machine()
else
shut_pod()
return TRUE
pryer.visible_message(
span_danger("[pryer] starts prying open [src]!"),
span_notice("You start to pry open [src]."),
span_notice("You hear loud prying on metal.")
)
playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, TRUE)
SEND_SIGNAL(src, COMSIG_BITRUNNER_CROWBAR_ALERT, pryer)
if(do_after(pryer, 15 SECONDS, src))
if(!state_open)
sever_connection()
open_machine()
return TRUE
/obj/machinery/netpod/ui_interact(mob/user, datum/tgui/ui)
if(!is_operational || occupant)
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "NetpodOutfits")
ui.set_autoupdate(FALSE)
ui.open()
/obj/machinery/netpod/ui_data()
var/list/data = list()
data["netsuit"] = netsuit
return data
/obj/machinery/netpod/ui_static_data()
var/list/data = list()
if(!length(cached_outfits))
cached_outfits += make_outfit_collection("Jobs", subtypesof(/datum/outfit/job))
data["collections"] = cached_outfits
return data
/obj/machinery/netpod/ui_act(action, params)
. = ..()
if(.)
return TRUE
switch(action)
if("select_outfit")
var/datum/outfit/new_suit = resolve_outfit(params["outfit"])
if(new_suit)
netsuit = new_suit
return TRUE
return FALSE
/obj/machinery/netpod/attack_ghost(mob/dead/observer/our_observer)
var/our_target = avatar_ref?.resolve()
if(isnull(our_target) || !our_observer.orbit(our_target))
return ..()
/// 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
var/obj/structure/hololadder/wayout = server.generate_hololadder()
if(isnull(wayout))
balloon_alert(neo, "out of bandwidth!")
return
current_avatar = server.generate_avatar(wayout, netsuit)
avatar_ref = WEAKREF(current_avatar)
server.stock_gear(current_avatar, neo, generated_domain)
neo.set_static_vision(3 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
/// Creates a list of outfit entries for the UI.
/obj/machinery/netpod/proc/make_outfit_collection(identifier, list/outfit_list)
var/list/collection = list(
"name" = identifier,
"outfits" = list()
)
for(var/datum/outfit/outfit as anything in outfit_list)
var/outfit_name = initial(outfit.name)
if(findtext(outfit_name, "(") != 0 || findtext(outfit_name, "-") != 0) // No special variants please
continue
collection["outfits"] += list(list("path" = outfit, "name" = outfit_name))
return list(collection)
/// Machine has been broken - handles signals and reverting sprites
/obj/machinery/netpod/proc/on_broken(datum/source)
SIGNAL_HANDLER
sever_connection()
/// Checks the integrity, alerts occupants
/obj/machinery/netpod/proc/on_damage_taken(datum/source, damage_amount)
SIGNAL_HANDLER
if(isnull(occupant) || !connected)
return
var/total = max_integrity - damage_amount
var/integrity = (atom_integrity / total) * 100
if(integrity > 50)
return
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_INTEGRITY)
/// Puts points on the current occupant's card account
/obj/machinery/netpod/proc/on_domain_complete(datum/source, atom/movable/crate, reward_points)
SIGNAL_HANDLER
if(isnull(occupant) || !connected)
return
var/mob/living/player = occupant
var/datum/bank_account/account = player.get_bank_account()
if(isnull(account))
return
account.bitrunning_points += reward_points * 100
/// The domain has been fully purged, so we should double check our avatar is deleted
/obj/machinery/netpod/proc/on_domain_scrubbed(datum/source)
SIGNAL_HANDLER
var/mob/avatar = avatar_ref?.resolve()
if(isnull(avatar))
return
QDEL_NULL(avatar)
/// Boots out anyone in the machine && opens it
/obj/machinery/netpod/proc/on_power_loss(datum/source)
SIGNAL_HANDLER
if(state_open)
return
if(isnull(occupant) || !connected)
connected = FALSE
open_machine()
return
sever_connection()
/// When the server is upgraded, drops brain damage a little
/obj/machinery/netpod/proc/on_server_upgraded(obj/machinery/quantum_server/source)
SIGNAL_HANDLER
disconnect_damage = BASE_DISCONNECT_DAMAGE * (1 - source.servo_bonus)
/// Resolves a path to an outfit.
/obj/machinery/netpod/proc/resolve_outfit(text)
var/path = text2path(text)
if(!ispath(path, /datum/outfit))
return
for(var/wardrobe in cached_outfits)
for(var/outfit in wardrobe["outfits"])
if(path == outfit["path"])
return path
message_admins("[usr]:[usr.ckey] attempted to select an unavailable outfit from a netpod")
return
/// 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)
/// Closes the machine without shoving in an occupant
/obj/machinery/netpod/proc/shut_pod()
state_open = FALSE
playsound(src, 'sound/machines/tramclose.ogg', 60, TRUE, frequency = 65000)
flick("[base_icon_state]_closing", src)
set_density(TRUE)
update_appearance()
/// 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
#undef BASE_DISCONNECT_DAMAGE
+50
View File
@@ -10,12 +10,62 @@
suit = /obj/item/clothing/suit/jacket/trenchcoat
id = /obj/item/card/id/advanced
/datum/outfit/echolocator/post_equip(mob/living/carbon/human/user, visualsOnly)
. = ..()
user.psykerize()
/datum/outfit/bitductor
name = "Bitrunning Abductor"
uniform = /obj/item/clothing/under/abductor
gloves = /obj/item/clothing/gloves/fingerless
shoes = /obj/item/clothing/shoes/jackboots
/datum/outfit/beachbum_combat
name = "Beachbum: Island Combat"
id = /obj/item/card/id/advanced
l_pocket = null
r_pocket = null
shoes = /obj/item/clothing/shoes/sandal
uniform = /obj/item/clothing/under/pants/jeans
/// Available ranged weapons
var/list/ranged_weaps = list(
/obj/item/gun/ballistic/automatic/pistol,
/obj/item/gun/ballistic/rifle/boltaction,
/obj/item/gun/ballistic/automatic/mini_uzi,
/obj/item/gun/ballistic/automatic/pistol/deagle,
/obj/item/gun/ballistic/rocketlauncher/unrestricted,
/obj/item/gun/ballistic/automatic/ar,
)
/// Corresponding ammo
var/list/corresponding_ammo = list(
/obj/item/ammo_box/magazine/m9mm,
/obj/item/ammo_box/strilka310,
/obj/item/ammo_box/magazine/uzim9mm,
/obj/item/ammo_box/magazine/m50,
/obj/item/food/pizzaslice/dank, // more silly, less destructive
/obj/item/ammo_box/magazine/m223,
)
/datum/outfit/beachbum_combat/post_equip(mob/living/carbon/human/bum, visualsOnly)
. = ..()
var/choice = rand(1, length(ranged_weaps))
var/weapon = ranged_weaps[choice]
bum.put_in_active_hand(new weapon)
var/ammo = corresponding_ammo[choice]
var/obj/item/ammo1 = new ammo
var/obj/item/ammo2 = new ammo
if(!bum.equip_to_slot_if_possible(new ammo, ITEM_SLOT_LPOCKET))
ammo1.forceMove(get_turf(bum))
if(!bum.equip_to_slot_if_possible(new ammo, ITEM_SLOT_RPOCKET))
ammo2.forceMove(get_turf(bum))
if(prob(50))
bum.equip_to_slot_if_possible(new /obj/item/clothing/glasses/sunglasses, ITEM_SLOT_EYES)
@@ -77,12 +77,18 @@
. += 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.")
+6
View File
@@ -4,6 +4,7 @@
#define GRADE_A "A"
#define GRADE_S "S"
/// Handles calculating rewards based on number of players, parts, threats, etc
/obj/machinery/quantum_server/proc/calculate_rewards()
var/rewards_base = 0.8
@@ -20,6 +21,7 @@
return rewards_base
/// Handles spawning the (new) crate and deleting the former
/obj/machinery/quantum_server/proc/generate_loot(obj/cache, obj/machinery/byteforge/chosen_forge)
SSblackbox.record_feedback("tally", "bitrunning_domain_primary_completed", 1, generated_domain.key)
@@ -55,6 +57,8 @@
chosen_forge.start_to_spawn(reward_cache)
return TRUE
/// Builds secondary loot if the achievements were met
/obj/machinery/quantum_server/proc/generate_secondary_loot(obj/curiosity, obj/machinery/byteforge/chosen_forge)
SSblackbox.record_feedback("tally", "bitrunning_domain_secondary_completed", 1, generated_domain.key)
spark_at_location(curiosity) // abracadabra!
@@ -65,6 +69,7 @@
chosen_forge.start_to_spawn(reward_curiosity)
return TRUE
/// Returns the markdown text containing domain completion information
/obj/machinery/quantum_server/proc/get_completion_certificate(time_difference, grade)
var/base_points = generated_domain.reward_points
@@ -126,6 +131,7 @@
return generated_domain.difficulty >= BITRUNNER_DIFFICULTY_MEDIUM && (grade in passing_grades)
/// Grades the player's run based on several factors
/obj/machinery/quantum_server/proc/grade_completion(completion_time)
var/score = length(spawned_threat_refs) * 5
@@ -24,6 +24,7 @@
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)
@@ -69,8 +70,15 @@
if(broadcasting)
start_broadcasting_network(BITRUNNER_CAMERA_NET)
if(generated_domain.announce_to_ghosts)
notify_ghosts("Bitrunners have loaded a domain that offers ghost interactions. Check the spawners menu for more information.",
src,
"Matrix Glitch",
)
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 in SSbitrunning.all_domains)
@@ -82,6 +90,7 @@
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()
@@ -116,6 +125,15 @@
var/turf/signaler_turf = get_turf(thing)
signaler_turf.AddComponent(/datum/component/bitrunning_points, generated_domain)
qdel(thing)
continue
if(istype(thing, /obj/effect/landmark/bitrunning/permanent_exit))
var/turf/tile = get_turf(thing)
exit_turfs += tile
qdel(thing)
new /obj/structure/hololadder(tile)
if(!length(exit_turfs))
CRASH("Failed to find exit turfs on generated domain.")
@@ -134,6 +152,7 @@
return TRUE
/// Stops the current virtual domain and disconnects all users
/obj/machinery/quantum_server/proc/reset(fast = FALSE)
is_ready = FALSE
@@ -155,6 +174,7 @@
stop_broadcasting_network(BITRUNNER_CAMERA_NET)
/// Tries to clean up everything in the domain
/obj/machinery/quantum_server/proc/scrub_vdom()
sever_connections() /// just in case someone's connected
@@ -15,6 +15,7 @@
new /obj/structure/closet/crate/secure/bitrunning/encrypted(chosen_turf)
return TRUE
/// Attempts to spawn a lootbox
/obj/machinery/quantum_server/proc/attempt_spawn_curiosity(list/possible_turfs)
if(!length(possible_turfs)) // Out of turfs to place a curiosity
@@ -35,9 +36,10 @@
new /obj/item/storage/lockbox/bitrunning/encrypted(chosen_turf)
return chosen_turf
/// Generates a new avatar for the bitrunner.
/obj/machinery/quantum_server/proc/generate_avatar(obj/structure/hololadder/wayout, datum/outfit/netsuit)
var/mob/living/carbon/human/avatar = new(wayout.loc)
/obj/machinery/quantum_server/proc/generate_avatar(turf/destination, datum/outfit/netsuit)
var/mob/living/carbon/human/avatar = new(destination)
var/outfit_path = generated_domain.forced_outfit || netsuit
var/datum/outfit/to_wear = new outfit_path()
@@ -61,8 +63,9 @@
if(istype(hat))
hat.set_armor(/datum/armor/none)
for(var/obj/thing in avatar.held_items)
qdel(thing)
if(!generated_domain.forced_outfit)
for(var/obj/thing in avatar.held_items)
qdel(thing)
var/obj/item/storage/backpack/bag = avatar.back
if(istype(bag))
@@ -88,32 +91,9 @@
network = BITRUNNER_CAMERA_NET, \
emp_proof = TRUE, \
)
return avatar
/// Generates a new hololadder for the bitrunner. Effectively a respawn attempt.
/obj/machinery/quantum_server/proc/generate_hololadder()
if(!length(exit_turfs))
return
if(retries_spent >= length(exit_turfs))
return
var/turf/destination
for(var/turf/dest_turf in exit_turfs)
if(!locate(/obj/structure/hololadder) in dest_turf)
destination = dest_turf
break
if(isnull(destination))
return
var/obj/structure/hololadder/wayout = new(destination, src)
if(isnull(wayout))
return
retries_spent += 1
return wayout
/// Loads in any mob segments of the map
/obj/machinery/quantum_server/proc/load_mob_segments()
@@ -142,6 +122,7 @@
return TRUE
/// Scans over neo's contents for bitrunning tech disks. Loads the items or abilities onto the avatar.
/obj/machinery/quantum_server/proc/stock_gear(mob/living/carbon/human/avatar, mob/living/carbon/human/neo, datum/lazy_template/virtual_domain/generated_domain)
var/domain_forbids_items = generated_domain.forbids_disk_items
@@ -4,12 +4,14 @@
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
@@ -26,6 +28,7 @@
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
@@ -51,6 +54,7 @@
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
@@ -58,6 +62,7 @@
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
@@ -98,6 +103,7 @@
/// 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
@@ -4,6 +4,7 @@
SEND_SIGNAL(src, COMSIG_BITRUNNER_THREAT_CREATED)
threat.AddComponent(/datum/component/virtual_entity, src)
/// Choses which antagonist role is spawned based on threat
/obj/machinery/quantum_server/proc/get_antagonist_role()
var/list/available = list()
@@ -19,6 +20,7 @@
return chosen
/// Selects a target to mutate. Gives two attempts, then crashes if it fails.
/obj/machinery/quantum_server/proc/get_mutation_target()
var/datum/weakref/target_ref = pick(mutation_candidate_refs)
@@ -35,6 +37,7 @@
resolved = target_ref.resolve()
return resolved
/// Finds any mobs with minds in the zones and gives them the bad news
/obj/machinery/quantum_server/proc/notify_spawned_threats()
for(var/datum/weakref/baddie_ref as anything in spawned_threat_refs)
@@ -52,10 +55,12 @@
to_chat(baddie, span_userdanger("You have been flagged for deletion! Thank you for your service."))
/// Removes a specific threat - used when station spawning
/obj/machinery/quantum_server/proc/remove_threat(mob/living/threat)
spawned_threat_refs.Remove(WEAKREF(threat))
/// Selects the role and waits for a ghost orbiter
/obj/machinery/quantum_server/proc/setup_glitch(datum/antagonist/bitrunning_glitch/forced_role)
if(!validate_mutation_candidates())
@@ -83,6 +88,7 @@
spawn_glitch(chosen_role, mutation_target, chosen_one)
return mutation_target
/// Orbit poll has concluded - spawn the antag
/obj/machinery/quantum_server/proc/spawn_glitch(datum/antagonist/bitrunning_glitch/chosen_role, mob/living/mutation_target, mob/dead/observer/ghost)
if(QDELETED(mutation_target))
@@ -121,6 +127,7 @@
add_threats(new_mob)
/// Oh boy - transports the antag station side
/obj/machinery/quantum_server/proc/station_spawn(mob/living/antag, obj/machinery/byteforge/chosen_forge)
antag.balloon_alert(antag, "scanning...")
@@ -165,6 +172,7 @@
do_teleport(antag, get_turf(chosen_forge), forced = TRUE, asoundin = 'sound/magic/ethereal_enter.ogg', asoundout = 'sound/magic/ethereal_exit.ogg', channel = TELEPORT_CHANNEL_QUANTUM)
/// Removes any invalid candidates from the list
/obj/machinery/quantum_server/proc/validate_mutation_candidates()
for(var/datum/weakref/creature_ref as anything in mutation_candidate_refs)
+85 -8
View File
@@ -1,11 +1,13 @@
#define MAX_DISTANCE 4 // How far crates can spawn from the server
/// Resets the cooldown state and updates icons
/obj/machinery/quantum_server/proc/cool_off()
is_ready = TRUE
update_appearance()
radio.talk_into(src, "Thermal systems within operational parameters. Proceeding to domain configuration.", RADIO_CHANNEL_SUPPLY)
/// If there are hosted minds, attempts to get a list of their current virtual bodies w/ vitals
/obj/machinery/quantum_server/proc/get_avatar_data()
var/list/hosted_avatars = list()
@@ -31,6 +33,49 @@
return hosted_avatars
/// I grab the atom here so I can signal it / manipulate spawners etc
/obj/machinery/quantum_server/proc/get_avatar_destination() as /atom
// Branch A: Custom spawns
if(length(generated_domain.custom_spawns))
var/atom/valid_spawner
while(isnull(valid_spawner))
var/atom/chosen = pick(generated_domain.custom_spawns)
if(QDELETED(chosen))
generated_domain.custom_spawns -= chosen
continue
valid_spawner = chosen
break
return valid_spawner
// Branch B: Hololadders
if(!length(exit_turfs))
return
if(retries_spent >= length(exit_turfs))
return
var/turf/exit_tile
for(var/turf/dest_turf in exit_turfs)
if(!locate(/obj/structure/hololadder) in dest_turf)
exit_tile = dest_turf
break
if(isnull(exit_tile))
return
var/obj/structure/hololadder/wayout = new(exit_tile, src)
if(isnull(wayout))
return
retries_spent += 1
return wayout
/// Locates any turfs with forges on them, returns a random one
/obj/machinery/quantum_server/proc/get_random_nearby_forge()
var/list/nearby_forges = list()
@@ -40,6 +85,7 @@
return pick(nearby_forges)
/// Gets a random available domain given the current points.
/obj/machinery/quantum_server/proc/get_random_domain_id()
if(points < 1)
@@ -85,6 +131,7 @@
SEND_SIGNAL(src, COMSIG_BITRUNNER_QSRV_SEVER)
/// Do some magic teleport sparks
/obj/machinery/quantum_server/proc/spark_at_location(obj/cache)
playsound(cache, 'sound/magic/blink.ogg', 50, vary = TRUE)
@@ -92,16 +139,33 @@
sparks.set_up(5, location = get_turf(cache))
sparks.start()
/// Returns a turf if it's not dense, else will find a neighbor.
/obj/machinery/quantum_server/proc/validate_turf(turf/chosen_turf)
if(!chosen_turf.is_blocked_turf())
return chosen_turf
for(var/turf/tile in get_adjacent_open_turfs(chosen_turf))
if(!tile.is_blocked_turf())
return chosen_turf
/// Starts building a new avatar for the player.
/// Called by netpods when they don't have a current avatar.
/// This is a procedural proc which links several others together.
/obj/machinery/quantum_server/proc/start_new_connection(mob/living/carbon/human/neo, datum/outfit/netsuit) as /mob/living/carbon/human
var/atom/entry_atom = get_avatar_destination()
if(isnull(entry_atom))
return
var/mob/living/carbon/new_avatar = generate_avatar(get_turf(entry_atom), netsuit)
stock_gear(new_avatar, neo, generated_domain)
// Cleanup for domains with one time use custom spawns
if(!length(generated_domain.custom_spawns))
return new_avatar
// If we're spawning from some other fuckery, no need for this
if(istype(entry_atom, /obj/effect/mob_spawn/ghost_role/human/virtual_domain))
var/obj/effect/mob_spawn/ghost_role/human/virtual_domain/spawner = entry_atom
spawner.artificial_spawn(new_avatar)
if(!generated_domain.keep_custom_spawns)
generated_domain.custom_spawns -= entry_atom
qdel(entry_atom)
return new_avatar
#undef MAX_DISTANCE
/// Toggles broadcast on and off
/obj/machinery/quantum_server/proc/toggle_broadcast()
@@ -116,3 +180,16 @@
// And we only flip TVs when there's a domain, because otherwise there's no cams to watch
set_network_broadcast_status(BITRUNNER_CAMERA_NET, broadcasting)
return TRUE
/// Returns a turf if it's not dense, else will find a neighbor.
/obj/machinery/quantum_server/proc/validate_turf(turf/chosen_turf)
if(!chosen_turf.is_blocked_turf())
return chosen_turf
for(var/turf/tile in get_adjacent_open_turfs(chosen_turf))
if(!tile.is_blocked_turf())
return chosen_turf
#undef MAX_DISTANCE
+13 -6
View File
@@ -3,12 +3,9 @@
prompt_name = "a virtual domain debug entity"
flavour_text = "You probably shouldn't be seeing this, contact a coder!"
you_are_text = "You are NOT supposed to be here. How did you let this happen?"
important_text = "You must eliminate any bitrunners from the domain."
important_text = "Bitrunning is a crime, and your primary threat."
temp_body = TRUE
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/Initialize(mapload)
. = ..()
notify_ghosts("The [name] has been created. The virtual world calls for aid!", src, "Virtual Insanity!")
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/special(mob/living/spawned_mob, mob/mob_possessor)
var/datum/mind/ghost_mind = mob_possessor.mind
@@ -19,6 +16,12 @@
spawned_mob.mind.add_antag_datum(/datum/antagonist/domain_ghost_actor)
/// Simulates a ghost role spawn without calling special(), ie a bitrunner spawn instead of a ghost.
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/proc/artificial_spawn(mob/living/runner)
SEND_SIGNAL(src, COMSIG_BITRUNNER_SPAWNED, runner)
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/pirate
name = "Virtual Pirate Remains"
desc = "Some inanimate bones. They feel like they could spring to life at any moment!"
@@ -27,22 +30,25 @@
icon_state = "remains"
prompt_name = "a virtual skeleton pirate"
you_are_text = "You are a virtual pirate. Yarrr!"
flavour_text = "You have awoken, without instruction. There's a LANDLUBBER after yer booty. Stop them!"
flavour_text = " There's a LANDLUBBER after yer booty. Stop them!"
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/pirate/special(mob/living/spawned_mob, mob/mob_possessor)
. = ..()
spawned_mob.fully_replace_character_name(spawned_mob.real_name, "[pick(strings(PIRATE_NAMES_FILE, "generic_beginnings"))][pick(strings(PIRATE_NAMES_FILE, "generic_endings"))]")
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/syndie
name = "Virtual Syndicate Sleeper"
icon = 'icons/obj/machines/sleeper.dmi'
icon_state = "sleeper_s"
prompt_name = "a virtual syndicate operative"
you_are_text = "You are a virtual syndicate operative."
flavour_text = "You have awoken, without instruction. Alarms blare! We are being boarded!"
flavour_text = "Alarms blare! We are being boarded!"
outfit = /datum/outfit/virtual_syndicate
spawner_job_path = /datum/job/space_syndicate
/datum/outfit/virtual_syndicate
name = "Virtual Syndie"
id = /obj/item/card/id/advanced/chameleon
@@ -53,5 +59,6 @@
shoes = /obj/item/clothing/shoes/combat
implants = list(/obj/item/implant/weapons_auth)
/datum/outfit/virtual_syndicate/post_equip(mob/living/carbon/human/user, visualsOnly)
user.faction |= ROLE_SYNDICATE
@@ -0,0 +1,46 @@
/datum/lazy_template/virtual_domain/island_brawl
name = "Island Brawl"
announce_to_ghosts = TRUE
cost = BITRUNNER_COST_HIGH
desc = "A 'peaceful' island tucked away in the middle of nowhere. This map will auto-complete after a number of deaths have occurred."
difficulty = BITRUNNER_DIFFICULTY_HIGH
forced_outfit = /datum/outfit/beachbum_combat
help_text = "There may be bounties laid out across the island, but the primary objective is to survive. Deaths on the island will count towards the final score."
key = "island_brawl"
map_name = "island_brawl"
reward_points = BITRUNNER_REWARD_HIGH
secondary_loot = list(
/obj/item/toy/beach_ball = 2,
/obj/item/clothing/shoes/sandal = 1,
/obj/item/clothing/glasses/sunglasses = 1,
/obj/item/gun/ballistic/automatic/mini_uzi = 1,
)
/datum/lazy_template/virtual_domain/island_brawl/setup_domain(list/created_atoms)
for(var/obj/effect/mob_spawn/ghost_role/human/virtual_domain/islander/spawner in created_atoms)
custom_spawns += spawner
RegisterSignals(spawner, list(COMSIG_GHOSTROLE_SPAWNED, COMSIG_BITRUNNER_SPAWNED), PROC_REF(on_spawn))
/// Someone has spawned in, so we check for their death
/datum/lazy_template/virtual_domain/island_brawl/proc/on_spawn(datum/source, mob/living/spawned_mob)
SIGNAL_HANDLER
RegisterSignals(spawned_mob, list(COMSIG_LIVING_DEATH), PROC_REF(on_death))
/// Mob has died, so we add a point to the domain
/datum/lazy_template/virtual_domain/island_brawl/proc/on_death(datum/source, gibbed)
SIGNAL_HANDLER
add_points(1)
/obj/effect/mob_spawn/ghost_role/human/virtual_domain/islander
name = "Islander"
outfit = /datum/outfit/beachbum_combat
prompt_name = "a combat beach bum"
you_are_text = "You are a virtual islander."
flavour_text = "Don't let anyone ruin your idyllic vacation spot. Coordinate with others- or don't!"
@@ -1,5 +1,6 @@
/datum/lazy_template/virtual_domain/pirates
name = "Corsair Cove"
announce_to_ghosts = TRUE
cost = BITRUNNER_COST_MEDIUM
desc = "Battle your way to the hidden treasure, seize the booty, and make a swift escape before the pirates turn the tide."
difficulty = BITRUNNER_DIFFICULTY_MEDIUM
@@ -1,5 +1,6 @@
/datum/lazy_template/virtual_domain/syndicate_assault
name = "Syndicate Assault"
announce_to_ghosts = TRUE
cost = BITRUNNER_COST_MEDIUM
desc = "Board the enemy ship and recover the stolen cargo."
difficulty = BITRUNNER_DIFFICULTY_MEDIUM
@@ -7,50 +7,82 @@
map_name = "None"
key = "Virtual Domain"
place_on_top = TRUE
/// Cost of this map to load
var/cost = BITRUNNER_COST_NONE
/// Any outfit that you wish to force on avatars. Overrides preferences
var/datum/outfit/forced_outfit
/// The description of the map for the console UI
var/desc = "A map."
/// Affects the ui and ability to scan info.
var/difficulty = BITRUNNER_DIFFICULTY_NONE
/// Whether to tell observers this map is being used
var/announce_to_ghosts = FALSE
/// The map file to load
var/filename = "virtual_domain.dmm"
/// If this domain blocks the use of items from disks, for whatever reason
var/forbids_disk_items = FALSE
/// If this domain blocks the use of spells from disks, for whatever reason
var/forbids_disk_spells = FALSE
/// Information given to connected clients via ability
var/help_text
/// Whether to display this as a modular map
var/is_modular = FALSE
/// Byond will look for modular mob segment landmarks then choose from here at random. You can make them unique also.
var/list/datum/modular_mob_segment/mob_modules = list()
/// An assoc list of typepath/amount to spawn on completion. Not weighted - the value is the amount
var/list/completion_loot
/// An accoc list of typepath/amount to spawn from secondary objectives. Not weighted - the value is the total number of items that can be obtained.
var/list/secondary_loot = list()
/// Number of secondary loot boxes generated. Resets when the domain is reloaded.
var/secondary_loot_generated
/// Forces all mob modules to only load once
var/modular_unique_mobs = FALSE
// Name to show in the UI
var/name = "Virtual Domain"
/// Points to reward for completion. Used to purchase new domains and calculate ore rewards.
var/reward_points = BITRUNNER_REWARD_MIN
/// The start time of the map. Used to calculate time taken
var/start_time
/// This map is specifically for unit tests. Shouldn't display in game
var/test_only = FALSE
/**
* Generic settings / UI
*/
/// Cost of this map to load
var/cost = BITRUNNER_COST_NONE
/// The description of the map for the console UI
var/desc = "A map."
/// Affects the ui and ability to scan info.
var/difficulty = BITRUNNER_DIFFICULTY_NONE
/// Write these to help complete puzzles and other objectives. Viewed in the domain info ability.
var/help_text
// Name to show in the UI
var/name = "Virtual Domain"
/// Points to reward for completion. Used to purchase new domains and calculate ore rewards.
var/reward_points = BITRUNNER_REWARD_MIN
/**
* Player customization
*/
/// If this domain blocks the use of items from disks, for whatever reason
var/forbids_disk_items = FALSE
/// If this domain blocks the use of spells from disks, for whatever reason
var/forbids_disk_spells = FALSE
/// Any outfit that you wish to force on avatars. Overrides preferences
var/datum/outfit/forced_outfit
/**
* Loot
*/
/// An assoc list of typepath/amount to spawn on completion. Not weighted - the value is the amount
var/list/completion_loot
/// An assoc list of typepath/amount to spawn from secondary objectives. Not weighted - the value is the total number of items that can be obtained.
var/list/secondary_loot = list()
/// Number of secondary loot boxes generated. Resets when the domain is reloaded.
var/secondary_loot_generated
/// Has this domain been beaten with high enough score to spawn a tech disk?
var/disk_reward_spawned = FALSE
/**
* Modularity
*/
/// Whether to display this as a modular map
var/is_modular = FALSE
/// Byond will look for modular mob segment landmarks then choose from here at random. You can make them unique also.
var/list/datum/modular_mob_segment/mob_modules = list()
/// Forces all mob modules to only load once
var/modular_unique_mobs = FALSE
/**
* Spawning
*/
/// Looks for random landmarks to spawn on.
var/list/custom_spawns = list()
/// Set TRUE if you want reusable custom spawners
var/keep_custom_spawns = FALSE
/// Sends a point to any loot signals on the map
/datum/lazy_template/virtual_domain/proc/add_points(points_to_add)
SEND_SIGNAL(src, COMSIG_BITRUNNER_GOAL_POINT, points_to_add)
/// Overridable proc to be called after the map is loaded.
/datum/lazy_template/virtual_domain/proc/setup_domain(list/created_atoms)
return