Files
CHOMPStation2/code/modules/overmap/ships/computers/shuttle.dm
Leshana 4d9cc39664 Make shuttle control consoles constructable.
- Adds circuit boards for shuttle consoles. (Ferry, Multi, and Overmap).
- Deconstructing a console saves the linked shuttle tag in the board for when it is re-constructed.  New boards start blank but will auto-link if you build the console on a shuttle.
- Boards know what type of shuttle they can control and will only auto-link with a shuttle if it is the appropriate type.

Note: By default the only mapped-in shuttle consoles that are deconstrutable are overmap and multi shuttle consoles.   For any others, consoles built mid-game will be deconstrutable but the mapped-in ones will not.  That way the arrival, escape, supply ferry shuttles etc won't be messed with unless the mapper specifically chooses to override and make them that way.
2020-04-11 19:54:03 -04:00

47 lines
1.7 KiB
Plaintext

//Shuttle controller computer for shuttles going between sectors
/obj/machinery/computer/shuttle_control/explore
name = "general shuttle control console"
circuit = /obj/item/weapon/circuitboard/shuttle_console/explore
ui_template = "shuttle_control_console_exploration.tmpl"
/obj/machinery/computer/shuttle_control/explore/get_ui_data(var/datum/shuttle/autodock/overmap/shuttle)
. = ..()
if(istype(shuttle))
var/total_gas = 0
for(var/obj/structure/fuel_port/FP in shuttle.fuel_ports) //loop through fuel ports
var/obj/item/weapon/tank/fuel_tank = locate() in FP
if(fuel_tank)
total_gas += fuel_tank.air_contents.total_moles
var/fuel_span = "good"
if(total_gas < shuttle.fuel_consumption * 2)
fuel_span = "bad"
. += list(
"destination_name" = shuttle.get_destination_name(),
"can_pick" = shuttle.moving_status == SHUTTLE_IDLE,
"fuel_usage" = shuttle.fuel_consumption * 100,
"remaining_fuel" = round(total_gas, 0.01) * 100,
"fuel_span" = fuel_span
)
/obj/machinery/computer/shuttle_control/explore/handle_topic_href(var/datum/shuttle/autodock/overmap/shuttle, var/list/href_list)
if(ismob(usr))
var/mob/user = usr
shuttle.operator_skill = user.get_skill_value(/datum/skill/pilot)
if((. = ..()) != null)
return
if(href_list["pick"])
var/list/possible_d = shuttle.get_possible_destinations()
var/D
if(possible_d.len)
D = input("Choose shuttle destination", "Shuttle Destination") as null|anything in possible_d
else
to_chat(usr,"<span class='warning'>No valid landing sites in range.</span>")
possible_d = shuttle.get_possible_destinations()
if(CanInteract(usr, global.default_state) && (D in possible_d))
shuttle.set_destination(possible_d[D])
return TOPIC_REFRESH