Merge pull request #17010 from S34NW/electrochromic_spawner_thingy

Passes ID var from window spawners to electrochromic windows
This commit is contained in:
Fox McCloud
2021-11-04 14:09:34 -04:00
committed by GitHub
2 changed files with 22 additions and 3 deletions
+8
View File
@@ -74,6 +74,14 @@
/obj/effect/spawner
name = "object spawner"
/**
* Used when we want to pass vars from a spawner to a spawned object
*
* a - The spawned object we want to pass a var to
*/
/obj/effect/spawner/proc/synchronize_variables(atom/a)
return
/obj/effect/list_container
name = "list container"
@@ -11,6 +11,7 @@
/obj/effect/spawner/window/Initialize(mapload)
. = ..()
var/turf/T = get_turf(src)
var/obj/structure/window/WI
for(var/obj/structure/grille/G in get_turf(src))
// Complain noisily
log_runtime(EXCEPTION("Extra grille on turf: ([T.x],[T.y],[T.z])"), src)
@@ -23,10 +24,11 @@
break
if(!cdir)
continue
var/obj/structure/window/WI = new window_to_spawn_regular(get_turf(src))
WI = new window_to_spawn_regular(get_turf(src))
WI.dir = cdir
else
new window_to_spawn_full(get_turf(src))
WI = new window_to_spawn_full(get_turf(src))
synchronize_variables(WI)
if(useGrille)
new /obj/structure/grille(get_turf(src))
@@ -34,7 +36,6 @@
air_update_turf(TRUE) //atmos can pass otherwise
return INITIALIZE_HINT_QDEL
/obj/effect/spawner/window/reinforced
name = "reinforced window spawner"
icon_state = "rwindow_spawner"
@@ -64,6 +65,16 @@
icon_state = "ewindow_spawner"
window_to_spawn_regular = /obj/structure/window/reinforced/polarized
window_to_spawn_full = /obj/structure/window/full/reinforced/polarized
/// Used to link electrochromic windows to buttons
var/id
/obj/effect/spawner/window/reinforced/polarized/synchronize_variables(atom/a)
if(useFull)
var/obj/structure/window/full/reinforced/polarized/p = a
p.id = id
else
var/obj/structure/window/reinforced/polarized/p = a
p.id = id
/obj/effect/spawner/window/shuttle
name = "shuttle window spawner"