Skip to content

Commit

Permalink
Modular updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vinylspiders authored and Iajret committed Jan 19, 2024
1 parent e675c53 commit d2d618c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
39 changes: 21 additions & 18 deletions modular_nova/modules/automapper/code/area_spawn_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ SUBSYSTEM_DEF(area_spawn)
turf_list = area_turf_info["[mode]"] = list()

// Get highest priority items
for(var/turf/iterating_turf as anything in area.get_contained_turfs())
// Only retain turfs of the highest priority
var/priority = process_turf(iterating_turf, mode)
if(priority > 0)
LAZYADDASSOC(turf_list, "[priority]", list(iterating_turf))
for(var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists())
for(var/turf/iterating_turf as anything in zlevel_turfs)
// Only retain turfs of the highest priority
var/priority = process_turf(iterating_turf, mode)
if(priority > 0)
LAZYADDASSOC(turf_list, "[priority]", list(iterating_turf))

// Sort the priorities descending
return sortTim(turf_list, GLOBAL_PROC_REF(cmp_num_string_asc))
Expand Down Expand Up @@ -333,17 +334,18 @@ SUBSYSTEM_DEF(area_spawn)
if(!found_area)
continue

for(var/turf/candidate_turf as anything in found_area.get_contained_turfs())
// Don't spawn if there's already a desired_atom here.
if(is_type_on_turf(candidate_turf, desired_atom))
continue
for(var/list/zlevel_turfs as anything in found_area.get_zlevel_turf_lists())
for(var/turf/candidate_turf as anything in zlevel_turfs)
// Don't spawn if there's already a desired_atom here.
if(is_type_on_turf(candidate_turf, desired_atom))
continue

for(var/over_atom_type in over_atoms)
// Spawn on the first one we find in the turf and stop.
if(is_type_on_turf(candidate_turf, over_atom_type))
new desired_atom(candidate_turf)
// Break the over_atom_type loop.
break
for(var/over_atom_type in over_atoms)
// Spawn on the first one we find in the turf and stop.
if(is_type_on_turf(candidate_turf, over_atom_type))
new desired_atom(candidate_turf)
// Break the over_atom_type loop.
break

/obj/effect/turf_test
name = "PASS"
Expand All @@ -361,9 +363,10 @@ SUBSYSTEM_DEF(area_spawn)
set name = "Test Area Spawner"
set desc = "Show area spawner placement candidates as an overlay."

for(var/turf/area_turf as anything in area.get_contained_turfs())
for(var/obj/effect/turf_test/old_test in area_turf)
qdel(old_test)
for(var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists())
for(var/turf/area_turf as anything in zlevel_turfs)
for(var/obj/effect/turf_test/old_test in area_turf)
qdel(old_test)

SSarea_spawn.clear_cache()
for(var/mode in 0 to AREA_SPAWN_MODE_COUNT - 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,11 @@
apc_loop:
for(var/obj/machinery/power/apc/controller as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc))
var/area/apc_area = get_area(controller) // make sure that no "critical" APCs lose their power (SM, namely)
for(var/turf/turf as anything in apc_area.get_contained_turfs())
for(var/obj/machinery/depowered_machinery in turf)
if(depowered_machinery.critical_machine)
continue apc_loop
for(var/list/zlevel_turfs as anything in apc_area.get_zlevel_turf_lists())
for(var/turf/turf as anything in zlevel_turfs)
for(var/obj/machinery/depowered_machinery in turf)
if(depowered_machinery.critical_machine)
continue apc_loop

controller.cell?.charge = 0

Expand Down
9 changes: 5 additions & 4 deletions modular_nova/modules/decay_subsystem/code/decaySS.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ SUBSYSTEM_DEF(decay)
possible_areas += iterating_area

// Now add the turfs
for(var/turf/iterating_turf as anything in iterating_area.get_contained_turfs())
if(!(iterating_turf.flags_1 & CAN_BE_DIRTY_1))
continue
possible_turfs += iterating_turf
for(var/list/zlevel_turfs as anything in iterating_area.get_zlevel_turf_lists())
for(var/turf/iterating_turf as anything in zlevel_turfs)
if(!(iterating_turf.flags_1 & CAN_BE_DIRTY_1))
continue
possible_turfs += iterating_turf

if(!possible_turfs)
CRASH("SSDecay had no possible turfs to use!")
Expand Down
17 changes: 9 additions & 8 deletions modular_nova/modules/mold/code/mold_event.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@
if(!is_type_in_typecache(checked_area, possible_spawn_areas))
continue

for(var/turf/open/floor in checked_area.get_contained_turfs())
if(isopenspaceturf(floor))
continue
for(var/list/zlevel_turfs as anything in checked_area.get_zlevel_turf_lists())
for(var/turf/open/floor in zlevel_turfs)
if(isopenspaceturf(floor))
continue

if(!floor.Enter(test_resin))
continue
if(!floor.Enter(test_resin))
continue

if(locate(/turf/closed) in range(2, floor))
continue
if(locate(/turf/closed) in range(2, floor))
continue

turfs += floor
turfs += floor

qdel(test_resin)

Expand Down

0 comments on commit d2d618c

Please sign in to comment.