mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 06:52:39 +00:00
Changeling Meteor event now breaks more gracefully and will absolutely make sure the changeling gets where it should Co-authored-by: Rhials <Datguy33456@gmail.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
199 lines
5.6 KiB
Plaintext
199 lines
5.6 KiB
Plaintext
//Station Shield
|
|
// A chain of satellites encircles the station
|
|
// Satellites be actived to generate a shield that will block unorganic matter from passing it.
|
|
/datum/station_goal/station_shield
|
|
name = "Station Shield"
|
|
var/coverage_goal = 500
|
|
requires_space = TRUE
|
|
|
|
/datum/station_goal/station_shield/get_report()
|
|
return list(
|
|
"<blockquote>The station is located in a zone full of space debris.",
|
|
"We have a prototype shielding system you must deploy to reduce collision-related accidents.",
|
|
"",
|
|
"You can order the satellites and control systems at cargo.</blockquote>",
|
|
).Join("\n")
|
|
|
|
|
|
/datum/station_goal/station_shield/on_report()
|
|
//Unlock
|
|
var/datum/supply_pack/P = SSshuttle.supply_packs[/datum/supply_pack/engineering/shield_sat]
|
|
P.special_enabled = TRUE
|
|
|
|
P = SSshuttle.supply_packs[/datum/supply_pack/engineering/shield_sat_control]
|
|
P.special_enabled = TRUE
|
|
|
|
/datum/station_goal/station_shield/check_completion()
|
|
if(..())
|
|
return TRUE
|
|
if(get_coverage() >= coverage_goal)
|
|
return TRUE
|
|
return FALSE
|
|
|
|
/datum/station_goal/proc/get_coverage()
|
|
var/list/coverage = list()
|
|
for(var/obj/machinery/satellite/meteor_shield/A in GLOB.machines)
|
|
if(!A.active || !is_station_level(A.z))
|
|
continue
|
|
coverage |= view(A.kill_range,A)
|
|
return coverage.len
|
|
|
|
/obj/machinery/computer/sat_control
|
|
name = "satellite control"
|
|
desc = "Used to control the satellite network."
|
|
circuit = /obj/item/circuitboard/computer/sat_control
|
|
var/notice
|
|
|
|
/obj/machinery/computer/sat_control/ui_interact(mob/user, datum/tgui/ui)
|
|
. = ..()
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "SatelliteControl", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/computer/sat_control/ui_act(action, params)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("toggle")
|
|
toggle(text2num(params["id"]))
|
|
. = TRUE
|
|
|
|
/obj/machinery/computer/sat_control/proc/toggle(id)
|
|
var/turf/current_turf = get_turf(src)
|
|
for(var/obj/machinery/satellite/S in GLOB.machines)
|
|
if(S.id == id && is_valid_z_level(get_turf(S), current_turf))
|
|
S.toggle()
|
|
|
|
/obj/machinery/computer/sat_control/ui_data()
|
|
var/list/data = list()
|
|
|
|
data["satellites"] = list()
|
|
for(var/obj/machinery/satellite/S in GLOB.machines)
|
|
data["satellites"] += list(list(
|
|
"id" = S.id,
|
|
"active" = S.active,
|
|
"mode" = S.mode
|
|
))
|
|
data["notice"] = notice
|
|
|
|
|
|
var/datum/station_goal/station_shield/G = locate() in GLOB.station_goals
|
|
if(G)
|
|
data["meteor_shield"] = 1
|
|
data["meteor_shield_coverage"] = G.get_coverage()
|
|
data["meteor_shield_coverage_max"] = G.coverage_goal
|
|
return data
|
|
|
|
|
|
/obj/machinery/satellite
|
|
name = "\improper Defunct Satellite"
|
|
desc = ""
|
|
icon = 'icons/obj/machines/satellite.dmi'
|
|
icon_state = "sat_inactive"
|
|
base_icon_state = "sat"
|
|
anchored = FALSE
|
|
density = TRUE
|
|
use_power = NO_POWER_USE
|
|
var/mode = "NTPROBEV0.8"
|
|
var/active = FALSE
|
|
var/static/gid = 0
|
|
var/id = 0
|
|
|
|
/obj/machinery/satellite/Initialize(mapload)
|
|
. = ..()
|
|
id = gid++
|
|
|
|
/obj/machinery/satellite/interact(mob/user)
|
|
toggle(user)
|
|
|
|
/obj/machinery/satellite/set_anchored(anchorvalue)
|
|
. = ..()
|
|
if(isnull(.))
|
|
return //no need to process if we didn't change anything.
|
|
active = anchorvalue
|
|
if(anchorvalue)
|
|
begin_processing()
|
|
animate(src, pixel_y = 2, time = 10, loop = -1)
|
|
else
|
|
end_processing()
|
|
animate(src, pixel_y = 0, time = 10)
|
|
update_appearance()
|
|
|
|
/obj/machinery/satellite/proc/toggle(mob/user)
|
|
if(!active && !isinspace())
|
|
if(user)
|
|
to_chat(user, span_warning("You can only activate [src] in space."))
|
|
return FALSE
|
|
if(user)
|
|
to_chat(user, span_notice("You [active ? "deactivate": "activate"] [src]."))
|
|
set_anchored(!anchored)
|
|
return TRUE
|
|
|
|
/obj/machinery/satellite/update_icon_state()
|
|
icon_state = "[base_icon_state]_[active ? "active" : "inactive"]"
|
|
return ..()
|
|
|
|
/obj/machinery/satellite/multitool_act(mob/living/user, obj/item/I)
|
|
..()
|
|
to_chat(user, span_notice("// NTSAT-[id] // Mode : [active ? "PRIMARY" : "STANDBY"] //[(obj_flags & EMAGGED) ? "DEBUG_MODE //" : ""]"))
|
|
return TRUE
|
|
|
|
/obj/machinery/satellite/meteor_shield
|
|
name = "\improper Meteor Shield Satellite"
|
|
desc = "A meteor point-defense satellite."
|
|
mode = "M-SHIELD"
|
|
processing_flags = START_PROCESSING_MANUALLY
|
|
subsystem_type = /datum/controller/subsystem/processing/fastprocess
|
|
var/kill_range = 14
|
|
|
|
/obj/machinery/satellite/meteor_shield/proc/space_los(meteor)
|
|
for(var/turf/T in get_line(src,meteor))
|
|
if(!isspaceturf(T))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/obj/machinery/satellite/meteor_shield/process()
|
|
if(!active)
|
|
return
|
|
for(var/obj/effect/meteor/meteor_to_destroy in GLOB.meteor_list)
|
|
if(meteor_to_destroy.z != z)
|
|
continue
|
|
if(get_dist(meteor_to_destroy, src) > kill_range)
|
|
continue
|
|
if(!(obj_flags & EMAGGED) && space_los(meteor_to_destroy))
|
|
Beam(get_turf(meteor_to_destroy), icon_state="sat_beam", time = 5)
|
|
if(meteor_to_destroy.shield_defense(src))
|
|
qdel(meteor_to_destroy)
|
|
|
|
/obj/machinery/satellite/meteor_shield/toggle(user)
|
|
if(!..(user))
|
|
return FALSE
|
|
if(obj_flags & EMAGGED)
|
|
if(active)
|
|
change_meteor_chance(2)
|
|
else
|
|
change_meteor_chance(0.5)
|
|
|
|
/obj/machinery/satellite/meteor_shield/proc/change_meteor_chance(mod)
|
|
// Update the weight of all meteor events
|
|
for(var/datum/round_event_control/meteor_wave/meteors in SSevents.control)
|
|
meteors.weight *= mod
|
|
for(var/datum/round_event_control/stray_meteor/stray_meteor in SSevents.control)
|
|
stray_meteor.weight *= mod
|
|
|
|
/obj/machinery/satellite/meteor_shield/Destroy()
|
|
. = ..()
|
|
if(active && (obj_flags & EMAGGED))
|
|
change_meteor_chance(0.5)
|
|
|
|
/obj/machinery/satellite/meteor_shield/emag_act(mob/user)
|
|
if(obj_flags & EMAGGED)
|
|
return
|
|
obj_flags |= EMAGGED
|
|
to_chat(user, span_notice("You access the satellite's debug mode, increasing the chance of meteor strikes."))
|
|
if(active)
|
|
change_meteor_chance(2)
|