mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits. - Shuttles no longer require a separate area for each location they jump to. Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle. This means that more than one shuttle could use the same docking port (not at the same time of course). - Enhanced shuttle control computers to use nanoui if they didn't. - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes. - Allows the possibility of shuttles (or destinations) that start on late-loaded maps. - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests This all required a bit of infrastructure improvements. - ChangeArea proc, for changing the area of a turf. - Fixed lighting overlays actually being able to be destroyed. - Added a few utility macros and procs. - Added "turf translation" procs which are like move_contents_to but more flexible.
154 lines
3.9 KiB
Plaintext
154 lines
3.9 KiB
Plaintext
//Zlevel where overmap objects should be
|
|
#define OVERMAP_ZLEVEL 1
|
|
//How far from the edge of overmap zlevel could randomly placed objects spawn
|
|
#define OVERMAP_EDGE 7
|
|
|
|
|
|
|
|
//Dimension of overmap (squares 4 lyfe)
|
|
var/global/list/map_sectors = list()
|
|
|
|
/area/overmap/
|
|
name = "System Map"
|
|
icon_state = "start"
|
|
requires_power = 0
|
|
base_turf = /turf/unsimulated/map
|
|
|
|
/turf/unsimulated/map
|
|
icon = 'icons/turf/space.dmi'
|
|
icon_state = "map"
|
|
|
|
/turf/unsimulated/map/edge
|
|
opacity = 1
|
|
density = 1
|
|
|
|
/turf/unsimulated/map/New()
|
|
..()
|
|
name = "[x]-[y]"
|
|
var/list/numbers = list()
|
|
|
|
if(x == 1 || x == global.using_map.overmap_size)
|
|
numbers += list("[round(y/10)]","[round(y%10)]")
|
|
if(y == 1 || y == global.using_map.overmap_size)
|
|
numbers += "-"
|
|
if(y == 1 || y == global.using_map.overmap_size)
|
|
numbers += list("[round(x/10)]","[round(x%10)]")
|
|
|
|
for(var/i = 1 to numbers.len)
|
|
var/image/I = image('icons/effects/numbers.dmi',numbers[i])
|
|
I.pixel_x = 5*i - 2
|
|
I.pixel_y = world.icon_size/2 - 3
|
|
if(y == 1)
|
|
I.pixel_y = 3
|
|
I.pixel_x = 5*i + 4
|
|
if(y == global.using_map.overmap_size)
|
|
I.pixel_y = world.icon_size - 9
|
|
I.pixel_x = 5*i + 4
|
|
if(x == 1)
|
|
I.pixel_x = 5*i - 2
|
|
if(x == global.using_map.overmap_size)
|
|
I.pixel_x = 5*i + 2
|
|
overlays += I
|
|
|
|
|
|
|
|
|
|
|
|
//list used to track which zlevels are being 'moved' by the proc below
|
|
var/list/moving_levels = list()
|
|
//Proc to 'move' stars in spess
|
|
//yes it looks ugly, but it should only fire when state actually change.
|
|
//null direction stops movement
|
|
proc/toggle_move_stars(zlevel, direction)
|
|
if(!zlevel)
|
|
return
|
|
|
|
var/gen_dir = null
|
|
if(direction & (NORTH|SOUTH))
|
|
gen_dir += "ns"
|
|
else if(direction & (EAST|WEST))
|
|
gen_dir += "ew"
|
|
if(!direction)
|
|
gen_dir = null
|
|
|
|
if (moving_levels["zlevel"] != gen_dir)
|
|
moving_levels["zlevel"] = gen_dir
|
|
for(var/x = 1 to world.maxx)
|
|
for(var/y = 1 to world.maxy)
|
|
var/turf/space/T = locate(x,y,zlevel)
|
|
if (istype(T))
|
|
if(!gen_dir)
|
|
T.icon_state = "[((T.x + T.y) ^ ~(T.x * T.y) + T.z) % 25]"
|
|
else
|
|
T.icon_state = "speedspace_[gen_dir]_[rand(1,15)]"
|
|
for(var/atom/movable/AM in T)
|
|
if (!AM.anchored)
|
|
AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1)
|
|
|
|
|
|
/*
|
|
//list used to cache empty zlevels to avoid nedless map bloat
|
|
var/list/cached_space = list()
|
|
|
|
proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A)
|
|
var/obj/effect/map/M = map_sectors["[T.z]"]
|
|
if (!M)
|
|
return
|
|
var/mapx = M.x
|
|
var/mapy = M.y
|
|
var/nx = 1
|
|
var/ny = 1
|
|
var/nz = M.map_z
|
|
|
|
if(T.x <= TRANSITIONEDGE)
|
|
nx = world.maxx - TRANSITIONEDGE - 2
|
|
ny = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
|
|
mapx = max(1, mapx-1)
|
|
|
|
else if (A.x >= (world.maxx - TRANSITIONEDGE - 1))
|
|
nx = TRANSITIONEDGE + 2
|
|
ny = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
|
|
mapx = min(world.maxx, mapx+1)
|
|
|
|
else if (T.y <= TRANSITIONEDGE)
|
|
ny = world.maxy - TRANSITIONEDGE -2
|
|
nx = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
|
|
mapy = max(1, mapy-1)
|
|
|
|
else if (A.y >= (world.maxy - TRANSITIONEDGE - 1))
|
|
ny = TRANSITIONEDGE + 2
|
|
nx = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
|
|
mapy = min(world.maxy, mapy+1)
|
|
|
|
testing("[A] moving from [M] ([M.x], [M.y]) to ([mapx],[mapy]).")
|
|
|
|
var/turf/map = locate(mapx,mapy,OVERMAP_ZLEVEL)
|
|
var/obj/effect/map/TM = locate() in map
|
|
if(TM)
|
|
nz = TM.map_z
|
|
testing("Destination: [TM]")
|
|
else
|
|
if(cached_space.len)
|
|
var/obj/effect/map/sector/temporary/cache = cached_space[cached_space.len]
|
|
cached_space -= cache
|
|
nz = cache.map_z
|
|
cache.x = mapx
|
|
cache.y = mapy
|
|
testing("Destination: *cached* [TM]")
|
|
else
|
|
world.maxz++
|
|
nz = world.maxz
|
|
TM = new /obj/effect/map/sector/temporary(mapx, mapy, nz)
|
|
testing("Destination: *new* [TM]")
|
|
|
|
var/turf/dest = locate(nx,ny,nz)
|
|
if(dest)
|
|
A.loc = dest
|
|
|
|
if(istype(M, /obj/effect/map/sector/temporary))
|
|
var/obj/effect/map/sector/temporary/source = M
|
|
if (source.can_die())
|
|
testing("Catching [M] for future use")
|
|
source.loc = null
|
|
cached_space += source
|
|
*/ |