mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-22 13:36:51 +01:00
adds/fixes mapping helpers for: windows, power lines (#3992)
* wacky * Wacky * pani * t * all that * fixes * coggers! * that * fix * regex * regex * okay * okay Co-authored-by: fake_vm_user <fake_vm_user>
This commit is contained in:
co-authored by
fake_vm_user <fake_vm_user>
parent
98e27bf172
commit
12fc0e8adf
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* our only job is to spawn something and then self-delete
|
||||
*/
|
||||
/atom/movable/spawner
|
||||
icon = 'icons/mapping/spawners/spawners.dmi'
|
||||
icon_state = ""
|
||||
layer = MID_LANDMARK_LAYER
|
||||
/// lateload?
|
||||
var/late = FALSE
|
||||
|
||||
/atom/movable/spawner/Initialize(mapload)
|
||||
SHOULD_CALL_PARENT(FALSE)
|
||||
flags |= INITIALIZED
|
||||
if(!late)
|
||||
Spawn() // we always spawn in Initialize(), because if anything we spawn has LateInitialize behavior, that'll be really bad, huh.
|
||||
// keep in mind though, anything requiring even regular Initialize() behavior will be trampled, so, spawners are only good for
|
||||
// simple things.
|
||||
return INITIALIZE_HINT_QDEL
|
||||
else
|
||||
// do not use late unless you absolutely know what you're doing
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/atom/movable/spawner/LateInitialize()
|
||||
Spawn()
|
||||
|
||||
/atom/movable/spawner/proc/Spawn()
|
||||
return
|
||||
|
||||
/**
|
||||
* simple spawner - spawn a typepath x times
|
||||
*/
|
||||
/atom/movable/spawner/simple
|
||||
var/path
|
||||
var/amount
|
||||
|
||||
/atom/movable/spawner/simple/Spawn()
|
||||
for(var/i in 1 to min(50, amount))
|
||||
new path(loc)
|
||||
|
||||
/**
|
||||
* multi spawner - spawn a typepath x times for paths in list
|
||||
* paths can be text as **byond params**, not json.
|
||||
*/
|
||||
/atom/movable/spawner/multi
|
||||
var/list/paths
|
||||
|
||||
/atom/movable/spawner/multi/Spawn()
|
||||
// check lists
|
||||
var/list/_paths = list()
|
||||
// if is text, params2list
|
||||
if(istext(paths))
|
||||
paths = params2list(paths)
|
||||
if(!islist(paths))
|
||||
return
|
||||
// manual verify
|
||||
for(var/path in paths)
|
||||
// first check amount
|
||||
if(!paths[path])
|
||||
paths[path] = 1
|
||||
else if(isnum(paths[path]))
|
||||
if(paths[path] <= 0)
|
||||
stack_trace("invalid amount [paths[path]] at multi spawner at [AREACOORD(src)]")
|
||||
continue
|
||||
else
|
||||
stack_trace("invalid amount [paths[path]] at multi spawner at [AREACOORD(src)]")
|
||||
// then type
|
||||
if(ispath(path))
|
||||
_paths[path] = paths[path]
|
||||
else if(istext(path))
|
||||
var/_path = text2path(path)
|
||||
if(!_path)
|
||||
stack_trace("invalid path [path] at multi spawner at [AREACOORD(src)]")
|
||||
_paths[_path] = paths[path]
|
||||
|
||||
else
|
||||
stack_trace("invalid path [path] at multi spawner at [AREACOORD(src)]")
|
||||
// spawn
|
||||
for(var/path in _paths)
|
||||
for(var/i in 1 to _paths[path])
|
||||
new path(loc)
|
||||
@@ -0,0 +1,71 @@
|
||||
/atom/movable/spawner/window
|
||||
icon = 'icons/mapping/spawners/windows.dmi'
|
||||
icon_state = "glass_grille_pane"
|
||||
late = TRUE
|
||||
|
||||
/// spawn full windows or panes on grille?
|
||||
var/full_window = FALSE
|
||||
/// spawn grille at all?
|
||||
var/spawn_grille = TRUE
|
||||
/// full window path
|
||||
var/window_full_path = /obj/structure/window/basic/full
|
||||
/// pane path
|
||||
var/window_pane_path = /obj/structure/window/basic
|
||||
/// found dirs
|
||||
var/found_dirs = NONE
|
||||
|
||||
/atom/movable/spawner/window/Initialize(mapload)
|
||||
if(!full_window)
|
||||
find_dirs()
|
||||
return ..()
|
||||
|
||||
/atom/movable/spawner/window/proc/find_dirs()
|
||||
for(var/d in GLOB.cardinal)
|
||||
var/atom/movable/spawner/window/WS = locate() in get_step(src, d)
|
||||
if(WS)
|
||||
found_dirs |= d
|
||||
|
||||
/atom/movable/spawner/window/Spawn()
|
||||
if(spawn_grille)
|
||||
new /obj/structure/grille(loc)
|
||||
if(!full_window)
|
||||
new window_full_path(loc)
|
||||
else
|
||||
// spawn in dirs not in found dirs
|
||||
var/obj/structure/window/W
|
||||
for(var/d in GLOB.cardinal)
|
||||
if(found_dirs & d)
|
||||
continue
|
||||
W = new window_pane_path(loc)
|
||||
W.setDir(d)
|
||||
|
||||
/atom/movable/spawner/window/full
|
||||
full_window = TRUE
|
||||
icon_state = "glass_grille_full"
|
||||
|
||||
/atom/movable/spawner/window/reinforced
|
||||
icon_state = "rglass_grille_pane"
|
||||
window_pane_path = /obj/structure/window/reinforced
|
||||
window_full_path = /obj/structure/window/reinforced/full
|
||||
|
||||
/atom/movable/spawner/window/reinforced/full
|
||||
icon_state = "rglass_grille_full"
|
||||
full_window = TRUE
|
||||
|
||||
/atom/movable/spawner/window/borosillicate
|
||||
icon_state = "phoron_grille_pane"
|
||||
window_pane_path = /obj/structure/window/phoronbasic
|
||||
window_full_path = /obj/structure/window/phoronbasic/full
|
||||
|
||||
/atom/movable/spawner/window/borosillicate/full
|
||||
icon_state = "phoron_grille_full"
|
||||
full_window = TRUE
|
||||
|
||||
/atom/movable/spawner/window/borosillicate/reinforced
|
||||
icon_state = "rphoron_grille_pane"
|
||||
window_pane_path = /obj/structure/window/phoronreinforced
|
||||
window_full_path = /obj/structure/window/phoronreinforced/full
|
||||
|
||||
/atom/movable/spawner/window/borosillicate/reinforced/full
|
||||
icon_state = "rphoron_grille_full"
|
||||
full_window = TRUE
|
||||
Reference in New Issue
Block a user