From 0319c9650218358942770caad86a6c30c384798c Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 8 Jun 2014 11:19:51 -0400 Subject: [PATCH] Adds docking support to shuttles, NanoUI --- baystation12.dme | 2 +- code/controllers/shuttle_controller.dm | 16 +- code/datums/spells/knock.dm | 2 +- code/game/gamemodes/mutiny/mutiny.dm | 2 +- code/game/machinery/door_control.dm | 6 +- code/game/machinery/doors/airlock.dm | 53 +- .../machinery/{ => doors}/airlock_control.dm | 512 +++++++++--------- .../embedded_controller/docking_program.dm | 5 +- code/modules/admin/topic.dm | 2 +- code/modules/shuttles/shuttle.dm | 70 +-- code/modules/shuttles/shuttle_console.dm | 55 +- nano/css/shared.css | 6 + nano/templates/docking_airlock_console.tmpl | 2 +- nano/templates/shuttle_control_console.tmpl | 74 +++ nano/templates/simple_airlock_console.tmpl | 53 +- nano/templates/simple_docking_console.tmpl | 2 +- 16 files changed, 504 insertions(+), 358 deletions(-) rename code/game/machinery/{ => doors}/airlock_control.dm (92%) create mode 100644 nano/templates/shuttle_control_console.tmpl diff --git a/baystation12.dme b/baystation12.dme index 58f449724f..3d1bd1760c 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -275,7 +275,6 @@ #include "code\game\jobs\job\silicon.dm" #include "code\game\machinery\adv_med.dm" #include "code\game\machinery\ai_slipper.dm" -#include "code\game\machinery\airlock_control.dm" #include "code\game\machinery\alarm.dm" #include "code\game\machinery\atmo_control.dm" #include "code\game\machinery\autolathe.dm" @@ -375,6 +374,7 @@ #include "code\game\machinery\computer\station_alert.dm" #include "code\game\machinery\computer\syndicate_specops_shuttle.dm" #include "code\game\machinery\doors\airlock.dm" +#include "code\game\machinery\doors\airlock_control.dm" #include "code\game\machinery\doors\airlock_electronics.dm" #include "code\game\machinery\doors\alarmlock.dm" #include "code\game\machinery\doors\brigdoors.dm" diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index f889a37e17..e0d2b8626d 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -11,10 +11,10 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle -datum/shuttle_controller +datum/shuttle_controller/emergency_shuttle var/alert = 0 //0 = emergency, 1 = crew cycle - var/location = 0 //0 = somewhere far away (in spess), 1 = at SS13, 2 = returned from SS13 + location = 0 //0 = somewhere far away (in spess), 1 = at SS13, 2 = returned from SS13 var/online = 0 var/direction = 1 //-1 = going back to central command, 1 = going to SS13, 2 = in transit to centcom (not recalled) @@ -52,10 +52,10 @@ datum/shuttle_controller return SHUTTLEARRIVETIME -datum/shuttle_controller/proc/shuttlealert(var/X) +datum/shuttle_controller/emergency_shuttle/proc/shuttlealert(var/X) alert = X -datum/shuttle_controller/proc/recall() +datum/shuttle_controller/emergency_shuttle/proc/recall() if(direction == 1) var/timeleft = timeleft() if(alert == 0) @@ -78,7 +78,7 @@ datum/shuttle_controller/proc/recall() // returns the time (in seconds) before shuttle arrival // note if direction = -1, gives a count-up to SHUTTLEARRIVETIME -datum/shuttle_controller/proc/timeleft() +datum/shuttle_controller/emergency_shuttle/proc/timeleft() if(online) var/timeleft = round((endtime - world.timeofday)/10 ,1) if(direction == 1 || direction == 2) @@ -89,13 +89,13 @@ datum/shuttle_controller/proc/timeleft() return get_shuttle_arrive_time() // sets the time left to a given delay (in seconds) -datum/shuttle_controller/proc/settimeleft(var/delay) +datum/shuttle_controller/emergency_shuttle/proc/settimeleft(var/delay) endtime = world.timeofday + delay * 10 timelimit = delay // sets the shuttle direction // 1 = towards SS13, -1 = back to centcom -datum/shuttle_controller/proc/setdirection(var/dirn) +datum/shuttle_controller/emergency_shuttle/proc/setdirection(var/dirn) if(direction == dirn) return direction = dirn @@ -104,7 +104,7 @@ datum/shuttle_controller/proc/setdirection(var/dirn) endtime = world.timeofday + (get_shuttle_arrive_time()*10 - ticksleft) return -datum/shuttle_controller/proc/process() +datum/shuttle_controller/emergency_shuttle/proc/process() datum/shuttle_controller/emergency_shuttle/process() if(!online) diff --git a/code/datums/spells/knock.dm b/code/datums/spells/knock.dm index a67eefe65f..48ba2c633c 100644 --- a/code/datums/spells/knock.dm +++ b/code/datums/spells/knock.dm @@ -14,6 +14,6 @@ for(var/obj/machinery/door/door in T.contents) spawn(1) if(istype(door,/obj/machinery/door/airlock)) - door:locked = 0 + door:unlock(1) //forced because it's magic! door.open() return \ No newline at end of file diff --git a/code/game/gamemodes/mutiny/mutiny.dm b/code/game/gamemodes/mutiny/mutiny.dm index 1f3d13c136..0d394ed9d6 100644 --- a/code/game/gamemodes/mutiny/mutiny.dm +++ b/code/game/gamemodes/mutiny/mutiny.dm @@ -158,7 +158,7 @@ datum/game_mode/mutiny proc/unbolt_vault_door() var/obj/machinery/door/airlock/vault = locate(/obj/machinery/door/airlock/vault) - vault.locked = 0 + vault.lock() proc/make_secret_transcript() var/obj/machinery/computer/telecomms/server/S = locate(/obj/machinery/computer/telecomms/server) diff --git a/code/game/machinery/door_control.dm b/code/game/machinery/door_control.dm index 63251c2b68..2dcb0c0b2e 100644 --- a/code/game/machinery/door_control.dm +++ b/code/game/machinery/door_control.dm @@ -93,8 +93,7 @@ if(specialfunctions & IDSCAN) D.aiDisabledIdScanner = 1 if(specialfunctions & BOLTS) - D.locked = 1 - D.update_icon() + D.lock() if(specialfunctions & SHOCK) D.secondsElectrified = -1 if(specialfunctions & SAFE) @@ -104,8 +103,7 @@ D.aiDisabledIdScanner = 0 if(specialfunctions & BOLTS) if(!D.isWireCut(4) && D.arePowerSystemsOn()) - D.locked = 0 - D.update_icon() + D.unlock() if(specialfunctions & SHOCK) D.secondsElectrified = 0 if(specialfunctions & SAFE) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 536785fd76..7fbb1ba616 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -386,17 +386,10 @@ About the new airlock wires panel: //one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not), //raises them if they are down (only if power's on) if(!src.locked) - src.locked = 1 - for(var/mob/M in range(1,src)) - M << "You hear a click from the bottom of the door." - src.updateUsrDialog() + src.lock() else - if(src.arePowerSystemsOn()) //only can raise bolts if power's on - src.locked = 0 - for(var/mob/M in range(1,src)) - M << "You hear a click from the bottom of the door." - src.updateUsrDialog() - update_icon() + src.unlock() + src.updateUsrDialog() if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2) //two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter). @@ -460,9 +453,7 @@ About the new airlock wires panel: src.updateUsrDialog() if(AIRLOCK_WIRE_DOOR_BOLTS) //Cutting this wire also drops the door bolts, and mending it does not raise them. (This is what happens now, except there are a lot more wires going to door bolts at present) - if(src.locked!=1) - src.locked = 1 - update_icon() + src.lock() src.updateUsrDialog() if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2) //Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user. @@ -720,7 +711,7 @@ About the new airlock wires panel: t1 += text("Backup Power Output wire is cut.
\n") if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) - t1 += text("Door bolt drop wire is cut.
\n") + t1 += text("Door bolt control wire is cut.
\n") else if(!src.locked) t1 += text("Door bolts are up. Drop them?
\n", src) else @@ -1000,9 +991,8 @@ About the new airlock wires panel: //drop door bolts if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) usr << "You can't drop the door bolts - The door bolt control wire has been cut." - else if(src.locked!=1) - src.locked = 1 - update_icon() + else + src.lock() if(5) //un-electrify door if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY)) @@ -1068,15 +1058,11 @@ About the new airlock wires panel: if(4) //raise door bolts if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) - usr << text("The door bolt drop wire is cut - you can't raise the door bolts.
\n") + usr << text("The door bolt control wire is cut - you can't raise the door bolts.
\n") else if(!src.locked) usr << text("The door bolts are already up.
\n") else - if(src.arePowerSystemsOn()) - src.locked = 0 - update_icon() - else - usr << text("Cannot raise door bolts due to power failure.
\n") + src.unlock() if(5) //electrify door for 30 seconds @@ -1330,6 +1316,23 @@ About the new airlock wires panel: ..() return +/obj/machinery/door/airlock/proc/lock(var/forced=0) + if (src.locked) return + + src.locked = 1 + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + +/obj/machinery/door/airlock/proc/unlock(var/forced=0) + if (!src.locked) return + + if(forced || src.arePowerSystemsOn()) //only can raise bolts if power's on + src.locked = 0 + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + /obj/machinery/door/airlock/New() ..() @@ -1357,7 +1360,7 @@ About the new airlock wires panel: airlockWireColorToIndex = wire_assignments[4] /obj/machinery/door/airlock/proc/prison_open() - src.locked = 0 + src.unlock() src.open() - src.locked = 1 + src.lock() return \ No newline at end of file diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/doors/airlock_control.dm similarity index 92% rename from code/game/machinery/airlock_control.dm rename to code/game/machinery/doors/airlock_control.dm index a5de183a92..6326a287b8 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/doors/airlock_control.dm @@ -1,255 +1,259 @@ -#define AIRLOCK_CONTROL_RANGE 5 - -// This code allows for airlocks to be controlled externally by setting an id_tag and comm frequency (disables ID access) -obj/machinery/door/airlock - var/id_tag - var/frequency - var/shockedby = list() - var/datum/radio_frequency/radio_connection - explosion_resistance = 15 - - -obj/machinery/door/airlock/receive_signal(datum/signal/signal) - if(!signal || signal.encryption) return - - if(id_tag != signal.data["tag"] || !signal.data["command"]) return - - switch(signal.data["command"]) - if("open") - open(1) - - if("close") - close(1) - - if("unlock") - locked = 0 - update_icon() - - if("lock") - locked = 1 - update_icon() - - if("secure_open") - locked = 0 - update_icon() - - sleep(2) - open(1) - - locked = 1 - update_icon() - - if("secure_close") - locked = 0 - close(1) - - locked = 1 - sleep(2) - update_icon() - - send_status() - - -obj/machinery/door/airlock/proc/send_status() - if(radio_connection) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = id_tag - signal.data["timestamp"] = world.time - - signal.data["door_status"] = density?("closed"):("open") - signal.data["lock_status"] = locked?("locked"):("unlocked") - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - - -obj/machinery/door/airlock/open(surpress_send) - . = ..() - if(!surpress_send) send_status() - - -obj/machinery/door/airlock/close(surpress_send) - . = ..() - if(!surpress_send) send_status() - - -obj/machinery/door/airlock/Bumped(atom/AM) - ..(AM) - if(istype(AM, /obj/mecha)) - var/obj/mecha/mecha = AM - if(density && radio_connection && mecha.occupant && (src.allowed(mecha.occupant) || src.check_access_list(mecha.operation_req_access))) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = id_tag - signal.data["timestamp"] = world.time - - signal.data["door_status"] = density?("closed"):("open") - signal.data["lock_status"] = locked?("locked"):("unlocked") - - signal.data["bumped_with_access"] = 1 - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - return - -obj/machinery/door/airlock/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - if(new_frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) - - -obj/machinery/door/airlock/initialize() - if(frequency) - set_frequency(frequency) - - update_icon() - - -obj/machinery/door/airlock/New() - ..() - - if(radio_controller) - set_frequency(frequency) - - - - -obj/machinery/airlock_sensor - icon = 'icons/obj/airlock_machines.dmi' - icon_state = "airlock_sensor_off" - name = "airlock sensor" - - anchored = 1 - power_channel = ENVIRON - - var/id_tag - var/master_tag - var/frequency = 1379 - var/command = "cycle" - - var/datum/radio_frequency/radio_connection - - var/on = 1 - var/alert = 0 - var/previousPressure - -obj/machinery/airlock_sensor/update_icon() - if(on) - if(alert) - icon_state = "airlock_sensor_alert" - else - icon_state = "airlock_sensor_standby" - else - icon_state = "airlock_sensor_off" - -obj/machinery/airlock_sensor/attack_hand(mob/user) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = master_tag - signal.data["command"] = command - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - flick("airlock_sensor_cycle", src) - -obj/machinery/airlock_sensor/process() - if(on) - var/datum/gas_mixture/air_sample = return_air() - var/pressure = round(air_sample.return_pressure(),0.1) - - if(abs(pressure - previousPressure) > 0.001 || previousPressure == null) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = id_tag - signal.data["timestamp"] = world.time - signal.data["pressure"] = num2text(pressure) - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - - previousPressure = pressure - - alert = (pressure < ONE_ATMOSPHERE*0.8) - - update_icon() - -obj/machinery/airlock_sensor/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) - -obj/machinery/airlock_sensor/initialize() - set_frequency(frequency) - -obj/machinery/airlock_sensor/New() - ..() - if(radio_controller) - set_frequency(frequency) - - -obj/machinery/airlock_sensor/airlock_interior - command = "cycle_interior" - -obj/machinery/airlock_sensor/airlock_exterior - command = "cycle_exterior" - -obj/machinery/access_button - icon = 'icons/obj/airlock_machines.dmi' - icon_state = "access_button_standby" - name = "access button" - - anchored = 1 - power_channel = ENVIRON - - var/master_tag - var/frequency = 1449 - var/command = "cycle" - - var/datum/radio_frequency/radio_connection - - var/on = 1 - - -obj/machinery/access_button/update_icon() - if(on) - icon_state = "access_button_standby" - else - icon_state = "access_button_off" - - -obj/machinery/access_button/attack_hand(mob/user) - add_fingerprint(usr) - if(!allowed(user)) - user << "\red Access Denied" - - else if(radio_connection) - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.data["tag"] = master_tag - signal.data["command"] = command - - radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - flick("access_button_cycle", src) - - -obj/machinery/access_button/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) - - -obj/machinery/access_button/initialize() - set_frequency(frequency) - - -obj/machinery/access_button/New() - ..() - - if(radio_controller) - set_frequency(frequency) - -obj/machinery/access_button/airlock_interior - frequency = 1379 - command = "cycle_interior" - -obj/machinery/access_button/airlock_exterior - frequency = 1379 +#define AIRLOCK_CONTROL_RANGE 5 + +// This code allows for airlocks to be controlled externally by setting an id_tag and comm frequency (disables ID access) +obj/machinery/door/airlock + var/id_tag + var/frequency + var/shockedby = list() + var/datum/radio_frequency/radio_connection + explosion_resistance = 15 + +obj/machinery/door/airlock/proc/can_radio() + if( !arePowerSystemsOn() || (stat & NOPOWER) || isWireCut(AIRLOCK_WIRE_AI_CONTROL) ) + return 0 + return 1 + + +obj/machinery/door/airlock/receive_signal(datum/signal/signal) + if (!can_radio()) return + + if(!signal || signal.encryption) return + + if(id_tag != signal.data["tag"] || !signal.data["command"]) return + + switch(signal.data["command"]) + if("open") + open() + + if("close") + close() + + if("unlock") + unlock() + + if("lock") + lock() + + if("secure_open") + unlock() + + sleep(2) + open() + + lock() + + if("secure_close") + unlock() + close() + + lock() + sleep(2) + + send_status() + + +obj/machinery/door/airlock/proc/send_status() + if (!can_radio()) return + + if(radio_connection) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.data["tag"] = id_tag + signal.data["timestamp"] = world.time + + signal.data["door_status"] = density?("closed"):("open") + signal.data["lock_status"] = locked?("locked"):("unlocked") + + radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + + +obj/machinery/door/airlock/open(surpress_send) + . = ..() + if(!surpress_send) send_status() + + +obj/machinery/door/airlock/close(surpress_send) + . = ..() + if(!surpress_send) send_status() + + +obj/machinery/door/airlock/Bumped(atom/AM) + ..(AM) + if(istype(AM, /obj/mecha)) + var/obj/mecha/mecha = AM + if(density && radio_connection && mecha.occupant && (src.allowed(mecha.occupant) || src.check_access_list(mecha.operation_req_access))) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.data["tag"] = id_tag + signal.data["timestamp"] = world.time + + signal.data["door_status"] = density?("closed"):("open") + signal.data["lock_status"] = locked?("locked"):("unlocked") + + signal.data["bumped_with_access"] = 1 + + radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + return + +obj/machinery/door/airlock/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + if(new_frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) + + +obj/machinery/door/airlock/initialize() + if(frequency) + set_frequency(frequency) + + update_icon() + + +obj/machinery/door/airlock/New() + ..() + + if(radio_controller) + set_frequency(frequency) + + + + +obj/machinery/airlock_sensor + icon = 'icons/obj/airlock_machines.dmi' + icon_state = "airlock_sensor_off" + name = "airlock sensor" + + anchored = 1 + power_channel = ENVIRON + + var/id_tag + var/master_tag + var/frequency = 1379 + var/command = "cycle" + + var/datum/radio_frequency/radio_connection + + var/on = 1 + var/alert = 0 + var/previousPressure + +obj/machinery/airlock_sensor/update_icon() + if(on) + if(alert) + icon_state = "airlock_sensor_alert" + else + icon_state = "airlock_sensor_standby" + else + icon_state = "airlock_sensor_off" + +obj/machinery/airlock_sensor/attack_hand(mob/user) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.data["tag"] = master_tag + signal.data["command"] = command + + radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + flick("airlock_sensor_cycle", src) + +obj/machinery/airlock_sensor/process() + if(on) + var/datum/gas_mixture/air_sample = return_air() + var/pressure = round(air_sample.return_pressure(),0.1) + + if(abs(pressure - previousPressure) > 0.001 || previousPressure == null) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.data["tag"] = id_tag + signal.data["timestamp"] = world.time + signal.data["pressure"] = num2text(pressure) + + radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + + previousPressure = pressure + + alert = (pressure < ONE_ATMOSPHERE*0.8) + + update_icon() + +obj/machinery/airlock_sensor/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) + +obj/machinery/airlock_sensor/initialize() + set_frequency(frequency) + +obj/machinery/airlock_sensor/New() + ..() + if(radio_controller) + set_frequency(frequency) + + +obj/machinery/airlock_sensor/airlock_interior + command = "cycle_interior" + +obj/machinery/airlock_sensor/airlock_exterior + command = "cycle_exterior" + +obj/machinery/access_button + icon = 'icons/obj/airlock_machines.dmi' + icon_state = "access_button_standby" + name = "access button" + + anchored = 1 + power_channel = ENVIRON + + var/master_tag + var/frequency = 1449 + var/command = "cycle" + + var/datum/radio_frequency/radio_connection + + var/on = 1 + + +obj/machinery/access_button/update_icon() + if(on) + icon_state = "access_button_standby" + else + icon_state = "access_button_off" + + +obj/machinery/access_button/attack_hand(mob/user) + add_fingerprint(usr) + if(!allowed(user)) + user << "\red Access Denied" + + else if(radio_connection) + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.data["tag"] = master_tag + signal.data["command"] = command + + radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) + flick("access_button_cycle", src) + + +obj/machinery/access_button/proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) + + +obj/machinery/access_button/initialize() + set_frequency(frequency) + + +obj/machinery/access_button/New() + ..() + + if(radio_controller) + set_frequency(frequency) + +obj/machinery/access_button/airlock_interior + frequency = 1379 + command = "cycle_interior" + +obj/machinery/access_button/airlock_exterior + frequency = 1379 command = "cycle_exterior" \ No newline at end of file diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm index c0da99c947..b0bda9322d 100644 --- a/code/game/machinery/embedded_controller/docking_program.dm +++ b/code/game/machinery/embedded_controller/docking_program.dm @@ -192,10 +192,13 @@ response_sent = 0 override_enabled = 0 -//returns 1 if we are saftely undocked (and the shuttle can leave) /datum/computer/file/embedded_program/docking/proc/undocked() return (dock_state == STATE_UNDOCKED) +//returns 1 if we are saftely undocked (and the shuttle can leave) +/datum/computer/file/embedded_program/docking/proc/can_launch() + return undocked() + /datum/computer/file/embedded_program/docking/proc/send_docking_command(var/recipient, var/command) var/datum/signal/signal = new signal.data["tag"] = id_tag diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 0db601a521..aa4cf3a934 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1928,7 +1928,7 @@ feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","ShA") - var/shuttle_tag = input("Which shuttle do you want to call?") as null|anything in shuttles.locations + var/shuttle_tag = input("Which shuttle do you want to call?") as null|anything in shuttles.location if(shuttle_tag && !shuttles.moving[shuttle_tag]) shuttles.jump_shuttle(shuttle_tag) diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index ceb683c646..8e8c9e90a0 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -1,14 +1,14 @@ //These lists are populated in /datum/shuttle_controller/New() //Shuttle controller is instantiated in master_controller.dm. -#define STATUS_IDLE -#define STATUS_WARMUP -#define STATUS_INTRANSIT +#define SHUTTLE_IDLE 0 +#define SHUTTLE_WARMUP 1 +#define SHUTTLE_INTRANSIT 2 var/global/datum/shuttle_controller/shuttles /datum/shuttle_controller //This isn't really a controller... - var/list/locations = list() + var/list/location = list() var/list/warmup = list() var/list/moving = list() var/list/areas_offsite = list() @@ -26,53 +26,53 @@ var/global/datum/shuttle_controller/shuttles ..() //Supply and escape shuttles. - locations["Supply"] = 1 + location["Supply"] = 1 warmup["Supply"] = 0 - moving["Supply"] = STATUS_IDLE + moving["Supply"] = SHUTTLE_IDLE areas_offsite["Supply"] = locate(/area/supply/dock) areas_station["Supply"] = locate(/area/supply/station) docking_targets["Supply"] = list(null, null) // Admin shuttles. - locations["Centcom"] = 1 + location["Centcom"] = 1 warmup["Centcom"] = 0 - moving["Centcom"] = STATUS_IDLE + moving["Centcom"] = SHUTTLE_IDLE areas_offsite["Centcom"] = locate(/area/shuttle/transport1/centcom) areas_station["Centcom"] = locate(/area/shuttle/transport1/station) docking_targets["Centcom"] = list(null, null) - locations["Administration"] = 1 + location["Administration"] = 1 warmup["Administration"] = 0 - moving["Administration"] = STATUS_IDLE + moving["Administration"] = SHUTTLE_IDLE areas_offsite["Administration"] = locate(/area/shuttle/administration/centcom) areas_station["Administration"] = locate(/area/shuttle/administration/station) docking_targets["Administration"] = list(null, null) - locations["Alien"] = 0 + location["Alien"] = 0 warmup["Alien"] = 0 - moving["Alien"] = STATUS_IDLE + moving["Alien"] = SHUTTLE_IDLE areas_offsite["Alien"] = locate(/area/shuttle/alien/base) areas_station["Alien"] = locate(/area/shuttle/alien/mine) docking_targets["Alien"] = list(null, null) // Public shuttles. - locations["Engineering"] = 1 + location["Engineering"] = 1 warmup["Engineering"] = 10 - moving["Engineering"] = STATUS_IDLE + moving["Engineering"] = SHUTTLE_IDLE areas_offsite["Engineering"] = locate(/area/shuttle/constructionsite/site) areas_station["Engineering"] = locate(/area/shuttle/constructionsite/station) docking_targets["Engineering"] = list(null, null) - locations["Mining"] = 0 + location["Mining"] = 0 warmup["Mining"] = 10 - moving["Mining"] = STATUS_IDLE + moving["Mining"] = SHUTTLE_IDLE areas_offsite["Mining"] = locate(/area/shuttle/mining/outpost) areas_station["Mining"] = locate(/area/shuttle/mining/station) docking_targets["Mining"] = list(null, null) - locations["Research"] = 0 + location["Research"] = 0 warmup["Research"] = 10 - moving["Research"] = STATUS_IDLE + moving["Research"] = SHUTTLE_IDLE areas_offsite["Research"] = locate(/area/shuttle/research/outpost) areas_station["Research"] = locate(/area/shuttle/research/station) docking_targets["Research"] = list("research_dock_airlock", "research_dock_airlock") @@ -95,9 +95,9 @@ var/global/datum/shuttle_controller/shuttles VS.interim = /area/vox_station/transit multi_shuttles["Vox Skipjack"] = VS - locations["Vox Skipjack"] = 1 + location["Vox Skipjack"] = 1 warmup["Vox Skipjack"] = 10 - moving["Vox Skipjack"] = STATUS_IDLE + moving["Vox Skipjack"] = SHUTTLE_IDLE //Nuke Ops shuttle. var/datum/multi_shuttle/MS = new @@ -120,24 +120,24 @@ var/global/datum/shuttle_controller/shuttles MS.interim = /area/syndicate_station/transit multi_shuttles["Syndicate"] = MS - locations["Syndicate"] = 1 + location["Syndicate"] = 1 warmup["Syndicate"] = 10 - moving["Syndicate"] = STATUS_IDLE + moving["Syndicate"] = SHUTTLE_IDLE /datum/shuttle_controller/proc/jump_shuttle(var/shuttle_tag,var/area/origin,var/area/destination) - if(moving[shuttle_tag] != STATUS_IDLE) return + if(moving[shuttle_tag] != SHUTTLE_IDLE) return - moving[shuttle_tag] = STATUS_WARMUP + moving[shuttle_tag] = SHUTTLE_WARMUP spawn(warmup[shuttle_tag]*10) move_shuttle(shuttle_tag, origin, destination) - moving[shuttle_tag] = STATUS_IDLE + moving[shuttle_tag] = SHUTTLE_IDLE //This is for shuttles with a timer before arrival such as the vox skipjack and the escape shuttle. /datum/shuttle_controller/proc/jump_shuttle_long(var/shuttle_tag,var/area/departing,var/area/destination,var/area/interim,var/travel_time) - if(moving[shuttle_tag] != STATUS_IDLE) return + if(moving[shuttle_tag] != SHUTTLE_IDLE) return - moving[shuttle_tag] = STATUS_WARMUP + moving[shuttle_tag] = SHUTTLE_WARMUP spawn(warmup[shuttle_tag]*10) move_shuttle(shuttle_tag,locate(departing),locate(interim)) @@ -146,7 +146,7 @@ var/global/datum/shuttle_controller/shuttles move_shuttle(shuttle_tag,locate(interim),locate(destination)) - moving[shuttle_tag] = STATUS_IDLE + moving[shuttle_tag] = SHUTTLE_IDLE return @@ -155,7 +155,7 @@ var/global/datum/shuttle_controller/shuttles /datum/shuttle_controller/proc/move_shuttle(var/shuttle_tag,var/area/origin,var/area/destination) //world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]." - if(!shuttle_tag || isnull(locations[shuttle_tag])) + if(!shuttle_tag || isnull(location[shuttle_tag])) return var/area/area_going_to @@ -163,16 +163,16 @@ var/global/datum/shuttle_controller/shuttles //world << "Using supplied destination [destination]." area_going_to = destination else - //world << "Using controller value [(locations[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag])]." - area_going_to = (locations[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag]) + //world << "Using controller value [(location[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag])]." + area_going_to = (location[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag]) var/area/area_coming_from if(origin) //world << "Using supplied origin [origin]." area_coming_from = origin else - //world << "Using controller value [(locations[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag])]." - area_coming_from = (locations[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag]) + //world << "Using controller value [(location[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag])]." + area_coming_from = (location[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag]) //world << "area_coming_from: [area_coming_from]" //world << "area_going_to: [area_going_to]" @@ -181,7 +181,7 @@ var/global/datum/shuttle_controller/shuttles //world << "cancelling move, shuttle will overlap." return - moving[shuttle_tag] = STATUS_INTRANSIT + moving[shuttle_tag] = SHUTTLE_INTRANSIT var/list/dstturfs = list() var/throwy = world.maxy @@ -206,7 +206,7 @@ var/global/datum/shuttle_controller/shuttles area_coming_from.move_contents_to(area_going_to) - locations[shuttle_tag] = !locations[shuttle_tag] + location[shuttle_tag] = !location[shuttle_tag] for(var/mob/M in area_going_to) if(M.client) diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index e2cfb755d7..1a06315872 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -1,5 +1,5 @@ /obj/machinery/computer/shuttle_control - name = "shuttle console" + name = "shuttle control console" icon = 'icons/obj/computer.dmi' icon_state = "shuttle" req_access = list(access_engine) @@ -11,7 +11,7 @@ var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself var/hacked = 0 // Has been emagged, no access restrictions. - var/waiting = 0 + var/wait_for_launch = 0 /obj/machinery/computer/shuttle_control/initialize() //search for our controller, if we have one. @@ -20,11 +20,21 @@ if (C.id_tag == docking_controller_tag && istype(C.program, /datum/computer/file/embedded_program/docking)) docking_controller = C.program +/obj/machinery/computer/shuttle_control/process() + if (wait_for_launch) + if (docking_controller && docking_controller.can_launch()) + shuttles.jump_shuttle(shuttle_tag) + wait_for_launch = 0 + +/* /obj/machinery/computer/shuttle_control/attack_hand(user as mob) if(..(user)) return src.add_fingerprint(user) + +//ui_interact() + var/dat dat = "
[shuttle_tag] Shuttle Control
" @@ -32,12 +42,47 @@ if(waiting || shuttles.moving[shuttle_tag]) dat += "Location: Moving
" else - dat += "Location: [shuttles.locations[shuttle_tag] ? "Offsite" : "Station"]
" + dat += "Location: [shuttles.location[shuttle_tag] ? "Offsite" : "Station"]
" dat += "Send
" user << browse("[dat]", "window=[shuttle_tag]shuttlecontrol;size=200x150") +*/ + +/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) + var/data[0] + + var/shuttle_state + switch(shuttles.moving[shuttle_tag]) + if(SHUTTLE_IDLE) shuttle_state = "idle" + if(SHUTTLE_WARMUP) shuttle_state = "warmup" + if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit" + + if (docking_controller) + data = list( + "shuttle_state" = shuttle_state, + "shuttle_loc" = shuttles.location[shuttle_tag], + "has_docking" = 1, + "docking_status" = docking_controller.get_docking_status(), + "override_enabled" = docking_controller.override_enabled, + ) + else + data = list( + "shuttle_state" = shuttle_state, + "shuttle_loc" = shuttles.location[shuttle_tag], + "has_docking" = 0, + "docking_status" = null, + "override_enabled" = null, + ) + + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) + + if (!ui) + ui = new(user, src, ui_key, "shuttle_control_console.tmpl", "[shuttle_tag] Shuttle Control", 470, 290) + ui.set_initial_data(data) + ui.open() + ui.set_auto_update(1) /obj/machinery/computer/shuttle_control/Topic(href, href_list) if(..()) @@ -48,7 +93,7 @@ if(href_list["move"]) if (!shuttles.moving[shuttle_tag]) usr << "\blue [shuttle_tag] Shuttle recieved message and will be sent shortly." - shuttles.move_shuttle(shuttle_tag) + wait_for_launch = 1 else usr << "\blue [shuttle_tag] Shuttle is already moving." @@ -70,7 +115,7 @@ var/list/setup_complete = list() //so we dont setup the same shuttle repeatedly for (var/obj/machinery/computer/shuttle_control/S in machines) - var/location = shuttles.locations[S.shuttle_tag] + var/location = shuttles.location[S.shuttle_tag] var/dock_target = shuttles.docking_targets[S.shuttle_tag][location+1] //damned byond is 1-indexed - don't forget if (!(S.shuttle_tag in setup_complete) && S.docking_controller && dock_target) diff --git a/nano/css/shared.css b/nano/css/shared.css index 650d956f64..ac4657db34 100644 --- a/nano/css/shared.css +++ b/nano/css/shared.css @@ -177,6 +177,12 @@ h4 { color: #ee0000; font-weight: bold; } + +.idle { + color: #272727; + font-weight: bold; +} + .redBackground { background: #ea0000; } diff --git a/nano/templates/docking_airlock_console.tmpl b/nano/templates/docking_airlock_console.tmpl index e40758494f..abc263a5a6 100644 --- a/nano/templates/docking_airlock_console.tmpl +++ b/nano/templates/docking_airlock_console.tmpl @@ -37,7 +37,7 @@ {{else docking_status == "undocked"}} - NOT IN USE + NOT IN USE {{else}} ERROR {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, airlock_disabled ? null : 'redBackground')}} diff --git a/nano/templates/shuttle_control_console.tmpl b/nano/templates/shuttle_control_console.tmpl new file mode 100644 index 0000000000..3fd8f5d1a8 --- /dev/null +++ b/nano/templates/shuttle_control_console.tmpl @@ -0,0 +1,74 @@ +

