diff --git a/code/__defines/atc.dm b/code/__defines/atc.dm index ee651765b8..2cbd56f3b4 100644 --- a/code/__defines/atc.dm +++ b/code/__defines/atc.dm @@ -4,8 +4,8 @@ #define ATC_DEF "Defense" #define ATC_INDU "Industrial" #define ATC_SCI "Scientific" -#define ATC_TYPICAL list(ATC_MED, ATC_TRANS, ATC_FREIGHT, ATC_DEF, ATC_INDU, ATC_SCI) +#define ATC_TYPICAL ATC_MED, ATC_TRANS, ATC_FREIGHT, ATC_DEF, ATC_INDU, ATC_SCI #define ATC_DIPLO "Diplomacy" #define ATC_LUX "Luxury" -#define ATC_ALL list(ATC_MED, ATC_TRANS, ATC_FREIGHT, ATC_DEF, ATC_INDU, ATC_SCI, ATC_DIPLO, ATC_LUX) \ No newline at end of file +#define ATC_ALL ATC_MED, ATC_TRANS, ATC_FREIGHT, ATC_DEF, ATC_INDU, ATC_SCI, ATC_DIPLO, ATC_LUX \ No newline at end of file diff --git a/code/modules/busy_space/air_traffic.dm b/code/modules/busy_space/air_traffic.dm index b9f1d98815..89f4f23112 100644 --- a/code/modules/busy_space/air_traffic.dm +++ b/code/modules/busy_space/air_traffic.dm @@ -3,9 +3,9 @@ var/global/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/delay_min = 30 SECONDS //How long between ATC traffic, min. Default is 25 mins. + var/delay_max = 45 SECONDS //How long between ATC traffic, max. Default is 40 mins. + var/backoff_delay = 5 SECONDS //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 @@ -49,22 +49,18 @@ var/global/datum/lore/atc_controller/atc = new/datum/lore/atc_controller /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] + + //get the relevant mission string from our org. + //will also give us a new ship name + var/mission_text = source.generate_mission() //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/combined_name = "[source.short_name] [source.current_ship]" var/alt_atc_names = list("[using_map.station_short] TraCon","[using_map.station_short] Control","[using_map.station_short] ATC","[using_map.station_short] Airspace") var/wrong_atc_names = list("Sol Command","New Reykjavik StarCon", "NLS Southern Cross TraCon", "[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' @@ -90,7 +86,7 @@ var/global/datum/lore/atc_controller/atc = new/datum/lore/atc_controller else chatter_type = pick(2;"emerg",5;"wrong_freq","normal") //Be nice to have wrong_lang... - var/yes = prob(source.shady) //Chance for them to say yes vs no + var/yes = prob(source.legit) //Chance for them to say yes vs no var/request = pick(requests) var/callname = pick(alt_atc_names) @@ -103,7 +99,7 @@ var/global/datum/lore/atc_controller/atc = new/datum/lore/atc_controller 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_request = "[callname], this is [source.short_name] [mission_text], [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") @@ -114,18 +110,18 @@ var/global/datum/lore/atc_controller/atc = new/datum/lore/atc_controller 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_request = "[callname], this is [source.short_name] [mission_text], [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 - if(source.motto && prob(10) || source.motto == "With Major Bill's, you won't pay major bills!") //ten percent chance of postpending the motto, unless it's MBT, in which case it will literally always do that + if(source.motto && prob(source.annoying)) full_closure += " " + source.motto //Ship sends request to ATC - msg(full_request,"[prefix] [shipname]") + msg(full_request,"[source.current_ship]") sleep(5 SECONDS) //ATC sends response to ship msg(full_response) sleep(5 SECONDS) //Ship sends response to ATC - msg(full_closure,"[prefix] [shipname]") + msg(full_closure,"[source.current_ship]") return \ No newline at end of file diff --git a/code/modules/busy_space/locations.dm b/code/modules/busy_space/locations.dm index 752eb4c62e..4c75cdc5f8 100644 --- a/code/modules/busy_space/locations.dm +++ b/code/modules/busy_space/locations.dm @@ -1,7 +1,7 @@ /datum/lore/location var/desc = "" - var/types = list() + var/mission_types = list() /datum/lore/location/New(a,b) desc = a - types = b \ No newline at end of file + mission_types = b \ No newline at end of file diff --git a/code/modules/busy_space/missions.dm b/code/modules/busy_space/missions.dm new file mode 100644 index 0000000000..f001c37799 --- /dev/null +++ b/code/modules/busy_space/missions.dm @@ -0,0 +1,50 @@ +/datum/lore/mission + var/prefix = "" + var/mission_strings = list() + var/mission_type = "" + +/datum/lore/mission/New(a,b,c) + prefix = a + mission_strings = b + mission_type = c + +/datum/lore/mission/prebuilt +/datum/lore/mission/prebuilt/New(a) + prefix = a + +//Default mission types for ease of populating organizations +//Most orgs that do medical missions are going to run comperable kinds of medical mission +/datum/lore/mission/prebuilt/medical + mission_strings = list("medical", "medical resupply", "hospital", "pathogen containment") + mission_type = ATC_MED + +/datum/lore/mission/prebuilt/transport + mission_strings = list("transport", "passenger transport", "general transport", "courier", "just-in-time delivery") + mission_type = ATC_TRANS + +/datum/lore/mission/prebuilt/freight + mission_strings = list("freight", "hauling", "bulk transport", "materials delivery") + mission_type = ATC_FREIGHT + +/datum/lore/mission/prebuilt/defense + mission_strings = list("defense", "asset protection", "patrol") + mission_type = ATC_DEF + +/datum/lore/mission/prebuilt/industrial + mission_strings = list("industrial", "construction", "repair", "maintence", "factory resupply") + mission_type = ATC_INDU + +/datum/lore/mission/prebuilt/scientific + mission_strings = list("scientific", "research", "data collection", "survey") + mission_type = ATC_SCI + +/datum/lore/mission/prebuilt/diplomatic + mission_strings = list("diplomatic") //theres not a lot of words for 'diplomatic' + mission_type = ATC_DIPLO + +/datum/lore/mission/prebuilt/luxury + mission_strings = list("luxury cruise", "pleasure cruise", "VIP transport", "sight-seeing", "vacation") + mission_type = ATC_LUX + +/datum/lore/mission/prebuilt/transport/default + prefix = "ITV" \ No newline at end of file diff --git a/code/modules/busy_space/organizations.dm b/code/modules/busy_space/organizations.dm index 5e06024447..3f9d530f7c 100644 --- a/code/modules/busy_space/organizations.dm +++ b/code/modules/busy_space/organizations.dm @@ -1,14 +1,20 @@ //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/acronym = "" // Organization's acronym, e.g. 'NT' for NanoTrasen'. - 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. - var/shady = 10 // The odds of them being denied a flight route. mostly a function of their reputation though unfamiliarity with local traffic rules is also a factor + var/name = "" // Organization's name + var/short_name = "" // Organization's shortname (NanoTrasen for "NanoTrasen Incorporated") + var/acronym = "" // Organization's acronym, e.g. 'NT' for NanoTrasen'. + 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. + var/legit = 90 // The odds of them being approved a flight route. mostly a function of their reputation though unfamiliarity with local traffic rules is also a factor + var/annoying = 10 // The odds they'll say their motto at the end of a successfully negotiatiated route. + var/serviced = list(/datum/lore/system/sol = 1) // systems they work in, weighted + var/missions = list() // mission types they run +// var/special_locations = list() // individual locations they might run missions to outside of their serviced systems + var/mission_noun = list("flight","mission","route") // used for random mission generation + var/current_ship = "" // the most recent ship from this org to have talked on the tracon 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. @@ -165,6 +171,7 @@ /datum/lore/organization/New() ..() + missions += new /datum/lore/mission/prebuilt/transport/default if(autogenerate_destination_names) // Lets pad out the destination names. var/i = rand(6, 10) var/list/star_names = list( @@ -176,6 +183,82 @@ destination_names.Add("a [pick(destination_types)] in [pick(star_names)]") i-- +/datum/lore/organization/proc/generate_mission() + current_ship = "ITV Testing" + // pick what system we're going to run in + var/datum/lore/system/destination_system = pickweight(serviced) + if(destination_system) + destination_system = new destination_system + to_world("destination selected") + + //shuffle + missions = shuffle(missions) + destination_system.locations = shuffle(destination_system.locations) + to_world(jointext(destination_system.locations, "")) + to_world("shuffled") + + //init other variables + var/destination_mission_types = list() + var/possible_mission_types = list() + to_world("vars initialized") + + //find what missions we can run + for(var/datum/lore/mission/x in missions) + possible_mission_types |= x.mission_type + + to_world("source mission types populated:") + to_world(jointext(possible_mission_types, "")) + + //populate destination_missions with all the mission types in that system + for(var/datum/lore/location/x in destination_system.locations) + destination_mission_types |= x.mission_types + + + to_world("destination mission types populated:") + to_world(jointext(destination_mission_types, "")) + + // only find missions in the system we can run + possible_mission_types &= destination_mission_types + + to_world("union found") + to_world(jointext(possible_mission_types, "")) + + //sanity checking + if(!possible_mission_types) + to_world("sanity check failed") + return "ERROR" //change to fail silently after testing + + //select a mission we can run + var/datum/lore/mission/selected_mission + for(var/datum/lore/mission/x in missions) + if(x.mission_type in possible_mission_types) + selected_mission = x + to_world("mission selected") + to_world(selected_mission.mission_type) + break + else + to_world("mission failed selection") + + //select a place to do it at + var/datum/lore/location/selected_location + for(var/datum/lore/location/x in destination_system.locations) + if(selected_mission.mission_type in x.mission_types) + selected_location = x + to_world("destination selected") + to_world(selected_location.desc) + break + else + world << "destination selection failed" + + //set our ship name for consistancy on the tracon + current_ship = "[selected_mission.prefix] [pick(ship_names)]" + to_world("ship name selected") + world.log << current_ship + + //finally return our answer + return "[current_ship] on a [pick(selected_mission.mission_strings)] [pick(mission_noun)] to [selected_location.desc]" + + ////////////////////////////////////////////////////////////////////////////////// // TSCs @@ -200,6 +283,15 @@ motto = "" ship_prefixes = list("NSV" = "exploration", "NTV" = "hauling", "NDV" = "patrol", "NRV" = "emergency response", "NDV" = "asset protection") + missions = list( // they get almost every mission type because they're like the protagonists + new /datum/lore/mission/prebuilt/medical("NMV"), + new /datum/lore/mission/prebuilt/transport("NTV"), + new /datum/lore/mission/prebuilt/defense("NDV"), + new /datum/lore/mission/prebuilt/freight("NFV"), + new /datum/lore/mission/prebuilt/industrial("NIV"), + new /datum/lore/mission/prebuilt/scientific("NSV") + ) + //Scientist naming scheme ship_names = list( "Bardeen", @@ -264,7 +356,6 @@ destination_names.Remove(string_to_test) - /datum/lore/organization/tsc/hephaestus name = "Hephaestus Industries" short_name = "Hephaestus" @@ -617,6 +708,7 @@ work = "courier and passenger transit" headquarters = "Mars, Sol" motto = "With Major Bill's, you won't pay major bills!" + annoying = 100 //oh god ship_prefixes = list("TTV" = "transport", "TTV" = "luxury transit") destination_names = list() @@ -628,7 +720,7 @@ history = "" work = "trade and transit" headquarters = "N/A" - motto = "N/A" + motto = "" ship_prefixes = list("IEV" = "prospecting", "IEC" = "prospecting", "IFV" = "bulk freight", "ITV" = "passenger transport", "ITC" = "just-in-time delivery") destination_names = list() @@ -640,7 +732,7 @@ history = "" work = "trade and transit" headquarters = "N/A" - motto = "N/A" + motto = "" autogenerate_destination_names = FALSE ship_prefixes = list("ITC" = "local shuttle service", "ITC" = "luxury transit", "ITC" = "pleasure cruise", "ITC" = "private transport", "IFC" = "courier", "IFC" = "local delivery", "IIC" = "maintenance", "IMC" = "medical response") @@ -850,5 +942,4 @@ "an incursion site within Vir", "rendezvous to an incursion site in Oasis", "rendezvous to an incursion site in Gavel" - ) - + ) \ No newline at end of file diff --git a/code/modules/busy_space/systems.dm b/code/modules/busy_space/systems.dm index c5e8f5593d..eeca3cb72f 100644 --- a/code/modules/busy_space/systems.dm +++ b/code/modules/busy_space/systems.dm @@ -18,9 +18,9 @@ if(rand(length(planets))) // equal chance of an event in local space or any individual planet initial = pick(planetary_destinations) if(initial in list("an outpost", "a facility")) //clunky but w/e - mission = ATC_TYPICAL + mission = list(ATC_TYPICAL) else - mission = ATC_ALL + mission = list(ATC_ALL) locations += new /datum/lore/location((initial + " on " + pick(planets) + ", " + name), mission) else initial = pick(space_destinations) @@ -28,19 +28,21 @@ mission = list(ATC_TRANS, ATC_FREIGHT, ATC_DEF, ATC_INDU) //generally unmanned so no medical or science jobs else if(initial in list("an anomaly")) mission = list(ATC_DEF, ATC_SCI) //theres kinda only two things to do about mysterious space wedgies) - else if (initial in list("a dockyard", "a station", "a vessel", "a spaceport", "an outpost", "a facility")) - mission = ATC_TYPICAL + else if(initial in list("a dockyard", "a station", "a vessel", "a spaceport", "an outpost", "a facility")) + mission = list(ATC_TYPICAL) else - mission = ATC_ALL - locations += new /datum/lore/location((initial + " in " + name), mission) + mission = list(ATC_ALL) + locations += new /datum/lore/location("[initial] in [name]", mission) i-- + locations += new /datum/lore/location("in [name]", list(ATC_ALL)) //disable after testing? /datum/lore/system/ganesha name = "Ganesha" desc = "Can you believe that shit has been on the timeline since like 2016 and its never even made it onto the map. the south dakota of space." planets = list("It Probably Has One??") - +/datum/lore/system/sol + name = "Sol" /* /datum/lore/system/vir name = "Vir" diff --git a/polaris.dme b/polaris.dme index 436b3ef896..27af0e983a 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1569,6 +1569,7 @@ #include "code\modules\busy_space\air_traffic.dm" #include "code\modules\busy_space\locations.dm" #include "code\modules\busy_space\loremaster.dm" +#include "code\modules\busy_space\missions.dm" #include "code\modules\busy_space\organizations.dm" #include "code\modules\busy_space\systems.dm" #include "code\modules\catalogue\atoms.dm" @@ -3333,7 +3334,7 @@ #include "code\ZAS\Zone.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -#include "maps\cynosure\cynosure.dm" +#include "maps\example\example.dm" #include "maps\submaps\_helpers.dm" #include "maps\submaps\poi_landmark.dm" #include "maps\submaps\engine_submaps\engine_areas.dm"