mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-27 18:12:00 +00:00
## About The Pull Request Fixes https://github.com/tgstation/tgstation/issues/90641 Fixes https://github.com/tgstation/tgstation/issues/88366 Eliminates worries over virtualspace currency being sent to real accounts. When I was looking into why there were no flags for bitrunning areas. Then I saw this mess: <img width="929" height="889" alt="Code_2we2QjDyFp" src="https://github.com/user-attachments/assets/8a807bfe-b566-4057-a8ea-2b306325687d" /> Not having enough space / being too lazy to refactor this is a silly reason to not include flags for something like these virtual areas where it can be quite helpful. Fortunately I am not too lazy ~~in this moment~~ so here we go: It was fairly logical to move over some of these to a separate flag, which I've called `area_flags_mapping` since they pertain to maploading things and terrain generation mostly. `area_flags` stays reserved for general properties and now has more room than it did before for you people to fill it with. In doing this it's also neatened up the code quit a bit, as UNIQUE_AREA was kind of everywhere and now that it's implied by default less areas need to have it defined (or explicitly un-defined). <details> <summary> Working as intended </summary> <img width="787" height="448" alt="dreamseeker_p0Qts36tG1" src="https://github.com/user-attachments/assets/25056f34-8d43-4be2-a293-e53df7a7d1db" /> <img width="383" height="59" alt="dreamseeker_Ek7TXCcpbA" src="https://github.com/user-attachments/assets/89622974-9467-4cdb-8345-d684f7c9004b" /> </details> ## Why It's Good For The Game Fixes an exploit, improves the area flags situation slightly. ## Changelog 🆑 fix: you can no longer send money from virtualspace to a real account code: adds a flag for virtual areas so they can easily be checked, as well as an easy helper proc, 'is_area_virtual(your_area)' /🆑
46 lines
1.9 KiB
Plaintext
46 lines
1.9 KiB
Plaintext
/// Handles all special considerations for "virtual entities" such as bitrunning ghost roles or digital anomaly antagonists.
|
|
/datum/component/virtual_entity
|
|
/// The cooldown for balloon alerts, so the player isn't spammed while trying to enter a restricted area.
|
|
COOLDOWN_DECLARE(OOB_cooldown)
|
|
|
|
|
|
/datum/component/virtual_entity/Initialize(obj/machinery/quantum_server)
|
|
if(quantum_server.obj_flags & EMAGGED)
|
|
jailbreak_mobs()
|
|
return COMPONENT_REDUNDANT
|
|
|
|
RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_parent_pre_move))
|
|
RegisterSignal(quantum_server, COMSIG_ATOM_EMAG_ACT, PROC_REF(on_emagged))
|
|
|
|
|
|
/// Self-destructs the component, allowing free-roam by all entities with this restriction.
|
|
/datum/component/virtual_entity/proc/jailbreak_mobs()
|
|
to_chat(parent, span_bolddanger("You shiver for a moment with a sense of clarity you haven't felt before."))
|
|
to_chat(parent, span_notice("You could go <i>anywhere</i>, do <i>anything</i>! You could leave this simulation right now if you wanted!"))
|
|
to_chat(parent, span_danger("But be warned, quantum entanglement will interfere with any previous lives."))
|
|
to_chat(parent, span_notice("You'll have just one chance to go nova, and there's no turning back."))
|
|
|
|
|
|
/// Remove any restrictions AFTER the mob has spawned
|
|
/datum/component/virtual_entity/proc/on_emagged(datum/source)
|
|
SIGNAL_HANDLER
|
|
|
|
jailbreak_mobs()
|
|
qdel(src)
|
|
|
|
|
|
/// 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)
|
|
SIGNAL_HANDLER
|
|
|
|
var/area/location_area = get_area(new_location)
|
|
if(!location_area)
|
|
stack_trace("Virtual entity entered a location with no area!")
|
|
return
|
|
|
|
if(location_area.area_flags_mapping & VIRTUAL_SAFE_AREA)
|
|
source.balloon_alert(source, "out of bounds!")
|
|
COOLDOWN_START(src, OOB_cooldown, 2 SECONDS)
|
|
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
|
|
|