Shuttle Status

+
+
+
+ Shuttle Location: +
+
+ {{if !shuttle_loc}} + At station + {{else}} + Offsite + {{/if}} +
+
+
+
+
+
+ Bluespace Drive: +
+
+ {{if shuttle_state == "idle"}} + IDLE + {{else shuttle_state == "warmup"}} + SPINNING UP + {{else shuttle_state == "in_transit"}} + ENGAGED + {{else}} + ERROR + {{/if}} +
+
+
+{{if has_docking}} +
+
+
+ Docking Status: +
+
+ {{if docking_status == "docked"}} + DOCKED + {{else docking_status == "docking"}} + DOCKING + {{else docking_status == "undocking"}} + UNDOCKING + {{else docking_status == "undocked"}} + UNDOCKED + {{else}} + ERROR + {{/if}} +
+
+
+
+
+
+ Docking Override: +
+
+ SAFE +
+
+
+{{/if}} + +

Shuttle Control

+
+
+
+ {{:~link('Launch Shuttle', 'alert', {'move' : '1'}, null : null)}} +
+
+
\ No newline at end of file diff --git a/nano/templates/simple_airlock_console.tmpl b/nano/templates/simple_airlock_console.tmpl index 9975295859..5679295e6e 100644 --- a/nano/templates/simple_airlock_console.tmpl +++ b/nano/templates/simple_airlock_console.tmpl @@ -1,36 +1,49 @@
- Chamber Pressure: + Docking Port Status:
- {{:~displayBar(chamber_pressure, 0, 200, chamber_pressure < 80 || chamber_pressure > 120 ? 'bad' : chamber_pressure < 95 || chamber_pressure > 110 ? 'average' : 'good')}} -
- {{:chamber_pressure}} kPa -
+ {{if docking_status == "docked"}} + {{if !override_enabled}} + DOCKED + {{else}} + DOCKED-OVERRIDE ENABLED + {{/if}} + {{else docking_status == "docking"}} + {{if !override_enabled}} + DOCKING + {{else}} + DOCKING-OVERRIDE ENABLED + {{/if}} + {{else docking_status == "undocking"}} + {{if !override_enabled}} + UNDOCKING + {{else}} + UNDOCKING-OVERRIDE ENABLED + {{/if}} + {{else docking_status == "undocked"}} + {{if !override_enabled}} + UNDOCKED + {{else}} + UNDOCKED-OVERRIDE ENABLED + {{/if}} + {{else}} + ERROR + {{/if}}
-
- {{:~link('Cycle to Exterior', 'arrowthickstop-1-w', {'command' : 'cycle_ext'}, processing ? 'disabled' : null)}} - {{:~link('Cycle to Interior', 'arrowthickstop-1-e', {'command' : 'cycle_int'}, processing ? 'disabled' : null)}} -
- {{if interior_status.state == "open"}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_ext'}, null, 'redBackground')}} + {{if docking_status == "docked"}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} {{else}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_ext'}, null, processing ? 'yellowBackground' : null)}} - {{/if}} - {{if exterior_status.state == "open"}} - {{:~link('Force interior door', 'alert', {'command' : 'force_int'}, null, 'redBackground')}} - {{else}} - {{:~link('Force interior door', 'alert', {'command' : 'force_int'}, null, processing ? 'yellowBackground' : null)}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} {{/if}}
-
- {{:~link('Abort', 'cancel', {'command' : 'abort'}, processing ? null : 'disabled', processing ? 'redBackground' : null)}} -
\ No newline at end of file diff --git a/nano/templates/simple_docking_console.tmpl b/nano/templates/simple_docking_console.tmpl index 5679295e6e..5b6cc6d1e1 100644 --- a/nano/templates/simple_docking_console.tmpl +++ b/nano/templates/simple_docking_console.tmpl @@ -24,7 +24,7 @@ {{/if}} {{else docking_status == "undocked"}} {{if !override_enabled}} - UNDOCKED + UNDOCKED {{else}} UNDOCKED-OVERRIDE ENABLED {{/if}}