Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Domains now have certain areas protected from ghost role interference #82960

Merged
merged 16 commits into from
May 7, 2024
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_bitrunning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
// Ladder
/// from /obj/structure/hololadder/disconnect()
#define COMSIG_BITRUNNER_LADDER_SEVER "bitrunner_ladder_sever"

/// Sent when a server console is emagged
#define COMSIG_BITRUNNER_SERVER_EMAGGED "bitrunner_server_emagged"
17 changes: 16 additions & 1 deletion code/datums/components/virtual_entity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

/datum/component/virtual_entity/Initialize()
. = ..()

for(var/obj/machinery/quantum_server/server in SSmachines.get_machines_by_type(/obj/machinery/quantum_server))
if(server.obj_flags & EMAGGED)
Rhials marked this conversation as resolved.
Show resolved Hide resolved
jailbreak_mobs() //This just sends a message and self-deletes, a bit messy but it works.
return

RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_parent_pre_move))
RegisterSignal(parent, COMSIG_BITRUNNER_SERVER_EMAGGED, PROC_REF(jailbreak_mobs))
Rhials marked this conversation as resolved.
Show resolved Hide resolved

///Prevents entry to a certain area if it has flags preventing virtual entities from entering.
/datum/component/virtual_entity/proc/on_parent_pre_move(atom/movable/source, atom/new_location)
Expand All @@ -18,5 +25,13 @@

if(location_area.area_flags & VIRTUAL_SAFE_AREA)
source.balloon_alert(source, "out of bounds!")
COOLDOWN_START(src, OOB_cooldown, 1 SECONDS)
COOLDOWN_START(src, OOB_cooldown, 2 SECONDS)
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE

///Self-destructs the component, allowing free-roam by all entities with this restriction.
/datum/component/virtual_entity/proc/jailbreak_mobs()
SIGNAL_HANDLER

to_chat(parent, span_alert("You shiver for a moment, then suddenly feel a sense of clarity you haven't felt before. \
You can go anywhere, do anything! You could leave this simulation right now if you wanted!"))
qdel(src)
6 changes: 5 additions & 1 deletion code/modules/bitrunning/server/_parent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,15 @@
/obj/machinery/quantum_server/emag_act(mob/user, obj/item/card/emag/emag_card)
. = ..()

if(obj_flags & EMAGGED)
return

obj_flags |= EMAGGED
glitch_chance = 0.09

add_overlay(mutable_appearance('icons/obj/machines/bitrunning.dmi', "emag_overlay"))
balloon_alert(user, "bzzzt...")
balloon_alert(user, "system jailbroken...")
SEND_GLOBAL_SIGNAL(COMSIG_BITRUNNER_SERVER_EMAGGED)
playsound(src, 'sound/effects/sparks1.ogg', 35, vary = TRUE)

/obj/machinery/quantum_server/update_appearance(updates)
Expand Down