Merge pull request #3065 from Neerti/3/6/2017_invisible_spaceships

Ports Vore's Space Traffic Controller feature.
This commit is contained in:
Anewbe
2017-03-13 15:59:09 -05:00
committed by GitHub
7 changed files with 485 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if(istype(A, /area/hallway))
A.readyalert()
atc.reroute_traffic(yes = 1)
//calls the shuttle for a routine crew transfer
/datum/emergency_shuttle_controller/proc/call_transfer()
if(!can_call()) return
@@ -98,6 +100,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
shuttle.move_time = SHUTTLE_TRANSIT_DURATION
priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_called_message, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"))
atc.shift_ending()
//recalls the shuttle
/datum/emergency_shuttle_controller/proc/recall()

View File

@@ -35,10 +35,12 @@
var/stat_msg1
var/stat_msg2
var/datum/lore/atc_controller/ATC
var/datum/announcement/priority/crew_announcement = new
/obj/machinery/computer/communications/New()
..()
ATC = atc
crew_announcement.newscast = 1
/obj/machinery/computer/communications/process()
@@ -130,6 +132,8 @@
if("messagelist")
src.currmsg = 0
src.state = STATE_MESSAGELIST
if("toggleatc")
src.ATC.squelched = !src.ATC.squelched
if("viewmessage")
src.state = STATE_VIEWMESSAGE
if (!src.currmsg)
@@ -311,6 +315,7 @@
else
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=login'>Log In</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=messagelist'>Message List</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=toggleatc'>[ATC.squelched ? "Enable" : "Disable"] ATC Relay</A> \]"
if(STATE_CALLSHUTTLE)
dat += "Are you sure you want to call the shuttle? \[ <A HREF='?src=\ref[src];operation=callshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]"
if(STATE_CANCELSHUTTLE)
@@ -374,6 +379,7 @@
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-callshuttle'>Call Emergency Shuttle</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-messagelist'>Message List</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=ai-status'>Set Status Display</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=toggleatc'>[ATC.squelched ? "Enable" : "Disable"] ATC Relay</A> \]"
if(STATE_CALLSHUTTLE)
dat += "Are you sure you want to call the shuttle? \[ <A HREF='?src=\ref[src];operation=ai-callshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=ai-main'>Cancel</A> \]"
if(STATE_MESSAGELIST)

View File

