diff --git a/code/modules/shieldgen/shield_capacitor.dm b/code/modules/shieldgen/shield_capacitor.dm
index 92ccfb5a233..63437279017 100644
--- a/code/modules/shieldgen/shield_capacitor.dm
+++ b/code/modules/shieldgen/shield_capacitor.dm
@@ -148,3 +148,6 @@
icon_state = "broke"
else
..()
+
+/obj/machinery/shield_capacitor/multiz
+ max_charge_rate = 1250000 //1250 kW
\ No newline at end of file
diff --git a/code/modules/shieldgen/shield_gen.dm b/code/modules/shieldgen/shield_gen.dm
index 1bf901763b3..77a07ba056f 100644
--- a/code/modules/shieldgen/shield_gen.dm
+++ b/code/modules/shieldgen/shield_gen.dm
@@ -29,6 +29,8 @@
var/time_since_fail = 100
var/energy_conversion_rate = 0.0002 //how many renwicks per watt?
use_power = 0 //doesn't use APC power
+ var/multiz = FALSE
+ var/multi_unlocked = FALSE
/obj/machinery/shield_gen/Initialize()
for(var/obj/machinery/shield_capacitor/possible_cap in range(1, src))
@@ -73,7 +75,7 @@
for(var/obj/machinery/shield_capacitor/cap in range(1, src))
if(cap.owned_gen)
continue
- if(get_dir(cap, src) == cap.dir && src.anchored)
+ if(get_dir(cap, src) == cap.dir && cap.anchored)
owned_capacitor = cap
owned_capacitor.owned_gen = src
updateDialog()
@@ -96,45 +98,30 @@
interact(user)
/obj/machinery/shield_gen/interact(mob/user)
- if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN)) )
- if (!istype(user, /mob/living/silicon))
- user.unset_machine()
- user << browse(null, "window=shield_generator")
- return
- var/t = "Shield Generator Control Console
"
if(locked)
- t += "Swipe your ID card to begin."
+ to_chat(user, SPAN_WARNING("The device is locked. Swipe your ID to unlock it."))
+ return
+ if(!anchored)
+ to_chat(user, SPAN_WARNING("The device needs to be bolted to the ground first."))
+ return
else
- t += "[owned_capacitor ? "Charge capacitor connected." : "Unable to locate charge capacitor!"]
"
- t += "This generator is: [active ? "Online" : "Offline" ] [active ? "\[Deactivate\]" : "\[Activate\]"]
"
- t += "Field Status: [time_since_fail > 2 ? "Stable" : "Unstable"]
"
- t += "Coverage Radius (restart required): \
- --- \
- -- \
- - \
- [field_radius] m \
- + \
- ++ \
- +++
"
- t += "Overall Field Strength: [round(average_field_strength, 0.01)] Renwick ([target_field_strength ? round(100 * average_field_strength / target_field_strength, 0.1) : "NA"]%)
"
- t += "Upkeep Power: [round(field.len * max(average_field_strength * dissipation_rate, min_dissipation) / energy_conversion_rate)] W
"
- t += "Charge Rate: -- \
- [strengthen_rate] Renwick/s \
- ++
"
- t += "Shield Generation Power: [round(field.len * min(strengthen_rate, target_field_strength - average_field_strength) / energy_conversion_rate)] W
"
- t += "Maximum Field Strength: \
- \[min\] \
- -- \
- - \
- [target_field_strength] Renwick \
- + \
- ++ \
- \[max\]
"
- t += "
"
- t += "Refresh "
- t += "Close
"
- user << browse(t, "window=shield_generator;size=500x400")
- user.set_machine(src)
+ if(owned_capacitor)
+ if(!(owned_capacitor in range(1, src) && get_dir(owned_capacitor, src) == owned_capacitor.dir && owned_capacitor.anchored))
+ if(owned_capacitor.owned_gen == src)
+ owned_capacitor.owned_gen = null
+ owned_capacitor = null
+ if(!owned_capacitor)
+ for(var/obj/machinery/shield_capacitor/cap in range(1, src))
+ if(cap.owned_gen)
+ continue
+ if(get_dir(cap, src) == cap.dir && cap.anchored)
+ owned_capacitor = cap
+ owned_capacitor.owned_gen = src
+ updateDialog()
+ break
+ return src.ui_interact(user)
+
+
/obj/machinery/shield_gen/machinery_process()
if (!anchored && active)
@@ -177,28 +164,7 @@
else
average_field_strength = 0
-/obj/machinery/shield_gen/Topic(href, href_list[])
- ..()
- if( href_list["close"] )
- usr << browse(null, "window=shield_generator")
- usr.unset_machine()
- return
- else if( href_list["toggle"] )
- if (!active && !anchored)
- to_chat(usr, "The [src] needs to be firmly secured to the floor first.")
- return
- toggle()
- else if( href_list["change_radius"] )
- field_radius = between(0, field_radius + text2num(href_list["change_radius"]), max_field_radius)
- else if( href_list["strengthen_rate"] )
- strengthen_rate = between(0, strengthen_rate + text2num(href_list["strengthen_rate"]), max_strengthen_rate)
- else if( href_list["target_field_strength"] )
- target_field_strength = between(1, target_field_strength + text2num(href_list["target_field_strength"]), max_field_strength)
-
- updateDialog()
-
/obj/machinery/shield_gen/ex_act(var/severity)
-
if(active)
toggle()
return ..()
@@ -264,3 +230,53 @@
T = locate(gen_turf.x + field_radius, gen_turf.y + y_offset, gen_turf.z)
if (T)
. += T
+
+/obj/machinery/shield_gen/ui_interact(mob/user)
+ var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
+ if (!ui)
+ ui = new(user, src, "machinery-shields-shield", 480, 400, "Shield Generator", state = interactive_state)
+ ui.open()
+ ui.auto_update_content = TRUE
+
+/obj/machinery/shield_gen/vueui_data_change(list/data, mob/user, datum/vueui/ui)
+ data = ..() || list()
+
+ data["owned_capacitor"] = owned_capacitor
+ data["active"] = active
+ data["time_since_fail"] = time_since_fail
+ data["multi_unlocked"] = multi_unlocked
+ data["multiz"] = multiz
+ data["field_radius"] = field_radius
+ data["min_field_radius"] = 1
+ data["max_field_radius"] = max_field_radius
+ data["average_field"] = round(average_field_strength, 0.01)
+ data["progress_field"] = (target_field_strength ? round(100 * average_field_strength / target_field_strength, 0.1) : "NA")
+ data["power_take"] = round(field.len * max(average_field_strength * dissipation_rate, min_dissipation) / energy_conversion_rate)
+ data["shield_power"] = round(field.len * min(strengthen_rate, target_field_strength - average_field_strength) / energy_conversion_rate)
+ data["strengthen_rate"] = (strengthen_rate * 10)
+ data["max_strengthen_rate"] = (max_strengthen_rate * 10)
+ data["target_field_strength"] = target_field_strength
+
+ return data
+
+/obj/machinery/shield_gen/Topic(href, href_list)
+ if (!isturf(loc))
+ return 0
+
+ if(href_list["toggle"])
+ toggle()
+
+ if(href_list["multiz"])
+ multiz = !multiz
+
+ if (href_list["size_set"])
+ field_radius = between(1, text2num(href_list["size_set"]), max_field_radius)
+
+ if (href_list["charge_set"])
+ strengthen_rate = (between(1, text2num(href_list["charge_set"]), (max_strengthen_rate * 10)) / 10)
+
+ if (href_list["field_set"])
+ target_field_strength = between(1, text2num(href_list["field_set"]), 10)
+
+ src.add_fingerprint(usr)
+ return 1
\ No newline at end of file
diff --git a/code/modules/shieldgen/shield_gen_external.dm b/code/modules/shieldgen/shield_gen_external.dm
index 99a65695d66..5541bed6543 100644
--- a/code/modules/shieldgen/shield_gen_external.dm
+++ b/code/modules/shieldgen/shield_gen_external.dm
@@ -3,10 +3,12 @@
/obj/machinery/shield_gen/external
name = "hull shield generator"
+ multi_unlocked = TRUE
//NOT MULTIZ COMPATIBLE
//Search for space turfs within range that are adjacent to a simulated turf.
/obj/machinery/shield_gen/external/get_shielded_turfs()
+ set background = 1
var/list/out = list()
var/turf/gen_turf = get_turf(src)
@@ -31,4 +33,53 @@
out += T
break
+ if(multiz)
+ var/connected_levels = list()
+ var/turf/above = getzabove(src)
+ var/turf/below = getzbelow(src)
+ if(above)
+ for(var/turf/z in above)
+ connected_levels += z
+ if(below)
+ for(var/turf/z in below)
+ connected_levels += z
+ for(var/turf/z in connected_levels)
+ for (var/tt in RANGE_TURFS(field_radius, z))
+ T = tt
+ // Ignore station areas.
+ if (the_station_areas[T.loc])
+ continue
+ else if (istype(T, /turf/space) || istype(T, /turf/unsimulated/floor/asteroid) || isopenturf(T))
+ for (var/uu in RANGE_TURFS(1, T))
+ U = uu
+ if (T == U)
+ continue
+
+ if (the_station_areas[U.loc])
+ out += T
+ break
return out
+
+/obj/machinery/shield_gen/external/proc/getzabove(var/turf/location)
+ var/connected = list()
+ var/turf/above = GetAbove(location)
+
+ if(above)
+ connected += above
+ var/connected_levels = getzabove(above)
+ for(var/turf/z as anything in connected_levels)
+ connected += z
+
+ return connected
+
+/obj/machinery/shield_gen/external/proc/getzbelow(var/turf/location)
+ var/connected = list()
+ var/turf/below = GetBelow(location)
+
+ if(below)
+ connected += below
+ var/connected_levels = getzbelow(below)
+ for(var/turf/z as anything in connected_levels)
+ connected += z
+
+ return connected
\ No newline at end of file
diff --git a/html/changelogs/ShieldZGen.yml b/html/changelogs/ShieldZGen.yml
new file mode 100644
index 00000000000..14e9e6f8e49
--- /dev/null
+++ b/html/changelogs/ShieldZGen.yml
@@ -0,0 +1,6 @@
+author: TheGreyWolf
+
+delete-after: True
+
+changes:
+ - rscadd: "Added the ability for shield generators to cover multiple z-levels."
diff --git a/maps/aurora/aurora-6_surface.dmm b/maps/aurora/aurora-6_surface.dmm
index f5a56d4c650..06d083aeaaa 100644
--- a/maps/aurora/aurora-6_surface.dmm
+++ b/maps/aurora/aurora-6_surface.dmm
@@ -14845,14 +14845,14 @@
/turf/simulated/floor/lino/grey,
/area/hallway/secondary/entry/departure_lounge)
"nqU" = (
-/obj/machinery/shield_capacitor{
- dir = 8
- },
/obj/effect/floor_decal/industrial/outline/yellow,
/obj/structure/cable/cyan{
d2 = 2;
icon_state = "0-2"
},
+/obj/machinery/shield_capacitor/multiz{
+ dir = 8
+ },
/turf/simulated/floor/plating,
/area/storage/shields)
"nrZ" = (
@@ -23314,14 +23314,14 @@
/turf/simulated/floor/plating,
/area/hallway/secondary/entry/emergency)
"uAC" = (
-/obj/machinery/shield_capacitor{
- dir = 4
- },
/obj/effect/floor_decal/industrial/outline/yellow,
/obj/structure/cable/cyan{
d2 = 2;
icon_state = "0-2"
},
+/obj/machinery/shield_capacitor/multiz{
+ dir = 4
+ },
/turf/simulated/floor/plating,
/area/storage/shields)
"uAT" = (
@@ -23508,7 +23508,7 @@
/obj/machinery/power/smes/buildable{
RCon_tag = "Surface - Shield Substation";
charge = 1e+007;
- cur_coils = 4;
+ cur_coils = 5;
input_attempt = 1;
input_level = 500000;
output_attempt = 1;
diff --git a/vueui/src/components/view/machinery/shields/shield.vue b/vueui/src/components/view/machinery/shields/shield.vue
new file mode 100644
index 00000000000..8ae39eede47
--- /dev/null
+++ b/vueui/src/components/view/machinery/shields/shield.vue
@@ -0,0 +1,59 @@
+
+
+
+
+ {{owned_capacitor ? "Charge capacitor connected" : "Unable to locate charge capacitor"}}
+
+
+
+ {{active ? "Online" : "Offline"}} Toggle
+
+
+
+ {{multiz ? "Online" : "Offline"}} Toggle
+
+
+
+ {{time_since_fail > 2 ? "Stable" : "Unstable"}}
+
+
+
+ {{ average_field }} Renwick ({{ progress_field }}%)
+
+
+
+ {{ power_take }} W
+
+
+
+ {{ shield_power }} W
+
+
+
+
+ {{field_radius}} M
+
+
+
+
+
+ {{strengthen_rate}} Renwick
+
+
+
+
+
+ {{target_field_strength}}
+
+
+
+
+
+
+
\ No newline at end of file