Files
Aurora.3/code/modules/overmap/ships/computers/engine_control.dm
Fluffy b8902e2e16 Runtime map now loads in ~11 seconds instead of ~40, sped up various other things (#19957)
Runtime map now has a bunch of new areas / items with often-tested
stuffs, and some hard-to-put-at-runtime stuffs.
Runtime map jobs now are positioned to make it faster to reach the
aforementioned often-tested stuffs.
Runtime map doesn't generate an overmap anymore by default, which speeds
up the process.
Runtime map now loads in ~11 seconds instead of ~40 seconds as it was
before.
Updated the maploader to be faster in parsing maps.
Bapi is not engaged anymore if we're only measuring the map size, which
speeds up the process.
In fastboot we do not generate the codexes anymore, which speeds up the
process.
In fastboot and if exoplanets and away sites are not enabled, we do not
parse the map templates anymore, which speeds up the process.
Updated the icon smoothing to be faster.
Optimized cargo area code.
Other optimizations.
2024-10-06 21:31:01 +00:00

119 lines
3.7 KiB
Plaintext

//Engine control and monitoring console
/obj/machinery/computer/ship/engines
name = "engine control console"
icon_screen = "enginecontrol"
icon_keyboard = "cyan_key"
icon_keyboard_emis = "cyan_key_mask"
light_color = LIGHT_COLOR_CYAN
circuit = /obj/item/circuitboard/ship/engines
var/display_state = "status"
/obj/machinery/computer/ship/engines/cockpit
density = 0
icon = 'icons/obj/cockpit_console.dmi'
icon_state = "right"
icon_screen = "engine"
icon_keyboard = null
circuit = null
/obj/machinery/computer/ship/engines/terminal
name = "engine control terminal"
icon = 'icons/obj/machinery/modular_terminal.dmi'
icon_screen = "engines"
icon_keyboard = "tech_key"
icon_keyboard_emis = "tech_key_mask"
is_connected = TRUE
has_off_keyboards = TRUE
can_pass_under = FALSE
light_power_on = 1
/obj/machinery/computer/ship/engines/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!connected)
display_reconnect_dialog(user, "ship control systems")
return
var/data[0]
data["state"] = display_state
data["global_state"] = connected.engines_state
data["global_limit"] = round(connected.thrust_limit*100)
var/total_thrust = 0
var/list/enginfo[0]
for(var/datum/ship_engine/E in connected.engines)
var/list/rdata[0]
rdata["eng_type"] = E.name
rdata["eng_on"] = E.is_on()
rdata["eng_thrust"] = E.get_thrust()
rdata["eng_thrust_limiter"] = round(E.get_thrust_limit()*100)
rdata["eng_status"] = E.get_status()
rdata["eng_reference"] = "[REF(E)]"
total_thrust += E.get_thrust()
enginfo.Add(list(rdata))
data["engines_info"] = enginfo
data["total_thrust"] = total_thrust
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "engines_control.tmpl", "[connected.get_real_name()] Engines Control", 390, 530)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/ship/engines/Topic(href, href_list)
if(..())
return TOPIC_HANDLED
if(href_list["state"])
display_state = href_list["state"]
return TOPIC_REFRESH
if(href_list["global_toggle"])
connected.engines_state = !connected.engines_state
for(var/datum/ship_engine/E in connected.engines)
if(connected.engines_state == !E.is_on())
E.toggle()
return TOPIC_REFRESH
if(href_list["set_global_limit"])
var/newlim = tgui_input_number(usr, "Input the new thrust limit.", "Thrust Limit", connected.thrust_limit*100, 100, 0)
if(!CanInteract(usr, GLOB.physical_state))
return TOPIC_NOACTION
connected.thrust_limit = clamp(newlim/100, 0, 1)
for(var/datum/ship_engine/E in connected.engines)
E.set_thrust_limit(connected.thrust_limit)
return TOPIC_REFRESH
if(href_list["global_limit"])
connected.thrust_limit = clamp(connected.thrust_limit + text2num(href_list["global_limit"]), 0, 1)
for(var/datum/ship_engine/E in connected.engines)
E.set_thrust_limit(connected.thrust_limit)
return TOPIC_REFRESH
if(href_list["engine"])
if(href_list["set_limit"])
var/datum/ship_engine/E = locate(href_list["engine"])
var/newlim = tgui_input_number(usr, "Input the new thrust limit.", "Thrust Limit", E.get_thrust_limit(), 100, 0)
if(!CanInteract(usr, GLOB.physical_state))
return
var/limit = clamp(newlim/100, 0, 1)
if(istype(E))
E.set_thrust_limit(limit)
return TOPIC_REFRESH
if(href_list["limit"])
var/datum/ship_engine/E = locate(href_list["engine"])
var/limit = clamp(E.get_thrust_limit() + text2num(href_list["limit"]), 0, 1)
if(istype(E))
E.set_thrust_limit(limit)
return TOPIC_REFRESH
if(href_list["toggle"])
var/datum/ship_engine/E = locate(href_list["engine"])
if(istype(E))
E.toggle()
return TOPIC_REFRESH
return TOPIC_REFRESH
return TOPIC_NOACTION