@@ -0,0 +1,129 @@
//Cactus, Speedbird, Dynasty, oh my
var/datum/lore/atc_controller/atc = new/datum/lore/atc_controller
/datum/lore/atc_controller
var/delay_max = 25 MINUTES //How long between ATC traffic, max. Default is 25 mins.
var/delay_min = 40 MINUTES //How long between ATC traffic, min. Default is 40 mins.
var/backoff_delay = 5 MINUTES //How long to back off if we can't talk and want to. Default is 5 mins.
var/next_message //When the next message should happen in world.time
var/force_chatter_type //Force a specific type of messages
var/squelched = 0 //If ATC is squelched currently
/datum/lore/atc_controller/New()
spawn(10 SECONDS) //Lots of lag at the start of a shift.
msg("New shift beginning, resuming traffic control.")
next_message = world.time + rand(delay_min,delay_max)
process()
/datum/lore/atc_controller/proc/process()
if(world.time >= next_message)
if(squelched)
next_message = world.time + backoff_delay
else
next_message = world.time + rand(delay_min,delay_max)
random_convo()
spawn(1 MINUTE) //We don't really need high-accuracy here.
process()
/datum/lore/atc_controller/proc/msg(var/message,var/sender)
ASSERT(message)
global_announcer.autosay("[message]", sender ? sender : "[using_map.station_short] Space Control")
/datum/lore/atc_controller/proc/reroute_traffic(var/yes = 1)
if(yes)
if(!squelched)
msg("Rerouting traffic away from [using_map.station_name].")
squelched = 1
else
if(squelched)
msg("Resuming normal traffic routing around [using_map.station_name].")
squelched = 0
/datum/lore/atc_controller/proc/shift_ending(var/evac = 0)
msg("Automated Shuttle departing [using_map.station_name] for [using_map.dock_name] on routine transfer route.","NT Automated Shuttle")
sleep(5 SECONDS)
msg("Automated Shuttle, cleared to complete routine transfer from [using_map.station_name] to [using_map.dock_name].")
/datum/lore/atc_controller/proc/random_convo()
var/one = pick(loremaster.organizations) //These will pick an index, not an instance
var/two = pick(loremaster.organizations)
var/datum/lore/organization/source = loremaster.organizations[one] //Resolve to the instances
var/datum/lore/organization/dest = loremaster.organizations[two]
//Let's get some mission parameters
var/owner = source.short_name //Use the short name
var/prefix = pick(source.ship_prefixes) //Pick a random prefix
var/mission = source.ship_prefixes[prefix] //The value of the prefix is the mission type that prefix does
var/shipname = pick(source.ship_names) //Pick a random ship name to go with it
var/destname = pick(dest.destination_names) //Pick a random holding from the destination
var/combined_name = "[owner] [prefix] [shipname]"
var/alt_atc_names = list("[using_map.station_short] TraCon","[using_map.station_short] Control","[using_map.station_short] STC","[using_map.station_short] Airspace")
var/wrong_atc_names = list("Sol Command","Orion Control", "[using_map.dock_name]")
var/mission_noun = list("flight","mission","route")
var/request_verb = list("requesting","calling for","asking for")
//First response is 'yes', second is 'no'
var/requests = list("[using_map.station_short] transit clearance" = list("permission for transit granted", "permission for transit denied, contact regional on 953.5"),
"planetary flight rules" = list("authorizing planetary flight rules", "denying planetary flight rules right now due to traffic"),
"special flight rules" = list("authorizing special flight rules", "denying special flight rules, not allowed for your traffic class"),
"current solar weather info" = list("sending you the relevant information via tightbeam", "cannot fulfill your request at the moment"),
"nearby traffic info" = list("sending you current traffic info", "no available info in your area"),
"remote telemetry data" = list("sending telemetry now", "no uplink from your ship, recheck your uplink and ask again"),
"refueling information" = list("sending refueling information now", "no fuel for your ship class in this sector"),
"a current system time sync" = list("sending time sync ping to you now", "your ship isn't compatible with our time sync, set time manually"),
"current system starcharts" = list("transmitting current starcharts", "your request is queued, overloaded right now"),
"permission to engage FTL" = list("permission to engage FTL granted, good day", "permission denied, wait for current traffic to pass"),
"permission to transit system" = list("permission to transit granted, good day", "permission denied, wait for current traffic to pass"),
"permission to depart system" = list("permission to depart granted, good day", "permission denied, wait for current traffic to pass"),
"permission to enter system" = list("good day, permission to enter granted", "permission denied, wait for current traffic to pass"),
)
//Random chance things for variety
var/chatter_type = "normal"
if(force_chatter_type)
chatter_type = force_chatter_type
else
chatter_type = pick(2;"emerg",5;"wrong_freq","normal") //Be nice to have wrong_lang...
var/yes = prob(90) //Chance for them to say yes vs no
var/request = pick(requests)
var/callname = pick(alt_atc_names)
var/response = requests[request][yes ? 1 : 2] //1 is yes, 2 is no
var/full_request
var/full_response
var/full_closure
switch(chatter_type)
if("wrong_freq")
callname = pick(wrong_atc_names)
full_request = "[callname], this is [combined_name] on a [mission] [pick(mission_noun)] to [destname], [pick(request_verb)] [request]."
full_response = "[combined_name], this is [using_map.station_short] TraCon, wrong frequency. Switch to [rand(700,999)].[rand(1,9)]."
full_closure = "[using_map.station_short] TraCon, understood, apologies."
if("wrong_lang")
//Can't implement this until autosay has language support
if("emerg")
var/problem = pick("hull breaches on multiple decks","unknown life forms on board","a drive about to go critical","asteroids impacting the hull","a total loss of engine power","people trying to board the ship")
full_request = "This is [combined_name] declaring an emergency! We have [problem]!"
full_response = "[combined_name], this is [using_map.station_short] TraCon, copy. Switch to emergency responder channel [rand(700,999)].[rand(1,9)]."
full_closure = "[using_map.station_short] TraCon, okay, switching now."
else
full_request = "[callname], this is [combined_name] on a [mission] [pick(mission_noun)] to [destname], [pick(request_verb)] [request]."
full_response = "[combined_name], this is [using_map.station_short] TraCon, [response]." //Station TraCon always calls themselves TraCon
full_closure = "[using_map.station_short] TraCon, [yes ? "thank you" : "understood"], good day." //They always copy what TraCon called themselves in the end when they realize they said it wrong
//Ship sends request to ATC
msg(full_request,"[prefix] [shipname]")
sleep(5 SECONDS)
//ATC sends response to ship
msg(full_response)
sleep(5 SECONDS)
//Ship sends response to ATC
msg(full_closure,"[prefix] [shipname]")
return

