Skip to content

Commit

Permalink
[MIRROR] Fix Shuttle Control Console Syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
SierraKomodo authored and SierraHelper committed Aug 12, 2024
1 parent 0bfe8f2 commit 176bf18
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 48 deletions.
1 change: 0 additions & 1 deletion baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@
#include "code\datums\extensions\multitool\store.dm"
#include "code\datums\extensions\multitool\circuitboards\buildtype_select.dm"
#include "code\datums\extensions\multitool\circuitboards\circuitboards.dm"
#include "code\datums\extensions\multitool\circuitboards\shuttle_console.dm"
#include "code\datums\extensions\multitool\circuitboards\stationalert.dm"
#include "code\datums\extensions\multitool\items\clothing.dm"
#include "code\datums\extensions\multitool\items\items.dm"
Expand Down
29 changes: 0 additions & 29 deletions code/datums/extensions/multitool/circuitboards/shuttle_console.dm

This file was deleted.

17 changes: 0 additions & 17 deletions code/game/objects/items/weapons/circuitboards/computer/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,7 @@
name = "circuit board (basic shuttle console)"
build_path = /obj/machinery/computer/shuttle_control
origin_tech = list(TECH_DATA = 3)
var/shuttle_tag

/obj/item/stock_parts/circuitboard/shuttle_console/construct(obj/machinery/computer/shuttle_control/M)
M.shuttle_tag = shuttle_tag

/obj/item/stock_parts/circuitboard/shuttle_console/deconstruct(obj/machinery/computer/shuttle_control/M)
shuttle_tag = M.shuttle_tag

/obj/item/stock_parts/circuitboard/shuttle_console/Initialize()
set_extension(src, /datum/extension/interactive/multitool/circuitboards/shuttle_console)
. = ..()

/obj/item/stock_parts/circuitboard/shuttle_console/proc/is_valid_shuttle(datum/shuttle/shuttle)
return TRUE

/obj/item/stock_parts/circuitboard/shuttle_console/explore
name = "circuit board (long range shuttle console)"
build_path = /obj/machinery/computer/shuttle_control/explore

/obj/item/stock_parts/circuitboard/shuttle_console/explore/is_valid_shuttle(datum/shuttle/shuttle)
return istype(shuttle, /datum/shuttle/autodock/overmap)
5 changes: 5 additions & 0 deletions code/modules/overmap/ships/computers/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
machine_name = "long range shuttle console"
machine_desc = "Used to control spacecraft that are designed to move between local sectors in open space."


/obj/machinery/computer/shuttle_control/explore/is_valid_shuttle(datum/shuttle/shuttle)
return istype(shuttle, /datum/shuttle/autodock/overmap)


/obj/machinery/computer/shuttle_control/explore/get_ui_data(datum/shuttle/autodock/overmap/shuttle)
. = ..()
if(istype(shuttle))
Expand Down
35 changes: 34 additions & 1 deletion code/modules/shuttles/shuttle_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,45 @@
machine_name = "basic shuttle console"
machine_desc = "A simple control system for small spacecraft, allowing automated movement from one navigation point to another."

var/shuttle_tag // Used to coordinate data in shuttle controller.
/// Used to coordinate data in shuttle controller. Set by `sync_shuttle()`.
var/shuttle_tag
var/hacked = 0 // Has been emagged, no access restrictions.

var/ui_template = "shuttle_control_console.tmpl"


/obj/machinery/computer/shuttle_control/Initialize(mapload, init_shuttle_tag)
. = ..()
if (init_shuttle_tag)
shuttle_tag = init_shuttle_tag
if (!shuttle_tag)
sync_shuttle()


/obj/machinery/computer/shuttle_control/on_update_icon()
icon_screen = shuttle_tag ? initial(icon_screen) : "shuttle_error"
..()


/// Sets `shuttle_tag` to a new value based on the computer's current area, or to `null` if the area is not a valid shuttle.
/obj/machinery/computer/shuttle_control/proc/sync_shuttle()
shuttle_tag = null
var/area/current_area = get_area(src)
for (var/shuttle_name in SSshuttle.shuttles)
var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_name]
if (!(current_area in shuttle.shuttle_area))
continue
if (!is_valid_shuttle(SSshuttle.shuttles[shuttle_name]))
break
shuttle_tag = shuttle_name
break


/// Determines whether the given shuttle datum is valid for this computer.
/obj/machinery/computer/shuttle_control/proc/is_valid_shuttle(datum/shuttle/shuttle)
return !istype(shuttle, /datum/shuttle/autodock/overmap)


/obj/machinery/computer/shuttle_control/interface_interact(mob/user)
ui_interact(user)
return TRUE
Expand Down
Binary file modified icons/obj/machines/computer.dmi
Binary file not shown.

0 comments on commit 176bf18

Please sign in to comment.