mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Adds an overmap helper to find what sector you're in
This commit is contained in:
@@ -103,7 +103,7 @@ SUBSYSTEM_DEF(shuttles)
|
|||||||
try_add_landmark_tag(shuttle_landmark_tag, O)
|
try_add_landmark_tag(shuttle_landmark_tag, O)
|
||||||
landmarks_still_needed -= shuttle_landmark_tag
|
landmarks_still_needed -= shuttle_landmark_tag
|
||||||
else if(istype(shuttle_landmark, /obj/effect/shuttle_landmark/automatic)) //These find their sector automatically
|
else if(istype(shuttle_landmark, /obj/effect/shuttle_landmark/automatic)) //These find their sector automatically
|
||||||
O = map_sectors["[shuttle_landmark.z]"]
|
O = get_overmap_sector(get_z(shuttle_landmark))
|
||||||
O ? O.add_landmark(shuttle_landmark, shuttle_landmark.shuttle_restricted) : (landmarks_awaiting_sector += shuttle_landmark)
|
O ? O.add_landmark(shuttle_landmark, shuttle_landmark.shuttle_restricted) : (landmarks_awaiting_sector += shuttle_landmark)
|
||||||
|
|
||||||
/datum/controller/subsystem/shuttles/proc/get_landmark(var/shuttle_landmark_tag)
|
/datum/controller/subsystem/shuttles/proc/get_landmark(var/shuttle_landmark_tag)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ SUBSYSTEM_DEF(skybox)
|
|||||||
res.overlays += base
|
res.overlays += base
|
||||||
|
|
||||||
if(global.using_map.use_overmap && settings.use_overmap_details)
|
if(global.using_map.use_overmap && settings.use_overmap_details)
|
||||||
var/obj/effect/overmap/visitable/O = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/O = get_overmap_sector(z)
|
||||||
if(istype(O))
|
if(istype(O))
|
||||||
var/image/overmap = image(settings.icon)
|
var/image/overmap = image(settings.icon)
|
||||||
overmap.overlays += O.generate_skybox()
|
overmap.overlays += O.generate_skybox()
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ var/const/enterloopsanity = 100
|
|||||||
|
|
||||||
/turf/proc/inertial_drift(atom/movable/A as mob|obj)
|
/turf/proc/inertial_drift(atom/movable/A as mob|obj)
|
||||||
if(!(A.last_move)) return
|
if(!(A.last_move)) return
|
||||||
if((istype(A, /mob/) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1)))
|
if((istype(A, /mob/) && src.x > 1 && src.x < (world.maxx) && src.y > 1 && src.y < (world.maxy)))
|
||||||
var/mob/M = A
|
var/mob/M = A
|
||||||
if(M.Process_Spacemove(1))
|
if(M.Process_Spacemove(1))
|
||||||
M.inertia_dir = 0
|
M.inertia_dir = 0
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
//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/Initialize()
|
|
||||||
. = ..()
|
|
||||||
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
|
|
||||||
|
|
||||||
if (moving_levels["[zlevel]"] != direction)
|
|
||||||
moving_levels["[zlevel]"] = direction
|
|
||||||
|
|
||||||
var/list/spaceturfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
|
||||||
for(var/turf/space/T in spaceturfs)
|
|
||||||
T.toggle_transit(direction)
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
5
code/modules/overmap/helpers.dm
Normal file
5
code/modules/overmap/helpers.dm
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/proc/get_overmap_sector(var/z)
|
||||||
|
if(using_map.use_overmap)
|
||||||
|
return map_sectors["[z]"]
|
||||||
|
else
|
||||||
|
return null
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#define waypoint_sector(waypoint) map_sectors["[waypoint.z]"]
|
#define waypoint_sector(waypoint) get_overmap_sector(get_z(waypoint))
|
||||||
|
|
||||||
/datum/shuttle/autodock/overmap
|
/datum/shuttle/autodock/overmap
|
||||||
warmup_time = 10
|
warmup_time = 10
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
/obj/machinery/computer/ship/proc/sync_linked()
|
/obj/machinery/computer/ship/proc/sync_linked()
|
||||||
var/obj/effect/overmap/visitable/ship/sector = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/ship/sector = get_overmap_sector(z)
|
||||||
if(!sector)
|
if(!sector)
|
||||||
return
|
return
|
||||||
return attempt_hook_up_recursive(sector)
|
return attempt_hook_up_recursive(sector)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
/obj/effect/shuttle_landmark/ship/Destroy()
|
/obj/effect/shuttle_landmark/ship/Destroy()
|
||||||
var/obj/effect/overmap/visitable/ship/landable/ship = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/ship/landable/ship = get_overmap_sector(z)
|
||||||
if(istype(ship) && ship.landmark == src)
|
if(istype(ship) && ship.landmark == src)
|
||||||
ship.landmark = null
|
ship.landmark = null
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
on_landing(from, into)
|
on_landing(from, into)
|
||||||
|
|
||||||
/obj/effect/overmap/visitable/ship/landable/proc/on_landing(obj/effect/shuttle_landmark/from, obj/effect/shuttle_landmark/into)
|
/obj/effect/overmap/visitable/ship/landable/proc/on_landing(obj/effect/shuttle_landmark/from, obj/effect/shuttle_landmark/into)
|
||||||
var/obj/effect/overmap/visitable/target = map_sectors["[into.z]"]
|
var/obj/effect/overmap/visitable/target = get_overmap_sector(get_z(into))
|
||||||
var/datum/shuttle/shuttle_datum = SSshuttles.shuttles[shuttle]
|
var/datum/shuttle/shuttle_datum = SSshuttles.shuttles[shuttle]
|
||||||
if(into.landmark_tag == shuttle_datum.motherdock) // If our motherdock is a landable ship, it won't be found properly here so we need to find it manually.
|
if(into.landmark_tag == shuttle_datum.motherdock) // If our motherdock is a landable ship, it won't be found properly here so we need to find it manually.
|
||||||
for(var/obj/effect/overmap/visitable/ship/landable/landable in SSshuttles.ships)
|
for(var/obj/effect/overmap/visitable/ship/landable/landable in SSshuttles.ships)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A)
|
|||||||
if (!T || !A)
|
if (!T || !A)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/obj/effect/overmap/visitable/M = map_sectors["[T.z]"]
|
var/obj/effect/overmap/visitable/M = get_overmap_sector(T.z)
|
||||||
if (!M)
|
if (!M)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Dimension of overmap (squares 4 lyfe)
|
//Dimension of overmap (squares 4 lyfe)
|
||||||
var/global/list/map_sectors = list()
|
var/global/list/map_sectors = list()
|
||||||
|
|
||||||
/area/overmap/
|
/area/overmap
|
||||||
name = "System Map"
|
name = "System Map"
|
||||||
icon_state = "start"
|
icon_state = "start"
|
||||||
requires_power = 0
|
requires_power = 0
|
||||||
|
|||||||
@@ -55,14 +55,14 @@
|
|||||||
if(!istype(docking_controller))
|
if(!istype(docking_controller))
|
||||||
log_error("Could not find docking controller for shuttle waypoint '[name]', docking tag was '[docking_tag]'.")
|
log_error("Could not find docking controller for shuttle waypoint '[name]', docking tag was '[docking_tag]'.")
|
||||||
if(using_map.use_overmap)
|
if(using_map.use_overmap)
|
||||||
var/obj/effect/overmap/visitable/location = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/location = get_overmap_sector(z)
|
||||||
if(location && location.docking_codes)
|
if(location && location.docking_codes)
|
||||||
docking_controller.docking_codes = location.docking_codes
|
docking_controller.docking_codes = location.docking_codes
|
||||||
|
|
||||||
/obj/effect/shuttle_landmark/forceMove()
|
/obj/effect/shuttle_landmark/forceMove()
|
||||||
var/obj/effect/overmap/visitable/map_origin = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/map_origin = get_overmap_sector(z)
|
||||||
. = ..()
|
. = ..()
|
||||||
var/obj/effect/overmap/visitable/map_destination = map_sectors["[z]"]
|
var/obj/effect/overmap/visitable/map_destination = get_overmap_sector(z)
|
||||||
if(map_origin != map_destination)
|
if(map_origin != map_destination)
|
||||||
if(map_origin)
|
if(map_origin)
|
||||||
map_origin.remove_landmark(src, shuttle_restricted)
|
map_origin.remove_landmark(src, shuttle_restricted)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
if(active_docking_controller)
|
if(active_docking_controller)
|
||||||
set_docking_codes(active_docking_controller.docking_codes)
|
set_docking_codes(active_docking_controller.docking_codes)
|
||||||
else if(global.using_map.use_overmap)
|
else if(global.using_map.use_overmap)
|
||||||
var/obj/effect/overmap/visitable/location = map_sectors["[current_location.z]"]
|
var/obj/effect/overmap/visitable/location = get_overmap_sector(get_z(current_location))
|
||||||
if(location && location.docking_codes)
|
if(location && location.docking_codes)
|
||||||
set_docking_codes(location.docking_codes)
|
set_docking_codes(location.docking_codes)
|
||||||
dock()
|
dock()
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ GLOBAL_LIST_BOILERPLATE(papers_dockingcode, /obj/item/weapon/paper/dockingcodes)
|
|||||||
var/dockingcodes = null
|
var/dockingcodes = null
|
||||||
var/z_to_check = codes_from_z ? codes_from_z : z
|
var/z_to_check = codes_from_z ? codes_from_z : z
|
||||||
if(using_map.use_overmap)
|
if(using_map.use_overmap)
|
||||||
var/obj/effect/overmap/visitable/location = map_sectors["[z_to_check]"]
|
var/obj/effect/overmap/visitable/location = get_overmap_sector(z_to_check)
|
||||||
if(location && location.docking_codes)
|
if(location && location.docking_codes)
|
||||||
dockingcodes = location.docking_codes
|
dockingcodes = location.docking_codes
|
||||||
|
|
||||||
|
|||||||
@@ -2883,6 +2883,7 @@
|
|||||||
#include "code\modules\organs\subtypes\vox_vr.dm"
|
#include "code\modules\organs\subtypes\vox_vr.dm"
|
||||||
#include "code\modules\organs\subtypes\xenos.dm"
|
#include "code\modules\organs\subtypes\xenos.dm"
|
||||||
#include "code\modules\overmap\bluespace_rift_vr.dm"
|
#include "code\modules\overmap\bluespace_rift_vr.dm"
|
||||||
|
#include "code\modules\overmap\helpers.dm"
|
||||||
#include "code\modules\overmap\overmap_object.dm"
|
#include "code\modules\overmap\overmap_object.dm"
|
||||||
#include "code\modules\overmap\overmap_shuttle.dm"
|
#include "code\modules\overmap\overmap_shuttle.dm"
|
||||||
#include "code\modules\overmap\sectors.dm"
|
#include "code\modules\overmap\sectors.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user