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 20:15:31 +02:00
committed by GitHub
parent cf7fe3eff7
commit 2e5fdf970c
100 changed files with 15780 additions and 16628 deletions

View File

@@ -185,7 +185,6 @@ var/list/gamemode_cache = list()
var/use_discord_pins = 0
var/python_path = "python" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
var/use_overmap = 0
// Event settings
var/expected_round_length = 3 * 60 * 60 * 10 // 3 hours
@@ -719,9 +718,6 @@ var/list/gamemode_cache = list()
if("max_maint_drones")
config.max_maint_drones = text2num(value)
if("use_overmap")
config.use_overmap = 1
if("expected_round_length")
config.expected_round_length = MinutesToTicks(text2num(value))

View File

@@ -5,7 +5,7 @@
flags = SS_NO_INIT | SS_BACKGROUND | SS_NO_TICK_CHECK
priority = SS_PRIORITY_ARRIVALS
var/datum/shuttle/ferry/arrival/shuttle
var/datum/shuttle/autodock/ferry/arrival/shuttle
var/launch_time //the time at which the shuttle will be launched
var/wait_for_launch = 0 //if the shuttle is waiting to launch
@@ -21,8 +21,8 @@
// Timing.
if (world.time >= launch_time) //time to launch the shuttle
stop_launch_countdown()
shuttle.launch(src)
for (var/thing in current_mobs)
shuttle.try_jump()
for(var/thing in current_mobs)
var/mob/living/carbon/human/M = locate(thing)
if (istype(M) && M.centcomm_despawn_timer)
deltimer(M.centcomm_despawn_timer)
@@ -38,7 +38,6 @@
if (!shuttle.location)
return
if (istype(M))
current_mobs += SOFTREF(M)

View File

@@ -37,7 +37,7 @@ var/datum/controller/subsystem/cargo/SScargo
//shuttle movement
var/movetime = 1200
var/min_movetime = 1200
var/datum/shuttle/ferry/supply/shuttle
var/datum/shuttle/autodock/ferry/supply/shuttle
//Item vars
var/last_item_id = 0 //The ID of the last item that has been added
@@ -582,16 +582,15 @@ var/datum/controller/subsystem/cargo/SScargo
//Sells stuff on the shuttle to centcom
/datum/controller/subsystem/cargo/proc/sell()
var/area/area_shuttle = shuttle.get_location_area()
if(!area_shuttle) return
if(!shuttle.shuttle_area)
return
var/msg = ""
var/matched_bounty = FALSE
var/sold_atoms = ""
for(var/place in area_shuttle)
var/area/shuttle/shuttle_area = place
for(var/atom/movable/AM in shuttle_area)
for(var/area/subarea in shuttle.shuttle_area)
for(var/atom/movable/AM in subarea)
if(bounty_ship_item_and_contents(AM, dry_run = FALSE))
matched_bounty = TRUE
if(!AM.anchored)
@@ -626,22 +625,23 @@ var/datum/controller/subsystem/cargo/SScargo
var/list/approved_orders = get_orders_by_status("approved",0)
var/area/area_shuttle = shuttle.get_location_area()
if(!area_shuttle)
return 0
if(!shuttle.shuttle_area)
return
var/list/clear_turfs = list()
for(var/turf/T in area_shuttle)
if(T.density) continue
var/contcount
for(var/atom/A in T.contents)
if(!A.simulated)
for(var/area/subarea in shuttle.shuttle_area)
for(var/turf/T in subarea)
if(T.density)
continue
contcount++
if(contcount)
continue
clear_turfs += T
var/contcount
for(var/atom/A in T.contents)
if(!A.simulated)
continue
contcount++
if(contcount)
continue
clear_turfs += T
for(var/datum/cargo_order/co in approved_orders)
if(!co)

View File

