Merge pull request #7018 from VOREStation/aro-overmapwrap

Move overmap wrapping onto edge turfs
This commit is contained in:
Aronai Sieyes
2020-03-27 16:16:02 -04:00
committed by GitHub
2 changed files with 30 additions and 27 deletions

View File

@@ -146,7 +146,6 @@
var/turf/newloc = locate(x + deltas[1], y + deltas[2], z)
if(newloc)
Move(newloc)
handle_wraparound()
update_icon()
/obj/effect/overmap/visitable/ship/update_icon()
@@ -181,27 +180,6 @@
. = min(last_movement[i] - world.time + 1/abs(speed[i]), .)
. = max(.,0)
/obj/effect/overmap/visitable/ship/proc/handle_wraparound()
var/nx = x
var/ny = y
var/low_edge = 1
var/high_edge = global.using_map.overmap_size - 1
if((dir & WEST) && x == low_edge)
nx = high_edge
else if((dir & EAST) && x == high_edge)
nx = low_edge
if((dir & SOUTH) && y == low_edge)
ny = high_edge
else if((dir & NORTH) && y == high_edge)
ny = low_edge
if((x == nx) && (y == ny))
return //we're not flying off anywhere
var/turf/T = locate(nx,ny,z)
if(T)
forceMove(T)
/obj/effect/overmap/visitable/ship/proc/halt()
adjust_speed(-speed[1], -speed[2])
halted = 1
@@ -210,11 +188,6 @@
if(!SSshuttles.overmap_halted)
halted = 0
/obj/effect/overmap/visitable/ship/Bump(var/atom/A)
if(istype(A,/turf/unsimulated/map/edge))
handle_wraparound()
..()
/obj/effect/overmap/visitable/ship/proc/get_helm_skill()//delete this mover operator skill to overmap obj
return operator_skill

View File

@@ -15,6 +15,36 @@ var/global/list/map_sectors = list()
/turf/unsimulated/map/edge
opacity = 1
density = 1
var/map_is_to_my
var/turf/unsimulated/map/edge/wrap_buddy
/turf/unsimulated/map/edge/Initialize()
. = ..()
//This could be done by using the using_map.overmap_size much faster, HOWEVER, doing it programatically to 'find'
// the edges this way allows for 'sub overmaps' elsewhere and whatnot.
for(var/side in alldirs) //The order of this list is relevant: It should definitely break on finding a cardinal FIRST.
var/turf/T = get_step(src, side)
if(T?.type == /turf/unsimulated/map) //Not a wall, not something else, EXACTLY a flat map turf.
map_is_to_my = side
break
if(map_is_to_my)
var/turf/T = get_step(src, map_is_to_my) //Should be a normal map turf
while(istype(T, /turf/unsimulated/map))
T = get_step(T, map_is_to_my) //Could be a wall if the map is only 1 turf big
if(istype(T, /turf/unsimulated/map/edge))
wrap_buddy = T
break
/turf/unsimulated/map/edge/Destroy()
wrap_buddy = null
return ..()
/turf/unsimulated/map/edge/Bumped(var/atom/movable/AM)
if(wrap_buddy?.map_is_to_my)
AM.forceMove(get_step(wrap_buddy, wrap_buddy.map_is_to_my))
else
. = ..()
/turf/unsimulated/map/Initialize()
. = ..()