Files
Bubberstation/code/game/objects/effects/spawners/structure.dm
SkyratBot b8d9874c27 [MIRROR] Converts all A && A.B into A?.B (#1292)
* Converts A && A.B into A?.B (#54342)

Implements the ?. operator, replacing code like A && A.B with A?.B

BYOND Ref:
When reading A?.B, it's equivalent to A && A.B except that A is only evaluated once, even if it's a complex expression like a proc call.

* Converts all A && A.B into A?.B

Co-authored-by: ZeWaka <zewakagamer@gmail.com>
2020-10-13 23:19:25 +02:00

358 lines
17 KiB
Plaintext

/*
Because mapping is already tedious enough this spawner let you spawn generic
"sets" of objects rather than having to make the same object stack again and
again.
*/
/obj/effect/spawner/structure
name = "map structure spawner"
var/list/spawn_list
/obj/effect/spawner/structure/Initialize()
. = ..()
if(spawn_list?.len)
for(var/I in spawn_list)
new I(get_turf(src))
return INITIALIZE_HINT_QDEL
//normal windows
/obj/effect/spawner/structure/window
icon = 'icons/obj/structures_spawners.dmi'
icon_state = "window_spawner"
name = "window spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/fulltile)
dir = SOUTH
/obj/effect/spawner/structure/window/hollow
name = "hollow window spawner"
icon_state = "hwindow_spawner_full"
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/north, /obj/structure/window/spawner/east, /obj/structure/window/spawner/west)
/obj/effect/spawner/structure/window/hollow/end
icon_state = "hwindow_spawner_end"
/obj/effect/spawner/structure/window/hollow/end/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/north, /obj/structure/window/spawner/east, /obj/structure/window/spawner/west)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/north, /obj/structure/window/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/east, /obj/structure/window/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/north, /obj/structure/window/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/middle
icon_state = "hwindow_spawner_middle"
/obj/effect/spawner/structure/window/hollow/middle/Initialize()
switch(dir)
if(NORTH,SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/north)
if(EAST,WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/east, /obj/structure/window/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/directional
icon_state = "hwindow_spawner_directional"
/obj/effect/spawner/structure/window/hollow/directional/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/north)
if(NORTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/north, /obj/structure/window/spawner/east)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/east)
if(SOUTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window)
if(SOUTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window, /obj/structure/window/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/west)
if(NORTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/spawner/north, /obj/structure/window/spawner/west)
. = ..()
//reinforced
/obj/effect/spawner/structure/window/reinforced
name = "reinforced window spawner"
icon_state = "rwindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/fulltile)
/obj/effect/spawner/structure/window/hollow/reinforced
name = "hollow reinforced window spawner"
icon_state = "hrwindow_spawner_full"
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/east, /obj/structure/window/reinforced/spawner/west)
/obj/effect/spawner/structure/window/hollow/reinforced/end
icon_state = "hrwindow_spawner_end"
/obj/effect/spawner/structure/window/hollow/reinforced/end/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/east, /obj/structure/window/reinforced/spawner/west)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/east, /obj/structure/window/reinforced/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/reinforced/middle
icon_state = "hrwindow_spawner_middle"
/obj/effect/spawner/structure/window/hollow/reinforced/middle/Initialize()
switch(dir)
if(NORTH,SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/north)
if(EAST,WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/east, /obj/structure/window/reinforced/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/reinforced/directional
icon_state = "hrwindow_spawner_directional"
/obj/effect/spawner/structure/window/hollow/reinforced/directional/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/north)
if(NORTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/east)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/east)
if(SOUTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced)
if(SOUTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced, /obj/structure/window/reinforced/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/west)
if(NORTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/spawner/north, /obj/structure/window/reinforced/spawner/west)
. = ..()
//tinted
/obj/effect/spawner/structure/window/reinforced/tinted
name = "tinted reinforced window spawner"
icon_state = "twindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/tinted/fulltile)
//shuttle window
/obj/effect/spawner/structure/window/shuttle
name = "shuttle window spawner"
icon_state = "swindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle)
//plastitanium window
/obj/effect/spawner/structure/window/plasma/reinforced/plastitanium
name = "plastitanium window spawner"
icon_state = "plastitaniumwindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/plastitanium)
//ice window
/obj/effect/spawner/structure/window/ice
name = "ice window spawner"
icon_state = "icewindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/fulltile/ice)
//survival pod window
/obj/effect/spawner/structure/window/survival_pod
name = "pod window spawner"
icon_state = "podwindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/reinforced/survival_pod)
/obj/effect/spawner/structure/window/hollow/survival_pod
name = "hollow pod window spawner"
icon_state = "podwindow_spawner_full"
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/east, /obj/structure/window/shuttle/survival_pod/spawner/west)
/obj/effect/spawner/structure/window/hollow/survival_pod/end
icon_state = "podwindow_spawner_end"
/obj/effect/spawner/structure/window/hollow/survival_pod/end/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/east, /obj/structure/window/shuttle/survival_pod/spawner/west)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/east, /obj/structure/window/shuttle/survival_pod/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/survival_pod/middle
icon_state = "podwindow_spawner_middle"
/obj/effect/spawner/structure/window/hollow/survival_pod/middle/Initialize()
switch(dir)
if(NORTH,SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/north)
if(EAST,WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/east, /obj/structure/window/shuttle/survival_pod/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/survival_pod/directional
icon_state = "podwindow_spawner_directional"
/obj/effect/spawner/structure/window/hollow/survival_pod/directional/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/north)
if(NORTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/east)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/east)
if(SOUTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod)
if(SOUTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod, /obj/structure/window/shuttle/survival_pod/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/west)
if(NORTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/shuttle/survival_pod/spawner/north, /obj/structure/window/shuttle/survival_pod/spawner/west)
. = ..()
//plasma windows
/obj/effect/spawner/structure/window/plasma
name = "plasma window spawner"
icon_state = "pwindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/fulltile)
/obj/effect/spawner/structure/window/hollow/plasma
name = "hollow plasma window spawner"
icon_state = "phwindow_spawner_full"
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/east, /obj/structure/window/plasma/spawner/west)
/obj/effect/spawner/structure/window/hollow/plasma/end
icon_state = "phwindow_spawner_end"
/obj/effect/spawner/structure/window/hollow/plasma/end/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/east, /obj/structure/window/plasma/spawner/west)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/east, /obj/structure/window/plasma/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/plasma/middle
icon_state = "phwindow_spawner_middle"
/obj/effect/spawner/structure/window/hollow/plasma/middle/Initialize()
switch(dir)
if(NORTH,SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/north)
if(EAST,WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/east, /obj/structure/window/plasma/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/plasma/directional
icon_state = "phwindow_spawner_directional"
/obj/effect/spawner/structure/window/hollow/plasma/directional/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/north)
if(NORTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/east)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/east)
if(SOUTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma)
if(SOUTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma, /obj/structure/window/plasma/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/west)
if(NORTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/spawner/north, /obj/structure/window/plasma/spawner/west)
. = ..()
//plasma reinforced
/obj/effect/spawner/structure/window/plasma/reinforced
name = "reinforced plasma window spawner"
icon_state = "prwindow_spawner"
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/fulltile)
/obj/effect/spawner/structure/window/hollow/plasma/reinforced
name = "hollow reinforced plasma window spawner"
icon_state = "phrwindow_spawner_full"
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/east, /obj/structure/window/plasma/reinforced/spawner/west)
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/end
icon_state = "phrwindow_spawner_end"
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/end/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/east, /obj/structure/window/plasma/reinforced/spawner/west)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/east, /obj/structure/window/plasma/reinforced/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/middle
icon_state = "phrwindow_spawner_middle"
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/middle/Initialize()
switch(dir)
if(NORTH,SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/north)
if(EAST,WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/east, /obj/structure/window/plasma/reinforced/spawner/west)
. = ..()
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/directional
icon_state = "phrwindow_spawner_directional"
/obj/effect/spawner/structure/window/hollow/plasma/reinforced/directional/Initialize()
switch(dir)
if(NORTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/north)
if(NORTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/east)
if(EAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/east)
if(SOUTHEAST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/east)
if(SOUTH)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced)
if(SOUTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced, /obj/structure/window/plasma/reinforced/spawner/west)
if(WEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/west)
if(NORTHWEST)
spawn_list = list(/obj/structure/grille, /obj/structure/window/plasma/reinforced/spawner/north, /obj/structure/window/plasma/reinforced/spawner/west)
. = ..()