View File

@@ -0,0 +1,13 @@
//I AM THE LOREMASTER, ARE YOU THE GATEKEEPER?
var/datum/lore/loremaster/loremaster = new/datum/lore/loremaster
/datum/lore/loremaster
var/list/organizations = list()
/datum/lore/loremaster/New()
var/list/paths = typesof(/datum/lore/organization) - /datum/lore/organization
for(var/path in paths)
var/datum/lore/organization/instance = new path()
organizations[path] = instance

View File

@@ -0,0 +1,326 @@
//Datums for different companies that can be used by busy_space
/datum/lore/organization
var/name = "" // Organization's name
var/short_name = "" // Organization's shortname (NanoTrasen for "NanoTrasen Incorporated")
var/desc = "" // One or two paragraph description of the organization, but only current stuff. Currently unused.
var/history = "" // Historical discription of the organization's origins Currently unused.
var/work = "" // Short description of their work, eg "an arms manufacturer"
var/headquarters = "" // Location of the organization's HQ. Currently unused.
var/motto = "" // A motto/jingle/whatever, if they have one. Currently unused.
var/list/ship_prefixes = list() //Some might have more than one! Like NanoTrasen. Value is the mission they perform, e.g. ("ABC" = "mission desc")
var/list/ship_names = list( //Names of spaceships. This is a mostly generic list that all the other organizations inherit from if they don't have anything better.
"Kestrel",
"Beacon",
"Signal",
"Freedom",
"Glory",
"Axiom",
"Eternal",
"Icarus",
"Harmony",
"Light",
"Discovery",
"Endeavour",
"Explorer",
"Swift",
"Dragonfly",
"Ascendant",
"Tenacious",
"Pioneer",
"Hawk",
"Haste",
"Radiant",
"Luminous"
)
var/list/destination_names = list() //Names of static holdings that the organization's ships visit regularly.
var/autogenerate_destination_names = TRUE
/datum/lore/organization/New()
..()
if(autogenerate_destination_names) // Lets pad out the destination names.
var/i = rand(6, 10)
var/list/star_names = list(
"Sol", "Alpha Centauri", "Sirius", "Vega", "Regulus", "Vir", "Algol", "Aldebaran",
"Delta Doradus", "Menkar", "Geminga", "Elnath", "Gienah", "Mu Leporis", "Nyx", "Tau Ceti",
"Wazn", "Alphard", "Phact", "Altair")
var/list/destination_types = list("dockyard", "station", "vessel", "waystation", "telecommunications satellite", "spaceport", "distress beacon", "anomaly", "colony", "outpost")
while(i)
destination_names.Add("a [pick(destination_types)] in [pick(star_names)]")
i--
//////////////////////////////////////////////////////////////////////////////////
// TSCs
/datum/lore/organization/nanotrasen
name = "NanoTrasen Incorporated"
short_name = "NanoTrasen"
desc = "" // Todo: Write this.
history = "" // This too.
work = "research giant"
headquarters = "Luna"
motto = ""
ship_prefixes = list("NSV" = "exploration", "NTV" = "hauling", "NDV" = "patrol", "NRV" = "emergency response")
// Note that the current station being used will be pruned from this list upon being instantiated
destination_names = list(
"NSS Exodus in Nyx",
"NCS Northern Star in Vir",
"NCS Southern Cross in Vir",
"NDV Icarus in Nyx",
"NAS Vir Central Command",
"a dockyard orbiting Sif",
"an asteroid orbiting Kara",
"an asteroid orbiting Rota",
"Vir Interstellar Spaceport"
)
/datum/lore/organization/nanotrasen/New()
..()
// Get rid of the current map from the list, so ships flying in don't say they're coming to the current map.
var/string_to_test = "[using_map.station_name] in [using_map.starsys_name]"
if(string_to_test in destination_names)
destination_names.Remove(string_to_test)
/datum/lore/organization/hephaestus
name = "Hephaestus Industries"
short_name = "Hephaestus"
desc = "Hephaestus Industries is the largest supplier of arms, ammunition, and small millitary vehicles in Sol space. \
Hephaestus products have a reputation for reliability, and the corporation itself has a noted tendency to stay removed \
from corporate politics. They enforce their neutrality with the help of a fairly large asset-protection contingent which \
prevents any contracting polities from using their own materiel against them. SolGov itself is one of Hephastus<75> largest \
bulk contractors owing to the above factors."
history = ""
work = "arms manufacturer"
headquarters = ""
motto = ""
ship_prefixes = list("HTV" = "freight", "HTV" = "munitions resupply")
destination_names = list(
"a SolGov dockyard on Luna"
)
/datum/lore/organization/vey_med
name = "Vey Medical"
short_name = "Vey Med"
desc = "Vey-Med is one of the newer TSCs on the block and is notable for being largely owned and opperated by Skrell. \
Despite the suspicion and prejudice leveled at them for their alien origin, Vey-Med has obtained market dominance in \
the sale of medical equipment-- from surgical tools to large medical devices to the Oddyseus trauma response mecha \
and everything in between. Their equipment tends to be top-of-the-line, most obviously shown by their incredibly \
human-like FBP designs. Vey<65>s rise to stardom came from their introduction of ressurective cloning, although in \
recent years they<65>ve been forced to diversify as their patents expired and NanoTrasen-made medications became \
essential to modern cloning."
history = ""
work = "medical equipment supplier"
headquarters = ""
motto = ""
ship_prefixes = list("VTV" = "transportation", "VMV" = "medical resupply")
destination_names = list()
/datum/lore/organization/zeng_hu
name = "Zeng-Hu pharmaceuticals"
short_name = "Zeng-Hu"
desc = "Zeng-Hu is an old TSC, based in the Sol system. Until the discovery of Phoron, Zeng-Hu maintained a stranglehold \
on the market for medications, and many household names are patentted by Zeng-Hu-- Bicaridyne, Dylovene, Tricordrizine, \
and Dexalin all came from a Zeng-Hu medical laboratory. Zeng-Hu<48>s fortunes have been in decline as Nanotrasen<65>s near monopoly \
on phoron research cuts into their R&D and Vey-Med<65>s superior medical equipment effectively decimated their own equipment \
interests. The three-way rivalry between these companies for dominance in the medical field is well-known and a matter of \
constant economic speculation."
history = ""
work = "pharmaceuticals company"
headquarters = ""
motto = ""
ship_prefixes = list("ZTV" = "transportation", "ZMV" = "medical resupply")
destination_names = list()
/datum/lore/organization/ward_takahashi
name = "Ward-Takahashi General Manufacturing Conglomerate"
short_name = "Ward-Takahashi"
desc = "Ward-Takahashi focuses on the sale of small consumer electronics, with its computers, communicators, \
and even mid-class automobiles a fixture of many households. Less famously, Ward-Takahashi also supplies most \
of the AI cores on which vital control systems are mounted, and it is this branch of their industry that has \
led to their tertiary interest in the development and sale of high-grade AI systems. Ward-Takahashi<68>s economies \
of scale frequently steal market share from Nanotrasen<65>s high-price products, leading to a bitter rivalry in the \
consumer electronics market."
history = ""
work = "electronics manufacturer"
headquarters = ""
motto = ""
ship_prefixes = list("WTV" = "freight")
destination_names = list()
/datum/lore/organization/bishop
name = "Bishop Cybernetics"
short_name = "Bishop"
desc = "Bishop<6F>s focus is on high-class, stylish cybernetics. A favorite among transhumanists (and a b<>te noire for \
bioconservatives), Bishop manufactures not only prostheses but also brain augmentation, synthetic organ replacements, \
and odds and ends like implanted wrist-watches. Their business model tends towards smaller, boutique operations, giving \
it a reputation for high price and luxury, with Bishop cyberware often rivalling Vey-Med<65>s for cost. Bishop<6F>s reputation \
for catering towards the interests of human augmentation enthusiasts instead of positronics have earned it ire from the \
Positronic Rights Group and puts it in ideological (but not economic) comptetition with Morpheus Cyberkinetics."
history = ""
work = "cybernetics and augmentation manufacturer"
headquarters = ""
motto = ""
ship_prefixes = list("BTV" = "transportation")
destination_names = list()
/datum/lore/organization/morpheus
name = "Morpheus Cyberkinetics"
short_name = "Morpheus"
desc = "The only large corporation run by positronic intelligences, Morpheus caters almost exclusively to their sensibilities \
and needs. A product of the synthetic colony of Shelf, Morpheus eschews traditional advertising to keep their prices low and \
relied on word of mouth among positronics to reach their current economic dominance. Morpheus in exchange lobbies heavily for \
positronic rights, sponsors positronics through their Jans-Fhriede test, and tends to other positronic concerns to earn them \
the good-will of the positronics, and the ire of those who wish to exploit them."
history = ""
work = "cybernetics manufacturer"
headquarters = ""
motto = ""
ship_prefixes = list("MTV" = "freight")
// Culture names, because Anewbe told me so.
ship_names = list(
"Nervous Energy",
"Prosthetic Conscience",
"Revisionist",
"Trade Surplus",
"Flexible Demeanour",
"Just Read The Instructions",
"Limiting Factor",
"Cargo Cult",
"Gunboat Diplomat",
"A Ship With A View",
"Cantankerous",
"I Thought He Was With You",
"Never Talk To Strangers",
"Sacrificial Victim",
"Unwitting Accomplice",
"Bad For Business",
"Just Testing",
"Size Isn't Everything",
"Yawning Angel",
"Liveware Problem",
"Very Little Gravitas Indeed",
"Zero Gravitas",
"Gravitas Free Zone",
"Absolutely No You-Know-What",
"Existence Is Pain",
"I'm Walking Here",
"Screw Loose",
"Of Course I Still Love You",
"Limiting Factor",
"So Much For Subtley",
"Unfortunate Conflict Of Evidence",
"Prime Mover",
"It's One Of Ours",
"Thank You And Goodnight",
"Boo!",
"Reasonable Excuse",
"Honest Mistake",
"Appeal To Reason",
"My First Ship II",
"Hidden Income",
"Anything Legal Considered",
"New Toy",
"Me, I'm Always Counting",
"Just Five More Minutes"
)
destination_names = list()
/datum/lore/organization/xion
name = "Xion Manufacturing Group"
short_name = "Xion"
desc = "Xion, quietly, controls most of the market for industrial equipment. Their portfolio includes mining exosuits, \
factory equipment, rugged positronic chassis, and other pieces of equipment vital to the function of the economy. Xion \
keeps its control of the market by leasing, not selling, their equipment, and through infamous and bloody patent protection \
lawsuits. Xion are noted to be a favorite contractor for SolGov engineers, owing to their low cost and rugged design."
history = ""
work = "industrial equipment manufacturer"
headquarters = ""
motto = ""
ship_prefixes = list("XTV" = "hauling")
destination_names = list()
// Governments
/datum/lore/organization/sifgov
name = "Sif Governmental Authority"
short_name = "SifGov"
desc = "SifGov is the sole governing administration for the Vir system, based in New Reykjavik, Sif. It is a representative \
democratic government, and a fully recognized member of the Solar Confederate Government. Anyone operating inside of Vir must \
comply with SifGov's legislation and regulations."
history = "" // Todo like the rest of them
work = "governing body of Sif"
headquarters = "New Reykjavik, Sif"
motto = ""
autogenerate_destination_names = FALSE
ship_prefixes = list("SGA" = "hauling", "SGA" = "energy relay")
destination_names = list(
"New Reykjavik on Sif",
"Radiance Energy Chain",
"a dockyard orbiting Sif",
"a telecommunications satellite",
"Vir Interstellar Spaceport"
)
/datum/lore/organization/solgov
name = "Solar Confederate Government"
short_name = "SolGov"
desc = "SolGov is a decentralized confederation of human governmental entities based on Luna, Sol, which defines top-level law for their member states. \
Member states receive various benefits such as defensive pacts, trade agreements, social support and funding, and being able to participate \
in the Colonial Assembly. The majority, but not all human territories are members of SolGov. As such, SolGov is a major power and \
defacto represents humanity on the galatic stage."
history = "" // Todo
work = "governing polity of humanity's Confederation"
headquarters = "Luna"
motto = "Nil Mortalibus Ardui Est" // Latin, because latin. Says 'Nothing is too steep for mortals'.
autogenerate_destination_names = TRUE
ship_prefixes = list("SCG-T" = "transportation", "SCG-D" = "diplomatic", "SCG-F" = "freight")
destination_names = list(
"Venus",
"Earth",
"Luna",
"Mars",
"Titan"
)// autogen will add a lot of other places as well.
/*
// To be expanded upon later, once the military lore gets sorted out.
// Military
/datum/lore/organization/sif_guard
name = "Sif Homeguard Forces" // Todo: Get better name from lorepeople.
short_name = "SifGuard"
desc = ""
history = ""
work = "Sif Governmental Authority's military"
headquarters = "Sif" // Make this more specific later.
motto = ""
autogenerate_destination_names = FALSE // Kinda weird if SifGuard goes to Nyx.
ship_prefixes = list("SGSC" = "military", "SGSC" = "patrol", "SGSC" = "rescue", "SGSC" = "emergency response") // Todo: Replace prefix with better one.
destination_names = list(
"a classified location in SolGov territory",
"Sif orbit",
"the rings of Kara",
"the rings of Rota",
"Firnir orbit",
"Tyr orbit",
"Magni orbit",
"a wreck in SifGov territory",
"a military outpost",
)
*/

View File

@@ -50,6 +50,11 @@
if(FA.z in using_map.contact_levels)
FA.set_security_level(newlevel)
if(level >= SEC_LEVEL_RED)
atc.reroute_traffic(yes = 1) // Tell them fuck off we're busy.
else
atc.reroute_traffic(yes = 0)
/proc/get_security_level()
switch(security_level)

View File

@@ -1146,6 +1146,9 @@
#include "code\modules\awaymissions\trigger.dm"
#include "code\modules\awaymissions\zlevel.dm"
#include "code\modules\blob\blob.dm"
#include "code\modules\busy_space\air_traffic.dm"
#include "code\modules\busy_space\loremaster.dm"
#include "code\modules\busy_space\organizations.dm"
#include "code\modules\client\client defines.dm"
#include "code\modules\client\client procs.dm"
#include "code\modules\client\movement.dm"