Added handling for space travel/stragglers.

Now new empty space levels are created if needed.
Added config option to use overmap system, ticked files in.

Conflicts:
	code/setup.dm
This commit is contained in:
Chinsky
2014-07-15 16:01:04 +04:00
parent 68fc5d91c6
commit c7257c1bf2
7 changed files with 104 additions and 11 deletions

View File

@@ -88,12 +88,6 @@ Sector should appear on overmap (in random place if you didn't set mapx,mapy)
TODO:
more mechanics to moving ship:
actually working engine objects
unary atmospheric machinery
give more thrust the more pressure gas has
ships have mass var, which is used to caalculate how much acceleration those engines give
better space travel / stragglers handling
shuttle console:
checking occupied pad or not with docking controllers
?landing pad size detection

View File

@@ -32,4 +32,52 @@ proc/toggle_move_stars(zlevel, direction)
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)
AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1)
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
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

View File

@@ -5,7 +5,8 @@
var/global/list/map_sectors = list()
/hook/startup/proc/build_map()
accessable_z_levels = list() //no space travel with this system, at least not like this
if(!config.use_overmap)
return 1
testing("Building overmap...")
var/obj/effect/mapinfo/data
for(var/level in 1 to world.maxz)
@@ -93,3 +94,34 @@ var/global/list/map_sectors = list()
name = "generic sector"
desc = "Sector with some stuff in it."
anchored = 1
//Space stragglers go here
/obj/effect/map/sector/temporary
name = "Deep Space"
icon_state = ""
always_known = 0
/obj/effect/map/sector/temporary/New(var/nx, var/ny, var/nz)
loc = locate(nx, ny, OVERMAP_ZLEVEL)
map_z = nz
map_sectors["[map_z]"] = src
testing("Temporary sector at [x],[y] was created, corresponding zlevel is [map_z].")
/obj/effect/map/sector/temporary/Del()
map_sectors["[map_z]"] = null
testing("Temporary sector at [x],[y] was deleted.")
if (can_die())
testing("Associated zlevel disappeared.")
world.maxz--
/obj/effect/map/sector/temporary/proc/can_die(var/mob/observer)
testing("Checking if sector at [map_z] can die.")
if(src.map_z < world.maxz) //can't specify which zlevel to remove
testing("It is not last sector in the stack.")
return 0
for(var/mob/M in player_list)
if(M != observer && M.z == map_z)
testing("There are people on it.")
return 0
return 1