@@ -4,8 +4,7 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
name = "Emergency Shuttle"
flags = SS_NO_TICK_CHECK | SS_NO_INIT
var/datum/shuttle/ferry/emergency/shuttle
var/list/escape_pods
var/datum/shuttle/autodock/ferry/emergency/shuttle
var/launch_time //the time at which the shuttle will be launched
var/force_time //the time at which the shuttle will be forced
@@ -22,7 +21,6 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
/datum/controller/subsystem/emergency_shuttle/Recover()
// Just copy all the stuff over.
src.shuttle = emergency_shuttle.shuttle
src.escape_pods = emergency_shuttle.escape_pods
src.launch_time = emergency_shuttle.launch_time
src.auto_recall = emergency_shuttle.auto_recall
src.auto_recall_time = emergency_shuttle.auto_recall_time
@@ -35,6 +33,8 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
NEW_SS_GLOBAL(emergency_shuttle)
/datum/controller/subsystem/emergency_shuttle/fire()
if(!shuttle)
return
if (wait_for_launch)
if (evac && auto_recall && world.time >= auto_recall_time)
recall()
@@ -43,7 +43,7 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
if (!shuttle.location) //leaving from the station
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
for (var/datum/shuttle/autodock/ferry/escape_pod/pod in escape_pods)
if (!pod.arming_controller || pod.arming_controller.armed)
pod.launch(src)
@@ -75,9 +75,9 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
//arm the escape pods
if (evac)
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
for (var/datum/shuttle/autodock/ferry/escape_pod/pod in escape_pods)
if (pod.arming_controller)
pod.arming_controller.arm()
pod.arming_controller.arm()
//begins the launch countdown and sets the amount of time left until launch
/datum/controller/subsystem/emergency_shuttle/proc/set_launch_countdown(var/seconds)
@@ -186,6 +186,8 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
//returns 1 if the shuttle is docked at the station and waiting to leave
/datum/controller/subsystem/emergency_shuttle/proc/waiting_to_leave()
if(!shuttle)
return
if (shuttle.location)
return 0 //not at station
return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT)
@@ -212,6 +214,8 @@ var/datum/controller/subsystem/emergency_shuttle/emergency_shuttle
return (launch_time - world.time)/10
/datum/controller/subsystem/emergency_shuttle/proc/has_eta()
if(!shuttle)
return
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle has gone to the station and come back at least once,

View File

@@ -378,7 +378,7 @@
SearchVar(SSnanoui)
SearchVar(SSpipenet)
SearchVar(SSprocessing)
SearchVar(shuttle_controller)
SearchVar(SSshuttle)
SearchVar(base_law_type)
SearchVar(discord_bot)
SearchVar(diseases)

View File

@@ -31,8 +31,6 @@
setupgenetics()
shuttle_controller.setup_shuttle_docks()
if (config.fastboot)
admin_notice("<span class='notice'><b>Fastboot is enabled; some features may not be available.</b></span>", R_DEBUG)

View File

