mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
- Ports the overmap, ships, sectors, and "landable" ships from baystation. - Ports necessary computers to control ships and overmap shuttles. - Shims missing machine and computer functionality pending future enhancements. - Includes required new sprites and sounds.
160 lines
4.4 KiB
Plaintext
160 lines
4.4 KiB
Plaintext
//How far from the edge of overmap zlevel could randomly placed objects spawn
|
|
#define OVERMAP_EDGE 2
|
|
|
|
#define SHIP_SIZE_TINY 1
|
|
#define SHIP_SIZE_SMALL 2
|
|
#define SHIP_SIZE_LARGE 3
|
|
|
|
//multipliers for max_speed to find 'slow' and 'fast' speeds for the ship
|
|
#define SHIP_SPEED_SLOW 1/(40 SECONDS)
|
|
#define SHIP_SPEED_FAST 3/(20 SECONDS)// 15 speed
|
|
|
|
#define OVERMAP_WEAKNESS_NONE 0
|
|
#define OVERMAP_WEAKNESS_FIRE 1
|
|
#define OVERMAP_WEAKNESS_EMP 2
|
|
#define OVERMAP_WEAKNESS_MINING 4
|
|
#define OVERMAP_WEAKNESS_EXPLOSIVE 8
|
|
|
|
//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"
|
|
initialized = FALSE // TODO - Fix unsimulated turf initialization so this override is not necessary!
|
|
|
|
/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
|
|
add_overlay(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
|
|
|
|
var/list/spaceturfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
|
for(var/turf/space/T in spaceturfs)
|
|
if(!gen_dir)
|
|
T.icon_state = initial(T.icon_state)
|
|
else
|
|
T.icon_state = "speedspace_[gen_dir]_[rand(1,15)]"
|
|
for(var/atom/movable/AM in T)
|
|
if (AM.simulated && !AM.anchored)
|
|
AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1)
|
|
CHECK_TICK
|
|
CHECK_TICK
|
|
/*
|
|
//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
|
|
*/ |