Landmark Shuttles (#8512)

The lifeless live again. Or in this case, what never actually lived here.

Ports Baystation12/Baystation12#17460 probably for real this time. What this allows us to do is create shuttles on runtime and make shuttles easier by just making landmarks and a shuttle instead of areas and shuttles. Also allows runtime landmark creation via flares or whatever AND allows shuttles to use different landmarks at will.

I removed most of the overmap stuff, I think. It shouldn't be hard to slam it in whenever we need to.

Changes:

    "Shuttle code has been completely reworked."
    "Shuttles can now be modified to have more than one destination."
    "Shuttles now have a takeoff sound."
    "You can now throw mobs against walls to damage them. A lot."
    "You now need a neckgrab to throw mobs."
    "BEING UNBUCKLED DURING SHUTTLE LAUNCH IS DANGEROUS! Don't do it."
    "Adminghosts can now interact with all shuttles."
This commit is contained in:
Matt Atlas
2020-04-05 21:15:31 +03:00
committed by GitHub
parent cf7fe3eff7
commit 2e5fdf970c
100 changed files with 15780 additions and 16628 deletions
+74 -54
View File
@@ -1,102 +1,122 @@
/obj/machinery/computer/shuttle_control
name = "shuttle control console"
icon = 'icons/obj/computer.dmi'
icon_screen = "explosive"
light_color = LIGHT_COLOR_ORANGE
light_color = LIGHT_COLOR_CYAN
icon_screen = "shuttle"
circuit = null
var/shuttle_tag // Used to coordinate data in shuttle controller.
var/hacked = FALSE // Has been emagged, no access restrictions.
var/shuttle_tag // Used to coordinate data in shuttle controller.
var/hacked = 0 // Has been emagged, no access restrictions.
/obj/machinery/computer/shuttle_control/attack_hand(user as mob)
if(..(user))
return
//src.add_fingerprint(user) //shouldn't need fingerprints just for looking at it.
if(!allowed(user))
to_chat(user, "<span class='warning'>Access Denied.</span>")
return 1
var/ui_template = "shuttle_control_console.tmpl"
/obj/machinery/computer/shuttle_control/attack_hand(mob/user)
ui_interact(user)
/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
/obj/machinery/computer/shuttle_control/attack_ai(mob/user)
ui_interact(user)
/obj/machinery/computer/shuttle_control/attack_ghost(var/mob/abstract/observer/user)
if(check_rights(R_ADMIN, 0, user))
ui_interact(user)
/obj/machinery/computer/shuttle_control/proc/get_ui_data(var/datum/shuttle/autodock/shuttle)
var/shuttle_state
switch(shuttle.moving_status)
if(SHUTTLE_IDLE) shuttle_state = "idle"
if(SHUTTLE_WARMUP) shuttle_state = "warmup"
if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit"
if(SHUTTLE_HALT) shuttle_state = "halt"
var/shuttle_status
switch (shuttle.process_state)
if(IDLE_STATE)
var/cannot_depart = shuttle.current_location.cannot_depart(shuttle)
if (shuttle.in_use)
shuttle_status = "Busy."
else if (!shuttle.location)
shuttle_status = "Standing-by at station."
else if(cannot_depart)
shuttle_status = cannot_depart
else
shuttle_status = "Standing-by at offsite location."
shuttle_status = "Standing-by at \the [shuttle.get_location_name()]."
if(WAIT_LAUNCH, FORCE_LAUNCH)
shuttle_status = "Shuttle has received command and will depart shortly."
shuttle_status = "Shuttle has recieved command and will depart shortly."
if(WAIT_ARRIVE)
shuttle_status = "Proceeding to destination."
shuttle_status = "Proceeding to \the [shuttle.get_destination_name()]."
if(WAIT_FINISH)
shuttle_status = "Arriving at destination now."
data = list(
return list(
"shuttle_status" = shuttle_status,
"shuttle_state" = shuttle_state,
"has_docking" = shuttle.docking_controller? 1 : 0,
"docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
"docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
"has_docking" = shuttle.active_docking_controller? 1 : 0,
"docking_status" = shuttle.active_docking_controller? shuttle.active_docking_controller.get_docking_status() : null,
"docking_override" = shuttle.active_docking_controller? shuttle.active_docking_controller.override_enabled : null,
"can_launch" = shuttle.can_launch(),
"can_cancel" = shuttle.can_cancel(),
"can_force" = shuttle.can_force()
"can_force" = shuttle.can_force(),
)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
// This is a subset of the actual checks; contains those that give messages to the user.
/obj/machinery/computer/shuttle_control/proc/can_move(var/datum/shuttle/autodock/shuttle, var/user)
var/cannot_depart = shuttle.current_location.cannot_depart(shuttle)
if(cannot_depart)
to_chat(user, SPAN_WARNING(cannot_depart))
return FALSE
if(!shuttle.next_location.is_valid(shuttle))
to_chat(user, SPAN_WARNING("Destination zone is invalid or obstructed."))
return FALSE
return TRUE
if (!ui)
ui = new(user, src, ui_key, "shuttle_control_console.tmpl", "[shuttle_tag] Shuttle Control", 470, 310)
/obj/machinery/computer/shuttle_control/proc/handle_topic_href(var/datum/shuttle/autodock/shuttle, var/list/href_list, var/user)
if(!istype(shuttle))
return TOPIC_NOACTION
if(href_list["move"])
if(can_move(shuttle, user))
shuttle.launch(src)
return TOPIC_REFRESH
return TOPIC_HANDLED
if(href_list["force"])
if(can_move(shuttle, user))
shuttle.force_launch(src)
return TOPIC_REFRESH
return TOPIC_HANDLED
if(href_list["cancel"])
shuttle.cancel_launch(src)
return TOPIC_REFRESH
/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/datum/shuttle/autodock/shuttle = SSshuttle.shuttles[shuttle_tag]
if (!istype(shuttle))
to_chat(user,"<span class='warning'>Unable to establish link with the shuttle.</span>")
return
var/list/data = get_ui_data(shuttle)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
ui = new(user, src, ui_key, ui_template, "[shuttle_tag] Shuttle Control", 470, 450)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/shuttle_control/Topic(href, href_list)
if(..())
return 1
/obj/machinery/computer/shuttle_control/Topic(user, href_list)
..()
usr.set_machine(src)
src.add_fingerprint(usr)
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
if(href_list["move"])
shuttle.launch(src)
if(href_list["force"])
shuttle.force_launch(src)
else if(href_list["cancel"])
shuttle.cancel_launch(src)
handle_topic_href(SSshuttle.shuttles[shuttle_tag], href_list, user)
/obj/machinery/computer/shuttle_control/emag_act(var/remaining_charges, var/mob/user)
if (!hacked)
if(!hacked)
req_access = list()
req_one_access = list()
hacked = 1
hacked = TRUE
to_chat(user, "You short out the console's ID checking system. It's now available to everyone!")
return 1
return TRUE
/obj/machinery/computer/shuttle_control/bullet_act(var/obj/item/projectile/Proj)
visible_message("\The [Proj] ricochets off \the [src]!")
/obj/machinery/computer/shuttle_control/ex_act(var/severity = 2.0)
/obj/machinery/computer/shuttle_control/ex_act()
return
/obj/machinery/computer/shuttle_control/emp_act()