@@ -1,81 +1,78 @@
var/datum/controller/subsystem/processing/shuttle/shuttle_controller
var/datum/controller/subsystem/processing/shuttle/SSshuttle
/datum/controller/subsystem/processing/shuttle
name = "Shuttles"
init_order = SS_INIT_SHUTTLE
name = "Shuttle"
wait = 2 SECONDS
flags = 0
priority = SS_PRIORITY_SHUTTLE
flags = 0 // Override parent.
var/list/shuttles
init_order = SS_INIT_MISC //Should be initialized after all maploading is over and atoms are initialized, to ensure that landmarks have been initialized.
var/list/shuttles = list() //maps shuttle tags to shuttle datums, so that they can be looked up.
var/list/process_shuttles = list() //simple list of shuttles, for processing
var/list/registered_shuttle_landmarks = list()
var/last_landmark_registration_time
var/list/docking_registry = list() //Docking controller tag -> docking controller program, mostly for init purposes.
var/list/shuttle_areas = list() //All the areas of all shuttles.
var/list/shuttles_to_initialize = list() //A queue for shuttles to initialize at the appropriate time.
var/block_queue = TRUE
var/tmp/list/working_shuttles
/datum/controller/subsystem/processing/shuttle/New()
NEW_SS_GLOBAL(shuttle_controller)
shuttles = list()
NEW_SS_GLOBAL(SSshuttle)
/datum/controller/subsystem/processing/shuttle/Recover()
src.shuttles = shuttle_controller.shuttles
/datum/controller/subsystem/processing/shuttle/Initialize()
last_landmark_registration_time = world.time
for(var/shuttle_type in subtypesof(/datum/shuttle)) // This accounts for most shuttles, though away maps can queue up more.
var/datum/shuttle/shuttle = shuttle_type
if(!(shuttle in current_map.map_shuttles))
continue
if(!initial(shuttle.defer_initialisation))
LAZYDISTINCTADD(shuttles_to_initialize, shuttle_type)
block_queue = FALSE
clear_init_queue()
. = ..()
/datum/controller/subsystem/processing/shuttle/proc/setup_shuttle_docks()
for(var/shuttle_tag in shuttles)
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
shuttle.init_docking_controllers()
shuttle.dock() //makes all shuttles docked to something at round start go into the docked state
/datum/controller/subsystem/processing/shuttle/fire(resumed = FALSE)
if (!resumed)
working_shuttles = process_shuttles.Copy()
for(var/obj/machinery/embedded_controller/C in SSmachinery.processing_machines)
if(istype(C.program, /datum/computer/file/embedded_program/docking))
C.program.tag = null //clear the tags, 'cause we don't need 'em anymore
while(working_shuttles.len)
var/datum/shuttle/shuttle = working_shuttles[working_shuttles.len]
working_shuttles.len--
if(shuttle.process_state && (shuttle.process(wait, times_fired, src) == PROCESS_KILL))
process_shuttles -= shuttle
/datum/controller/subsystem/processing/shuttle/Initialize(timeofday)
var/datum/shuttle/ferry/shuttle
if(TICK_CHECK)
return
// Escape shuttle.
shuttle = new/datum/shuttle/ferry/emergency()
shuttle.location = 1
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/shuttle/escape/centcom)
shuttle.area_station = locate(/area/shuttle/escape/station)
shuttle.area_transition = locate(/area/shuttle/escape/transit)
shuttle.docking_controller_tag = "escape_shuttle"
shuttle.dock_target_station = "escape_dock"
shuttle.dock_target_offsite = "centcom_dock"
shuttle.transit_direction = NORTH
shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN
//shuttle.docking_controller_tag = "supply_shuttle"
//shuttle.dock_target_station = "cargo_bay"
shuttles["Escape"] = shuttle
START_PROCESSING(shuttle_controller, shuttle)
if(!shuttle)
log_debug("Escape shuttle does not exist!")
else
emergency_shuttle.shuttle = shuttle
/datum/controller/subsystem/processing/shuttle/proc/clear_init_queue()
if(block_queue)
return
initialize_shuttles()
// Supply shuttle
shuttle = new/datum/shuttle/ferry/supply()
shuttle.location = 1
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/supply/dock)
shuttle.area_station = locate(/area/supply/station)
shuttle.docking_controller_tag = "supply_shuttle"
shuttle.dock_target_station = "cargo_bay"
shuttles["Supply"] = shuttle
START_PROCESSING(shuttle_controller, shuttle)
/datum/controller/subsystem/processing/shuttle/proc/initialize_shuttles()
var/list/shuttles_made = list()
for(var/shuttle_type in shuttles_to_initialize)
var/shuttle = initialize_shuttle(shuttle_type)
if(shuttle)
shuttles_made += shuttle
shuttles_to_initialize = null
SScargo.shuttle = shuttle
/datum/controller/subsystem/processing/shuttle/proc/register_landmark(shuttle_landmark_tag, obj/effect/shuttle_landmark/shuttle_landmark)
if (registered_shuttle_landmarks[shuttle_landmark_tag])
CRASH("Attempted to register shuttle landmark with tag [shuttle_landmark_tag], but it is already registered!")
if (istype(shuttle_landmark))
registered_shuttle_landmarks[shuttle_landmark_tag] = shuttle_landmark
last_landmark_registration_time = world.time
shuttle = new/datum/shuttle/ferry/arrival()
shuttle.location = 1
shuttle.warmup_time = 5
shuttle.area_station = locate(/area/shuttle/arrival/station)
shuttle.area_offsite = locate(/area/shuttle/arrival/centcom)
shuttle.area_transition = locate(/area/shuttle/arrival/transit)
shuttle.docking_controller_tag = "arrival_shuttle"
shuttle.dock_target_station = "arrival_dock"
shuttle.dock_target_offsite = "centcom_setup"
shuttle.transit_direction = EAST
shuttle.move_time = 60
shuttles["Arrival"] = shuttle
START_PROCESSING(shuttle_controller, shuttle)
/datum/controller/subsystem/processing/shuttle/proc/get_landmark(var/shuttle_landmark_tag)
return registered_shuttle_landmarks[shuttle_landmark_tag]
SSarrivals.shuttle = shuttle
current_map.setup_shuttles()
..()
/datum/controller/subsystem/processing/shuttle/proc/initialize_shuttle(var/shuttle_type)
var/datum/shuttle/shuttle = shuttle_type
if(initial(shuttle.category) != shuttle_type)
shuttle = new shuttle()
shuttle_areas |= shuttle.shuttle_area
return shuttle