push
This commit is contained in:
@@ -3,19 +3,22 @@
|
||||
desc = "Used to designate a precise transit location for a spacecraft."
|
||||
jump_action = null
|
||||
should_supress_view_changes = FALSE
|
||||
var/datum/action/innate/shuttledocker_rotate/rotate_action = new
|
||||
var/datum/action/innate/shuttledocker_place/place_action = new
|
||||
|
||||
var/shuttleId = ""
|
||||
var/shuttlePortId = ""
|
||||
var/shuttlePortName = "custom location"
|
||||
var/list/jumpto_ports = list() //hashset of ports to jump to and ignore for collision purposes
|
||||
var/obj/docking_port/stationary/my_port //the custom docking port placed by this console
|
||||
var/obj/docking_port/mobile/shuttle_port //the mobile docking port of the connected shuttle
|
||||
/// Hashset of ports to jump to and ignore for collision purposes
|
||||
var/list/jump_to_ports = list()
|
||||
/// The custom docking port placed by this console
|
||||
var/obj/docking_port/stationary/my_port
|
||||
/// The mobile docking port of the connected shuttle
|
||||
var/obj/docking_port/mobile/shuttle_port
|
||||
// Traits forbided for custom docking
|
||||
var/list/locked_traits = list(ZTRAIT_RESERVED, ZTRAIT_CENTCOM, ZTRAIT_AWAY, ZTRAIT_REEBE) //traits forbided for custom docking
|
||||
var/view_range = 0
|
||||
var/x_offset = 0
|
||||
var/y_offset = 0
|
||||
var/list/whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava)
|
||||
var/list/whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava, /turf/open/openspace)
|
||||
var/space_turfs_only = TRUE
|
||||
var/see_hidden = FALSE
|
||||
var/designate_time = 0
|
||||
@@ -24,37 +27,52 @@
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/Initialize(mapload)
|
||||
. = ..()
|
||||
actions += new /datum/action/innate/shuttledocker_rotate(src)
|
||||
actions += new /datum/action/innate/shuttledocker_place(src)
|
||||
|
||||
GLOB.navigation_computers += src
|
||||
whitelist_turfs = typecacheof(whitelist_turfs)
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/Destroy()
|
||||
. = ..()
|
||||
if(my_port?.get_docked())
|
||||
my_port.delete_after = TRUE
|
||||
my_port.shuttle_id = null
|
||||
my_port.name = "Old [my_port.name]"
|
||||
my_port = null
|
||||
else
|
||||
QDEL_NULL(my_port)
|
||||
|
||||
GLOB.navigation_computers -= src
|
||||
|
||||
/// "Initializes" any default port ids we have, done so add_jumpable_port can be a proper setter
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/set_init_ports()
|
||||
var/list/init_ports = jump_to_ports.Copy()
|
||||
jump_to_ports = list() //Reset it so we don't get dupes
|
||||
for(var/port_id in init_ports)
|
||||
add_jumpable_port(port_id)
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/add_jumpable_port(port_id)
|
||||
if(!length(jump_to_ports))
|
||||
actions += new /datum/action/innate/camera_jump/shuttle_docker(src)
|
||||
jump_to_ports[port_id] = TRUE
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/remove_jumpable_port(port_id)
|
||||
jump_to_ports -= port_id
|
||||
if(!length(jump_to_ports))
|
||||
var/datum/action/to_remove = locate(/datum/action/innate/camera_jump/shuttle_docker) in actions
|
||||
actions -= to_remove
|
||||
qdel(to_remove)
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if(jammed)
|
||||
to_chat(user, "<span class='warning'>The Syndicate is jamming the console!</span>")
|
||||
to_chat(user, span_warning("The Syndicate is jamming the console!"))
|
||||
return
|
||||
if(!shuttle_port && !SSshuttle.getShuttle(shuttleId))
|
||||
to_chat(user,"<span class='warning'>Warning: Shuttle connection severed!</span>")
|
||||
to_chat(user, span_warning("Warning: Shuttle connection severed!"))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/GrantActions(mob/living/user)
|
||||
if(jumpto_ports.len)
|
||||
jump_action = new /datum/action/innate/camera_jump/shuttle_docker
|
||||
..()
|
||||
|
||||
if(rotate_action)
|
||||
rotate_action.target = user
|
||||
rotate_action.Grant(user)
|
||||
actions += rotate_action
|
||||
|
||||
if(place_action)
|
||||
place_action.target = user
|
||||
place_action.Grant(user)
|
||||
actions += place_action
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/CreateEye()
|
||||
shuttle_port = SSshuttle.getShuttle(shuttleId)
|
||||
if(QDELETED(shuttle_port))
|
||||
@@ -65,14 +83,13 @@
|
||||
var/mob/camera/aiEye/remote/shuttle_docker/the_eye = eyeobj
|
||||
the_eye.setDir(shuttle_port.dir)
|
||||
var/turf/origin = locate(shuttle_port.x + x_offset, shuttle_port.y + y_offset, shuttle_port.z)
|
||||
for(var/V in shuttle_port.shuttle_areas)
|
||||
var/area/A = V
|
||||
for(var/turf/T in A)
|
||||
if(T.z != origin.z)
|
||||
for(var/area/shuttle_area as anything in shuttle_port.shuttle_areas)
|
||||
for(var/turf/shuttle_turf as anything in shuttle_area)
|
||||
if(shuttle_turf.z != origin.z)
|
||||
continue
|
||||
var/image/I = image('icons/effects/alphacolors.dmi', origin, "red")
|
||||
var/x_off = T.x - origin.x
|
||||
var/y_off = T.y - origin.y
|
||||
var/x_off = shuttle_turf.x - origin.x
|
||||
var/y_off = shuttle_turf.y - origin.y
|
||||
I.loc = locate(origin.x + x_off, origin.y + y_off, origin.z) //we have to set this after creating the image because it might be null, and images created in nullspace are immutable.
|
||||
I.layer = ABOVE_NORMAL_TURF_LAYER
|
||||
I.plane = 0
|
||||
@@ -112,45 +129,55 @@
|
||||
var/mob/camera/aiEye/remote/shuttle_docker/the_eye = eyeobj
|
||||
var/landing_clear = checkLandingSpot()
|
||||
if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED))
|
||||
to_chat(current_user, "<span class='warning'>Targeting transit location, please wait [DisplayTimeText(designate_time)]...</span>")
|
||||
to_chat(current_user, span_warning("Targeting transit location, please wait [DisplayTimeText(designate_time)]..."))
|
||||
designating_target_loc = the_eye.loc
|
||||
var/wait_completed = do_after(current_user, designate_time, designating_target_loc, timed_action_flags = IGNORE_HELD_ITEM, extra_checks = CALLBACK(src, TYPE_PROC_REF(/obj/machinery/computer/camera_advanced/shuttle_docker, canDesignateTarget)))
|
||||
designating_target_loc = null
|
||||
if(!current_user)
|
||||
return
|
||||
if(!wait_completed)
|
||||
to_chat(current_user, "<span class='warning'>Operation aborted.</span>")
|
||||
to_chat(current_user, span_warning("Operation aborted."))
|
||||
return
|
||||
landing_clear = checkLandingSpot()
|
||||
|
||||
if(landing_clear != SHUTTLE_DOCKER_LANDING_CLEAR)
|
||||
switch(landing_clear)
|
||||
if(SHUTTLE_DOCKER_BLOCKED)
|
||||
to_chat(current_user, "<span class='warning'>Invalid transit location</span>")
|
||||
to_chat(current_user, span_warning("Invalid transit location."))
|
||||
if(SHUTTLE_DOCKER_BLOCKED_BY_HIDDEN_PORT)
|
||||
to_chat(current_user, "<span class='warning'>Unknown object detected in landing zone. Please designate another location.</span>")
|
||||
to_chat(current_user, span_warning("Unknown object detected in landing zone. Please designate another location."))
|
||||
return
|
||||
|
||||
///Make one use port that deleted after fly off, to don't lose info that need on to properly fly off.
|
||||
if(my_port?.get_docked())
|
||||
my_port.unregister()
|
||||
my_port.delete_after = TRUE
|
||||
my_port.shuttle_id = null
|
||||
my_port.name = "Old [my_port.name]"
|
||||
my_port = null
|
||||
|
||||
if(!my_port)
|
||||
my_port = new()
|
||||
my_port.unregister()
|
||||
my_port.name = shuttlePortName
|
||||
my_port.id = shuttlePortId
|
||||
my_port.shuttle_id = shuttlePortId
|
||||
my_port.height = shuttle_port.height
|
||||
my_port.width = shuttle_port.width
|
||||
my_port.dheight = shuttle_port.dheight
|
||||
my_port.dwidth = shuttle_port.dwidth
|
||||
my_port.hidden = shuttle_port.hidden
|
||||
my_port.register(TRUE)
|
||||
my_port.setDir(the_eye.dir)
|
||||
my_port.forceMove(locate(eyeobj.x - x_offset, eyeobj.y - y_offset, eyeobj.z))
|
||||
|
||||
if(current_user.client)
|
||||
current_user.client.images -= the_eye.placed_images
|
||||
|
||||
QDEL_LIST(the_eye.placed_images)
|
||||
LAZYCLEARLIST(the_eye.placed_images)
|
||||
|
||||
for(var/V in the_eye.placement_images)
|
||||
var/image/I = V
|
||||
for(var/image/place_spots as anything in the_eye.placement_images)
|
||||
var/image/newI = image('icons/effects/alphacolors.dmi', the_eye.loc, "blue")
|
||||
newI.loc = I.loc //It is highly unlikely that any landing spot including a null tile will get this far, but better safe than sorry.
|
||||
newI.loc = place_spots.loc //It is highly unlikely that any landing spot including a null tile will get this far, but better safe than sorry.
|
||||
newI.layer = ABOVE_OPEN_TURF_LAYER
|
||||
newI.plane = 0
|
||||
newI.mouse_opacity = 0
|
||||
@@ -158,11 +185,11 @@
|
||||
|
||||
if(current_user.client)
|
||||
current_user.client.images += the_eye.placed_images
|
||||
to_chat(current_user, "<span class='notice'>Transit location designated</span>")
|
||||
return
|
||||
to_chat(current_user, span_notice("Transit location designated."))
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget()
|
||||
if(!designating_target_loc || !current_user || (eyeobj.loc != designating_target_loc) || (stat & (NOPOWER|BROKEN)) )
|
||||
if(!designating_target_loc || !current_user || (eyeobj.loc != designating_target_loc) || (machine_stat & (NOPOWER|BROKEN)) )
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -230,11 +257,6 @@
|
||||
if(!is_type_in_typecache(turf_type, whitelist_turfs))
|
||||
return SHUTTLE_DOCKER_BLOCKED
|
||||
|
||||
if(length(whitelist_turfs))
|
||||
var/turf_type = hidden_turf_info ? hidden_turf_info[2] : T.type
|
||||
if(!is_type_in_typecache(turf_type, whitelist_turfs))
|
||||
return SHUTTLE_DOCKER_BLOCKED
|
||||
|
||||
// Checking for overlapping dock boundaries
|
||||
for(var/i in 1 to overlappers.len)
|
||||
var/obj/docking_port/port = overlappers[i]
|
||||
@@ -251,29 +273,30 @@
|
||||
return SHUTTLE_DOCKER_BLOCKED
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/update_hidden_docking_ports(list/remove_images, list/add_images)
|
||||
if(!see_hidden && current_user && current_user.client)
|
||||
if(!see_hidden && current_user?.client)
|
||||
current_user.client.images -= remove_images
|
||||
current_user.client.images += add_images
|
||||
|
||||
/obj/machinery/computer/camera_advanced/shuttle_docker/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock, idnum, override=FALSE)
|
||||
if(port && (shuttleId == initial(shuttleId) || override))
|
||||
shuttleId = port.id
|
||||
shuttlePortId = "[port.id]_custom"
|
||||
shuttleId = port.shuttle_id
|
||||
shuttlePortId = "[port.shuttle_id]_custom"
|
||||
if(dock)
|
||||
jumpto_ports += dock.id
|
||||
add_jumpable_port(dock.shuttle_id)
|
||||
return TRUE
|
||||
|
||||
/mob/camera/aiEye/remote/shuttle_docker
|
||||
visible_icon = FALSE
|
||||
use_static = USE_STATIC_NONE
|
||||
var/list/placement_images = list()
|
||||
var/list/placed_images = list()
|
||||
use_static = FALSE
|
||||
var/list/image/placement_images = list()
|
||||
var/list/image/placed_images = list()
|
||||
|
||||
/mob/camera/aiEye/remote/shuttle_docker/Initialize(mapload, obj/machinery/computer/camera_advanced/origin)
|
||||
src.origin = origin
|
||||
return ..()
|
||||
|
||||
/mob/camera/aiEye/remote/shuttle_docker/setLoc(T)
|
||||
..()
|
||||
/mob/camera/aiEye/remote/shuttle_docker/setLoc(turf/destination, force_update = FALSE)
|
||||
. = ..()
|
||||
var/obj/machinery/computer/camera_advanced/shuttle_docker/console = origin
|
||||
console.checkLandingSpot()
|
||||
|
||||
@@ -289,10 +312,9 @@
|
||||
button_icon_state = "mech_cycle_equip_off"
|
||||
|
||||
/datum/action/innate/shuttledocker_rotate/Activate()
|
||||
if(QDELETED(target) || !isliving(target))
|
||||
if(QDELETED(owner) || !isliving(owner))
|
||||
return
|
||||
var/mob/living/C = target
|
||||
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
||||
var/mob/camera/aiEye/remote/remote_eye = owner.remote_control
|
||||
var/obj/machinery/computer/camera_advanced/shuttle_docker/origin = remote_eye.origin
|
||||
origin.rotateLandingSpot()
|
||||
|
||||
@@ -302,25 +324,23 @@
|
||||
button_icon_state = "mech_zoom_off"
|
||||
|
||||
/datum/action/innate/shuttledocker_place/Activate()
|
||||
if(QDELETED(target) || !isliving(target))
|
||||
if(QDELETED(owner) || !isliving(owner))
|
||||
return
|
||||
var/mob/living/C = target
|
||||
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
||||
var/mob/camera/aiEye/remote/remote_eye = owner.remote_control
|
||||
var/obj/machinery/computer/camera_advanced/shuttle_docker/origin = remote_eye.origin
|
||||
origin.placeLandingSpot(target)
|
||||
origin.placeLandingSpot(owner)
|
||||
|
||||
/datum/action/innate/camera_jump/shuttle_docker
|
||||
name = "Jump to Location"
|
||||
button_icon_state = "camera_jump"
|
||||
|
||||
/datum/action/innate/camera_jump/shuttle_docker/Activate()
|
||||
if(QDELETED(target) || !isliving(target))
|
||||
if(QDELETED(owner) || !isliving(owner))
|
||||
return
|
||||
var/mob/living/C = target
|
||||
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
||||
var/mob/camera/aiEye/remote/remote_eye = owner.remote_control
|
||||
var/obj/machinery/computer/camera_advanced/shuttle_docker/console = remote_eye.origin
|
||||
|
||||
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, 0)
|
||||
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, FALSE)
|
||||
|
||||
var/list/L = list()
|
||||
for(var/V in SSshuttle.stationary)
|
||||
@@ -330,7 +350,7 @@
|
||||
var/obj/docking_port/stationary/S = V
|
||||
if(console.z_lock.len && !(S.z in console.z_lock))
|
||||
continue
|
||||
if(console.jumpto_ports[S.id])
|
||||
if(console.jump_to_ports[S.shuttle_id])
|
||||
L["([L.len])[S.name]"] = S
|
||||
|
||||
for(var/V in SSshuttle.beacons)
|
||||
@@ -345,18 +365,19 @@
|
||||
else
|
||||
L["([L.len]) [nav_beacon.name] locked"] = null
|
||||
|
||||
playsound(console, 'sound/machines/terminal_prompt.ogg', 25, 0)
|
||||
var/selected = input("Choose location to jump to", "Locations", null) as null|anything in L
|
||||
if(QDELETED(src) || QDELETED(target) || !isliving(target))
|
||||
playsound(console, 'sound/machines/terminal_prompt.ogg', 25, FALSE)
|
||||
var/selected = tgui_input_list(usr, "Choose location to jump to", "Locations", sort_list(L))
|
||||
if(isnull(selected))
|
||||
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, FALSE)
|
||||
return
|
||||
playsound(src, "terminal_type", 25, 0)
|
||||
if(selected)
|
||||
var/turf/T = get_turf(L[selected])
|
||||
if(T)
|
||||
playsound(console, 'sound/machines/terminal_prompt_confirm.ogg', 25, 0)
|
||||
remote_eye.setLoc(T)
|
||||
to_chat(target, "<span class='notice'>Jumped to [selected]</span>")
|
||||
C.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/tiled/flash/static)
|
||||
C.clear_fullscreen("flash", 3)
|
||||
else
|
||||
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, 0)
|
||||
if(QDELETED(src) || QDELETED(owner) || !isliving(owner))
|
||||
return
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
var/turf/T = get_turf(L[selected])
|
||||
if(isnull(T))
|
||||
return
|
||||
playsound(console, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE)
|
||||
remote_eye.setLoc(T)
|
||||
to_chat(owner, span_notice("Jumped to [selected]."))
|
||||
owner.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/tiled/flash/static)
|
||||
owner.clear_fullscreen("flash", 3)
|
||||
|
||||
Reference in New Issue
Block a user