[MIRROR] Shuttle tweak and fix (#1330)

* Shuttle tweak and fix (#54395)

Fix lavaland podding
Make lavaland pod destinations hidden
Removed unused variables from connect_to_shuttle() proc
Shuttle consoles remove old custom port id from possible destinations when connects to new shuttle
Custom ports keeps clear from unwanted numbers.
Now shuttle machinery property connects to additional loaded shuttles.
Add some docking_port register logging and safety.

* Shuttle tweak and fix

Co-authored-by: Dennok <Deneles@yandex.ru>
This commit is contained in:
SkyratBot
2020-10-15 22:09:49 +01:00
committed by GitHub
co-authored by Dennok
parent 6d8dc769f6
commit ae61b17587
21 changed files with 83 additions and 60 deletions
+6 -2
View File
@@ -145,7 +145,11 @@
obj_flags |= EMAGGED
to_chat(user, "<span class='notice'>You fried the consoles ID checking system.</span>")
/obj/machinery/computer/shuttle/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock, idnum, override=FALSE)
if(port && (shuttleId == initial(shuttleId) || override))
/obj/machinery/computer/shuttle/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
if(port)
//Remove old custom port id and ";;"
var/find_old = findtextEx(possible_destinations, "[shuttleId]_custom")
if(find_old)
possible_destinations = replacetext(replacetextEx(possible_destinations, "[shuttleId]_custom", ""), ";;", ";")
shuttleId = port.id
possible_destinations += ";[port.id]_custom"
+3 -3
View File
@@ -587,10 +587,9 @@
obj_flags |= EMAGGED
to_chat(user, "<span class='warning'>You fry the pod's alert level checking system.</span>")
/obj/machinery/computer/shuttle/pod/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock, idnum, override=FALSE)
/obj/machinery/computer/shuttle/pod/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
. = ..()
if(possible_destinations == initial(possible_destinations) || override)
possible_destinations = "pod_lavaland[idnum]"
possible_destinations += ";[port.id]_lavaland"
/obj/docking_port/stationary/random
name = "escape pod"
@@ -598,6 +597,7 @@
dwidth = 1
width = 3
height = 4
hidden = TRUE
var/target_area = /area/lavaland/surface/outdoors
var/edge_distance = 16
// Minimal distance from the map edge, setting this too low can result in shuttle landing on the edge and getting "sliced"
+3 -3
View File
@@ -171,7 +171,7 @@
my_port.dheight = shuttle_port.dheight
my_port.dwidth = shuttle_port.dwidth
my_port.hidden = shuttle_port.hidden
my_port.register()
my_port.register(TRUE)
my_port.setDir(the_eye.dir)
my_port.forceMove(locate(eyeobj.x - x_offset, eyeobj.y - y_offset, eyeobj.z))
@@ -283,8 +283,8 @@
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))
/obj/machinery/computer/camera_advanced/shuttle_docker/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
if(port)
shuttleId = port.id
shuttlePortId = "[port.id]_custom"
if(dock)
+32 -13
View File
@@ -36,10 +36,22 @@
///Delete this port after ship fly off.
var/delete_after = FALSE
///are we registered in SSshuttles?
var/registered = FALSE
///register to SSshuttles
/obj/docking_port/proc/register()
if(registered)
WARNING("docking_port registered multiple times")
unregister()
registered = TRUE
return
///unregister from SSshuttles
/obj/docking_port/proc/unregister()
if(!registered)
WARNING("docking_port unregistered multiple times")
registered = FALSE
return
/obj/docking_port/proc/Check_id()
@@ -185,7 +197,8 @@
var/datum/map_template/shuttle/roundstart_template
var/json_key
/obj/docking_port/stationary/register()
/obj/docking_port/stationary/register(replace = FALSE)
. = ..()
if(!id)
id = "dock"
else
@@ -195,13 +208,14 @@
name = "dock"
var/counter = SSshuttle.assoc_stationary[id]
if(counter)
counter++
SSshuttle.assoc_stationary[id] = counter
id = "[id]_[counter]"
name = "[name] [counter]"
else
SSshuttle.assoc_stationary[id] = 1
if(!replace || !counter)
if(counter)
counter++
SSshuttle.assoc_stationary[id] = counter
id = "[id]_[counter]"
name = "[name] [counter]"
else
SSshuttle.assoc_stationary[id] = 1
if(!port_destinations)
port_destinations = id
@@ -224,6 +238,7 @@
#endif
/obj/docking_port/stationary/unregister()
. = ..()
SSshuttle.stationary -= src
/obj/docking_port/stationary/Destroy(force)
@@ -351,25 +366,29 @@
var/list/hidden_turfs = list()
/obj/docking_port/mobile/register(replace = FALSE)
. = ..()
if(!id)
id = "shuttle"
if(!name)
name = "shuttle"
if(!replace)
var/counter = SSshuttle.assoc_mobile[id]
var/counter = SSshuttle.assoc_mobile[id]
if(!replace || !counter)
if(counter)
counter++
SSshuttle.assoc_mobile[id] = counter
id = "[id]_[counter]"
name = "[name] [counter]"
//Re link machinery to new shuttle id
linkup()
else
SSshuttle.assoc_mobile[id] = 1
SSshuttle.mobile += src
/obj/docking_port/mobile/unregister()
. = ..()
SSshuttle.mobile -= src
/obj/docking_port/mobile/Destroy(force)
@@ -413,13 +432,13 @@
#endif
// Called after the shuttle is loaded from template
/obj/docking_port/mobile/proc/linkup(datum/map_template/shuttle/template, obj/docking_port/stationary/dock)
/obj/docking_port/mobile/proc/linkup(obj/docking_port/stationary/dock)
for(var/place in shuttle_areas)
var/area/area = place
area.connect_to_shuttle(src, dock, id, FALSE)
area.connect_to_shuttle(src, dock)
for(var/each in place)
var/atom/atom = each
atom.connect_to_shuttle(src, dock, id, FALSE)
atom.connect_to_shuttle(src, dock)
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact