Port missing PR - [MIRROR]SSmachines optimizations (#5403)

* Update Fire.dm

* Update machines.dm

* Update fuel.dm
This commit is contained in:
Razgriz
2022-12-15 21:49:31 -07:00
committed by GitHub
parent 2cbe1726a1
commit 120047e124
3 changed files with 27 additions and 25 deletions

View File

@@ -170,7 +170,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
continue
//Spread the fire.
if(prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && my_tile.CanPass(src, enemy_tile, 0,0) && enemy_tile.CanPass(src, my_tile, 0,0))
if(prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && my_tile.CanPass(src, enemy_tile) && enemy_tile.CanPass(src, my_tile))
enemy_tile.create_fire(firelevel)
else

View File

@@ -6,9 +6,6 @@
//
// SSmachines subsystem - Processing machines, pipenets, and powernets!
//
// Implementation Plan:
// PHASE 1 - Add subsystem using the existing global list vars
// PHASE 2 - Move the global list vars into the subsystem.
SUBSYSTEM_DEF(machines)
name = "Machines"
@@ -24,12 +21,6 @@ SUBSYSTEM_DEF(machines)
var/cost_powernets = 0
var/cost_power_objects = 0
// TODO - PHASE 2 - Switch these from globals to instance vars
// var/list/pipenets = list()
// var/list/machinery = list()
// var/list/powernets = list()
// var/list/power_objects = list()
var/list/current_run = list()
/datum/controller/subsystem/machines/Initialize(timeofday)
@@ -51,28 +42,31 @@ SUBSYSTEM_DEF(machines)
// The above is a lie. Turbolifts also call this proc.
/datum/controller/subsystem/machines/proc/makepowernets()
// TODO - check to not run while in the middle of a tick!
for(var/datum/powernet/PN in powernets)
for(var/datum/powernet/PN as anything in powernets)
qdel(PN)
powernets.Cut()
setup_powernets_for_cables(cable_list)
/datum/controller/subsystem/machines/proc/setup_powernets_for_cables(list/cables)
for(var/obj/structure/cable/PC in cables)
for(var/obj/structure/cable/PC as anything in cables)
if(!PC.powernet)
var/datum/powernet/NewPN = new()
NewPN.add_cable(PC)
propagate_network(PC,PC.powernet)
/datum/controller/subsystem/machines/proc/setup_atmos_machinery(list/atmos_machines)
var/list/actual_atmos_machines = list()
for(var/obj/machinery/atmospherics/machine in atmos_machines)
machine.atmos_init()
actual_atmos_machines += machine
CHECK_TICK
for(var/obj/machinery/atmospherics/machine in atmos_machines)
for(var/obj/machinery/atmospherics/machine as anything in actual_atmos_machines)
machine.build_network()
CHECK_TICK
for(var/obj/machinery/atmospherics/unary/U in atmos_machines)
for(var/obj/machinery/atmospherics/unary/U as anything in actual_atmos_machines)
if(istype(U, /obj/machinery/atmospherics/unary/vent_pump))
var/obj/machinery/atmospherics/unary/vent_pump/T = U
T.broadcast_status()
@@ -163,16 +157,24 @@ SUBSYSTEM_DEF(machines)
return
/datum/controller/subsystem/machines/Recover()
// TODO - PHASE 2
// if (istype(SSmachines.pipenets))
// pipenets = SSmachines.pipenets
// if (istype(SSmachines.machinery))
// machinery = SSmachines.machinery
// if (istype(SSmachines.powernets))
// powernets = SSmachines.powernets
// if (istype(SSmachines.power_objects))
// power_objects = SSmachines.power_objects
for(var/datum/D as anything in global.pipe_networks)
if(!istype(D, /datum/pipe_network))
error("Found wrong type during SSmachinery recovery: list=global.pipe_networks, item=[D], type=[D?.type]")
global.pipe_networks -= D
for(var/datum/D as anything in global.processing_machines)
if(!istype(D, /obj/machinery))
error("Found wrong type during SSmachinery recovery: list=global.processing_machines, item=[D], type=[D?.type]")
global.processing_machines -= D
for(var/datum/D as anything in global.powernets)
if(!istype(D, /datum/powernet))
error("Found wrong type during SSmachinery recovery: list=global.powernets, item=[D], type=[D?.type]")
global.powernets -= D
for(var/datum/D as anything in global.processing_power_items)
if(!istype(D, /obj/item))
error("Found wrong type during SSmachinery recovery: list=global.processing_power_items, item=[D], type=[D?.type]")
global.processing_power_items -= D
#undef SSMACHINES_PIPENETS
#undef SSMACHINES_MACHINERY
#undef SSMACHINES_POWERNETS
#undef SSMACHINES_POWER_OBJECTS

View File

@@ -38,7 +38,7 @@
for(var/d in cardinal)
var/turf/simulated/target = get_step(src,d)
var/turf/simulated/origin = get_turf(src)
if(origin.CanPass(src, target, 0, 0) && target.CanPass(src, origin, 0, 0))
if(origin.CanPass(src, target) && target.CanPass(src, origin))
var/obj/effect/decal/cleanable/liquid_fuel/other_fuel = locate() in target
if(other_fuel)
other_fuel.amount += amount*0.25
@@ -73,7 +73,7 @@
var/turf/simulated/O = get_step(S,d)
if(locate(/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel) in O)
continue
if(O.CanPass(null, S, 0, 0) && S.CanPass(null, O, 0, 0))
if(O.CanPass(src, S) && S.CanPass(src, O))
var/new_pool_amount = amount * 0.25
if(new_pool_amount > 0.1)
var/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel/F = new(O, new_pool_amount, d)