-
Notifications
You must be signed in to change notification settings - Fork 69
[SPOILERS] Redspace Anchor + Related Phenomena #46
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
XeonMations
wants to merge
43
commits into
Monkestation:master
Choose a base branch
from
XeonMations:anchor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
999b915
start
XeonMations e6faf85
awawwa
XeonMations 6a1f474
Update storm_trait.dm
XeonMations 00bd6a1
Update storm_trait.dm
XeonMations d3e5ed0
Update storm_trait.dm
XeonMations 6396ebb
wew
XeonMations 040b36b
Merge remote-tracking branch 'upstream/master' into anchor
XeonMations d5a6bec
Update tgstation.dme
XeonMations 8328d75
rahhh
XeonMations aecc40f
hghh
XeonMations e17dd5b
awaw
XeonMations a0b55a2
Update storm_subsystem.dm
XeonMations 723f264
time for frontend
XeonMations 3168042
rahhh
XeonMations 267e310
Update storm_subsystem.dm
XeonMations 0424055
Update redspace_anchor.dm
XeonMations 59e80eb
awawaw
XeonMations ff4b7dc
hm
XeonMations 78beed1
Update redspace_anchor.dm
XeonMations 6509407
Update redspace_anchor.dm
XeonMations 97e8406
Update RedspaceAnchor.tsx
XeonMations b0fc012
Update redspace_anchor.dm
XeonMations fda1973
Update modular_oculis/modules/storm/code/redspace_anchor.dm
XeonMations 29e15a6
Merge remote-tracking branch 'upstream/master' into anchor
XeonMations 12a7c96
Update redspace_anchor.dm
XeonMations 8c70af8
Update redspace_anchor.dm
XeonMations b1d14b4
wires and stuff
XeonMations 09f7399
awwawa
XeonMations 9d836ba
awawaw
XeonMations 27240f7
awawawwa
XeonMations b86a2e0
Update anchor_computer.dm
XeonMations 621383a
rah
XeonMations 1f219f4
Update anchor_computer.dm
XeonMations da8235d
Merge branch 'master' into anchor
XeonMations caa688c
Update redspace_anchor.dm
XeonMations 9a2dbd1
Merge branch 'master' into anchor
XeonMations 1085a2c
Merge branch 'master' into anchor
XeonMations 6fb6e57
Update tgstation.dme
XeonMations a77cbe8
Update storm_subsystem.dm
XeonMations 753daf1
wew
XeonMations 92e666f
Update redspace_anchor.dm
XeonMations be3ed39
TODO
XeonMations 3766e43
Merge branch 'master' into anchor
XeonMations File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
modular_oculis/modules/storm/code/anchor/anchor_computer.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /obj/item/circuitboard/computer/redspace_anchor_control | ||
| name = "Redspace Anchor Control" | ||
| greyscale_colors = CIRCUIT_COLOR_COMMAND | ||
| build_path = /obj/machinery/computer/redspace_anchor_computer | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer | ||
| name = "redspace anchor control computer" | ||
| desc = "Used to control the redspace anchor." | ||
| icon_screen = "comm" | ||
| circuit = /obj/item/circuitboard/computer/redspace_anchor_control | ||
| var/obj/machinery/redspace_anchor/connected_anchor = null | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/Initialize(mapload, obj/item/circuitboard/C) | ||
| . = ..() | ||
| for(var/obj/machinery/redspace_anchor/anchor as anything in SSmachines.get_machines_by_type(/obj/machinery/redspace_anchor)) | ||
| if(anchor.z == z) | ||
| connected_anchor = anchor | ||
| update_appearance() | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/update_overlays() | ||
| if(connected_anchor?.breaker) | ||
| icon_screen = "comm" | ||
| else | ||
| icon_screen = "syndishuttle" | ||
| . = ..() | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/ui_status(mob/user, datum/ui_state/state) | ||
| if(HAS_SILICON_ACCESS(user) && connected_anchor.ai_disabled) | ||
| to_chat(user, span_info("AI control has been disabled.")) | ||
| else if(!connected_anchor.shorted) | ||
| return ..() | ||
| return UI_CLOSE | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/ui_interact(mob/user, datum/tgui/ui) | ||
| . = ..() | ||
| ui = SStgui.try_update_ui(user, src, ui) | ||
| if(!ui) | ||
| ui = new(user, src, "RedspaceAnchor", name) | ||
| ui.open() | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/ui_data(mob/user) | ||
| var/list/data = list() | ||
| data["breaker"] = connected_anchor.breaker | ||
| data["charge_count"] = connected_anchor.charge_count | ||
| data["charging_state"] = connected_anchor.charging_state | ||
| data["on"] = connected_anchor.on | ||
| data["operational"] = (connected_anchor.machine_stat & BROKEN) ? FALSE : TRUE | ||
| data["violetspace_energy"] = connected_anchor.violetspace_energy | ||
| return data | ||
|
|
||
| /obj/machinery/computer/redspace_anchor_computer/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
| . = ..() | ||
| if(.) | ||
| return | ||
|
|
||
| switch(action) | ||
| if("gentoggle") | ||
| connected_anchor.breaker = !connected_anchor.breaker | ||
| investigate_log("was toggled [connected_anchor.breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", INVESTIGATE_ENGINE) | ||
| if(connected_anchor.violetspace_energy) | ||
| connected_anchor.trigger_unsafe_discharge() | ||
| investigate_log("was overloaded by remaining violetspace energy.", INVESTIGATE_ENGINE) | ||
| connected_anchor.set_power() | ||
| . = TRUE | ||
| if("discharge_violetspace") | ||
| if(connected_anchor.violetspace_energy && connected_anchor.can_discharge) | ||
| investigate_log("has discharged violetspace energy by [key_name(usr)].", INVESTIGATE_ENGINE) | ||
| connected_anchor.trigger_safe_discharge() | ||
| . = TRUE |
278 changes: 278 additions & 0 deletions
278
modular_oculis/modules/storm/code/anchor/redspace_anchor.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,278 @@ | ||
| #define POWER_IDLE 0 | ||
| #define POWER_UP 1 | ||
| #define POWER_DOWN 2 | ||
|
|
||
| /obj/machinery/redspace_anchor | ||
| name = "redspace anchor" | ||
| icon = 'modular_oculis/modules/storm/icons/redspace_anchor.dmi' | ||
| icon_state = "anchor_off" | ||
| interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | ||
| resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | ||
|
|
||
| /* | ||
| * Yes, I know this doesn't use BASE_MACHINE_IDLE_CONSUMPTION at all, | ||
| * and this is purelly done so that the code is readable without pulling out a calculator | ||
| * to make sure these values are right. | ||
| */ | ||
| use_power = IDLE_POWER_USE | ||
| idle_power_usage = (6 MEGA WATTS) // Lotta fucking power to keep the storm at bay. | ||
|
|
||
| // 3x3 offset by one row | ||
| pixel_x = -32 | ||
| pixel_y = -32 | ||
| bound_height = 96 | ||
| bound_width = 96 | ||
| bound_x = -32 | ||
| bound_y = -32 | ||
| density = TRUE | ||
| move_resist = INFINITY | ||
|
|
||
| /// Whether the redspace anchor is currently active. | ||
| var/on = TRUE | ||
| /// If the main breaker is on/off, to enable/disable the anchor. | ||
| var/breaker = TRUE | ||
| /// If the power cable is cut or not. | ||
| var/shorted = FALSE | ||
| /// If a silicon can interact with it. | ||
| var/ai_disabled = FALSE | ||
| /// If the anchor will produce an alarm when changing states. | ||
| var/alarm_disabled = FALSE | ||
| /// If the anchor can safely discharge its redspace energy. | ||
| var/can_discharge = TRUE | ||
| /// If the generator is idle, charging, or down. | ||
| var/charging_state = POWER_IDLE | ||
| /// How much charge the redspace anchor has, goes down when breaker is shut, and shuts down at 0. | ||
| var/charge_count = 100 | ||
|
|
||
| /// The overlay currently used. | ||
| var/current_overlay = null | ||
|
|
||
| /// Audio for when the redspace anchor is on | ||
| var/datum/looping_sound/redspace_anchor/soundloop | ||
|
|
||
| /// How much excess violetspace energy the redspace anchor has, which can cause it to fail once it reaches 100. | ||
| var/violetspace_energy = 0 | ||
|
|
||
| /obj/machinery/redspace_anchor/Initialize(mapload) | ||
| . = ..() | ||
| SSeidolon_storm.register_anchor(src) | ||
| set_wires(new /datum/wires/redspace_anchor(src)) | ||
| soundloop = new(src, start_immediately = FALSE) | ||
| if(on) | ||
| add_overlay("activated") | ||
|
|
||
| /obj/machinery/redspace_anchor/examine(mob/user) | ||
| if(HAS_TRAIT(user, TRAIT_MINDSHIELD)) | ||
| desc = "The most important machine on the station. You feel more... Stable, near it." | ||
| return ..() | ||
| desc = "The most important machine on the station. \n[span_danger("Looking directly at it gives you a headache.")]" | ||
| return ..() | ||
|
|
||
| /obj/machinery/redspace_anchor/safe_throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE) | ||
| return FALSE | ||
|
|
||
| /obj/machinery/redspace_anchor/ex_act(severity, target) | ||
| if(severity >= EXPLODE_DEVASTATE) // Very sturdy. | ||
| set_broken() | ||
| return TRUE | ||
| return FALSE | ||
|
|
||
| /obj/machinery/redspace_anchor/blob_act(obj/structure/blob/B) | ||
| if(prob(20)) | ||
| set_broken() | ||
|
|
||
| /obj/machinery/redspace_anchor/zap_act(power, zap_flags) | ||
| . = ..() | ||
| if(zap_flags & ZAP_MACHINE_EXPLOSIVE) | ||
| qdel(src) //like the singulo, tesla deletes it. stops it from exploding over and over | ||
|
|
||
| // You aren't allowed to move. | ||
| /obj/machinery/redspace_anchor/Move() | ||
| . = ..() | ||
| qdel(src) | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/set_broken() | ||
| atom_break() | ||
| update_appearance() | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/set_fix() | ||
| set_machine_stat(machine_stat & ~BROKEN) | ||
| update_appearance() | ||
|
|
||
| /obj/machinery/redspace_anchor/update_icon_state() | ||
| . = ..() | ||
| if(on) | ||
| icon_state = "anchor_on" | ||
| else | ||
| icon_state = "anchor_off" | ||
|
|
||
| /obj/machinery/redspace_anchor/screwdriver_act(mob/living/user, obj/item/tool) | ||
| if(machine_stat & BROKEN) | ||
| return | ||
| tool.play_tool_sound(src) | ||
| toggle_panel_open() | ||
| to_chat(user, span_notice("The wires have been [panel_open ? "exposed" : "unexposed"].")) | ||
| update_appearance() | ||
| return TRUE | ||
|
|
||
| // Wire interactions | ||
| /obj/machinery/redspace_anchor/proc/reset(wire) | ||
| switch(wire) | ||
| if(WIRE_POWER) | ||
| if(!wires.is_cut(WIRE_POWER)) | ||
| shorted = FALSE | ||
| set_power() | ||
| if(WIRE_AI) | ||
| if(!wires.is_cut(WIRE_AI)) | ||
| ai_disabled = FALSE | ||
| if(WIRE_ALARM) | ||
| if(!wires.is_cut(WIRE_ALARM)) | ||
| alarm_disabled = FALSE | ||
| if(WIRE_DISCHARGE) | ||
| update_appearance() | ||
|
|
||
| /obj/machinery/redspace_anchor/power_change() | ||
| . = ..() | ||
| if(SSticker.current_state == GAME_STATE_PLAYING) | ||
| investigate_log("has [machine_stat & NOPOWER ? "lost" : "regained"] power.", INVESTIGATE_ENGINE) | ||
| set_power() | ||
|
|
||
| // Set the charging state based on power/breaker. | ||
| /obj/machinery/redspace_anchor/proc/set_power() | ||
| var/new_state = FALSE | ||
| if(machine_stat & (NOPOWER|BROKEN) || !breaker || shorted) | ||
| new_state = FALSE | ||
| else if(breaker) | ||
| new_state = TRUE | ||
|
|
||
| charging_state = new_state ? POWER_UP : POWER_DOWN // Startup sequence animation. | ||
| if(SSticker.current_state == GAME_STATE_PLAYING) | ||
| investigate_log("is now [charging_state == POWER_UP ? "charging" : "discharging"].", INVESTIGATE_ENGINE) | ||
| update_appearance() | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/enable() | ||
| charging_state = POWER_IDLE | ||
| on = TRUE | ||
|
|
||
| //soundloop.start() | ||
| update_appearance() | ||
|
|
||
| if(SSticker.current_state == GAME_STATE_PLAYING) | ||
| investigate_log("was brought online.", INVESTIGATE_ENGINE) | ||
| message_admins("The redspace anchor was brought online [ADMIN_VERBOSEJMP(src)]") | ||
| shake_everyone() | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/disable() | ||
| charging_state = POWER_IDLE | ||
| on = FALSE | ||
|
|
||
| //soundloop.stop() | ||
| update_appearance() | ||
|
|
||
| if(SSticker.current_state == GAME_STATE_PLAYING) | ||
| investigate_log("was brought offline.", INVESTIGATE_ENGINE) | ||
| message_admins("The redspace anchor was brought offline. [ADMIN_VERBOSEJMP(src)]") | ||
| shake_everyone() | ||
|
|
||
| // Charge/Discharge and turn on/off when you reach 0/100 percent. | ||
| /obj/machinery/redspace_anchor/process() | ||
| if(machine_stat & BROKEN) | ||
| cut_overlays() | ||
| return | ||
|
|
||
| var/overlay_state = null | ||
| switch(charge_count) | ||
| if(0 to 20) | ||
| overlay_state = null | ||
| if(21 to 40) | ||
| overlay_state = "startup" | ||
| if(41 to 60) | ||
| overlay_state = "idle" | ||
| if(61 to 80) | ||
| overlay_state = "activating" | ||
| if(81 to 100) | ||
| overlay_state = "activated" | ||
|
|
||
| if(overlay_state != current_overlay) | ||
| cut_overlays() | ||
| if(overlay_state) | ||
| add_overlay(overlay_state) | ||
| current_overlay = overlay_state | ||
|
|
||
| if(charging_state == POWER_IDLE) | ||
| return | ||
| if((charging_state == POWER_UP) && (charge_count >= 100)) | ||
| enable() | ||
| else if((charging_state == POWER_DOWN) && (charge_count <= 0)) | ||
| disable() | ||
| else | ||
| if(charging_state == POWER_UP) | ||
| charge_count += 2 | ||
| else if(charging_state == POWER_DOWN) | ||
| charge_count -= 2 | ||
|
|
||
| for(var/mob/mobs as anything in GLOB.mob_list) | ||
| var/turf/mob_turf = get_turf(mobs) | ||
| if(!istype(mob_turf)) | ||
| continue | ||
| if(!is_valid_z_level(src, mob_turf)) | ||
| continue | ||
| if(mobs.client) | ||
| if((charge_count % 4 == 0 && prob(75)) && !alarm_disabled) // Let them know it is charging/discharging. | ||
| if(charging_state == POWER_UP) | ||
| mobs.playsound_local(mob_turf, 'sound/effects/magic/cosmic_expansion.ogg', 100, TRUE) | ||
| else | ||
| mobs.playsound_local(mob_turf, 'sound/effects/magic/swap.ogg', 100, TRUE) | ||
| if((charge_count <= 50) && (charging_state == POWER_DOWN) && prob(5)) | ||
| to_chat(mobs, span_bolddanger("You feel a foreign presence encroaching around you.")) | ||
|
|
||
| /// Shake everyone on the z level to let them know that the anchor was enagaged/disengaged. | ||
| /obj/machinery/redspace_anchor/proc/shake_everyone() | ||
| var/turf/T = get_turf(src) | ||
| var/sound/alert_sound = sound('sound/effects/alert.ogg') | ||
| for(var/mob/mobs as anything in GLOB.mob_list) | ||
| var/turf/mob_turf = get_turf(mobs) | ||
| if(!istype(mob_turf)) | ||
| continue | ||
| if(!is_valid_z_level(T, mob_turf)) | ||
| continue | ||
| if(mobs.client) | ||
| shake_camera(mobs, 15, 1) | ||
| mobs.playsound_local(T, null, 100, 1, 0.5, sound_to_use = alert_sound) | ||
| if(!SSmapping.level_has_any_trait(z, ZTRAIT_STATION)) | ||
| return | ||
| if(on) | ||
| priority_announce("Redspace Anchor activated. Storm dissipation in progress.", "Redspace Anchor") | ||
| else | ||
| priority_announce("Warning: Redspace Anchor has been disabled. Storm encroaching on station perimeter.", "Redspace Anchor") | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/tick(intensity) | ||
| if((charging_state != POWER_IDLE) || !on) | ||
| return | ||
| violetspace_energy += (rand(1,5) * intensity) | ||
| if(violetspace_energy >= 100) | ||
| trigger_unsafe_discharge() | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/trigger_unsafe_discharge() | ||
| violetspace_energy = 0 | ||
| breaker = FALSE | ||
| set_power() | ||
| priority_announce( | ||
| text = "Redspace Anchor failure! Unsafe shutdown in progress!", | ||
| title = "Redspace Anchor", | ||
| sound = SSstation.announcer.get_rand_alert_sound(), | ||
| has_important_message = TRUE, | ||
| ) | ||
|
|
||
| /obj/machinery/redspace_anchor/proc/trigger_safe_discharge() | ||
| violetspace_energy = 0 | ||
| priority_announce( | ||
| text = "Redspace Anchor safe discharge in progress.", | ||
| title = "Redspace Anchor", | ||
| sound = SSstation.announcer.get_rand_alert_sound(), | ||
| has_important_message = TRUE, | ||
| ) | ||
|
|
||
| #undef POWER_IDLE | ||
| #undef POWER_UP | ||
| #undef POWER_DOWN | ||
6 changes: 6 additions & 0 deletions
6
modular_oculis/modules/storm/code/anchor/redspace_anchor_soundloop.dm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| /datum/looping_sound/redspace_anchor | ||
| mid_sounds = list('sound/machines/hypertorus/loops/hypertorus_nominal.ogg') | ||
| mid_length = 6 SECONDS | ||
| volume = 55 | ||
| extra_range = 15 | ||
| vary = TRUE |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.