From c7257c1bf2fdd6c0a6577a972dd5fc056a37a89c Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 15 Jul 2014 16:01:04 +0400 Subject: [PATCH 1/3] 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 --- baystation12.dme | 9 ++++ code/WorkInProgress/Chinsky/overmap/README.dm | 6 --- .../Chinsky/overmap/_defines.dm | 50 ++++++++++++++++++- .../WorkInProgress/Chinsky/overmap/sectors.dm | 34 ++++++++++++- code/controllers/configuration.dm | 4 ++ code/game/turfs/space/space.dm | 7 ++- config/example/config.txt | 5 +- 7 files changed, 104 insertions(+), 11 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 4851c962cb..b528c9cf2f 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1400,6 +1400,15 @@ #include "code\WorkInProgress\Cael_Aislinn\Supermatter\ZeroPointLaser.dm" #include "code\WorkInProgress\Chinsky\ashtray.dm" #include "code\WorkInProgress\Chinsky\guestpass.dm" +#include "code\WorkInProgress\Chinsky\overmap\_defines.dm" +#include "code\WorkInProgress\Chinsky\overmap\README.dm" +#include "code\WorkInProgress\Chinsky\overmap\sectors.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\ship.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\computers\engine_control.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\computers\helm.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\computers\shuttle.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\engines\engine.dm" +#include "code\WorkInProgress\Chinsky\overmap\ships\engines\thermal.dm" #include "code\WorkInProgress\Cib\MedicalSideEffects.dm" #include "code\WorkInProgress\computer3\bios.dm" #include "code\WorkInProgress\computer3\buildandrepair.dm" diff --git a/code/WorkInProgress/Chinsky/overmap/README.dm b/code/WorkInProgress/Chinsky/overmap/README.dm index d11ea1fdee..14a7a955a5 100644 --- a/code/WorkInProgress/Chinsky/overmap/README.dm +++ b/code/WorkInProgress/Chinsky/overmap/README.dm @@ -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 diff --git a/code/WorkInProgress/Chinsky/overmap/_defines.dm b/code/WorkInProgress/Chinsky/overmap/_defines.dm index dfc0881ed5..55326b8da1 100644 --- a/code/WorkInProgress/Chinsky/overmap/_defines.dm +++ b/code/WorkInProgress/Chinsky/overmap/_defines.dm @@ -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) \ No newline at end of file + 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 \ No newline at end of file diff --git a/code/WorkInProgress/Chinsky/overmap/sectors.dm b/code/WorkInProgress/Chinsky/overmap/sectors.dm index 9e1635a960..410b418427 100644 --- a/code/WorkInProgress/Chinsky/overmap/sectors.dm +++ b/code/WorkInProgress/Chinsky/overmap/sectors.dm @@ -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 diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 66747abbb5..f85391b767 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -147,6 +147,7 @@ var/admin_irc = "" var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge. + var/use_overmap = 0 /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode @@ -502,6 +503,9 @@ if("max_maint_drones") config.max_maint_drones = text2num(value) + if("use_overmap") + config.use_overmap = 1 + else log_misc("Unknown setting in configuration: '[name]'") diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index d99dc06677..87ee17b963 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -71,9 +71,10 @@ if(ticker && ticker.mode) + // Okay, so let's make it so that people can travel z levels but not nuke disks! // if(ticker.mode.name == "nuclear emergency") return - if(A.z > 6) return + if(A.z > 6 && !config.use_overmap) return if (A.x <= TRANSITIONEDGE || A.x >= (world.maxx - TRANSITIONEDGE - 1) || A.y <= TRANSITIONEDGE || A.y >= (world.maxy - TRANSITIONEDGE - 1)) if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust)) del(A) @@ -82,7 +83,9 @@ if(istype(A, /obj/item/weapon/disk/nuclear)) // Don't let nuke disks travel Z levels ... And moving this shit down here so it only fires when they're actually trying to change z-level. del(A) //The disk's Del() proc ensures a new one is created return - + if(config.use_overmap) + overmap_spacetravel(src,A) + return var/list/disk_search = A.search_contents_for(/obj/item/weapon/disk/nuclear) if(!isemptylist(disk_search)) if(istype(A, /mob/living)) diff --git a/config/example/config.txt b/config/example/config.txt index fa8613e21d..faeebb79bc 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -256,4 +256,7 @@ USEALIENWHITELIST ALLOW_CULT_GHOSTWRITER ## Sets the minimum number of cultists needed for ghosts to write in blood. -REQ_CULT_GHOSTWRITER 6 +REQ_CULT_GHOSTWRITER 6 + +## Uncomment to use overmap system for zlevel travel +#USE_OVERMAP From 11f87c849b6f300a5b90cba8c8f8713af02c2072 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 15 Jul 2014 16:32:49 +0400 Subject: [PATCH 2/3] Added caching of zlevels. Currently only condition to cache them is lack of client mobs there. --- .../Chinsky/overmap/_defines.dm | 28 +++++++++++++++---- .../WorkInProgress/Chinsky/overmap/sectors.dm | 3 -- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/code/WorkInProgress/Chinsky/overmap/_defines.dm b/code/WorkInProgress/Chinsky/overmap/_defines.dm index 55326b8da1..c81cbb1ae6 100644 --- a/code/WorkInProgress/Chinsky/overmap/_defines.dm +++ b/code/WorkInProgress/Chinsky/overmap/_defines.dm @@ -35,6 +35,9 @@ proc/toggle_move_stars(zlevel, direction) 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) @@ -73,11 +76,26 @@ proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A) 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]") + 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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/code/WorkInProgress/Chinsky/overmap/sectors.dm b/code/WorkInProgress/Chinsky/overmap/sectors.dm index 410b418427..7f0b8548c9 100644 --- a/code/WorkInProgress/Chinsky/overmap/sectors.dm +++ b/code/WorkInProgress/Chinsky/overmap/sectors.dm @@ -117,9 +117,6 @@ var/global/list/map_sectors = list() /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.") From d86d330130b4e3b3e2795496510253ae6cd1f717 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 19 Aug 2014 19:07:17 +0400 Subject: [PATCH 3/3] Updated templates for nanoUI changes. --- nano/templates/engines_control.tmpl | 4 ++-- nano/templates/helm.tmpl | 3 +-- nano/templates/shuttle_control_console_exploration.tmpl | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/nano/templates/engines_control.tmpl b/nano/templates/engines_control.tmpl index 2e4816a3ac..726edf27ac 100644 --- a/nano/templates/engines_control.tmpl +++ b/nano/templates/engines_control.tmpl @@ -1,6 +1,6 @@
- {{:helper.link('Overall status', 'note', {'state' :'status'}, null, state == 'status' ? 'selected' : null)}} - {{:helper.link('Details', 'note', {'state' : 'engines'}, null, state == 'engines' ? 'selected' : null)}} + {{:helper.link('Overall status', 'note', {'state' :'status'}, null, data.state == 'status' ? 'selected' : null)}} + {{:helper.link('Details', 'note', {'state' : 'engines'}, null, data.state == 'engines' ? 'selected' : null)}}
{{if data.state == "engines"}} diff --git a/nano/templates/helm.tmpl b/nano/templates/helm.tmpl index 9fcee26fb2..c72d0921b8 100644 --- a/nano/templates/helm.tmpl +++ b/nano/templates/helm.tmpl @@ -6,8 +6,7 @@
Coordinates: {{:data.s_x}} : {{:data.s_y}}
- Additional information: {{:data.s_x}} : {{:data.s_y}} - {{:data.sector_info}} + Additional information: {{:data.sector_info}} diff --git a/nano/templates/shuttle_control_console_exploration.tmpl b/nano/templates/shuttle_control_console_exploration.tmpl index 0b1671c8c5..b220a44fda 100644 --- a/nano/templates/shuttle_control_console_exploration.tmpl +++ b/nano/templates/shuttle_control_console_exploration.tmpl @@ -58,16 +58,16 @@ {{:data.destination_name}}
- {{:data.~link('Choose Destination', 'arrowreturn-1-s', {'pick' : '1'}, data.can_pick ? null : 'disabled' , null)}} + {{:helper.link('Choose Destination', 'arrowreturn-1-s', {'pick' : '1'}, data.can_pick ? null : 'disabled' , null)}}

Shuttle Control

- {{:data.~link('Launch Shuttle', 'arrowthickstop-1-e', {'move' : '1'}, data.can_launch ? null : 'disabled' , null)}} - {{:data.~link('Cancel Launch', 'cancel', {'cancel' : '1'}, data.can_cancel ? null : 'disabled' , null)}} - {{:data.~link('Force Launch', 'alert', {'force' : '1'}, data.can_force ? null : 'disabled' , data.can_force ? 'redBackground' : null)}} + {{:helper.link('Launch Shuttle', 'arrowthickstop-1-e', {'move' : '1'}, data.can_launch ? null : 'disabled' , null)}} + {{:helper.link('Cancel Launch', 'cancel', {'cancel' : '1'}, data.can_cancel ? null : 'disabled' , null)}} + {{:helper.link('Force Launch', 'alert', {'force' : '1'}, data.can_force ? null : 'disabled' , data.can_force ? 'redBackground' : null)}}
\ No newline at end of file