Explosion subsystem (#17499)

* Initial port

* pause air

* decoupled input from processing

* explosion condition tweak

* closer to original recursive code

* accurate explosions

* better defer calls

* glob fix

* fix

* DON'T DO THAT

* initial deferral code

* small explosions ignored

* lower thresholds

* better thresholds again

* forbid powernet defer during init, explosions too

* don't block your own network regen

* use procs

* better thresholds, always defer at least

* admin notice

* subsytem updated

* Allow removal from networks

* defer till rebuild

* dir

* Update breaker_box.dm

* no init means no init

* then flag it...

---------

Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
Co-authored-by: C.L. <killer65311@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
Will
2025-08-15 16:55:19 -04:00
committed by GitHub
parent 5fa1055b7c
commit eba43f278c
17 changed files with 388 additions and 220 deletions
+5 -1
View File
@@ -276,7 +276,7 @@ ADMIN_VERB(stealth, R_STEALTH, "Stealth Mode", "Toggle stealth.", "Admin.Game")
set desc = "Cause an explosion of varying strength at your location."
var/turf/epicenter = mob.loc
var/list/choices = list("Small Bomb", "Medium Bomb", "Big Bomb", "Custom Bomb", "Cancel")
var/list/choices = list("Small Bomb", "Medium Bomb", "Big Bomb", "Maxcap Bomb", "SM Blast", "Custom Bomb", "Cancel")
var/choice = tgui_input_list(usr, "What size explosion would you like to produce?", "Explosion Choice", choices)
switch(choice)
if(null)
@@ -289,6 +289,10 @@ ADMIN_VERB(stealth, R_STEALTH, "Stealth Mode", "Toggle stealth.", "Admin.Game")
explosion(epicenter, 2, 3, 4, 4)
if("Big Bomb")
explosion(epicenter, 3, 5, 7, 5)
if("Maxcap Bomb") // Being able to test what players can legally make themselves sounds good, no?~
explosion(epicenter, BOMBCAP_DVSTN_RADIUS, BOMBCAP_HEAVY_RADIUS, BOMBCAP_LIGHT_RADIUS, BOMBCAP_FLASH_RADIUS)
if("SM Blast")
explosion(epicenter, 8, 16, 24, 32)
if("Custom Bomb")
var/devastation_range = tgui_input_number(usr, "Devastation range (in tiles):")
var/heavy_impact_range = tgui_input_number(usr, "Heavy impact range (in tiles):")
+1 -1
View File
@@ -445,7 +445,7 @@
var/turf/oldloc = loc
// Now lets move there!
if(!Move(landing))
if(!Move(landing, direct = dir)) //infinite fall fix
return 1
// Detect if we made a silent landing.
+1 -1
View File
@@ -26,7 +26,7 @@
for(var/obj/structure/cable/C in src.loc)
qdel(C)
. = ..()
for(var/datum/tgui_module/rcon/R in world)
for(var/datum/tgui_module/rcon/R in SStgui.all_uis)
R.FindDevices()
/obj/machinery/power/breakerbox/Initialize(mapload)
+9 -2
View File
@@ -281,6 +281,7 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
//handles merging diagonally matching cables
//for info : direction^3 is flipping horizontally, direction^12 is flipping vertically
/obj/structure/cable/proc/mergeDiagonalsNetworks(var/direction)
if(SSmachines.powernet_is_defered()) return;
//search for and merge diagonally matching cables from the first direction component (north/south)
var/turf/T = get_step(src, direction&3)//go north/south
@@ -325,6 +326,7 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
// merge with the powernets of power objects in the given direction
/obj/structure/cable/proc/mergeConnectedNetworks(var/direction)
if(SSmachines.powernet_is_defered()) return;
var/fdir = direction ? GLOB.reverse_dir[direction] : 0 //flip the direction, to match with the source position on its turf
@@ -353,6 +355,8 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
// merge with the powernets of power objects in the source turf
/obj/structure/cable/proc/mergeConnectedNetworksOnTurf()
if(SSmachines.powernet_is_defered()) return;
var/list/to_connect = list()
if(!powernet) //if we somehow have no powernet, make one (should not happen for cables)
@@ -441,6 +445,8 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
//should be called after placing a cable which extends another cable, creating a "smooth" cable that no longer terminates in the centre of a turf.
//needed as this can, unlike other placements, disconnect cables
/obj/structure/cable/proc/denode()
if(SSmachines.powernet_is_defered()) return;
var/turf/T1 = loc
if(!T1) return
@@ -476,8 +482,9 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
loc = null
powernet.remove_cable(src) //remove the cut cable from its powernet
var/datum/powernet/newPN = new()// creates a new powernet...
propagate_network(P_list[1], newPN)//... and propagates it to the other side of the cable
if(!SSmachines.powernet_is_defered()) // Deferring until rebuild
var/datum/powernet/newPN = new()// creates a new powernet...
propagate_network(P_list[1], newPN)//... and propagates it to the other side of the cable
// Disconnect machines connected to nodes
if(d1 == 0) // if we cut a node (O-X) cable
+2 -1
View File
@@ -74,10 +74,11 @@
anchored = !anchored
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(anchored)
connect_to_network()
to_chat(user, span_blue("You secure the generator to the floor."))
else
disconnect_from_network()
to_chat(user, span_blue("You unsecure the generator from the floor."))
SSmachines.makepowernets()
else if(O.has_tool_quality(TOOL_SCREWDRIVER))
open = !open
playsound(src, O.usesound, 50, 1)
+2
View File
@@ -66,6 +66,8 @@
// connect the machine to a powernet if a node cable is present on the turf
/obj/machinery/power/proc/connect_to_network()
if(SSmachines.powernet_is_defered()) return 0;
var/turf/T = src.loc
if(!T || !istype(T))
return 0
@@ -276,7 +276,7 @@
explode()
return ..()
/obj/structure/reagent_dispensers/fueltank/Move()
/obj/structure/reagent_dispensers/fueltank/Move(atom/newloc, direct, movetime)
if (..() && modded)
leak_fuel(amount_per_transfer_from_this/10.0)
@@ -24,10 +24,6 @@
sleep(25)
/datum/effect/effect/system/grav_pull/proc/do_pull()
//following is adapted from supermatter and singulo code
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1
// Let's just make this one loop.
for(var/X in orange(pull_radius, location))
// Movable atoms only
@@ -58,6 +54,3 @@
step_towards(X, location) // Step twice
step_towards(X, location)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0