mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #6918 from VOREStation/upstream-merge-6826
[MIRROR] Port Landmark Shuttles
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
#define FORCE_LAUNCH 2
|
||||
#define WAIT_ARRIVE 3
|
||||
#define WAIT_FINISH 4
|
||||
#define DO_AUTOPILOT 5
|
||||
|
||||
// Setting this much higher than 1024 could allow spammers to DOS the server easily.
|
||||
#define MAX_MESSAGE_LEN 2048 //VOREStation Edit - I'm not sure about "easily". It can be a little longer.
|
||||
|
||||
@@ -324,9 +324,11 @@ This actually tests if they have the same entries and values.
|
||||
|
||||
// Return a list of the values in an assoc list (including null)
|
||||
/proc/list_values(var/list/L)
|
||||
. = list()
|
||||
for(var/e in L)
|
||||
. += L[e]
|
||||
var/list/V = list()
|
||||
V.len = L.len // Preallocate!
|
||||
for(var/i in 1 to L.len)
|
||||
V[i] = L[L[i]] // We avoid += in case the value is itself a list
|
||||
return V
|
||||
|
||||
//Mergesort: divides up the list into halves to begin the sort
|
||||
/proc/sortKey(var/list/client/L, var/order = 1)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program // Cast to proper type
|
||||
var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program = program // Cast to proper type
|
||||
|
||||
data = list(
|
||||
"chamber_pressure" = round(airlock_program.memory["chamber_sensor_pressure"]),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
unacidable = 1
|
||||
simulated = 0
|
||||
invisibility = 101
|
||||
flags = SLANDMARK_FLAG_AUTOSET // We generally want to use current area/turf as base.
|
||||
|
||||
//ID of the landmark
|
||||
var/landmark_tag
|
||||
@@ -22,17 +23,23 @@
|
||||
var/turf/base_turf
|
||||
//Name of the shuttle, null for generic waypoint
|
||||
var/shuttle_restricted
|
||||
// var/flags = 0 - Already defined on /atom ? Is it being used for anything? Can we reuse it safely?
|
||||
|
||||
/obj/effect/shuttle_landmark/Initialize()
|
||||
. = ..()
|
||||
if(docking_controller)
|
||||
. = INITIALIZE_HINT_LATELOAD
|
||||
|
||||
// Even if this flag is set, hardcoded values take precedence.
|
||||
if(flags & SLANDMARK_FLAG_AUTOSET)
|
||||
base_area = get_area(src)
|
||||
if(ispath(base_area))
|
||||
var/area/A = locate(base_area)
|
||||
if(!istype(A))
|
||||
CRASH("Shuttle landmark \"[landmark_tag]\" couldn't locate area [base_area].")
|
||||
base_area = A
|
||||
else
|
||||
base_area = get_area(src)
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
if(T && !base_turf)
|
||||
base_turf = T.type
|
||||
else
|
||||
base_area = locate(base_area || world.area)
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
// The new arrivals shuttle.
|
||||
/datum/shuttle/ferry/arrivals
|
||||
/datum/shuttle/autodock/ferry/arrivals
|
||||
category = /datum/shuttle/autodock/ferry/arrivals
|
||||
|
||||
name = "Arrivals"
|
||||
location = 1
|
||||
location = FERRY_LOCATION_OFFSITE
|
||||
warmup_time = 25 // Warmup takes 5 seconds, so 30 total.
|
||||
always_process = TRUE
|
||||
var/launch_delay = 3
|
||||
|
||||
area_offsite = /area/shuttle/arrival/pre_game // not really 'pre game' but this area is already defined and unused
|
||||
area_station = /area/shuttle/arrival/station
|
||||
docking_controller_tag = "arrivals_shuttle"
|
||||
dock_target_station = "arrivals_dock"
|
||||
// Maps must implement their own subtype for their arrivals shuttle, and define at least:
|
||||
// shuttle_area
|
||||
// landmark_station (Which should define its dock target)
|
||||
// landmark_offsite
|
||||
// docking_controller_tag
|
||||
|
||||
// For debugging.
|
||||
/obj/machinery/computer/shuttle_control/arrivals
|
||||
@@ -18,36 +21,42 @@
|
||||
shuttle_tag = "Arrivals"
|
||||
|
||||
// Unlike most shuttles, the arrivals shuttle is completely automated, so we need to put some additional code here.
|
||||
|
||||
// Process the arrivals shuttle even when idle.
|
||||
/obj/machinery/computer/shuttle_control/arrivals/process()
|
||||
var/datum/shuttle/autodock/ferry/arrivals/shuttle = SSshuttles.shuttles[shuttle_tag]
|
||||
if(shuttle && shuttle.process_state == IDLE_STATE)
|
||||
shuttle.process()
|
||||
..()
|
||||
|
||||
// This proc checks if anyone is on the shuttle.
|
||||
/datum/shuttle/ferry/arrivals/proc/check_for_passengers(area/A)
|
||||
for(var/mob/living/L in A)
|
||||
return TRUE
|
||||
/datum/shuttle/autodock/ferry/arrivals/proc/check_for_passengers()
|
||||
for(var/area/A in shuttle_area)
|
||||
for(var/mob/living/L in A)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// This is to stop the shuttle if someone tries to stow away when its leaving.
|
||||
/datum/shuttle/ferry/arrivals/post_warmup_checks()
|
||||
/datum/shuttle/autodock/ferry/arrivals/post_warmup_checks()
|
||||
if(!location) // If we're at station.
|
||||
if(check_for_passengers(area_station))
|
||||
if(check_for_passengers())
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/shuttle/ferry/arrivals/process()
|
||||
/datum/shuttle/autodock/ferry/arrivals/process()
|
||||
if(process_state == IDLE_STATE)
|
||||
|
||||
if(location) // If we're off-station (space).
|
||||
if(check_for_passengers(area_offsite)) // No point arriving with an empty shuttle.
|
||||
if(check_for_passengers()) // No point arriving with an empty shuttle.
|
||||
warmup_time = initial(warmup_time)
|
||||
launch()
|
||||
message_passengers(area_offsite, "Arriving at [using_map.station_name] in thirty seconds...")
|
||||
message_passengers("Arriving at [using_map.station_name] in thirty seconds...")
|
||||
spawn(10 SECONDS)
|
||||
message_passengers(area_offsite, "Arriving at [using_map.station_name] in twenty seconds.")
|
||||
message_passengers("Arriving at [using_map.station_name] in twenty seconds.")
|
||||
spawn(10 SECONDS)
|
||||
message_passengers(area_offsite, "Arriving at [using_map.station_name] in ten seconds. Please buckle up.")
|
||||
message_passengers("Arriving at [using_map.station_name] in ten seconds. Please buckle up.")
|
||||
|
||||
else // We are at the station.
|
||||
if(!check_for_passengers(area_station)) // Don't leave with anyone.
|
||||
if(!check_for_passengers()) // Don't leave with anyone.
|
||||
if(launch_delay) // Give some time to get on the docks so people don't get trapped inbetween the dock airlocks.
|
||||
launch_delay--
|
||||
else
|
||||
@@ -58,7 +67,7 @@
|
||||
..() // Do everything else
|
||||
|
||||
/*
|
||||
/datum/shuttle/ferry/arrivals/current_dock_target()
|
||||
/datum/shuttle/autodock/ferry/arrivals/current_dock_target()
|
||||
if(location) // If we're off station.
|
||||
return null // Nothing to dock to in space.
|
||||
return ..()
|
||||
|
||||
@@ -217,4 +217,4 @@
|
||||
return //do nothing for now
|
||||
|
||||
/obj/effect/shuttle_landmark/transit
|
||||
flags = SLANDMARK_FLAG_ZERO_G
|
||||
flags = SLANDMARK_FLAG_ZERO_G|SLANDMARK_FLAG_AUTOSET
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
build_destinations()
|
||||
if(autopilot)
|
||||
flags |= SHUTTLE_FLAGS_PROCESS
|
||||
process_state = DO_AUTOPILOT
|
||||
if(autopilot_first_delay)
|
||||
autopilot_delay = autopilot_first_delay
|
||||
if(!visible_name)
|
||||
@@ -43,8 +44,6 @@
|
||||
/datum/shuttle/autodock/web_shuttle/perform_shuttle_move()
|
||||
..()
|
||||
last_move = world.time
|
||||
active_docking_controller = current_location.docking_controller
|
||||
update_docking_target(current_location)
|
||||
|
||||
/datum/shuttle/autodock/web_shuttle/short_jump()
|
||||
. = ..()
|
||||
@@ -61,6 +60,8 @@
|
||||
|
||||
/datum/shuttle/autodock/web_shuttle/on_shuttle_arrival()
|
||||
. = ..()
|
||||
active_docking_controller = current_location.docking_controller
|
||||
update_docking_target(current_location)
|
||||
web_master.on_shuttle_arrival()
|
||||
update_helmets()
|
||||
|
||||
@@ -131,11 +132,15 @@
|
||||
autopilot = TRUE
|
||||
autopilot_delay = initial(autopilot_delay)
|
||||
shuttle_controller.process_shuttles |= src
|
||||
if(process_state == IDLE_STATE)
|
||||
process_state = DO_AUTOPILOT
|
||||
else
|
||||
if(!autopilot)
|
||||
return
|
||||
autopilot = FALSE
|
||||
shuttle_controller.process_shuttles -= src
|
||||
if (process_state == DO_AUTOPILOT)
|
||||
process_state = initial(process_state)
|
||||
|
||||
/datum/shuttle/autodock/web_shuttle/proc/autopilot_say(message) // Makes the autopilot 'talk' to the passengers.
|
||||
var/padded_message = "<span class='game say'><span class='name'>shuttle autopilot</span> states, \"[message]\"</span>"
|
||||
|
||||
@@ -20,7 +20,7 @@ Shuttle destinations are represented by `/obj/effect/shuttle_landmark` objects o
|
||||
* `base_area` - Type path of the `/area` that should be here when a shuttle is *not* present.
|
||||
* `base_turf` - Type path of the `/turf` that should be here when a shuttle is *not* present.
|
||||
* `shuttle_restricted` - If not null, only the named shuttle is allowed to use this landmark. (TODO: Overmap functionality)
|
||||
* `flags` - Bitfield - defaults to zero, can be any combination of:
|
||||
* `flags` - Bitfield - defaults to `SLANDMARK_FLAG_AUTOSET`, can be any combination of:
|
||||
* `SLANDMARK_FLAG_AUTOSET` (1) - If set, will initialize base_area and base_turf to same as where it was spawned at.
|
||||
* `SLANDMARK_FLAG_ZERO_G` (2) - If set, Zero-G shuttles moved here will lose gravity unless the area has ambient gravity.
|
||||
* `special_dock_targets` - Used to configure shuttles with multiple docking controllers on the shuttle. Map of shuttle `name` -> `id_tag` of the docking controller it should use for this landmark. (Think of a shuttle with airlocks on both sides, each with their own controller. This would tell it which side to use.)
|
||||
|
||||
Reference in New Issue
Block a user