Station overmap sensors should connect automatically now (#7547)

This commit is contained in:
Atermonera
2020-08-27 18:31:22 -07:00
committed by GitHub
parent 3a554b776f
commit 60aec770ff
4 changed files with 24 additions and 13 deletions

View File

@@ -51,6 +51,8 @@
//This is called later in the init order by SSshuttles to populate sector objects. Importantly for subtypes, shuttles will be created by then.
/obj/effect/overmap/visitable/proc/populate_sector_objects()
for(var/obj/machinery/computer/ship/S in global.machines)
S.attempt_hook_up(src)
/obj/effect/overmap/visitable/proc/get_areas()
. = list()

View File

@@ -29,7 +29,7 @@
var/data[0]
data["viewing"] = viewing_overmap(user)
if(sensors)
if(sensors || find_sensors())
data["on"] = sensors.use_power
data["range"] = sensors.range
data["health"] = sensors.health
@@ -69,11 +69,13 @@
ui.set_auto_update(1)
/obj/machinery/computer/ship/sensors/OnTopic(var/mob/user, var/list/href_list, state)
if(..())
return TOPIC_HANDLED
if((. = ..()))
return
if (!linked)
return TOPIC_NOACTION
var/obj/effect/overmap/visitable/sector = get_overmap_sector(src.z)
if(!istype(sector) || !attempt_hook_up_recursive(sector))
return TOPIC_NOACTION
if (href_list["viewing"])
if(user && !isAI(user))

View File

@@ -10,16 +10,25 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
var/list/whitelisted_types = list(/obj/effect/overmap/visitable/ship)
var/list/blacklisted_types = list()
/obj/machinery/computer/ship/New()
. = ..()
var/list/L = list()
for(var/type in whitelisted_types)
L |= typesof(type)
for(var/type in blacklisted_types)
L -= typesof(type)
whitelisted_types = L
// A late init operation called in SSshuttles, used to attach the thing to the right ship.
/obj/machinery/computer/ship/proc/attempt_hook_up(obj/effect/overmap/visitable/ship/sector)
if(!sector || (sector.type in blacklisted_types) || !(sector.type in whitelisted_types))
return
/obj/machinery/computer/ship/proc/attempt_hook_up(obj/effect/overmap/visitable/sector)
if(!sector || !(sector.type in whitelisted_types))
return FALSE
if(sector.check_ownership(src))
linked = sector
return 1
return TRUE
/obj/machinery/computer/ship/proc/sync_linked(var/user = null)
var/obj/effect/overmap/visitable/ship/sector = get_overmap_sector(z)
var/obj/effect/overmap/visitable/sector = get_overmap_sector(z)
if(!sector)
return
. = attempt_hook_up_recursive(sector)
@@ -27,10 +36,10 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
to_chat(user, "<span class='notice'>[src] reconnected to [linked]</span>")
user << browse(null, "window=[src]") // close reconnect dialog
/obj/machinery/computer/ship/proc/attempt_hook_up_recursive(obj/effect/overmap/visitable/ship/sector)
/obj/machinery/computer/ship/proc/attempt_hook_up_recursive(obj/effect/overmap/visitable/sector)
if(attempt_hook_up(sector))
return sector
for(var/obj/effect/overmap/visitable/ship/candidate in sector)
for(var/obj/effect/overmap/visitable/candidate in sector)
if((. = .(candidate)))
return

View File

@@ -239,8 +239,6 @@
/obj/effect/overmap/visitable/ship/populate_sector_objects()
..()
for(var/obj/machinery/computer/ship/S in global.machines)
S.attempt_hook_up(src)
for(var/datum/ship_engine/E in ship_engines)
if(check_ownership(E.holder))
engines |= E