mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Allow fighters to traverse overmap ships predictably
This commit is contained in:
@@ -9,15 +9,15 @@
|
||||
var/ground_capable = FALSE //If we can fly over normal turfs and not just space
|
||||
|
||||
icon = 'icons/mecha/fighters64x64.dmi'
|
||||
|
||||
|
||||
icon_state = ""
|
||||
initial_icon = ""
|
||||
|
||||
|
||||
step_in = 2 //Fast
|
||||
|
||||
health = 400
|
||||
maxhealth = 400
|
||||
|
||||
|
||||
infra_luminosity = 6
|
||||
|
||||
opacity = FALSE
|
||||
@@ -50,6 +50,77 @@
|
||||
. = ..()
|
||||
consider_gravity()
|
||||
|
||||
//We don't get lost quite as easy.
|
||||
/obj/mecha/combat/fighter/touch_map_edge()
|
||||
//No overmap enabled or no driver to choose
|
||||
if(!using_map.use_overmap || !occupant || !can_ztravel())
|
||||
return ..()
|
||||
|
||||
var/obj/effect/overmap/visitable/our_ship = get_overmap_sector(z)
|
||||
|
||||
//We're not on the overmap
|
||||
if(!our_ship)
|
||||
return ..()
|
||||
|
||||
//Stored for safety checking after user input
|
||||
var/this_x = x
|
||||
var/this_y = y
|
||||
var/this_z = z
|
||||
var/this_occupant = occupant
|
||||
|
||||
var/what_edge
|
||||
|
||||
var/new_x
|
||||
var/new_y
|
||||
var/new_z
|
||||
|
||||
if(x <= TRANSITIONEDGE)
|
||||
what_edge = WEST
|
||||
new_x = world.maxx - TRANSITIONEDGE - 2
|
||||
new_y = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
|
||||
|
||||
else if (x >= (world.maxx - TRANSITIONEDGE + 1))
|
||||
what_edge = EAST
|
||||
new_x = TRANSITIONEDGE + 1
|
||||
new_y = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
|
||||
|
||||
else if (y <= TRANSITIONEDGE)
|
||||
what_edge = SOUTH
|
||||
new_y = world.maxy - TRANSITIONEDGE -2
|
||||
new_x = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
|
||||
|
||||
else if (y >= (world.maxy - TRANSITIONEDGE + 1))
|
||||
what_edge = NORTH
|
||||
new_y = TRANSITIONEDGE + 1
|
||||
new_x = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
|
||||
|
||||
var/list/choices = list()
|
||||
for(var/obj/effect/overmap/visitable/V in range(1, our_ship))
|
||||
choices[V.name] = V
|
||||
|
||||
var/choice = input("Choose an overmap destination:", "Destination", null) as null|anything in choices
|
||||
if(!choice)
|
||||
var/backwards = turn(what_edge, 180)
|
||||
forceMove(get_step(src,backwards)) //Move them back a step, then.
|
||||
set_dir(backwards)
|
||||
return
|
||||
else
|
||||
var/obj/effect/overmap/visitable/V = choices[choice]
|
||||
if(occupant != this_occupant || this_x != x || this_y != y || this_z != z || get_dist(V,our_ship) > 1) //Sanity after user input
|
||||
to_chat(occupant, "<span class='warning'>You or they appear to have moved!</span>")
|
||||
return
|
||||
var/list/levels = V.get_space_zlevels()
|
||||
if(!levels.len)
|
||||
to_chat(occupant, "<span class='warning'>You don't appear to be able to get there from here!</span>")
|
||||
return
|
||||
new_z = pick(levels)
|
||||
var/turf/destination = locate(new_x, new_y, new_z)
|
||||
if(!destination || destination.density)
|
||||
to_chat(occupant, "<span class='warning'>You don't appear to be able to get there from here! Is it blocked?</span>")
|
||||
return
|
||||
else
|
||||
forceMove(destination)
|
||||
|
||||
//Modified phazon code
|
||||
/obj/mecha/combat/fighter/Topic(href, href_list)
|
||||
..()
|
||||
@@ -97,7 +168,7 @@
|
||||
|
||||
/obj/mecha/combat/fighter/handle_equipment_movement()
|
||||
. = ..()
|
||||
consider_gravity(TRUE)
|
||||
consider_gravity(TRUE)
|
||||
|
||||
/obj/mecha/combat/fighter/proc/start_hover()
|
||||
if(!ion_trail.on) //We'll just use this to store if we're floating or not
|
||||
@@ -162,7 +233,7 @@
|
||||
step_in = 3 //Slightly slower than others
|
||||
|
||||
ground_capable = TRUE
|
||||
|
||||
|
||||
// Paint colors! Null if not set.
|
||||
var/stripe1_color
|
||||
var/stripe2_color
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
var/list/checked_turfs = list()
|
||||
for(var/turf/T in locs)
|
||||
var/turf/Tcheck = get_step(T, stepdir)
|
||||
if(!Tcheck) //Map edge
|
||||
continue
|
||||
if(Tcheck in checked_turfs)
|
||||
continue
|
||||
if(Tcheck in locs)
|
||||
|
||||
Reference in New Issue
Block a user