mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +01:00
[MODULAR] Adds an autospawn system to spawn stuff on top of other stuff, makes prison curtains use it (#19069)
Makes prison curtains autospawn
This commit is contained in:
@@ -99,3 +99,8 @@
|
||||
/datum/area_spawn/customs_agent_landmark
|
||||
desired_atom = /obj/effect/landmark/start/customs_agent
|
||||
target_areas = list(/area/station/security/checkpoint/supply, /area/station/cargo/storage)
|
||||
|
||||
/datum/area_spawn_over/prison_curtains
|
||||
desired_atom = /obj/structure/curtain/cloth/prison
|
||||
over_atoms = list(/obj/structure/window/reinforced/fulltile, /obj/machinery/door/airlock/security/glass, /obj/machinery/door/airlock/public/glass)
|
||||
target_areas = list(/area/station/security/prison/safe)
|
||||
|
||||
@@ -49,7 +49,14 @@ SUBSYSTEM_DEF(area_spawn)
|
||||
for(var/iterating_type in subtypesof(/datum/area_spawn))
|
||||
var/datum/area_spawn/iterating_area_spawn = new iterating_type
|
||||
iterating_area_spawn.try_spawn()
|
||||
qdel(iterating_area_spawn)
|
||||
clear_cache()
|
||||
|
||||
for(var/iterating_type in subtypesof(/datum/area_spawn_over))
|
||||
var/datum/area_spawn_over/iterating_area_spawn_over = new iterating_type
|
||||
iterating_area_spawn_over.try_spawn()
|
||||
qdel(iterating_area_spawn_over)
|
||||
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
/**
|
||||
@@ -301,6 +308,43 @@ SUBSYSTEM_DEF(area_spawn)
|
||||
|
||||
new final_desired_atom(candidate_turf)
|
||||
|
||||
/**
|
||||
* Spawns an atom on any turf that contains specific over atoms.
|
||||
*/
|
||||
/datum/area_spawn_over
|
||||
/// The target area types for us to search for the over_atoms.
|
||||
var/list/target_areas
|
||||
/// The list of atom types to spawn the desired atom over.
|
||||
var/list/over_atoms
|
||||
/// The atom type that we want to spawn
|
||||
var/desired_atom
|
||||
/// Map blacklist, this is used to determine what maps we should not spawn on.
|
||||
var/list/blacklisted_stations = list("Void Raptor", "Runtime Station", "MultiZ Debug")
|
||||
|
||||
/**
|
||||
* Spawn the atoms.
|
||||
*/
|
||||
/datum/area_spawn_over/proc/try_spawn()
|
||||
if(SSmapping.config.map_name in blacklisted_stations)
|
||||
return
|
||||
|
||||
for(var/area_type in target_areas)
|
||||
var/area/found_area = GLOB.areas_by_type[area_type]
|
||||
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/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"
|
||||
icon = 'modular_skyrat/modules/automapper/icons/area_test.dmi'
|
||||
|
||||
Reference in New Issue
Block a user