diff --git a/scripts/scenario_48_visitors.lua b/scripts/scenario_48_visitors.lua index 857f75fc5b..9b8a69acee 100755 --- a/scripts/scenario_48_visitors.lua +++ b/scripts/scenario_48_visitors.lua @@ -1,13 +1,13 @@ -- Name: Unwanted Visitors --- Description: Get rid of the unwanted visitors. Various other missions follow (check the dispatch office). Missions may challenge the helm officer regardless of the difficulty level chosen. You may choose to continue or stand down after each mission. +-- Description: Get rid of the unwanted visitors. Other missions follow. Check friendly stations for mission orders. Dispatch office provides new missions. Continue or stand down after each mission. --- ---- Running all missions can take several hours. Consider real life limits when given the option to stand down at the end of each mission. Some missions are easier to complete in a warp ship than in a jump ship. Only one of the last set of missions may be selected. +--- Each mission takes 15 - 50 minutes. That can add up. Four missions in the first area, three in the second area and in the third area, one open ended mission, chosen from three possibilities. --- ---- If you have already played one or more missions and want to choose to replay or avoid a particular mission, choose a 'Selectable' variation. Choosing a 'Random' variation gives you no mission choice. The default is partial selection control allowing you to select a mission group. +--- When returning to this scenario, choose "selectable" to perform missions you have not yet completed. Choose "Random" to be surprised at the missions selected. --- ---- Buttons on the Game Master screen can change the speed of objects in various orbits by 10 percent per click +--- GM buttons slow or speed celestial body orbits, turn on or off server voices, insert unique player ships or end the mission. --- ---- If you are playing on a LAN and no longer want to hear voices from the server running a main screen, change file scenario_48_visitors.lua in the scripts folder such that 'server_voices = false' rather than 'server_voices = true' on line 37. Note: case is important, so match the case in the lua file, not what you see here (which is always upper case). After editing, you will need to restart the server. +--- USN Discord: https://discord.gg/PntGG3a where you can join a game online. --- --- Voice Actors: --- Admiral U. E. @@ -20,81 +20,100 @@ --- Slate https://www.amazon.com/T.-L.-Ford/e/B0034Q6Q2S --- Stephen Priddy --- ---- Version 1 +--- Version 2 -- Type: Replayable Mission --- Variation[Easy]: Easy goals and/or enemies --- Variation[Hard]: Hard goals and/or enemies --- Variation[Random]: Next mission is chosen at random --- Variation[Selectable]: Next mission may be selected --- Variation[Easy Random]: Easy goals and/or enemies, Next mission is chosen at random --- Variation[Easy Selectable]: Easy goals and/or enemies, Next mission may be selected --- Variation[Hard Random]: Hard goals and/or enemies, Next mission is chosen at random --- Variation[Hard Selectable]: Hard goals and/or enemies, Next mission may be selected +-- Setting[Enemies]: Configures the strength of the enemies +-- Enemies[Easy]: Enemies are weaker or fewer than normal +-- Enemies[Normal|Default]: Enemies are normal strength +-- Enemies[Hard]: Enemies are stronger or more numerous than normal +-- Enemies[Extreme]: Much stronger, many more enemies +-- Enemies[Quixotic]: Insanely strong and/or inordinately large numbers of enemies +-- Setting[Murphy]: Configures the perversity of the universe according to Murphy's law +-- Murphy[Easy]: Random factors are more in your favor +-- Murphy[Normal|Default]: Random factors are normal +-- Murphy[Hard]: Random factors are more against you +-- Setting[Mission]: Configures the scenario missions. There are different regions with missions. The default setting lets the players choose to move to the next region. The players must always complete the first mission. +-- Mission[Random]: The next mission is randomly selected +-- Mission[Region|Default]: Players may skip to the next region of missions +-- Mission[Selectable]: Players may choose each individual mission in each region + +-- Custom Info Indexes +-- Virus Fatality Timer 4 +-- Gather Coolant 8 +-- Sensor scan time 10 + +-- Custom Button Indexes +-- Virus Status 9 +-- Inventory 6 +-- Get Coolant 7 +-- Polly scan time 11 require("utils.lua") +require("generate_call_sign_scenario_utility.lua") +require("place_station_scenario_utility.lua") +require("cpu_ship_diversification_scenario_utility.lua") function init() - server_voices = true - if server_voices then - voice_queue = {} - voice_delay = 0 - voice_played = {} - plotV = handleVoiceQueue - end + scenario_version = "2.0.7" + ee_version = "2023.06.17" + print(string.format(" ---- Scenario: Unwanted Visitors ---- Version %s ---- Tested with EE version %s ----",scenario_version,ee_version)) print(_VERSION) - updateDiagnostic = false - stationCommsDiagnostic = false - planetologistDiagnostic = false - moveDiagnostic = false - pollyDiagnostic = false - fixSatelliteDiagnostic = false - shipCommsDiagnostic = false - prefix_length = 0 - suffix_index = 0 --stationCommunication could be nil (default), commsStation (embedded function) or comms_station_enhanced (external script) stationCommunication = "commsStation" setVariations() + setGlobals() setConstants() --missle type names, template names and scores, deployment directions, player ship names, etc. - setGoodsList() - setListOfStations() buildLocalSolarSystem() setOptionalMissions() setPlots() plotManager = plotDelay - plotM = movingObjects - plotT = workingTransports - plotCN = coolantNebulae - plotH = healthCheck --Damage to ship can kill repair crew members + --Damage to ship can kill repair crew members healthCheckTimer = 5 healthCheckTimerInterval = 5 mission_complete_count = 0 mission_region = 0 mainGMButtons() end +function setGlobals() + updateDiagnostic = false + stationCommsDiagnostic = false + planetologistDiagnostic = false + moveDiagnostic = false + fixSatelliteDiagnostic = false + shipCommsDiagnostic = false + goods = {} --overall tracking of goods + tradeFood = {} --stations that will trade food for other goods + tradeLuxury = {} --stations that will trade luxury for other goods + tradeMedicine = {} --stations that will trade medicine for other goods + server_voices = true + voice_queue = {} + voice_played = {} +end --------------------------- -- Game Master functions -- --------------------------- function mainGMButtons() clearGMFunctions() - addGMFunction(_("buttonGM", "Player ships"),playerShipGMButtons) - addGMFunction(_("buttonGM", "Adjust speed"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "End Mission"),endMissionGMButtons) + addGMFunction(_("buttonGM","+Player ships"),playerShipGMButtons) + addGMFunction(_("buttonGM","+Adjust speed"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","+End Mission"),endMissionGMButtons) + addGMFunction(_("buttonGM","+Voices"),adjustServerVoices) end -- GM player ship functions function playerShipGMButtons() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) if playerNarsil == nil then - addGMFunction(_("buttonGM", "Narsil"),createPlayerShipNarsil) + addGMFunction(_("buttonGM","Narsil"),createPlayerShipNarsil) end if playerHeadhunter == nil then - addGMFunction(_("buttonGM", "Headhunter"),createPlayerShipHeadhunter) + addGMFunction(_("buttonGM","Headhunter"),createPlayerShipHeadhunter) end if playerBlazon == nil then - addGMFunction(_("buttonGM", "Blazon"),createPlayerShipBlazon) + addGMFunction(_("buttonGM","Blazon"),createPlayerShipBlazon) end if playerSting == nil then - addGMFunction(_("buttonGM", "Sting"),createPlayerShipSting) + addGMFunction(_("buttonGM","Sting"),createPlayerShipSting) end end function createPlayerShipNarsil() @@ -124,6 +143,7 @@ function createPlayerShipNarsil() playerNarsil:setWeaponTubeExclusiveFor(5,"Mine") --Mine only playerNarsil:addReputationPoints(50) removeGMFunction("Narsil") + playerShipGMButtons() end function createPlayerShipHeadhunter() playerHeadhunter = PlayerSpaceship():setTemplate("Piranha"):setFaction("Human Navy"):setCallSign("Headhunter") @@ -159,6 +179,7 @@ function createPlayerShipHeadhunter() playerHeadhunter:setWeaponStorage("Nuke", 4) playerHeadhunter:addReputationPoints(50) removeGMFunction("Headhunter") + playerShipGMButtons() end function createPlayerShipBlazon() playerBlazon = PlayerSpaceship():setTemplate("Striker"):setFaction("Human Navy"):setCallSign("Blazon") @@ -188,6 +209,7 @@ function createPlayerShipBlazon() playerBlazon:setWeaponStorage("Mine",4) playerBlazon:addReputationPoints(50) removeGMFunction("Blazon") + playerShipGMButtons() end function createPlayerShipSting() playerSting = PlayerSpaceship():setTemplate("Hathcock"):setFaction("Human Navy"):setCallSign("Sting") @@ -214,94 +236,107 @@ function createPlayerShipSting() playerSting:setWeaponTubeDirection(2,180) playerSting:setWeaponTubeExclusiveFor(2,"Mine") playerSting:addReputationPoints(50) - removeGMFunction(_("buttonGM", "Sting")) + removeGMFunction("Sting") + playerShipGMButtons() end -- GM adjust speed functions function adjustSpeedGMButtons() + if speed_button_explanation == nil then + speed_button_explanation = "sent" + addGMMessage(string.format(_("msgGM","Primus is the planet closest to the sun. Secondus is the next planet out from the sun. Tertius is the third planet out from the sun. Sol Belt 1 is the belt of asteroids and stations closest to the sun. Sol Belt 2 is the next one out. Tertius moon belt is the asteroid, moon and station belt orbiting Tertius. Tertius belt 2 is the next one out from Tertius.\n--- Celestial Body Names ---\nSun: %s\nPrimus: %s\nSecondus: %s\nTertius: %s"),planetSol:getCallSign(),planetPrimus:getCallSign(),planetSecondus:getCallSign(),planetTertius:getCallSign())) + end clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Primus"),adjustPrimusSpeed) - addGMFunction(_("buttonGM", "Primus Moon"),adjustPrimusMoonSpeed) - addGMFunction(_("buttonGM", "Secondus"),adjustSecondusSpeed) - addGMFunction(_("buttonGM", "Secondus Station"),adjustSecondusStationSpeed) - addGMFunction(_("buttonGM", "Sol Belt 1"),adjustSolBelt1Speed) - addGMFunction(_("buttonGM", "Sol Belt 2"),adjustSolBelt2Speed) - addGMFunction(_("buttonGM", "Tertius"),adjustTertiusSpeed) - addGMFunction(_("buttonGM", "Tertius Moon Belt"),adjustTertiusMoonBeltSpeed) - addGMFunction(_("buttonGM", "Tertius Belt 2"),adjustTertiusBelt2Speed) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","Primus"),adjustPrimusSpeed) + addGMFunction(_("buttonGM","Primus Moon"),adjustPrimusMoonSpeed) + addGMFunction(_("buttonGM","Secondus"),adjustSecondusSpeed) + addGMFunction(_("buttonGM","Secondus Station"),adjustSecondusStationSpeed) + addGMFunction(_("buttonGM","Sol Belt 1"),adjustSolBelt1Speed) + addGMFunction(_("buttonGM","Sol Belt 2"),adjustSolBelt2Speed) + addGMFunction(_("buttonGM","Tertius"),adjustTertiusSpeed) + addGMFunction(_("buttonGM","Tertius Moon Belt"),adjustTertiusMoonBeltSpeed) + addGMFunction(_("buttonGM","Tertius Belt 2"),adjustTertiusBelt2Speed) end function adjustPrimusSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Primus"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Primus speed: %.1f",planetPrimus.orbit_speed)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Primus"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Primus speed: %.1f"),planetPrimus.orbit_speed) planetPrimus.orbit_speed = planetPrimus.orbit_speed * 1.1 planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed) - print(string.format("new slower Primus speed: %.1f",planetPrimus.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew slower Primus speed: %.1f"),msg,planetPrimus.orbit_speed) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Primus speed: %.1f",planetPrimus.orbit_speed)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Primus speed: %.1f"),planetPrimus.orbit_speed) planetPrimus.orbit_speed = planetPrimus.orbit_speed * .9 planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed) - print(string.format("new faster Primus speed: %.1f",planetPrimus.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew faster Primus speed: %.1f"),msg,planetPrimus.orbit_speed) + addGMMessage(msg) end) end function adjustPrimusMoonSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Primus Moon"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Primus moon speed: %.1f",planetPrimusMoonOrbitTime)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Primus Moon"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Primus moon speed: %.1f"),planetPrimusMoonOrbitTime) planetPrimusMoonOrbitTime = planetPrimusMoonOrbitTime * 1.1 planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime) - print(string.format("new slower Primus moon speed: %.1f",planetPrimusMoonOrbitTime)) + msg = string.format(_("msgGM","%s\nNew slower Primus moon speed: %.1f"),msg,planetPrimusMoonOrbitTime) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Primus moon speed: %.1f",planetPrimusMoonOrbitTime)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Primus moon speed: %.1f"),planetPrimusMoonOrbitTime) planetPrimusMoonOrbitTime = planetPrimusMoonOrbitTime * .9 planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime) - print(string.format("new faster Primus moon speed: %.1f",planetPrimusMoonOrbitTime)) + msg = string.format(_("msgGM","%s\nNew faster Primus moon speed: %.1f"),msg,planetPrimusMoonOrbitTime) + addGMMessage(msg) end) end function adjustSecondusSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Secondus"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Secondus speed: %.1f",planetSecondus.orbit_speed)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Secondus"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Secondus speed: %.1f"),planetSecondus.orbit_speed) planetSecondus.orbit_speed = planetSecondus.orbit_speed * 1.1 planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed) - print(string.format("new slower Secondus speed: %.1f",planetSecondus.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew slower Secondus speed: %.1f"),msg,planetSecondus.orbit_speed) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Secondus speed: %.1f",planetSecondus.orbit_speed)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Secondus speed: %.1f"),planetSecondus.orbit_speed) planetSecondus.orbit_speed = planetSecondus.orbit_speed * .9 planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed) - print(string.format("new faster Secondus speed: %.1f",planetSecondus.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew faster Secondus speed: %.1f"),msg,planetSecondus.orbit_speed) + addGMMessage(msg) end) end function adjustSecondusStationSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Secondus Stn"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Secondus station speed: %.3f",secondusStationOrbitIncrement)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Secondus Stn"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Secondus station speed: %.3f"),secondusStationOrbitIncrement) secondusStationOrbitIncrement = secondusStationOrbitIncrement * .9 - print(string.format("new slower Secondus station speed: %.3f",secondusStationOrbitIncrement)) + msg = string.format(_("msgGM","%s\nNew slower Secondus station speed: %.3f"),msg,secondusStationOrbitIncrement) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Secondus station speed: %.3f",secondusStationOrbitIncrement)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Secondus station speed: %.3f"),secondusStationOrbitIncrement) secondusStationOrbitIncrement = secondusStationOrbitIncrement * 1.1 - print(string.format("new faster Secondus station speed: %.3f",secondusStationOrbitIncrement)) + msg = string.format(_("msgGM","%s\nNew faster Secondus station speed: %.3f"),msg,secondusStationOrbitIncrement) + addGMMessage(msg) end) end function adjustSolBelt1Speed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Sol Belt 1"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Sol Belt 1 speed: %.3f",belt1OrbitalSpeed)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Sol Belt 1"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Sol Belt 1 speed: %.3f"),belt1OrbitalSpeed) belt1OrbitalSpeed = belt1OrbitalSpeed * .9 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -309,10 +344,11 @@ function adjustSolBelt1Speed() ta.speed = belt1OrbitalSpeed end end - print(string.format("new slower Sol Belt 1 speed: %.3f",belt1OrbitalSpeed)) + msg = string.format(_("msgGM","%s\nNew slower Sol Belt 1 speed: %.3f"),msg,belt1OrbitalSpeed) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Sol Belt 1 speed: %.3f",belt1OrbitalSpeed)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Sol Belt 1 speed: %.3f"),belt1OrbitalSpeed) belt1OrbitalSpeed = belt1OrbitalSpeed * 1.1 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -320,15 +356,16 @@ function adjustSolBelt1Speed() ta.speed = belt1OrbitalSpeed end end - print(string.format("new faster Sol Belt 1 speed: %.3f",belt1OrbitalSpeed)) + msg = string.format(_("msgGM","%s\nNew faster Sol Belt 1 speed: %.3f"),msg,belt1OrbitalSpeed) + addGMMessage(msg) end) end function adjustSolBelt2Speed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Sol Belt 2"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Sol Belt 2 speed: %.3f",belt2OrbitalSpeed)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Sol Belt 2"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Sol Belt 2 speed: %.3f"),belt2OrbitalSpeed) belt2OrbitalSpeed = belt2OrbitalSpeed * .9 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -336,10 +373,11 @@ function adjustSolBelt2Speed() ta.speed = belt2OrbitalSpeed end end - print(string.format("new slower Sol Belt 2 speed: %.3f",belt2OrbitalSpeed)) + msg = string.format(_("msgGM","%s\nNew slower Sol Belt 2 speed: %.3f"),msg,belt2OrbitalSpeed) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Sol Belt 2 speed: %.3f",belt2OrbitalSpeed)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Sol Belt 2 speed: %.3f"),belt2OrbitalSpeed) belt2OrbitalSpeed = belt2OrbitalSpeed * 1.1 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -347,32 +385,35 @@ function adjustSolBelt2Speed() ta.speed = belt2OrbitalSpeed end end - print(string.format("new faster Sol Belt 2 speed: %.3f",belt2OrbitalSpeed)) + msg = string.format(_("msgGM","%s\nNew faster Sol Belt 2 speed: %.3f"),msg,belt2OrbitalSpeed) + addGMMessage(msg) end) end function adjustTertiusSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Tertius"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Tertius speed: %.1f",planetTertius.orbit_speed)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Tertius"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Tertius speed: %.1f"),planetTertius.orbit_speed) planetTertius.orbit_speed = planetTertius.orbit_speed * 1.1 planetTertius:setOrbit(planetSol,planetTertius.orbit_speed) - print(string.format("new slower Tertius speed: %.1f",planetTertius.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew slower Tertius speed: %.1f"),msg,planetTertius.orbit_speed) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Tertius speed: %.1f",planetTertius.orbit_speed)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Tertius speed: %.1f"),planetTertius.orbit_speed) planetTertius.orbit_speed = planetTertius.orbit_speed * .9 planetTertius:setOrbit(planetSol,planetTertius.orbit_speed) - print(string.format("new faster Tertius speed: %.1f",planetTertius.orbit_speed)) + msg = string.format(_("msgGM","%s\nNew faster Tertius speed: %.1f"),msg,planetTertius.orbit_speed) + addGMMessage(msg) end) end function adjustTertiusMoonBeltSpeed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Tertius Moon"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Tertius Moon"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format(_("msgGM","Current Tertius Moon Belt speed: %.3f"),tertiusOrbitalBodyIncrement) tertiusOrbitalBodyIncrement = tertiusOrbitalBodyIncrement * .9 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -380,10 +421,11 @@ function adjustTertiusMoonBeltSpeed() ta.speed = tertiusOrbitalBodyIncrement end end - print(string.format("new slower Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement)) + msg = string.format(_("msgGM","%s\nNew slower Tertius Moon Belt speed: %.3f"),msg,tertiusOrbitalBodyIncrement) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Tertius Moon Belt speed: %.3f"),tertiusOrbitalBodyIncrement) tertiusOrbitalBodyIncrement = tertiusOrbitalBodyIncrement * 1.1 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -391,15 +433,16 @@ function adjustTertiusMoonBeltSpeed() ta.speed = tertiusOrbitalBodyIncrement end end - print(string.format("new faster Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement)) + msg = string.format(_("msgGM","%s\nNew faster Tertius Moon Belt speed: %.3f"),msg,tertiusOrbitalBodyIncrement) + addGMMessage(msg) end) end function adjustTertiusBelt2Speed() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Back from Tertius Belt 2"),adjustSpeedGMButtons) - addGMFunction(_("buttonGM", "Slower"),function() - print(string.format("current Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement)) + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","-From Tertius Belt 2"),adjustSpeedGMButtons) + addGMFunction(_("buttonGM","Slower"),function() + local msg = string.format("Current Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement) tertiusAsteroidBeltIncrement = tertiusAsteroidBeltIncrement * .9 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -413,10 +456,11 @@ function adjustTertiusBelt2Speed() tbs.speed = tertiusAsteroidBeltIncrement end end - print(string.format("new slower Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement)) + msg = string.format("%s\nNew slower Tertius Belt 2 speed: %.3f",msg,tertiusAsteroidBeltIncrement) + addGMMessage(msg) end) - addGMFunction(_("buttonGM", "Faster"),function() - print(string.format("current Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement)) + addGMFunction(_("buttonGM","Faster"),function() + local msg = string.format(_("msgGM","Current Tertius Belt 2 speed: %.3f"),tertiusAsteroidBeltIncrement) tertiusAsteroidBeltIncrement = tertiusAsteroidBeltIncrement * 1.1 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -430,88 +474,397 @@ function adjustTertiusBelt2Speed() tbs.speed = tertiusAsteroidBeltIncrement end end - print(string.format("new faster Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement)) + msg = string.format(_("msgGM","%s\nNew faster Tertius Belt 2 speed: %.3f"),msg,tertiusAsteroidBeltIncrement) + addGMMessage(msg) end) end -- GM end mission functions function endMissionGMButtons() clearGMFunctions() - addGMFunction(_("buttonGM", "Back to main"),mainGMButtons) - addGMFunction(_("buttonGM", "Human victory"),function() + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + addGMFunction(_("buttonGM","Human victory"),function() showEndStats() victory("Human Navy") end) - addGMFunction(_("buttonGM", "Exuari victory"),function() + addGMFunction(_("buttonGM","Exuari victory"),function() showEndStats() victory("Exuari") end) end +-- GM adjust voices +function adjustServerVoices() + clearGMFunctions() + addGMFunction(_("buttonGM","-Main"),mainGMButtons) + local button_label = _("buttonGM","Voices On") + if server_voices then + button_label = button_label .. "*" + end + addGMFunction(button_label,function() + server_voices = true + adjustServerVoices() + end) + button_label = _("buttonGM","Voices Off") + if not server_voices then + button_label = button_label .. "*" + end + addGMFunction(button_label,function() + server_voices = false + adjustServerVoices() + end) +end ------------------------------------------ -- Initialization and utility functions -- ------------------------------------------ function setVariations() - local svs = getScenarioVariation() --scenario variation string - if string.find(svs,"Easy") then - difficulty = .5 - coolant_loss = .99999 - coolant_gain = .01 - elseif string.find(svs,"Hard") then - difficulty = 2 - coolant_loss = .9999 - coolant_gain = .0001 - else - difficulty = 1 --default (normal) - coolant_loss = .99995 - coolant_gain = .001 - end - mission_choice = "Region Selectable" --valid choices are "Random", "Region Selectable" (default) and "Selectable" - if string.find(svs,"Selectable") then - mission_choice = "Selectable" - elseif string.find(svs,"Random") then - mission_choice = "Random" - end + local enemy_config = { + ["Easy"] = {number = .5}, + ["Normal"] = {number = 1}, + ["Hard"] = {number = 2}, + ["Extreme"] = {number = 3}, + ["Quixotic"] = {number = 5}, + } + enemy_power = enemy_config[getScenarioSetting("Enemies")].number + local murphy_config = { + ["Easy"] = {number = .5, adverse = .999, lose_coolant = .99999, gain_coolant = .005, rep = 40, start_danger = .4}, + ["Normal"] = {number = 1, adverse = .995, lose_coolant = .99995, gain_coolant = .001, rep = 20, start_danger = .8}, + ["Hard"] = {number = 2, adverse = .99, lose_coolant = .9999, gain_coolant = .0001, rep = 0, start_danger = 1.2}, + } + difficulty = murphy_config[getScenarioSetting("Murphy")].number + adverseEffect = murphy_config[getScenarioSetting("Murphy")].adverse + coolant_loss = murphy_config[getScenarioSetting("Murphy")].lose_coolant + coolant_gain = murphy_config[getScenarioSetting("Murphy")].gain_coolant + reputation_start_amount=murphy_config[getScenarioSetting("Murphy")].rep + current_danger = murphy_config[getScenarioSetting("Murphy")].start_danger + mission_choices = { + ["Region"] = "Region Selectable", + ["Random"] = "Random", + ["Selectable"] = "Selectable", + } + mission_choice = mission_choices[getScenarioSetting("Mission")] gameTimeLimit = 0 playWithTimeLimit = false end function setConstants() repeatExitBoundary = 100 - scarceResources = false - --Ship Template Name List - stnl = {"MT52 Hornet","MU52 Hornet","Adder MK5","Adder MK4","WX-Lindworm","Adder MK6","Phobos T3","Phobos M3","Piranha F8","Piranha F12","Ranus U","Nirvana R5A","Stalker Q7","Stalker R7","Atlantis X23","Starhammer II","Odin","Fighter","Cruiser","Missile Cruiser","Strikeship","Adv. Striker","Dreadnought","Battlestation","Blockade Runner","Ktlitan Fighter","Ktlitan Breaker","Ktlitan Worker","Ktlitan Drone","Ktlitan Feeder","Ktlitan Scout","Ktlitan Destroyer","Storm"} - --Ship Template Score List - stsl = {5 ,5 ,7 ,6 ,7 ,8 ,15 ,16 ,15 ,15 ,25 ,20 ,25 ,25 ,50 ,70 ,250 ,6 ,18 ,14 ,30 ,27 ,80 ,100 ,65 ,6 ,45 ,40 ,4 ,48 ,8 ,50 ,22} - -- square grid deployment - fleetPosDelta1x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1} - fleetPosDelta1y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2} - -- rough hexagonal deployment - fleetPosDelta2x = {0,2,-2,1,-1, 1, 1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5} - fleetPosDelta2y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1} + ship_template = { --ordered by relative strength + ["Gnat"] = {strength = 2, short_range_radar = 4500, create = gnat}, + ["Lite Drone"] = {strength = 3, short_range_radar = 5000, create = droneLite}, + ["Jacket Drone"] = {strength = 4, short_range_radar = 5000, create = droneJacket}, + ["Ktlitan Drone"] = {strength = 4, short_range_radar = 5000, create = stockTemplate}, + ["Heavy Drone"] = {strength = 5, short_range_radar = 5500, create = droneHeavy}, + ["Adder MK3"] = {strength = 5, short_range_radar = 5000, create = stockTemplate}, + ["MT52 Hornet"] = {strength = 5, short_range_radar = 5000, create = stockTemplate}, + ["MU52 Hornet"] = {strength = 5, short_range_radar = 5000, create = stockTemplate}, + ["Dagger"] = {strength = 6, short_range_radar = 5000, create = stockTemplate}, + ["MV52 Hornet"] = {strength = 6, short_range_radar = 5000, create = hornetMV52}, + ["MT55 Hornet"] = {strength = 6, short_range_radar = 5000, create = hornetMT55}, + ["Adder MK4"] = {strength = 6, short_range_radar = 5000, create = stockTemplate}, + ["Fighter"] = {strength = 6, short_range_radar = 5000, create = stockTemplate}, + ["Ktlitan Fighter"] = {strength = 6, short_range_radar = 5000, create = stockTemplate}, + ["FX64 Hornet"] = {strength = 7, short_range_radar = 5000, create = hornetFX64}, + ["Blade"] = {strength = 7, short_range_radar = 5000, create = stockTemplate}, + ["Gunner"] = {strength = 7, short_range_radar = 5000, create = stockTemplate}, + ["K2 Fighter"] = {strength = 7, short_range_radar = 5000, create = k2fighter}, + ["Adder MK5"] = {strength = 7, short_range_radar = 5000, create = stockTemplate}, + ["WX-Lindworm"] = {strength = 7, short_range_radar = 5500, create = stockTemplate}, + ["K3 Fighter"] = {strength = 8, short_range_radar = 5000, create = k3fighter}, + ["Shooter"] = {strength = 8, short_range_radar = 5000, create = stockTemplate}, + ["Jagger"] = {strength = 8, short_range_radar = 5000, create = stockTemplate}, + ["Adder MK6"] = {strength = 8, short_range_radar = 5000, create = stockTemplate}, + ["Ktlitan Scout"] = {strength = 8, short_range_radar = 7000, create = stockTemplate}, + ["WZ-Lindworm"] = {strength = 9, short_range_radar = 5500, create = wzLindworm}, + ["Adder MK7"] = {strength = 9, short_range_radar = 5000, create = stockTemplate}, + ["Adder MK8"] = {strength = 10, short_range_radar = 5500, create = stockTemplate}, + ["Adder MK9"] = {strength = 11, short_range_radar = 6000, create = stockTemplate}, + ["Nirvana R3"] = {strength = 12, short_range_radar = 5000, create = stockTemplate}, + ["Phobos R2"] = {strength = 13, short_range_radar = 5000, create = phobosR2}, + ["Missile Cruiser"] = {strength = 14, short_range_radar = 7000, create = stockTemplate}, + ["Waddle 5"] = {strength = 15, short_range_radar = 5000, create = waddle5}, + ["Jade 5"] = {strength = 15, short_range_radar = 5000, create = jade5}, + ["Phobos T3"] = {strength = 15, short_range_radar = 5000, create = stockTemplate}, + ["Guard"] = {strength = 15, short_range_radar = 5000, create = stockTemplate}, + ["Piranha F8"] = {strength = 15, short_range_radar = 6000, create = stockTemplate}, + ["Piranha F12"] = {strength = 15, short_range_radar = 6000, create = stockTemplate}, + ["Piranha F12.M"] = {strength = 16, short_range_radar = 6000, create = stockTemplate}, + ["Phobos M3"] = {strength = 16, short_range_radar = 5500, create = stockTemplate}, + ["Farco 3"] = {strength = 16, short_range_radar = 8000, create = farco3}, + ["Farco 5"] = {strength = 16, short_range_radar = 8000, create = farco5}, + ["Karnack"] = {strength = 17, short_range_radar = 5000, create = stockTemplate}, + ["Gunship"] = {strength = 17, short_range_radar = 5000, create = stockTemplate}, + ["Phobos T4"] = {strength = 18, short_range_radar = 5000, create = phobosT4}, + ["Cruiser"] = {strength = 18, short_range_radar = 6000, create = stockTemplate}, + ["Nirvana R5"] = {strength = 19, short_range_radar = 5000, create = stockTemplate}, + ["Farco 8"] = {strength = 19, short_range_radar = 8000, create = farco8}, + ["Nirvana R5A"] = {strength = 20, short_range_radar = 5000, create = stockTemplate}, + ["Adv. Gunship"] = {strength = 20, short_range_radar = 7000, create = stockTemplate}, + ["Ktlitan Worker"] = {strength = 20, short_range_radar = 5000, create = stockTemplate}, + ["Farco 11"] = {strength = 21, short_range_radar = 8000, create = farco11}, + ["Storm"] = {strength = 22, short_range_radar = 6000, create = stockTemplate}, + ["Warden"] = {strength = 22, short_range_radar = 6000, create = stockTemplate}, + ["Racer"] = {strength = 22, short_range_radar = 5000, create = stockTemplate}, + ["Strike"] = {strength = 23, short_range_radar = 5500, create = stockTemplate}, + ["Dash"] = {strength = 23, short_range_radar = 5500, create = stockTemplate}, + ["Farco 13"] = {strength = 24, short_range_radar = 5000, create = farco13}, + ["Sentinel"] = {strength = 24, short_range_radar = 5000, create = stockTemplate}, + ["Ranus U"] = {strength = 25, short_range_radar = 6000, create = stockTemplate}, + ["Flash"] = {strength = 25, short_range_radar = 6000, create = stockTemplate}, + ["Ranger"] = {strength = 25, short_range_radar = 6000, create = stockTemplate}, + ["Buster"] = {strength = 25, short_range_radar = 6000, create = stockTemplate}, + ["Stalker Q7"] = {strength = 25, short_range_radar = 5000, create = stockTemplate}, + ["Stalker R7"] = {strength = 25, short_range_radar = 5000, create = stockTemplate}, + ["Whirlwind"] = {strength = 26, short_range_radar = 6000, create = whirlwind}, + ["Hunter"] = {strength = 26, short_range_radar = 5500, create = stockTemplate}, + ["Adv. Striker"] = {strength = 27, short_range_radar = 5000, create = stockTemplate}, + ["Tempest"] = {strength = 30, short_range_radar = 6000, create = tempest}, + ["Strikeship"] = {strength = 30, short_range_radar = 5000, create = stockTemplate}, + ["Maniapak"] = {strength = 34, short_range_radar = 6000, create = maniapak}, + ["Fiend G4"] = {strength = 35, short_range_radar = 6500, create = stockTemplate}, + ["Cucaracha"] = {strength = 36, short_range_radar = 5000, create = cucaracha}, + ["Fiend G6"] = {strength = 39, short_range_radar = 6500, create = stockTemplate}, + ["Predator"] = {strength = 42, short_range_radar = 7500, create = predator}, + ["Ktlitan Breaker"] = {strength = 45, short_range_radar = 5000, create = stockTemplate}, + ["Hurricane"] = {strength = 46, short_range_radar = 6000, create = hurricane}, + ["Ktlitan Feeder"] = {strength = 48, short_range_radar = 5000, create = stockTemplate}, + ["Atlantis X23"] = {strength = 50, short_range_radar = 10000, create = stockTemplate}, + ["Ktlitan Destroyer"] = {strength = 50, short_range_radar = 9000, create = stockTemplate}, + ["K2 Breaker"] = {strength = 55, short_range_radar = 5000, create = k2breaker}, + ["Atlantis Y42"] = {strength = 60, short_range_radar = 10000, create = atlantisY42}, + ["Blockade Runner"] = {strength = 63, short_range_radar = 5500, create = stockTemplate}, + ["Starhammer II"] = {strength = 70, short_range_radar = 10000, create = stockTemplate}, + ["Enforcer"] = {strength = 75, short_range_radar = 9000, create = enforcer}, + ["Dreadnought"] = {strength = 80, short_range_radar = 9000, create = stockTemplate}, + ["Starhammer III"] = {strength = 85, short_range_radar = 12000, create = starhammerIII}, + ["Starhammer V"] = {strength = 90, short_range_radar = 15000, create = starhammerV}, + ["Tyr"] = {strength = 150,short_range_radar = 9500, create = tyr}, + } + formation_delta = { + ["square"] = { + x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1,0, 0,3,-3,1, 1,3,-3,-1,-1, 3,-3,2, 2,3,-3,-2,-2, 3,-3,3, 3,-3,-3,4,0,-4, 0,4,-4, 4,-4,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,5,-5,0, 0,5, 5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4}, + y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2,3,-3,0, 0,3,-3,1, 1, 3,-3,-1,-1,3,-3,2, 2, 3,-3,-2,-2,3,-3, 3,-3,0,4, 0,-4,4,-4,-4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4,0, 0,5,-5,5,-5, 5,-5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5}, + }, + ["hexagonal"] = { + x = {0,2,-2,1,-1, 1,-1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5,8,-8,4,-4, 4,-4,5,5 ,-5,-5,2, 2,-2,-2,0, 0,6, 6,-6,-6,7, 7,-7,-7,10,-10,5, 5,-5,-5,6, 6,-6,-6,7, 7,-7,-7,8, 8,-8,-8,9, 9,-9,-9,3, 3,-3,-3,1, 1,-1,-1,12,-12,6,-6, 6,-6,7,-7, 7,-7,8,-8, 8,-8,9,-9, 9,-9,10,-10,10,-10,11,-11,11,-11,4,-4, 4,-4,2,-2, 2,-2,0, 0}, + y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1,0, 0,4,-4,-4, 4,3,-3, 3,-3,4,-4, 4,-4,4,-4,2,-2, 2,-2,1,-1, 1,-1, 0, 0,5,-5, 5,-5,4,-4, 4,-4,3,-3, 3,-7,2,-2, 2,-2,1,-1, 1,-1,5,-5, 5,-5,5,-5, 5,-5, 0, 0,6, 6,-6,-6,5, 5,-5,-5,4, 4,-4,-4,3, 3,-3,-3, 2, 2,-2, -2, 1, 1,-1, -1,6, 6,-6,-6,6, 6,-6,-6,6,-6}, + }, + ["pyramid"] = { + [1] = { + {angle = 0, distance = 0}, + }, + [2] = { + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + }, + [3] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + }, + [4] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = 0, distance = 2}, + }, + [5] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + }, + [6] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + }, + [7] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + }, + [8] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + }, + [9] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = -4, distance = 4}, + {angle = 4, distance = 4}, + }, + [10] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = -2, distance = 3}, + {angle = 2, distance = 3}, + }, + [11] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = -4, distance = 4}, + {angle = 4, distance = 4}, + {angle = -3, distance = 4}, + {angle = 3, distance = 4}, + }, + [12] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = -2, distance = 3}, + {angle = 2, distance = 3}, + {angle = -1, distance = 3}, + {angle = 1, distance = 3}, + }, + [13] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = 0, distance = 3}, + {angle = -2, distance = 4}, + {angle = 2, distance = 4}, + {angle = -1, distance = 5}, + {angle = 1, distance = 5}, + {angle = 0, distance = 6}, + }, + [14] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = 0, distance = 4}, + {angle = -2, distance = 4}, + {angle = 2, distance = 4}, + {angle = -1, distance = 5}, + {angle = 1, distance = 5}, + {angle = 0, distance = 6}, + }, + [15] = { + {angle = 0, distance = 0}, + {angle = -1, distance = 1}, + {angle = 1, distance = 1}, + {angle = -2, distance = 2}, + {angle = 2, distance = 2}, + {angle = 0, distance = 2}, + {angle = -3, distance = 3}, + {angle = 3, distance = 3}, + {angle = 0, distance = 3}, + {angle = 0, distance = 4}, + {angle = -2, distance = 4}, + {angle = 2, distance = 4}, + {angle = -1, distance = 5}, + {angle = 1, distance = 5}, + {angle = 0, distance = 6}, + }, + }, + } + max_pyramid_tier = 15 --Player ship name lists to supplant standard randomized call sign generation - playerShipNamesForMP52Hornet = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"} - playerShipNamesForPiranha = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"} - playerShipNamesForFlaviaPFalcon = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"} - playerShipNamesForPhobosM3P = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"} - playerShipNamesForAtlantis = {"Excaliber","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"} - playerShipNamesForCruiser = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"} - playerShipNamesForMissileCruiser = {"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"} - playerShipNamesForFighter = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"} - playerShipNamesForBenedict = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"} - playerShipNamesForKiriya = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"} - playerShipNamesForStriker = {"Sparrow","Sizzle","Squawk","Crow","Phoenix","Snowbird","Hawk"} - playerShipNamesForLindworm = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"} - playerShipNamesForRepulse = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"} - playerShipNamesForEnder = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"} - playerShipNamesForNautilus = {"October","Abdiel","Manxman","Newcon","Nusret","Pluton","Amiral","Amur","Heinkel","Dornier"} - playerShipNamesForHathcock = {"Hayha","Waldron","Plunkett","Mawhinney","Furlong","Zaytsev","Pavlichenko","Pegahmagabow","Fett","Hawkeye","Hanzo"} - playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"} - playerShipNamesForProtoAtlantis = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"} - playerShipNamesForMaverick = {"Angel", "Thunderbird", "Roaster", "Magnifier", "Hedge"} - playerShipNamesForCrucible = {"Sling", "Stark", "Torrid", "Kicker", "Flummox"} - playerShipNamesForSurkov = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"} - playerShipNamesForStricken = {"Blazon", "Streaker", "Pinto", "Spear", "Javelin"} - playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"} - playerShipNamesForRedhook = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"} - playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"} + playerShipNamesFor = { + ["Atlantis"] = {"Excaliber","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"}, + ["Atlantis II"] = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}, + ["Benedict"] = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"}, + ["Crucible"] = {"Sling", "Stark", "Torrid", "Kicker", "Flummox"}, + ["Ender"] = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"}, + ["Flavia P.Falcon"] = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"}, + ["Hathcock"] = {"Hayha","Waldron","Plunkett","Mawhinney","Furlong","Zaytsev","Pavlichenko","Pegahmagabow","Fett","Hawkeye","Hanzo"}, + ["Kiriya"] = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"}, + ["Maverick"] = {"Angel", "Thunderbird", "Roaster", "Magnifier", "Hedge"}, + ["MP52 Hornet"] = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"}, + ["Nautilus"] = {"October","Abdiel","Manxman","Newcon","Nusret","Pluton","Amiral","Amur","Heinkel","Dornier"}, + ["Phobos M3P"] = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"}, + ["Piranha"] = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"}, + ["Player Cruiser"] = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"}, + ["Player Fighter"] = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"}, + ["Player Missile Cr."] ={"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"}, + ["Proto-Atlantis"] = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"}, + ["Redhook"] = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"}, + ["Repulse"] = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"}, + ["Stricken"] = {"Blazon", "Streaker", "Pinto", "Spear", "Javelin"}, + ["Striker"] = {"Sparrow","Sizzle","Squawk","Crow","Phoenix","Snowbird","Hawk"}, + ["Surkov"] = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"}, + ["ZX-Lindworm"] = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"}, + ["Leftovers"] = {"Foregone","Righteous",""}, + } + player_ship_stats = { + ["MP52 Hornet"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 600, cm_strafe = 0, }, + ["Piranha"] = { strength = 16, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, }, + ["Flavia P.Falcon"] = { strength = 13, cargo = 15, distance = 200, long_range_radar = 40000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 250, cm_strafe = 150, }, + ["Phobos M3P"] = { strength = 19, cargo = 10, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Atlantis"] = { strength = 52, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Player Cruiser"] = { strength = 40, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Player Missile Cr."] = { strength = 45, cargo = 8, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 450, cm_strafe = 150, }, + ["Player Fighter"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 15000, short_range_radar = 4500, tractor = false, mining = false, cm_boost = 600, cm_strafe = 0, }, + ["Benedict"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Kiriya"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 35000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Striker"] = { strength = 8, cargo = 4, distance = 200, long_range_radar = 35000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["ZX-Lindworm"] = { strength = 8, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 5500, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Repulse"] = { strength = 14, cargo = 12, distance = 200, long_range_radar = 38000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Ender"] = { strength = 100, cargo = 20, distance = 2000,long_range_radar = 45000, short_range_radar = 7000, tractor = true, mining = false, cm_boost = 800, cm_strafe = 500, }, + ["Nautilus"] = { strength = 12, cargo = 7, distance = 200, long_range_radar = 22000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Hathcock"] = { strength = 30, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = true, cm_boost = 200, cm_strafe = 150, }, + ["Maverick"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Crucible"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Proto-Atlantis"] = { strength = 40, cargo = 4, distance = 400, long_range_radar = 30000, short_range_radar = 4500, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Stricken"] = { strength = 40, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Surkov"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, }, + ["Redhook"] = { strength = 11, cargo = 8, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, }, + ["Pacu"] = { strength = 18, cargo = 7, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, }, + ["Phobos T2"] = { strength = 19, cargo = 9, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Wombat"] = { strength = 13, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Holmes"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 4000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Focus"] = { strength = 35, cargo = 4, distance = 200, long_range_radar = 32000, short_range_radar = 5000, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, }, + ["Flavia 2C"] = { strength = 25, cargo = 12, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = true, cm_boost = 250, cm_strafe = 150, }, + ["Destroyer IV"] = { strength = 25, cargo = 5, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Destroyer III"] = { strength = 25, cargo = 7, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 450, cm_strafe = 150, }, + ["MX-Lindworm"] = { strength = 10, cargo = 3, distance = 100, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Striker LX"] = { strength = 16, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, }, + ["Maverick XP"] = { strength = 23, cargo = 5, distance = 200, long_range_radar = 25000, short_range_radar = 7000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, }, + ["Era"] = { strength = 14, cargo = 14, distance = 200, long_range_radar = 50000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 250, cm_strafe = 150, }, + ["Squid"] = { strength = 14, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, }, + ["Atlantis II"] = { strength = 60, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, }, + } if server_voices then primusNames = {"Minos","Talos","Primus"} secondusNames = {"Secondus","Aurora","Covenant"} @@ -523,6 +876,12 @@ function setConstants() tertiusNames = {"Cat's Eye","Tertius","Dagoba","Pitcairn","Tl'ho","Megas","Amateru","Tadmore","Brahe"} solNames = {"Sol","Sun","Groombridge 34","Tau Ceti","Wolf 1061","Gliese 876","Barnard"} end + station_sizes = { + ["Huge Station"] = {strength = 10, short_lo = 150, short_hi = 500}, + ["Large Station"] = {strength = 5, short_lo = 90, short_hi = 300}, + ["Medium Station"] = {strength = 3, short_lo = 60, short_hi = 200}, + ["Small Station"] = {strength = 1, short_lo = 35, short_hi = 100}, + } commonGoods = {"food","medicine","nickel","platinum","gold","dilithium","tritanium","luxury","cobalt","impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"} componentGoods = {"impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"} mineralGoods = {"nickel","platinum","gold","dilithium","tritanium","cobalt"} @@ -566,7 +925,6 @@ function setConstants() "Victoria Garcia", "Miguel Lopez", "Renata Rodriguez"} - virus_status_functions = {virusStatusP1,virusStatusP2,virusStatusP3,virusStatusP4,virusStatusP5,virusStatusP6,virusStatusP7,virusStatusP8} -- short clip name length in seconds voice_clips = { ["Avery01"] = 0.971, @@ -676,24 +1034,88 @@ function setConstants() ["Tracy13"] = 3.344, ["Tracy14"] = 0.775, } - cargoInventoryList = {} - table.insert(cargoInventoryList,cargoInventory1) - table.insert(cargoInventoryList,cargoInventory2) - table.insert(cargoInventoryList,cargoInventory3) - table.insert(cargoInventoryList,cargoInventory4) - table.insert(cargoInventoryList,cargoInventory5) - table.insert(cargoInventoryList,cargoInventory6) - table.insert(cargoInventoryList,cargoInventory7) - table.insert(cargoInventoryList,cargoInventory8) - get_coolant_function = {} - table.insert(get_coolant_function,getCoolant1) - table.insert(get_coolant_function,getCoolant2) - table.insert(get_coolant_function,getCoolant3) - table.insert(get_coolant_function,getCoolant4) - table.insert(get_coolant_function,getCoolant5) - table.insert(get_coolant_function,getCoolant6) - table.insert(get_coolant_function,getCoolant7) - table.insert(get_coolant_function,getCoolant8) +end +function placeUVStation(psx,psy,name) + local pStation = nil + if stationSize == nil then + pStation = placeStation(psx,psy,name) + if stationFaction == "Human Navy" then + humanStationStrength = humanStationStrength + station_sizes[sizeTemplate].strength + pStation:onDestruction(humanStationDestroyed) + table.insert(humanStationList,pStation) --save station in friendly station list + elseif stationFaction ~= "Exuari" then + neutralStationStrength = neutralStationStrength + station_sizes[sizeTemplate].strength + pStation:onDestruction(neutralStationDestroyed) + table.insert(neutralStationList,pStation) --save station in friendly station list + end + else + pStation = placeStation(psx,psy,name,stationSize) + if stationFaction == "Human Navy" then + humanStationStrength = humanStationStrength + station_sizes[stationSize].strength + pStation:onDestruction(humanStationDestroyed) + elseif stationFaction ~= "Exuari" then + neutralStationStrength = neutralStationStrength + station_sizes[stationSize].strength + pStation:onDestruction(neutralStationDestroyed) + table.insert(neutralStationList,pStation) --save station in friendly station list + end + end + if stationCommunication ~= nil then + if stationCommunication == "commsStation" then + pStation:setCommsScript(""):setCommsFunction(commsStation) + else + pStation:setCommsScript(stationCommunication) + end + end + if stationStaticAsteroids then + local station_name = pStation:getCallSign() + if station_name == "Grasberg" or station_name == "Impala" or station_name == "Outpost-15" or station_name == "Outpost-21" then + placeRandomAsteroidAroundPoint(Asteroid,15,1,15000,psx,psy) + placeRandomAsteroidAroundPoint(VisualAsteroid,30,1,15000,psx,psy) + elseif station_name == "Krak" then + local posAxisKrak = random(0,360) + local posKrak = random(10000,60000) + local negKrak = random(10000,60000) + local spreadKrak = random(4000,7000) + local negAxisKrak = posAxisKrak + 180 + local xPosAngleKrak, yPosAngleKrak = vectorFromAngle(posAxisKrak, posKrak) + local posKrakEnd = random(30,70) + createRandomAlongArc(Asteroid, 30+posKrakEnd, psx+xPosAngleKrak, psy+yPosAngleKrak, posKrak, negAxisKrak, negAxisKrak+posKrakEnd, spreadKrak) + createRandomAlongArc(VisualAsteroid, (30+posKrakEnd)*2, psx+xPosAngleKrak, psy+yPosAngleKrak, posKrak, negAxisKrak, negAxisKrak+posKrakEnd, spreadKrak) + local xNegAngleKrak, yNegAngleKrak = vectorFromAngle(negAxisKrak, negKrak) + local negKrakEnd = random(40,80) + createRandomAlongArc(Asteroid, 30+negKrakEnd, psx+xNegAngleKrak, psy+yNegAngleKrak, negKrak, posAxisKrak, posAxisKrak+negKrakEnd, spreadKrak) + createRandomAlongArc(VisualAsteroid, (30+negKrakEnd)*2, psx+xNegAngleKrak, psy+yNegAngleKrak, negKrak, posAxisKrak, posAxisKrak+negKrakEnd, spreadKrak) + elseif station_name == "Kruk" then + local posAxisKruk = random(0,360) + local posKruk = random(10000,60000) + local negKruk = random(10000,60000) + local spreadKruk = random(4000,7000) + local negAxisKruk = posAxisKruk + 180 + local xPosAngleKruk, yPosAngleKruk = vectorFromAngle(posAxisKruk, posKruk) + local posKrukEnd = random(30,70) + createRandomAlongArc(Asteroid, 30+posKrukEnd, psx+xPosAngleKruk, psy+yPosAngleKruk, posKruk, negAxisKruk, negAxisKruk+posKrukEnd, spreadKruk) + createRandomAlongArc(VisualAsteroid, (30+posKrukEnd)*2, psx+xPosAngleKruk, psy+yPosAngleKruk, posKruk, negAxisKruk, negAxisKruk+posKrukEnd, spreadKruk) + local xNegAngleKruk, yNegAngleKruk = vectorFromAngle(negAxisKruk, negKruk) + local negKrukEnd = random(40,80) + createRandomAlongArc(Asteroid, 30+negKrukEnd, psx+xNegAngleKruk, psy+yNegAngleKruk, negKruk, posAxisKruk, posAxisKruk+negKrukEnd, spreadKruk) + createRandomAlongArc(VisualAsteroid, (30+negKrukEnd)*2, psx+xNegAngleKruk, psy+yNegAngleKruk, negKruk, posAxisKruk, posAxisKruk+negKrukEnd, spreadKruk) + elseif station_name == "Krik" then + local posAxisKrik = random(0,360) + local posKrik = random(30000,80000) + local negKrik = random(20000,60000) + local spreadKrik = random(5000,8000) + local negAxisKrik = posAxisKrik + 180 + local xPosAngleKrik, yPosAngleKrik = vectorFromAngle(posAxisKrik, posKrik) + local posKrikEnd = random(40,90) + createRandomAlongArc(Asteroid, 30+posKrikEnd, psx+xPosAngleKrik, psy+yPosAngleKrik, posKrik, negAxisKrik, negAxisKrik+posKrikEnd, spreadKrik) + createRandomAlongArc(VisualAsteroid, (30+posKrikEnd)*2, psx+xPosAngleKrik, psy+yPosAngleKrik, posKrik, negAxisKrik, negAxisKrik+posKrikEnd, spreadKrik) + local xNegAngleKrik, yNegAngleKrik = vectorFromAngle(negAxisKrik, negKrik) + local negKrikEnd = random(30,60) + createRandomAlongArc(Asteroid, 30+negKrikEnd, psx+xNegAngleKrik, psy+yNegAngleKrik, negKrik, posAxisKrik, posAxisKrik+negKrikEnd, spreadKrik) + createRandomAlongArc(VisualAsteroid, (30+negKrikEnd)*2, psx+xNegAngleKrik, psy+yNegAngleKrik, negKrik, posAxisKrik, posAxisKrik+negKrikEnd, spreadKrik) + end + end + return pStation end function buildLocalSolarSystem() stationList = {} @@ -759,14 +1181,9 @@ function buildLocalSolarSystem() psy = primusY+ply stationStaticAsteroids = false stationFaction = "Human Navy" --set station faction - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetPrimus:getCallSign(),primusMoonOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(clueStations,pStation) --1 primusStation = pStation -- player spawn band (5 units wide: 5000) @@ -822,14 +1239,9 @@ function buildLocalSolarSystem() plx, ply = vectorFromAngle(0,secondusStationOrbit) psx = secondusX + plx psy = secondusY + ply - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(secondusStations,pStation) table.insert(clueStations,pStation) --2 pStation.angle = 0 @@ -837,14 +1249,9 @@ function buildLocalSolarSystem() plx, ply = vectorFromAngle(120,secondusStationOrbit) psx = secondusX + plx psy = secondusY + ply - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(secondusStations,pStation) table.insert(clueStations,pStation) --3 pStation.angle = 120 @@ -852,14 +1259,9 @@ function buildLocalSolarSystem() plx, ply = vectorFromAngle(240,secondusStationOrbit) psx = secondusX + plx psy = secondusY + ply - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(secondusStations,pStation) table.insert(clueStations,pStation) --4 pStation.angle = 240 @@ -903,18 +1305,7 @@ function buildLocalSolarSystem() else stationFaction = "Independent" --set station faction end - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - if stationFaction == "Human Navy" then - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) - table.insert(humanStationList,pStation) --save station in friendly station list - else - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) - table.insert(neutralStationList,pStation) --save station in friendly station list - end + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") table.insert(stationList,pStation) --save station in general station list table.insert(playerSpawnBandStations,pStation) sa2 = sa2 + random(18,36) @@ -926,128 +1317,40 @@ function buildLocalSolarSystem() else stationFaction = "Independent" --set station faction end - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - if stationFaction == "Human Navy" then - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) - table.insert(humanStationList,pStation) --save station in friendly station list - else - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) - table.insert(neutralStationList,pStation) --save station in friendly station list - end + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") table.insert(stationList,pStation) --save station in general station list table.insert(playerSpawnBandStations,pStation) end --transports in player spawn band transportsInPlayerSpawnBandList = {} - transportCheckDelayInterval = 4 - transportCheckDelayTimer = transportCheckDelayInterval + local player_band_transports = { + {start_station = 1, target_station = 3}, + {start_station = 3, target_station = 5}, + {start_station = 5, target_station = 7}, + {start_station = 2, target_station = 4}, + {start_station = 4, target_station = 6}, + {start_station = 6, target_station = 8}, + } local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"} - local name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[1]:getPosition() - local tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[1]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[1]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[1] - tempTransport.targetEnd = playerSpawnBandStations[3] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) - end - table.insert(transportsInPlayerSpawnBandList,tempTransport) - name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[3]:getPosition() - tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[3]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[3]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[3] - tempTransport.targetEnd = playerSpawnBandStations[5] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) - end - table.insert(transportsInPlayerSpawnBandList,tempTransport) - name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[5]:getPosition() - tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[5]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[5]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[5] - tempTransport.targetEnd = playerSpawnBandStations[7] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) - end - table.insert(transportsInPlayerSpawnBandList,tempTransport) - name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[2]:getPosition() - tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[2]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[2]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[2] - tempTransport.targetEnd = playerSpawnBandStations[4] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) - end - table.insert(transportsInPlayerSpawnBandList,tempTransport) - name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[4]:getPosition() - tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[4]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[4]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[4] - tempTransport.targetEnd = playerSpawnBandStations[6] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) - end - table.insert(transportsInPlayerSpawnBandList,tempTransport) - name = transportType[math.random(1,#transportType)] - if random(1,100) < 30 then - name = name .. " Jump Freighter " .. math.random(3, 5) - else - name = name .. " Freighter " .. math.random(1, 5) - end - psx, psy = playerSpawnBandStations[6]:getPosition() - tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[6]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) - tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[6]:getFaction())) - tempTransport.targetStart = playerSpawnBandStations[6] - tempTransport.targetEnd = playerSpawnBandStations[8] - if random(1,100) < 50 then - tempTransport:orderDock(tempTransport.targetStart) - else - tempTransport:orderDock(tempTransport.targetEnd) + for i,band in ipairs(player_band_transports) do + local name = transportType[math.random(1,#transportType)] + if random(1,100) < 30 then + name = name .. " Jump Freighter " .. math.random(3, 5) + else + name = name .. " Freighter " .. math.random(1, 5) + end + local psx, psy = playerSpawnBandStations[band.start_station]:getPosition() + local tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[band.start_station]:getFaction()):setCommsScript(""):setCommsFunction(commsShip) + tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[band.start_station]:getFaction())) + tempTransport.targetStart = playerSpawnBandStations[band.start_station] + tempTransport.targetEnd = playerSpawnBandStations[band.target_station] + if random(1,100) < 50 then + tempTransport:orderDock(tempTransport.targetStart) + else + tempTransport:orderDock(tempTransport.targetEnd) + end + table.insert(transportsInPlayerSpawnBandList,tempTransport) end - table.insert(transportsInPlayerSpawnBandList,tempTransport) ------------------------------ -- populate asteroid belt 1 -- ------------------------------ @@ -1069,14 +1372,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Human Navy" --set station faction - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the inner asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit1/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(belt1Stations,pStation) table.insert(clueStations,pStation) --5 pStation.angle = beltStationAngle @@ -1091,14 +1389,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the inner asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit1/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt1Stations,pStation) table.insert(clueStations,pStation) --6 pStation.angle = beltStationAngle @@ -1118,14 +1411,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the inner asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit1/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt1Stations,pStation) table.insert(clueStations,pStation) --7 pStation.angle = beltStationAngle @@ -1139,14 +1427,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the inner asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit1/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt1Stations,pStation) table.insert(clueStations,pStation) --8 pStation.angle = beltStationAngle @@ -1166,14 +1449,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the inner asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit1/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt1Stations,pStation) table.insert(clueStations,pStation) --9 pStation.angle = beltStationAngle @@ -1190,7 +1468,7 @@ function buildLocalSolarSystem() createOrbitalAsteroids(asteroidPopulation,beltOrbit1,beltStationAngle,belt1Stations[5].angle-1,"belt1",math.floor(beltOrbit1Width/2)) plx, ply = vectorFromAngle(beltStationAngle + 10,beltOrbit1) belt1Artifact = Artifact():setPosition(solX+plx,solY+ply):setScanningParameters(3,2):setRadarSignatureInfo(1,1,0) - belt1Artifact:setModel("artifact6"):allowPickup(false):setDescriptions(_("scienceDescription-artifact", "Sensor readings change as the object orbits with the asteroid belt"), _("scienceDescription-artifact", "Object exhibits periodic spikes of chroniton particles")) + belt1Artifact:setModel("artifact6"):allowPickup(false):setDescriptions("Sensor readings change as the object orbits with the asteroid belt","Object exhibits periodic spikes of chroniton particles") belt1Artifact.angle = beltStationAngle + 10 ------------------------------ -- populate asteroid belt 2 -- @@ -1213,14 +1491,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Human Navy" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit2/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(belt2Stations,pStation) table.insert(clueStations,pStation) --10 pStation.angle = beltStationAngle @@ -1234,14 +1507,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit2/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt2Stations,pStation) table.insert(clueStations,pStation) --11 pStation.angle = beltStationAngle @@ -1261,14 +1529,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit2/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt2Stations,pStation) table.insert(clueStations,pStation) --12 pStation.angle = beltStationAngle @@ -1282,14 +1545,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit2/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt2Stations,pStation) table.insert(clueStations,pStation) --13 pStation.angle = beltStationAngle @@ -1309,14 +1567,9 @@ function buildLocalSolarSystem() psx = solX+plx psy = solY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetSol:getCallSign(),beltOrbit2/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(belt2Stations,pStation) table.insert(clueStations,pStation) --14 pStation.angle = beltStationAngle @@ -1403,14 +1656,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Human Navy" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the moons and asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusMoonOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(clueStations,pStation) --15 tertiusStation = pStation tertiusStation.angle = tertiusStationAngle @@ -1433,14 +1681,9 @@ function buildLocalSolarSystem() pmx, pmy = planetTertiusMoon1:getPosition() psx = pmx + plx psy = pmy + ply - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting a moon of %s at a distance of %.1fU",planetTertius:getCallSign(),tertiusMoon1StationOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(clueStations,pStation) --16 tertiusMoon1Station = pStation tertiusMoon1Station.angle = 0 @@ -1467,14 +1710,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Human Navy" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(humanStationList,pStation) --save station in friendly station list table.insert(clueStations,pStation) --16 table.insert(tertiusAsteroidStations,pStation) pStation.angle = beltStationAngle @@ -1489,14 +1727,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(tertiusAsteroidStations,pStation) table.insert(clueStations,pStation) --17 pStation.angle = beltStationAngle @@ -1511,14 +1744,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(tertiusAsteroidStations,pStation) table.insert(clueStations,pStation) --18 pStation.angle = beltStationAngle @@ -1533,14 +1761,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(tertiusAsteroidStations,pStation) table.insert(clueStations,pStation) --19 pStation.angle = beltStationAngle @@ -1555,14 +1778,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(tertiusAsteroidStations,pStation) table.insert(clueStations,pStation) --20 pStation.angle = beltStationAngle @@ -1577,14 +1795,9 @@ function buildLocalSolarSystem() psx = tertiusX+plx psy = tertiusY+ply stationFaction = "Independent" - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") pStation.comms_data.orbit = string.format("orbiting %s with the outer asteroids at a distance of %.1fU",planetTertius:getCallSign(),tertiusAsteroidOrbit/1000) table.insert(stationList,pStation) --save station in general station list - table.insert(neutralStationList,pStation) --save station in neutral station list table.insert(tertiusAsteroidStations,pStation) table.insert(clueStations,pStation) --21 pStation.angle = beltStationAngle @@ -1595,6 +1808,7 @@ function buildLocalSolarSystem() sa1 = random(0,360) sa2 = sa1 + 120 sa3 = sa2 + 120 + local asteroid_amount = 0 for i=1,4 do plx, ply = vectorFromAngle(sa1,outerBelt2Spawn - (outerBelt2SpawnWidth/2) + random(1,outerBelt2SpawnWidth)) psx = solX+plx @@ -1604,24 +1818,15 @@ function buildLocalSolarSystem() else stationFaction = "Independent" --set station faction end - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - if stationFaction == "Human Navy" then - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) - table.insert(humanStationList,pStation) --save station in friendly station list - else - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) - table.insert(neutralStationList,pStation) --save station in friendly station list - end + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") table.insert(stationList,pStation) --save station in general station list table.insert(outerBelt2Stations,pStation) table.insert(clueStations,pStation) --22-25 if random(1,100) < 8 then local abx, aby = vectorFromAngle(sa1,outerBelt2Spawn) - placeRandomAroundPoint(Asteroid,math.random(6,20),1,7800,solX+abx,solY+aby) + asteroid_amount = math.random(6,20) + placeRandomAsteroidAroundPoint(Asteroid,asteroid_amount,1,7800,solX+abx,solY+aby) + placeRandomAsteroidAroundPoint(VisualAsteroid,asteroid_amount*2,1,7800,solX+abx,solY+aby) end sa1 = sa1 + random(12,30) plx, ply = vectorFromAngle(sa2,outerBelt2Spawn - (outerBelt2SpawnWidth/2) + random(1,outerBelt2SpawnWidth)) @@ -1632,24 +1837,15 @@ function buildLocalSolarSystem() else stationFaction = "Independent" --set station faction end - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - if stationFaction == "Human Navy" then - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) - table.insert(humanStationList,pStation) --save station in friendly station list - else - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) - table.insert(neutralStationList,pStation) --save station in friendly station list - end + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") table.insert(stationList,pStation) --save station in general station list table.insert(outerBelt2Stations,pStation) table.insert(clueStations,pStation) --26-29 if random(1,100) < 8 then local abx, aby = vectorFromAngle(sa2,outerBelt2Spawn) - placeRandomAroundPoint(Asteroid,math.random(6,20),1,7800,solX+abx,solY+aby) + asteroid_amount = math.random(6,20) + placeRandomAsteroidAroundPoint(Asteroid,asteroid_amount,1,7800,solX+abx,solY+aby) + placeRandomAsteroidAroundPoint(VisualAsteroid,asteroid_amount*2,1,7800,solX+abx,solY+aby) end sa2 = sa2 + random(12,30) plx, ply = vectorFromAngle(sa3,outerBelt2Spawn - (outerBelt2SpawnWidth/2) + random(1,outerBelt2SpawnWidth)) @@ -1660,24 +1856,15 @@ function buildLocalSolarSystem() else stationFaction = "Independent" --set station faction end - si = math.random(1,#placeStation) --station index - pStation = placeStation[si]() --place selected station - table.remove(placeStation,si) --remove station from placement list - if stationFaction == "Human Navy" then - humanStationStrength = humanStationStrength + setStationStrength(pStation) - pStation:onDestruction(humanStationDestroyed) - table.insert(humanStationList,pStation) --save station in friendly station list - else - neutralStationStrength = neutralStationStrength + setStationStrength(pStation) - pStation:onDestruction(neutralStationDestroyed) - table.insert(neutralStationList,pStation) --save station in friendly station list - end + pStation = placeUVStation(psx,psy,"RandomHumanNeutral") table.insert(stationList,pStation) --save station in general station list table.insert(outerBelt2Stations,pStation) table.insert(clueStations,pStation) --30-33 if random(1,100) < 8 then local abx, aby = vectorFromAngle(sa3,outerBelt2Spawn) - placeRandomAroundPoint(Asteroid,math.random(6,20),1,7800,solX+abx,solY+aby) + asteroid_amount = math.random(6,20) + placeRandomAsteroidAroundPoint(Asteroid,asteroid_amount,1,7800,solX+abx,solY+aby) + placeRandomAsteroidAroundPoint(VisualAsteroid,asteroid_amount*2,1,7800,solX+abx,solY+aby) end sa3 = sa3 + random(12,30) end @@ -1770,20 +1957,20 @@ function nebulaRiver() end end coolant_nebula = {} - local nebula_index = 0 - for i=1,#nebula_list do - nebula_list[i].lose = false - nebula_list[i].gain = false + for i,neb in ipairs(nebula_list) do + neb.lose = false + neb.gain = false end local nebula_count = #nebula_list for i=1,math.random(math.floor(nebula_count/2)) do - nebula_index = math.random(1,#nebula_list) - table.insert(coolant_nebula,nebula_list[nebula_index]) - table.remove(nebula_list,nebula_index) - if math.random(1,100) < 50 then - coolant_nebula[#coolant_nebula].lose = true - else - coolant_nebula[#coolant_nebula].gain = true + local neb = tableRemoveRandom(nebula_list) + if neb ~= nil then + if math.random(1,100) < 50 then + neb.lose = true + else + neb.gain = true + end + table.insert(coolant_nebula,neb) end end end @@ -1800,6 +1987,7 @@ function createTertiusOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc, local radialPoint = startArc+ndex local pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1808,11 +1996,28 @@ function createTertiusOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc, ta.speed = speedIncrement ta.belt_id = belt_id table.insert(tertiusAsteroids,ta) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) end for ndex=1,math.floor(amount-arcLen) do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1820,13 +2025,30 @@ function createTertiusOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc, ta.distance = pointDist ta.speed = speedIncrement ta.belt_id = belt_id - table.insert(tertiusAsteroids,ta) + table.insert(tertiusAsteroids,ta) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) end else for ndex=1,amount do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1834,7 +2056,25 @@ function createTertiusOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc, ta.distance = pointDist ta.speed = speedIncrement ta.belt_id = belt_id - table.insert(tertiusAsteroids,ta) + table.insert(tertiusAsteroids,ta) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(tertiusX + math.cos(radialPoint / 180 * math.pi) * pointDist, tertiusY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = speedIncrement * random(.9,1.1) + tva.belt_id = belt_id + table.insert(tertiusAsteroids,tva) end end end @@ -1846,11 +2086,14 @@ function createOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc,belt_id clockwiseEndArc = clockwiseEndArc + 360 arcLen = arcLen + 360 end + local radialPoint = 0 + local pointDist = 0 if amount > arcLen then for ndex=1,math.floor(arcLen) do - local radialPoint = startArc+ndex - local pointDist = distance + random(-randomize,randomize) + radialPoint = startArc+ndex + pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1858,12 +2101,29 @@ function createOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc,belt_id ta.distance = pointDist ta.speed = beltOrbitalSpeed ta.belt_id = belt_id - table.insert(beltAsteroidList,ta) + table.insert(beltAsteroidList,ta) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) end for ndex=1,math.floor(amount-arcLen) do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1871,13 +2131,32 @@ function createOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc,belt_id ta.distance = pointDist ta.speed = beltOrbitalSpeed ta.belt_id = belt_id - table.insert(beltAsteroidList,ta) + table.insert(beltAsteroidList,ta) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) end else for ndex=1,amount do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) ta = Asteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + ta:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) if radialPoint > 360 then radialPoint = radialPoint - 360 end @@ -1885,7 +2164,25 @@ function createOrbitalAsteroids(amount,distance,startArc,clockwiseEndArc,belt_id ta.distance = pointDist ta.speed = beltOrbitalSpeed ta.belt_id = belt_id - table.insert(beltAsteroidList,ta) + table.insert(beltAsteroidList,ta) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) + radialPoint = random(startArc,clockwiseEndArc) + pointDist = distance + random(-randomize,randomize) + tva = VisualAsteroid():setPosition(solX + math.cos(radialPoint / 180 * math.pi) * pointDist, solY + math.sin(radialPoint / 180 * math.pi) * pointDist) + tva:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + tva.angle = radialPoint + tva.distance = pointDist + tva.speed = beltOrbitalSpeed * random(.9,1.1) + tva.belt_id = belt_id + table.insert(beltAsteroidList,tva) end end end @@ -2030,6 +2327,19 @@ function movingObjects(delta) end if moveDiagnostic then print("end of moving objects") end end +function angleFromVectorNorth(p1x,p1y,p2x,p2y) + if spew_function_diagnostic then print("top of angle from vector north") end + TWOPI = 6.2831853071795865 + RAD2DEG = 57.2957795130823209 + atan2parm1 = p2x - p1x + atan2parm2 = p2y - p1y + theta = math.atan2(atan2parm1, atan2parm2) + if theta < 0 then + theta = theta + TWOPI + end + if spew_function_diagnostic then print("bottom (ish) of angle from vector north") end + return (360 - (RAD2DEG * theta)) % 360 +end ------------------------------------------- -- Object destruction callback functions -- ------------------------------------------- @@ -2045,41 +2355,25 @@ function kraylorVesselDestroyed(self, instigator) local tempShipType = self:getTypeName() table.insert(kraylorVesselDestroyedNameList,self:getCallSign()) table.insert(kraylorVesselDestroyedType,tempShipType) - for k=1,#stnl do - if tempShipType == stnl[k] then - table.insert(kraylorVesselDestroyedValue,stsl[k]) - end - end + table.insert(kraylorVesselDestroyedValue,ship_template[tempShipType].strength) end function exuariVesselDestroyed(self, instigator) local tempShipType = self:getTypeName() table.insert(exuariVesselDestroyedNameList,self:getCallSign()) table.insert(exuariVesselDestroyedType,tempShipType) - for k=1,#stnl do - if tempShipType == stnl[k] then - table.insert(exuariVesselDestroyedValue,stsl[k]) - end - end + table.insert(exuariVesselDestroyedValue,ship_template[tempShipType].strength) end function humanVesselDestroyed(self, instigator) local tempShipType = self:getTypeName() table.insert(humanVesselDestroyedNameList,self:getCallSign()) table.insert(humanVesselDestroyedType,tempShipType) - for k=1,#stnl do - if tempShipType == stnl[k] then - table.insert(humanVesselDestroyedValue,stsl[k]) - end - end + table.insert(humanVesselDestroyedValue,ship_template[tempShipType].strength) end function arlenianVesselDestroyed(self, instigator) local tempShipType = self:getTypeName() table.insert(arlenianVesselDestroyedNameList,self:getCallSign()) table.insert(arlenianVesselDestroyedType,tempShipType) - for k=1,#stnl do - if tempShipType == stnl[k] then - table.insert(arlenianVesselDestroyedValue,stsl[k]) - end - end + table.insert(arlenianVesselDestroyedValue,ship_template[tempShipType].strength) end ------------------------------------------------------- -- Optional mission functions to upgrade player ship -- @@ -2088,124 +2382,124 @@ function setOptionalMissions() -- faster beams local required_good = chooseUpgradeGood("beam",playerSpawnBandStations[1]) playerSpawnBandStations[1].comms_data.character = "Horace Grayson" - playerSpawnBandStations[1].comms_data.characterDescription = _("characterInfo-comms", "He dabbles in ship system innovations. He's been working on improving beam weapons by reducing the amount of time between firing. I hear he's already installed some improvements on ships that have docked here previously") + playerSpawnBandStations[1].comms_data.characterDescription = _("characterInfo-comms","He dabbles in ship system innovations. He's been working on improving beam weapons by reducing the amount of time between firing. I hear he's already installed some improvements on ships that have docked here previously") playerSpawnBandStations[1].comms_data.characterFunction = "shrinkBeamCycle" playerSpawnBandStations[1].comms_data.characterGood = required_good local clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "I heard there's a guy named %s that can fix ship beam systems up so that they shoot faster. He lives out on %s in %s. He won't charge you much, but it won't be free."),playerSpawnBandStations[1].comms_data.character,playerSpawnBandStations[1]:getCallSign(),playerSpawnBandStations[1]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","I heard there's a guy named %s that can fix ship beam systems up so that they shoot faster. He lives out on %s in %s. He won't charge you much, but it won't be free."),playerSpawnBandStations[1].comms_data.character,playerSpawnBandStations[1]:getCallSign(),playerSpawnBandStations[1]:getSectorName()) -- spin faster required_good = chooseUpgradeGood("circuit",playerSpawnBandStations[2]) playerSpawnBandStations[2].comms_data.character = "Emily Patel" - playerSpawnBandStations[2].comms_data.characterDescription = _("characterInfo-comms", "She tinkers with ship systems like engines and thrusters. She's consulted with the military on tuning spin time by increasing thruster power. She's got prototypes that are awaiting formal military approval before installation") + playerSpawnBandStations[2].comms_data.characterDescription = _("characterInfo-comms","She tinkers with ship systems like engines and thrusters. She's consulted with the military on tuning spin time by increasing thruster power. She's got prototypes that are awaiting formal military approval before installation") playerSpawnBandStations[2].comms_data.characterFunction = "increaseSpin" playerSpawnBandStations[2].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "My friend, %s recently quit her job as a ship maintenance technician to set up this side gig. She's been improving ship systems and she's pretty good at it. She set up shop on %s in %s. I hear she's even lining up a contract with the navy for her improvements."),playerSpawnBandStations[2].comms_data.character,playerSpawnBandStations[2]:getCallSign(),playerSpawnBandStations[2]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","My friend, %s recently quit her job as a ship maintenance technician to set up this side gig. She's been improving ship systems and she's pretty good at it. She set up shop on %s in %s. I hear she's even lining up a contract with the navy for her improvements."),playerSpawnBandStations[2].comms_data.character,playerSpawnBandStations[2]:getCallSign(),playerSpawnBandStations[2]:getSectorName()) -- extra missile tube required_good = chooseUpgradeGood("nanites",playerSpawnBandStations[3]) playerSpawnBandStations[3].comms_data.character = "Fred McLassiter" - playerSpawnBandStations[3].comms_data.characterDescription = _("characterInfo-comms", "He specializes in miniaturization of weapons systems. He's come up with a way to add a missile tube and some missiles to any ship regardless of size or configuration") + playerSpawnBandStations[3].comms_data.characterDescription = _("characterInfo-comms","He specializes in miniaturization of weapons systems. He's come up with a way to add a missile tube and some missiles to any ship regardless of size or configuration") playerSpawnBandStations[3].comms_data.characterFunction = "addAuxTube" playerSpawnBandStations[3].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "There's this guy, %s out on %s in %s that can add a missile tube to your ship. He even added one to my cousin's souped up freighter. You should see the new paint job: amusingly phallic"),playerSpawnBandStations[3].comms_data.character,playerSpawnBandStations[3]:getCallSign(),playerSpawnBandStations[3]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","There's this guy, %s out on %s in %s that can add a missile tube to your ship. He even added one to my cousin's souped up freighter. You should see the new paint job: amusingly phallic"),playerSpawnBandStations[3].comms_data.character,playerSpawnBandStations[3]:getCallSign(),playerSpawnBandStations[3]:getSectorName()) -- cooler beam weapon firing required_good = chooseUpgradeGood("software",playerSpawnBandStations[4]) playerSpawnBandStations[4].comms_data.character = "Dorothy Ly" - playerSpawnBandStations[4].comms_data.characterDescription = _("characterInfo-comms", "She developed this technique for cooling beam systems so that they can be fired more often without burning out") + playerSpawnBandStations[4].comms_data.characterDescription = _("characterInfo-comms","She developed this technique for cooling beam systems so that they can be fired more often without burning out") playerSpawnBandStations[4].comms_data.characterFunction = "coolBeam" playerSpawnBandStations[4].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "There's this girl on %s in %s. She is hot. Her name is %s. When I say she is hot, I mean she has a way of keeping your beam weapons from excessive heat."),playerSpawnBandStations[4]:getCallSign(),playerSpawnBandStations[4]:getSectorName(),playerSpawnBandStations[4].comms_data.character) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","There's this girl on %s in %s. She is hot. Her name is %s. When I say she is hot, I mean she has a way of keeping your beam weapons from excessive heat."),playerSpawnBandStations[4]:getCallSign(),playerSpawnBandStations[4]:getSectorName(),playerSpawnBandStations[4].comms_data.character) -- longer beam range required_good = chooseUpgradeGood("optic",playerSpawnBandStations[5]) playerSpawnBandStations[5].comms_data.character = "Gerald Cook" - playerSpawnBandStations[5].comms_data.characterDescription = _("characterInfo-comms", "He knows how to modify beam systems to extend their range") + playerSpawnBandStations[5].comms_data.characterDescription = _("characterInfo-comms","He knows how to modify beam systems to extend their range") playerSpawnBandStations[5].comms_data.characterFunction = "longerBeam" playerSpawnBandStations[5].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "Do you know about %s? He can extend the range of your beam weapons. He's on %s in %s"),playerSpawnBandStations[5].comms_data.character,playerSpawnBandStations[5]:getCallSign(),playerSpawnBandStations[5]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","Do you know about %s? He can extend the range of your beam weapons. He's on %s in %s"),playerSpawnBandStations[5].comms_data.character,playerSpawnBandStations[5]:getCallSign(),playerSpawnBandStations[5]:getSectorName()) -- increased beam damage required_good = chooseUpgradeGood("filament",playerSpawnBandStations[6]) playerSpawnBandStations[6].comms_data.character = "Sally Jenkins" - playerSpawnBandStations[6].comms_data.characterDescription = _("characterInfo-comms", "She can make your beams hit harder") + playerSpawnBandStations[6].comms_data.characterDescription = _("characterInfo-comms","She can make your beams hit harder") playerSpawnBandStations[6].comms_data.characterFunction = "damageBeam" playerSpawnBandStations[6].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "You should visit %s in %s. There's a specialist in beam technology that can increase the damage done by your beams. Her name is %s"),playerSpawnBandStations[6]:getCallSign(),playerSpawnBandStations[6]:getSectorName(),playerSpawnBandStations[6].comms_data.character) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","You should visit %s in %s. There's a specialist in beam technology that can increase the damage done by your beams. Her name is %s"),playerSpawnBandStations[6]:getCallSign(),playerSpawnBandStations[6]:getSectorName(),playerSpawnBandStations[6].comms_data.character) -- increased maximum missile storage capacity required_good = chooseUpgradeGood("transporter",playerSpawnBandStations[7]) playerSpawnBandStations[7].comms_data.character = "Anh Dung Ly" - playerSpawnBandStations[7].comms_data.characterDescription = _("characterInfo-comms", "He can fit more missiles aboard your ship") + playerSpawnBandStations[7].comms_data.characterDescription = _("characterInfo-comms","He can fit more missiles aboard your ship") playerSpawnBandStations[7].comms_data.characterFunction = "moreMissiles" playerSpawnBandStations[7].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "Want to store more missiles on your ship? Talk to %s on station %s in %s. He can retrain your missile loaders and missile storage automation such that you will be able to store more missiles"),playerSpawnBandStations[7].comms_data.character,playerSpawnBandStations[7]:getCallSign(),playerSpawnBandStations[7]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","Want to store more missiles on your ship? Talk to %s on station %s in %s. He can retrain your missile loaders and missile storage automation such that you will be able to store more missiles"),playerSpawnBandStations[7].comms_data.character,playerSpawnBandStations[7]:getCallSign(),playerSpawnBandStations[7]:getSectorName()) -- faster impulse required_good = chooseUpgradeGood("impulse",playerSpawnBandStations[8]) playerSpawnBandStations[8].comms_data.character = "Doralla Ognats" - playerSpawnBandStations[8].comms_data.characterDescription = _("characterInfo-comms", "She can soup up your impulse engines") + playerSpawnBandStations[8].comms_data.characterDescription = _("characterInfo-comms","She can soup up your impulse engines") playerSpawnBandStations[8].comms_data.characterFunction = "fasterImpulse" playerSpawnBandStations[8].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "%s, an engineer/mechanic who knows propulsion systems backwards and forwards has a bay at the shipyard on %s in %s. She can give your impulse engines a significant boost to their top speed"),playerSpawnBandStations[8].comms_data.character,playerSpawnBandStations[8]:getCallSign(),playerSpawnBandStations[8]:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","%s, an engineer/mechanic who knows propulsion systems backwards and forwards has a bay at the shipyard on %s in %s. She can give your impulse engines a significant boost to their top speed"),playerSpawnBandStations[8].comms_data.character,playerSpawnBandStations[8]:getCallSign(),playerSpawnBandStations[8]:getSectorName()) -- stronger hull required_good = chooseUpgradeGood("repulsor",tertiusStation) tertiusStation.comms_data.character = "Maduka Lawal" - tertiusStation.comms_data.characterDescription = _("characterInfo-comms", "He can strengthen your hull") + tertiusStation.comms_data.characterDescription = _("characterInfo-comms","He can strengthen your hull") tertiusStation.comms_data.characterFunction = "strongerHull" tertiusStation.comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil and clue_station ~= tertiusStation) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "I know of a materials specialist on %s in %s named %s. He can strengthen the hull on your ship"),tertiusStation:getCallSign(),tertiusStation:getSectorName(),tertiusStation.comms_data.character) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","I know of a materials specialist on %s in %s named %s. He can strengthen the hull on your ship"),tertiusStation:getCallSign(),tertiusStation:getSectorName(),tertiusStation.comms_data.character) -- efficient batteries required_good = chooseUpgradeGood("battery",tertiusMoon1Station) tertiusMoon1Station.comms_data.character = "Susil Tarigan" - tertiusMoon1Station.comms_data.characterDescription = _("characterInfo-comms", "She knows how to increase your maximum energy capacity by improving battery efficiency") + tertiusMoon1Station.comms_data.characterDescription = _("characterInfo-comms","She knows how to increase your maximum energy capacity by improving battery efficiency") tertiusMoon1Station.comms_data.characterFunction = "efficientBatteries" tertiusMoon1Station.comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil and clue_station ~= tertiusMoon1Station) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "Have you heard about %s? She's on %s in %s and she can give your ship greater energy capacity by improving your battery efficiency"),tertiusMoon1Station.comms_data.character,tertiusMoon1Station:getCallSign(),tertiusMoon1Station:getSectorName()) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","Have you heard about %s? She's on %s in %s and she can give your ship greater energy capacity by improving your battery efficiency"),tertiusMoon1Station.comms_data.character,tertiusMoon1Station:getCallSign(),tertiusMoon1Station:getSectorName()) -- stronger shields required_good = chooseUpgradeGood("shield",tertiusAsteroidStations[1]) tertiusAsteroidStations[1].comms_data.character = "Paulo Silva" - tertiusAsteroidStations[1].comms_data.characterDescription = _("characterInfo-comms", "He can strengthen your shields") + tertiusAsteroidStations[1].comms_data.characterDescription = _("characterInfo-comms","He can strengthen your shields") tertiusAsteroidStations[1].comms_data.characterFunction = "strongerShields" tertiusAsteroidStations[1].comms_data.characterGood = required_good clue_station = clueStations[math.random(1,#clueStations)] repeat clue_station = clueStations[math.random(1,#clueStations)] until(clue_station.comms_data.gossip == nil and clue_station ~= tertiusAsteroidStations[1]) - clue_station.comms_data.gossip = string.format(_("gossip-comms", "If you stop at %s in %s, you should talk to %s. He can strengthen your shields. Trust me, it's always good to have stronger shields"),tertiusAsteroidStations[1]:getCallSign(),tertiusAsteroidStations[1]:getSectorName(),tertiusAsteroidStations[1].comms_data.character) + clue_station.comms_data.gossip = string.format(_("characterInfo-comms","If you stop at %s in %s, you should talk to %s. He can strengthen your shields. Trust me, it's always good to have stronger shields"),tertiusAsteroidStations[1]:getCallSign(),tertiusAsteroidStations[1]:getSectorName(),tertiusAsteroidStations[1].comms_data.character) end function chooseUpgradeGood(ideal_good,upgrade_station) local required_good = ideal_good @@ -2247,7 +2541,7 @@ function payForUpgrade() end function shrinkBeamCycle() if comms_source.shrinkBeamCycleUpgrade == nil then - addCommsReply(_("upgrade-comms", "Reduce beam cycle time"), function() + addCommsReply(_("upgrade-comms","Reduce beam cycle time"), function() local ctd = comms_target.comms_data if comms_source:getBeamWeaponRange(0) > 0 then if payForUpgrade() then @@ -2257,6 +2551,7 @@ function shrinkBeamCycle() end if partQuantity > 0 then comms_source.shrinkBeamCycleUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 local bi = 0 @@ -2269,12 +2564,13 @@ function shrinkBeamCycle() comms_source:setBeamWeapon(bi,tempArc,tempDir,tempRng,tempCyc * .75,tempDmg) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(_("upgrade-comms", "After accepting your gift, he reduced your Beam cycle time by 25%%")) + setCommsMessage(_("upgrade-comms","After accepting your gift, he reduced your Beam cycle time by 25%%")) else - setCommsMessage(string.format(_("upgrade-comms", "%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) end else comms_source.shrinkBeamCycleUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 bi = 0 repeat tempArc = comms_source:getBeamWeaponArc(bi) @@ -2285,17 +2581,17 @@ function shrinkBeamCycle() comms_source:setBeamWeapon(bi,tempArc,tempDir,tempRng,tempCyc * .75,tempDmg) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(string.format(_("upgrade-comms", "%s reduced your Beam cycle time by 25%% at no cost in trade with the message, 'Go get those Exuari.'"),ctd.character)) + setCommsMessage(string.format(_("upgrade-comms","%s reduced your Beam cycle time by 25%% at no cost in trade with the message, 'Go get those Exuari.'"),ctd.character)) end else - setCommsMessage(_("upgrade-comms", "Your ship type does not support a beam weapon upgrade.")) + setCommsMessage(_("upgrade-comms","Your ship type does not support a beam weapon upgrade.")) end end) end end function increaseSpin() if comms_source.increaseSpinUpgrade == nil then - addCommsReply(_("upgrade-comms", "Increase spin speed"), function() + addCommsReply(_("upgrade-comms","Increase spin speed"), function() local ctd = comms_target.comms_data if payForUpgrade() then local partQuantity = 0 @@ -2304,24 +2600,26 @@ function increaseSpin() end if partQuantity > 0 then comms_source.increaseSpinUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_source:setRotationMaxSpeed(comms_source:getRotationMaxSpeed()*1.5) - setCommsMessage(string.format(_("upgrade-comms", "Ship spin speed increased by 50%% after you gave %s to %s"),ctd.characterGood,ctd.character)) + setCommsMessage(string.format(_("upgrade-comms","Ship spin speed increased by 50%% after you gave %s to %s"),ctd.characterGood,ctd.character)) else - setCommsMessage(string.format(_("upgrade-comms", "%s requires %s for the spin upgrade"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s requires %s for the spin upgrade"),ctd.character,ctd.characterGood)) end else comms_source.increaseSpinUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source:setRotationMaxSpeed(player:getRotationMaxSpeed()*1.5) - setCommsMessage(string.format(_("upgrade-comms", "%s: I increased the speed your ship spins by 50%%. Normally, I'd require %s, but seeing as you're going out to take on the Exuari, we worked it out"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: I increased the speed your ship spins by 50%%. Normally, I'd require %s, but seeing as you're going out to take on the Exuari, we worked it out"),ctd.character,ctd.characterGood)) end end) end end function addAuxTube() if comms_source.auxTubeUpgrade == nil then - addCommsReply(_("upgrade-comms", "Add missile tube"), function() + addCommsReply(_("upgrade-comms","Add missle tube"), function() local ctd = comms_target.comms_data if payForUpgrade() then local luxQuantity = 0 @@ -2334,6 +2632,7 @@ function addAuxTube() end if partQuantity > 0 and luxQuantity > 0 then comms_source.auxTubeUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.goods["luxury"] = comms_source.goods["luxury"] - 1 comms_source.cargo = comms_source.cargo + 2 @@ -2343,26 +2642,27 @@ function addAuxTube() comms_source:setWeaponTubeExclusiveFor(originalTubes, "Homing") comms_source:setWeaponStorageMax("Homing", comms_source:getWeaponStorageMax("Homing") + 2) comms_source:setWeaponStorage("Homing", comms_source:getWeaponStorage("Homing") + 2) - setCommsMessage(string.format(_("upgrade-comms", "%s thanks you for the %s and the luxury and installs a homing missile tube for you"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s thanks you for the %s and the luxury and installs a homing missile tube for you"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s requires %s and luxury for the missile tube"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s requires %s and luxury for the missile tube"),ctd.character,ctd.characterGood)) end else comms_source.auxTubeUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 originalTubes = comms_source:getWeaponTubeCount() newTubes = originalTubes + 1 comms_source:setWeaponTubeCount(newTubes) comms_source:setWeaponTubeExclusiveFor(originalTubes, "Homing") comms_source:setWeaponStorageMax("Homing", comms_source:getWeaponStorageMax("Homing") + 2) comms_source:setWeaponStorage("Homing", comms_source:getWeaponStorage("Homing") + 2) - setCommsMessage(string.format(_("upgrade-comms", "%s installs a homing missile tube for you. The %s required was requisitioned from emergency contingency supplies"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s installs a homing missile tube for you. The %s required was requisitioned from emergency contingency supplies"),ctd.character,ctd.characterGood)) end end) end end function coolBeam() if comms_source.coolBeamUpgrade == nil then - addCommsReply(_("upgrade-comms", "Reduce beam heat"), function() + addCommsReply(_("upgrade-comms","Reduce beam heat"), function() local ctd = comms_target.comms_data if comms_source:getBeamWeaponRange(0) > 0 then if payForUpgrade() then @@ -2372,6 +2672,7 @@ function coolBeam() end if partQuantity > 0 then comms_source.coolBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 local bi = 0 @@ -2379,28 +2680,29 @@ function coolBeam() comms_source:setBeamWeaponHeatPerFire(bi,comms_source:getBeamWeaponHeatPerFire(bi) * 0.5) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(_("upgrade-comms", "Beam heat generation reduced by 50%%")) + setCommsMessage(_("upgrade-comms","Beam heat generation reduced by 50%%")) else - setCommsMessage(string.format(_("upgrade-comms", "%s says she needs %s before she can cool your beams"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s says she needs %s before she can cool your beams"),ctd.character,ctd.characterGood)) end else comms_source.coolBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 bi = 0 repeat comms_source:setBeamWeaponHeatPerFire(bi,comms_source:getBeamWeaponHeatPerFire(bi) * 0.5) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(string.format(_("upgrade-comms", "%s: Beam heat generation reduced by 50%%, no %s necessary. Go shoot some Exuari for me"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: Beam heat generation reduced by 50%%, no %s necessary. Go shoot some Exuari for me"),ctd.character,ctd.characterGood)) end else - setCommsMessage(_("upgrade-comms", "Your ship type does not support a beam weapon upgrade.")) + setCommsMessage(_("upgrade-comms","Your ship type does not support a beam weapon upgrade.")) end end) end end function longerBeam() if comms_source.longerBeamUpgrade == nil then - addCommsReply(_("upgrade-comms", "Extend beam range"), function() + addCommsReply(_("upgrade-comms","Extend beam range"), function() if optionalMissionDiagnostic then print("extending beam range") end local ctd = comms_target.comms_data if comms_source:getBeamWeaponRange(0) > 0 then @@ -2415,6 +2717,7 @@ function longerBeam() end if partQuantity > 0 then comms_source.longerBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 local bi = 0 @@ -2427,12 +2730,13 @@ function longerBeam() comms_source:setBeamWeapon(bi,tempArc,tempDir,tempRng * 1.25,tempCyc,tempDmg) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(string.format(_("upgrade-comms", "%s extended your beam range by 25%% and says thanks for the %s"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s extended your beam range by 25%% and says thanks for the %s"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) end else comms_source.longerBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 bi = 0 repeat tempArc = comms_source:getBeamWeaponArc(bi) @@ -2444,17 +2748,17 @@ function longerBeam() bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) if optionalMissionDiagnostic then print("beam range extended for free") end - setCommsMessage(string.format(_("upgrade-comms", "%s increased your beam range by 25%% without the usual %s from your ship"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s increased your beam range by 25%% without the usual %s from your ship"),ctd.character,ctd.characterGood)) end else - setCommsMessage(_("upgrade-comms", "Your ship type does not support a beam weapon upgrade.")) + setCommsMessage(_("upgrade-comms","Your ship type does not support a beam weapon upgrade.")) end end) end end function damageBeam() if comms_source.damageBeamUpgrade == nil then - addCommsReply(_("upgrade-comms", "Increase beam damage"), function() + addCommsReply(_("upgrade-comms","Increase beam damage"), function() local ctd = comms_target.comms_data if comms_source:getBeamWeaponRange(0) > 0 then if payForUpgrade() then @@ -2464,6 +2768,7 @@ function damageBeam() end if partQuantity > 0 then comms_source.damageBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 local bi = 0 @@ -2476,12 +2781,13 @@ function damageBeam() comms_source:setBeamWeapon(bi,tempArc,tempDir,tempRng,tempCyc,tempDmg*1.2) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(string.format(_("upgrade-comms", "%s increased your beam damage by 20%% and stores away the %s"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s increased your beam damage by 20%% and stores away the %s"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s requires %s for the upgrade"),ctd.character,ctd.characterGood)) end else comms_source.damageBeamUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 bi = 0 repeat tempArc = comms_source:getBeamWeaponArc(bi) @@ -2492,17 +2798,17 @@ function damageBeam() comms_source:setBeamWeapon(bi,tempArc,tempDir,tempRng,tempCyc,tempDmg*1.2) bi = bi + 1 until(comms_source:getBeamWeaponRange(bi) < 1) - setCommsMessage(string.format(_("upgrade-comms", "%s increased your beam damage by 20%%, waiving the usual %s requirement"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s increased your beam damage by 20%%, waiving the usual %s requirement"),ctd.character,ctd.characterGood)) end else - setCommsMessage(_("upgrade-comms", "Your ship type does not support a beam weapon upgrade.")) + setCommsMessage(_("upgrade-comms","Your ship type does not support a beam weapon upgrade.")) end end) end end function moreMissiles() if comms_source.moreMissilesUpgrade == nil then - addCommsReply(_("upgrade-comms", "Increase missile storage capacity"), function() + addCommsReply(_("upgrade-comms","Increase missile storage capacity"), function() local ctd = comms_target.comms_data if comms_source:getWeaponTubeCount() > 0 then if payForUpgrade() then @@ -2512,33 +2818,35 @@ function moreMissiles() end if partQuantity > 0 then comms_source.moreMissilesUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 local missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} - for _, missile_type in ipairs(missile_types) do + for i, missile_type in ipairs(missile_types) do comms_source:setWeaponStorageMax(missile_type, math.ceil(comms_source:getWeaponStorageMax(missile_type)*1.25)) end - setCommsMessage(string.format(_("upgrade-comms", "%s: You can now store at least 25%% more missiles. I appreciate the %s"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: You can now store at least 25%% more missiles. I appreciate the %s"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s needs %s for the upgrade"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s needs %s for the upgrade"),ctd.character,ctd.characterGood)) end else comms_source.moreMissilesUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} - for _, missile_type in ipairs(missile_types) do + for i, missile_type in ipairs(missile_types) do comms_source:setWeaponStorageMax(missile_type, math.ceil(comms_source:getWeaponStorageMax(missile_type)*1.25)) end - setCommsMessage(string.format(_("upgrade-comms", "%s: You can now store at least 25%% more missiles. I found some spare %s on the station. Go launch those missiles at those perfidious Exuari"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: You can now store at least 25%% more missiles. I found some spare %s on the station. Go launch those missiles at those perfidious Exuari"),ctd.character,ctd.characterGood)) end else - setCommsMessage(_("upgrade-comms", "Your ship type does not support a missile storage capacity upgrade.")) + setCommsMessage(_("upgrade-comms","Your ship type does not support a missile storage capacity upgrade.")) end end) end end function fasterImpulse() if comms_source.fasterImpulseUpgrade == nil then - addCommsReply(_("upgrade-comms", "Speed up impulse engines"), function() + addCommsReply(_("upgrade-comms","Speed up impulse engines"), function() local ctd = comms_target.comms_data if payForUpgrade() then local partQuantity = 0 @@ -2547,24 +2855,26 @@ function fasterImpulse() end if partQuantity > 0 then comms_source.fasterImpulseUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_source:setImpulseMaxSpeed(comms_source:getImpulseMaxSpeed()*1.25) - setCommsMessage(string.format(_("upgrade-comms", "%s: Your impulse engines now push you up to 25%% faster. Thanks for the %s"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: Your impulse engines now push you up to 25%% faster. Thanks for the %s"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "You need to bring %s to %s for the upgrade"),ctd.characterGood,ctd.character)) + setCommsMessage(string.format(_("upgrade-comms","You need to bring %s to %s for the upgrade"),ctd.characterGood,ctd.character)) end else comms_source.fasterImpulseUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source:setImpulseMaxSpeed(comms_source:getImpulseMaxSpeed()*1.25) - setCommsMessage(string.format(_("upgrade-comms", "%s: Your impulse engines now push you up to 25%% faster. I didn't need %s after all. Go run circles around those blinking Exuari"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: Your impulse engines now push you up to 25%% faster. I didn't need %s after all. Go run circles around those blinking Exuari"),ctd.character,ctd.characterGood)) end end) end end function strongerHull() if comms_source.strongerHullUpgrade == nil then - addCommsReply(_("upgrade-comms", "Strengthen hull"), function() + addCommsReply(_("upgrade-comms","Strengthen hull"), function() local ctd = comms_target.comms_data if payForUpgrade() then local partQuantity = 0 @@ -2573,26 +2883,28 @@ function strongerHull() end if partQuantity > 0 then comms_source.strongerHullUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_source:setHullMax(comms_source:getHullMax()*1.5) comms_source:setHull(comms_source:getHullMax()) - setCommsMessage(string.format(_("upgrade-comms", "%s: Thank you for the %s. Your hull is 50%% stronger"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: Thank you for the %s. Your hull is 50%% stronger"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s: I need %s before I can increase your hull strength"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: I need %s before I can increase your hull strength"),ctd.character,ctd.characterGood)) end else comms_source.strongerHullUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source:setHullMax(comms_source:getHullMax()*1.5) comms_source:setHull(comms_source:getHullMax()) - setCommsMessage(string.format(_("upgrade-comms", "%s: I made your hull 50%% stronger. I scrounged some %s from around here since you are on the Exuari offense team"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: I made your hull 50%% stronger. I scrounged some %s from around here since you are on the Exuari offense team"),ctd.character,ctd.characterGood)) end end) end end function efficientBatteries() if comms_source.efficientBatteriesUpgrade == nil then - addCommsReply(_("upgrade-comms", "Increase battery efficiency"), function() + addCommsReply(_("upgrade-comms","Increase battery efficiency"), function() local ctd = comms_target.comms_data if payForUpgrade() then local partQuantity = 0 @@ -2601,26 +2913,28 @@ function efficientBatteries() end if partQuantity > 0 then comms_source.efficientBatteriesUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_source:setMaxEnergy(comms_source:getMaxEnergy()*1.25) comms_source:setEnergy(comms_source:getMaxEnergy()) - setCommsMessage(string.format(_("upgrade-comms", "%s: I appreciate the %s. You have a 25%% greater energy capacity due to increased battery efficiency"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: I appreciate the %s. You have a 25%% greater energy capacity due to increased battery efficiency"),ctd.character,ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s: You need to bring me some %s before I can increase your battery efficiency"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: You need to bring me some %s before I can increase your battery efficiency"),ctd.character,ctd.characterGood)) end else comms_source.efficientBatteriesUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source:setMaxEnergy(comms_source:getMaxEnergy()*1.25) comms_source:setEnergy(comms_source:getMaxEnergy()) - setCommsMessage(string.format(_("upgrade-comms", "%s increased your battery efficiency by 25%% without the need for %s due to the pressing military demands on your ship"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s increased your battery efficiency by 25%% without the need for %s due to the pressing military demands on your ship"),ctd.character,ctd.characterGood)) end end) end end function strongerShields() if comms_source.strongerShieldsUpgrade == nil then - addCommsReply(_("upgrade-comms", "Strengthen shields"), function() + addCommsReply(_("upgrade-comms","Strengthen shields"), function() local ctd = comms_target.comms_data if payForUpgrade() then local partQuantity = 0 @@ -2629,6 +2943,7 @@ function strongerShields() end if partQuantity > 0 then comms_source.strongerShieldsUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 comms_source.goods[ctd.characterGood] = comms_source.goods[ctd.characterGood] - 1 comms_source.cargo = comms_source.cargo + 1 if comms_source:getShieldCount() == 1 then @@ -2636,2636 +2951,75 @@ function strongerShields() else comms_source:setShieldsMax(comms_source:getShieldMax(0)*1.2,comms_source:getShieldMax(1)*1.2) end - setCommsMessage(string.format(_("upgrade-comms", "%s: I've raised your shield maximum by 20%%, %s. Thanks for bringing the %s"),ctd.character,comms_source:getCallSign(),ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: I've raised your shield maximum by 20%%, %s. Thanks for bringing the %s"),ctd.character,comms_source:getCallSign(),ctd.characterGood)) else - setCommsMessage(string.format(_("upgrade-comms", "%s: You need to provide %s before I can raise your shield strength"),ctd.character,ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: You need to provide %s before I can raise your shield strength"),ctd.character,ctd.characterGood)) end else comms_source.strongerShieldsUpgrade = "done" + optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 if comms_source:getShieldCount() == 1 then comms_source:setShieldsMax(comms_source:getShieldMax(0)*1.2) else comms_source:setShieldsMax(comms_source:getShieldMax(0)*1.2,comms_source:getShieldMax(1)*1.2) end - setCommsMessage(string.format(_("upgrade-comms", "%s: Congratulations, %s, your shields are 20%% stronger. Don't worry about the %s. Go kick those Exuari outta here"),ctd.character,comms_source:getCallSign(),ctd.characterGood)) + setCommsMessage(string.format(_("upgrade-comms","%s: Congratulations, %s, your shields are 20%% stronger. Don't worry about the %s. Go kick those Exuari outta here"),ctd.character,comms_source:getCallSign(),ctd.characterGood)) end end) end end -function setGoodsList() - --list of goods available to buy, sell or trade (sell still under development) - --[[ - goodsList = { {"food",0}, - {"medicine",0}, - {"nickel",0}, - {"platinum",0}, - {"gold",0}, - {"dilithium",0}, - {"tritanium",0}, - {"luxury",0}, - {"cobalt",0}, - {"impulse",0}, - {"warp",0}, - {"shield",0}, - {"tractor",0}, - {"repulsor",0}, - {"beam",0}, - {"optic",0}, - {"robotic",0}, - {"filament",0}, - {"transporter",0}, - {"sensor",0}, - {"communication",0}, - {"autodoc",0}, - {"lifter",0}, - {"android",0}, - {"nanites",0}, - {"software",0}, - {"circuit",0}, - {"battery",0} } - --]] - goodsList = { {"food",0}, {"medicine",0}, {"nickel",0}, {"platinum",0}, {"gold",0}, {"dilithium",0}, {"tritanium",0}, {"luxury",0}, {"cobalt",0}, {"impulse",0}, {"warp",0}, {"shield",0}, {"tractor",0}, {"repulsor",0}, {"beam",0}, {"optic",0}, {"robotic",0}, {"filament",0}, {"transporter",0}, {"sensor",0}, {"communication",0}, {"autodoc",0}, {"lifter",0}, {"android",0}, {"nanites",0}, {"software",0}, {"circuit",0}, {"battery",0} } - goods = {} --overall tracking of goods - tradeFood = {} --stations that will trade food for other goods - tradeLuxury = {} --stations that will trade luxury for other goods - tradeMedicine = {} --stations that will trade medicine for other goods -end --------------------------------- --- Station related functions -- --------------------------------- -function setListOfStations() - --array of functions to facilitate randomized station placement (friendly and neutral) - placeStation = {placeAlcaleica, -- 1 - placeAnderson, -- 2 - placeArcher, -- 3 - placeArchimedes, -- 4 - placeArmstrong, -- 5 - placeAsimov, -- 6 - placeBarclay, -- 7 - placeBethesda, -- 8 - placeBroeck, -- 9 - placeCalifornia, --10 - placeCalvin, --11 - placeCavor, --12 - placeChatuchak, --13 - placeCoulomb, --14 - placeCyrus, --15 - placeDeckard, --16 - placeDeer, --17 - placeErickson, --18 - placeEvondos, --19 - placeFeynman, --20 - placeGrasberg, --21 - placeHayden, --22 - placeHeyes, --23 - placeHossam, --24 - placeImpala, --25 - placeKomov, --26 - placeKrak, --27 - placeKruk, --28 - placeLipkin, --29 - placeMadison, --30 - placeMaiman, --31 - placeMarconi, --32 - placeMayo, --33 - placeMiller, --34 - placeMuddville, --35 - placeNexus6, --36 - placeOBrien, --37 - placeOlympus, --38 - placeOrgana, --39 - placeOutpost15, --40 - placeOutpost21, --41 - placeOwen, --42 - placePanduit, --43 - placeRipley, --44 - placeRutherford, --45 - placeScience7, --46 - placeShawyer, --47 - placeShree, --48 - placeSoong, --49 - placeTiberius, --50 - placeTokra, --51 - placeToohie, --52 - placeUtopiaPlanitia, --53 - placeVactel, --54 - placeVeloquan, --55 - placeZefram} --56 - --array of functions to facilitate randomized station placement (friendly, neutral or enemy) - placeGenericStation = {placeJabba, -- 1 - placeKrik, -- 2 - placeLando, -- 3 - placeMaverick, -- 4 - placeNefatha, -- 5 - placeOkun, -- 6 - placeOutpost7, -- 7 - placeOutpost8, -- 8 - placeOutpost33, -- 9 - placePrada, --10 - placeResearch11, --11 - placeResearch19, --12 - placeRubis, --13 - placeScience2, --14 - placeScience4, --15 - placeSkandar, --16 - placeSpot, --17 - placeStarnet, --18 - placeTandon, --19 - placeVaiken, --20 - placeValero} --21 - --array of functions to facilitate randomized station placement (enemy) - placeEnemyStation = {placeAramanth, -- 1 - placeEmpok, -- 2 - placeGandala, -- 3 - placeHassenstadt, -- 4 - placeKaldor, -- 5 - placeMagMesra, -- 6 - placeMosEisley, -- 7 - placeQuestaVerde, -- 8 - placeRlyeh, -- 9 - placeScarletCit, --10 - placeStahlstadt, --11 - placeTic} --12 -end -function szt() ---Randomly choose station size template - if stationSize ~= nil then - sizeTemplate = stationSize - return sizeTemplate - end - stationSizeRandom = random(1,100) - if stationSizeRandom < 8 then - sizeTemplate = "Huge Station" -- 8 percent huge - elseif stationSizeRandom < 24 then - sizeTemplate = "Large Station" --16 percent large - elseif stationSizeRandom < 50 then - sizeTemplate = "Medium Station" --26 percent medium - else - sizeTemplate = "Small Station" --50 percent small - end - return sizeTemplate -end -function randomMineral(exclude) - local good = mineralGoods[math.random(1,#mineralGoods)] - if exclude == nil then - return good - else - repeat - good = mineralGoods[math.random(1,#mineralGoods)] - until(good ~= exclude) - return good - end -end -function randomComponent(exclude) - local good = componentGoods[math.random(1,#componentGoods)] - if exclude == nil then - return good - else - repeat - good = componentGoods[math.random(1,#componentGoods)] - until(good ~= exclude) - return good - end -end -function setStationComms(cStation) - if stationCommunication ~= nil then - if stationCommunication == "commsStation" then - cStation:setCommsScript(""):setCommsFunction(commsStation) +------------------------------------------- +-- Inventory button for relay/operations -- +------------------------------------------- +function cargoInventory(delta) + for i,p in ipairs(getActivePlayerShips()) do + local cargoHoldEmpty = true + if p.goods ~= nil then + for good, quantity in pairs(p.goods) do + if quantity ~= nil and quantity > 0 then + cargoHoldEmpty = false + break + end + end + end + if cargoHoldEmpty then + if p.inventory_button_rel ~= nil then + p:removeCustom(p.inventory_button_rel) + p.inventory_button_rel = nil + end + if p.inventory_button_ops ~= nil then + p:removeCustom(p.inventory_button_ops) + p.inventory_button_ops = nil + end else - cStation:setCommsScript(stationCommunication) + p.inventory_button_rel = "inventory_button_rel" + p:addCustomButton("Relay",p.inventory_button_rel,_("inventory-buttonRelay","Inventory"),function() + string.format("") + cargoInventoryGivenShip(p) + end,6) + p.inventory_button_ops = "inventory_button_ops" + p:addCustomButton("Operations",p.inventory_button_ops,_("inventory-buttonOperations","Inventory"),function() + string.format("") + cargoInventoryGivenShip(p) + end,6) end end end -function setStationStrength(sStation) - if sizeTemplate == "Huge Station" then - sStation.strength = 10 - elseif sizeTemplate == "Large Station" then - sStation.strength = 5 - elseif sizeTemplate == "Medium Station" then - sStation.strength = 3 - else - sStation.strength = 1 - end - return sStation.strength -end --- Human and neutral stations to be placed (all need some kind of goods) -- -function placeAlcaleica() - --Alcaleica - stationAlcaleica = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationAlcaleica) - stationAlcaleica:setPosition(psx,psy):setCallSign("Alcaleica"):setDescription(_("scienceDescription-station", "Optical Components")) - stationAlcaleica.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { optic = {quantity = 5, cost = 66} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We make and supply optic components for various station and ship systems"), - history = _("stationStory-comms", "This station continues the businesses from Earth based on the merging of several companies including Leica from Switzerland, the lens manufacturer and the Japanese advanced low carbon (ALCA) electronic and optic research and development company") - } - if stationFaction == "Human Navy" then - stationAlcaleica.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationAlcaleica.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationAlcaleica.comms_data.trade.medicine = true - end - else - stationAlcaleica.comms_data.trade.medicine = true - stationAlcaleica.comms_data.trade.food = true - end - return stationAlcaleica -end -function placeAnderson() - --Anderson - stationAnderson = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationAnderson) - stationAnderson:setPosition(psx,psy):setCallSign("Anderson"):setDescription(_("scienceDescription-station", "Battery and software engineering")) - stationAnderson.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { battery = {quantity = 5, cost = 66}, - software = {quantity = 5, cost = 115} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide high quality high capacity batteries and specialized software for all shipboard systems"), - history = _("stationStory-comms", "The station is named after a fictional software engineer in a late 20th century movie depicting humanity unknowingly conquered by aliens and kept docile by software generated illusion") - } - if stationFaction == "Human Navy" then - stationAnderson.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationAnderson.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationAnderson -end -function placeArcher() - --Archer - stationArcher = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationArcher) - stationArcher:setPosition(psx,psy):setCallSign("Archer"):setDescription(_("scienceDescription-station", "Shield and Armor Research")) - stationArcher.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { shield = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = true }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "The finest shield and armor manufacturer in the quadrant"), - history = _("stationStory-comms", "We named this station for the pioneering spirit of the 22nd century Starfleet explorer, Captain Jonathan Archer") - } - if stationFaction == "Human Navy" then - stationArcher.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationArcher.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationArcher.comms_data.trade.medicine = true - end - else - stationArcher.comms_data.trade.medicine = true - end - return stationArcher -end -function placeArchimedes() - --Archimedes - stationArchimedes = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationArchimedes) - stationArchimedes:setPosition(psx,psy):setCallSign("Archimedes"):setDescription(_("scienceDescription-station", "Energy and particle beam components")) - stationArchimedes.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { beam = {quantity = 5, cost = 80} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We fabricate general and specialized components for ship beam systems"), - history = _("stationStory-comms", "This station was named after Archimedes who, according to legend, used a series of adjustable focal length mirrors to focus sunlight on a Roman naval fleet invading Syracuse, setting fire to it") - } - if stationFaction == "Human Navy" then - stationArchimedes.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationArchimedes.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationArchimedes.comms_data.trade.medicine = true - end - else - stationArchimedes.comms_data.trade.food = true - end - return stationArchimedes -end -function placeArmstrong() - --Armstrong - stationArmstrong = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationArmstrong) - stationArmstrong:setPosition(psx,psy):setCallSign("Armstrong"):setDescription(_("scienceDescription-station", "Warp and Impulse engine manufacturing")) - stationArmstrong.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "friend", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { warp = {quantity = 5, cost = 77}, - repulsor = {quantity = 5, cost = 62} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We manufacture warp, impulse and jump engines for the human navy fleet as well as other independent clients on a contract basis"), - history = _("stationStory-comms", "The station is named after the late 19th century astronaut as well as the fictionlized stations that followed. The station initially constructed entire space worthy vessels. In time, it transitioned into specializeing in propulsion systems.") - } - if stationFaction == "Human Navy" then - stationArmstrong.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationArmstrong.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationArmstrong -end -function placeAsimov() - --Asimov - stationAsimov = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationAsimov) - stationAsimov:setCallSign("Asimov"):setDescription(_("scienceDescription-station", "Training and Coordination")):setPosition(psx,psy) - stationAsimov.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { tractor = {quantity = 5, cost = 48} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We train naval cadets in routine and specialized functions aboard space vessels and coordinate naval activity throughout the sector"), - history = _("stationStory-comms", "The original station builders were fans of the late 20th century scientist and author Isaac Asimov. The station was initially named Foundation, but was later changed simply to Asimov. It started off as a stellar observatory, then became a supply stop and as it has grown has become an educational and coordination hub for the region") - } - if stationFaction == "Human Navy" then - stationAsimov.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationAsimov.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationAsimov -end -function placeBarclay() - --Barclay - stationBarclay = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationBarclay) - stationBarclay:setPosition(psx,psy):setCallSign("Barclay"):setDescription(_("scienceDescription-station", "Communication components")) - stationBarclay.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { communication = {quantity = 5, cost = 58} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide a range of communication equipment and software for use aboard ships"), - history = _("stationStory-comms", "The station is named after Reginald Barclay who established the first transgalactic com link through the creative application of a quantum singularity. Station personnel often refer to the station as the Broccoli station") - } - if stationFaction == "Human Navy" then - stationBarclay.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationBarclay.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationBarclay.comms_data.trade.medicine = true - end - else - stationBarclay.comms_data.trade.medicine = true - end - return stationBarclay -end -function placeBethesda() - --Bethesda - stationBethesda = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationBethesda) - stationBethesda:setPosition(psx,psy):setCallSign("Bethesda"):setDescription(_("scienceDescription-station", "Medical research")) - stationBethesda.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "friend", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 4.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { autodoc = {quantity = 5, cost = 36}, - medicine = {quantity = 5, cost = 5}, - food = {quantity = math.random(5,10), cost = 1} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and treat exotic medical conditions"), - history = _("stationStory-comms", "The station is named after the United States national medical research center based in Bethesda, Maryland on earth which was established in the mid 20th century") - } - return stationBethesda -end -function placeBroeck() - --Broeck - stationBroeck = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationBroeck) - stationBroeck:setPosition(psx,psy):setCallSign("Broeck"):setDescription(_("scienceDescription-station", "Warp drive components")) - stationBroeck.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { warp = {quantity = 5, cost = 36} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 62 }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide warp drive engines and components"), - history = _("stationStory-comms", "This station is named after Chris Van Den Broeck who did some initial research into the possibility of warp drive in the late 20th century on Earth") - } - if stationFaction == "Human Navy" then - stationBroeck.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationBroeck.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationBroeck.comms_data.trade.medicine = random(1,100) < 53 - end - else - stationBroeck.comms_data.trade.medicine = random(1,100) < 53 - stationBroeck.comms_data.trade.food = random(1,100) < 14 - end - return stationBroeck -end -function placeCalifornia() - --California - stationCalifornia = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationCalifornia) - stationCalifornia:setPosition(psx,psy):setCallSign("California"):setDescription(_("scienceDescription-station", "Mining station")) - stationCalifornia.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 2.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { gold = {quantity = 5, cost = 90}, - dilithium = {quantity = 2, cost = 25} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomComponent()] = math.random(40,200) } - } - if stationFaction == "Human Navy" then - stationCalifornia.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationCalifornia.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationCalifornia -end -function placeCalvin() - --Calvin - stationCalvin = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationCalvin) - stationCalvin:setPosition(psx,psy):setCallSign("Calvin"):setDescription(_("scienceDescription-station", "Robotic research")) - stationCalvin.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { robotic = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = true }, - buy = { [randomComponent("robotic")] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and provide robotic systems and components"), - history = _("stationStory-comms", "This station is named after Dr. Susan Calvin who pioneered robotic behavioral research and programming") - } - if stationFaction == "Human Navy" then - stationCalvin.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationCalvin.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationCalvin.comms_data.trade.food = random(1,100) < 8 - end - return stationCalvin -end -function placeCavor() - --Cavor - stationCavor = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationCavor) - stationCavor:setPosition(psx,psy):setCallSign("Cavor"):setDescription(_("scienceDescription-station", "Advanced Material components")) - stationCavor.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { filament = {quantity = 5, cost = 42} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We fabricate several different kinds of materials critical to various space industries like ship building, station construction and mineral extraction"), - history = _("stationStory-comms", "We named our station after Dr. Cavor, the physicist that invented a barrier material for gravity waves - Cavorite") - } - if stationFaction == "Human Navy" then - stationCavor.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationCavor.comms_data.goods.medicine = {quantity = 5, cost = 5} - stationCavor.comms_data.trade.luxury = random(1,100) < 33 - else - if random(1,100) < 50 then - stationCavor.comms_data.trade.medicine = true - else - stationCavor.comms_data.trade.luxury = true - end - end - else - local whatTrade = random(1,100) - if whatTrade < 33 then - stationCavor.comms_data.trade.medicine = true - elseif whatTrade > 66 then - stationCavor.comms_data.trade.food = true - else - stationCavor.comms_data.trade.luxury = true - end - end - return stationCavor -end -function placeChatuchak() - --Chatuchak - stationChatuchak = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationChatuchak) - stationChatuchak:setPosition(psx,psy):setCallSign("Chatuchak"):setDescription(_("scienceDescription-station", "Trading station")) - stationChatuchak.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 60} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Only the largest market and trading location in twenty sectors. You can find your heart's desire here"), - history = _("stationStory-comms", "Modeled after the early 21st century bazaar on Earth in Bangkok, Thailand. Designed and built with trade and commerce in mind") - } - if stationFaction == "Human Navy" then - stationChatuchak.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationChatuchak.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationChatuchak -end -function placeCoulomb() - --Coulomb - stationCoulomb = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationCoulomb) - stationCoulomb:setPosition(psx,psy):setCallSign("Coulomb"):setDescription(_("scienceDescription-station", "Shielded circuitry fabrication")) - stationCoulomb.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { circuit = {quantity = 5, cost = 50} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 82 }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We make a large variety of circuits for numerous ship systems shielded from sensor detection and external control interference"), - history = _("stationStory-comms", "Our station is named after the law which quantifies the amount of force with which stationary electrically charged particals repel or attact each other - a fundamental principle in the design of our circuits") - } - if stationFaction == "Human Navy" then - stationCoulomb.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationCoulomb.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationCoulomb.comms_data.trade.medicine = random(1,100) < 27 - end - else - stationCoulomb.comms_data.trade.medicine = random(1,100) < 27 - stationCoulomb.comms_data.trade.food = random(1,100) < 16 - end - return stationCoulomb -end -function placeCyrus() - --Cyrus - stationCyrus = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationCyrus) - stationCyrus:setPosition(psx,psy):setCallSign("Cyrus"):setDescription(_("scienceDescription-station", "Impulse engine components")) - stationCyrus.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { impulse = {quantity = 5, cost = 124} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 78 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We supply high quality impulse engines and parts for use aboard ships"), - history = _("stationStory-comms", "This station was named after the fictional engineer, Cyrus Smith created by 19th century author Jules Verne") - } - if stationFaction == "Human Navy" then - stationCyrus.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationCyrus.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationCyrus.comms_data.trade.medicine = random(1,100) < 34 - end - else - stationCyrus.comms_data.trade.medicine = random(1,100) < 34 - stationCyrus.comms_data.trade.food = random(1,100) < 13 - end - return stationCyrus -end -function placeDeckard() - --Deckard - stationDeckard = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationDeckard) - stationDeckard:setPosition(psx,psy):setCallSign("Deckard"):setDescription(_("scienceDescription-station", "Android components")) - stationDeckard.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { android = {quantity = 5, cost = 73} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Supplier of android components, programming and service"), - history = _("stationStory-comms", "Named for Richard Deckard who inspired many of the sophisticated safety security algorithms now required for all androids") - } - if stationFaction == "Human Navy" then - stationDeckard.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationDeckard.comms_data.goods.medicine = {quantity = 5, cost = 5} - stationDeckard.comms_data.goods.medicine.cost = 5 - end - else - stationDeckard.comms_data.trade.food = true - end - return stationDeckard -end -function placeDeer() - --Deer - stationDeer = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationDeer) - stationDeer:setPosition(psx,psy):setCallSign("Deer"):setDescription(_("scienceDescription-station", "Repulsor and Tractor Beam Components")) - stationDeer.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { tractor = {quantity = 5, cost = 90}, - repulsor = {quantity = 5, cost = 95} }, - trade = { food = false, medicine = false, luxury = true }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We can meet all your pushing and pulling needs with specialized equipment custom made"), - history = _("stationStory-comms", "The station name comes from a short story by the 20th century author Clifford D. Simak as well as from the 19th century developer John Deere who inspired a company that makes the Earth bound equivalents of our products") - } - if stationFaction == "Human Navy" then - stationDeer.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - stationDeer.comms_data.goods.food.cost = 1 - if random(1,5) <= 1 then - stationDeer.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationDeer.comms_data.trade.medicine = true - end - else - stationDeer.comms_data.trade.medicine = true - stationDeer.comms_data.trade.food = true - end - return stationDeer -end -function placeErickson() - --Erickson - stationErickson = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationErickson) - stationErickson:setPosition(psx,psy):setCallSign("Erickson"):setDescription(_("scienceDescription-station", "Transporter components")) - stationErickson.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { transporter = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide transporters used aboard ships as well as the components for repair and maintenance"), - history = _("stationStory-comms", "The station is named after the early 22nd century inventor of the transporter, Dr. Emory Erickson. This station is proud to have received the endorsement of Admiral Leonard McCoy") - } - if stationFaction == "Human Navy" then - stationErickson.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationErickson.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationErickson.comms_data.trade.medicine = true - end - else - stationErickson.comms_data.trade.medicine = true - stationErickson.comms_data.trade.food = true - end - return stationErickson -end -function placeEvondos() - --Evondos - stationEvondos = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationEvondos) - stationEvondos:setPosition(psx,psy):setCallSign("Evondos"):setDescription(_("scienceDescription-station", "Autodoc components")) - stationEvondos.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { autodoc = {quantity = 5, cost = 56} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 41 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide components for automated medical machinery"), - history = _("stationStory-comms", "The station is the evolution of the company that started automated pharmaceutical dispensing in the early 21st century on Earth in Finland") - } - if stationFaction == "Human Navy" then - stationEvondos.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationEvondos.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationEvondos.comms_data.trade.medicine = true - end - else - stationEvondos.comms_data.trade.medicine = true - end - return stationEvondos -end -function placeFeynman() - --Feynman - stationFeynman = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationFeynman) - stationFeynman:setPosition(psx,psy):setCallSign("Feynman"):setDescription(_("scienceDescription-station", "Nanotechnology research")) - stationFeynman.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { software = {quantity = 5, cost = 115}, - nanites = {quantity = 5, cost = 79} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide nanites and software for a variety of ship-board systems"), - history = _("stationStory-comms", "This station's name recognizes one of the first scientific researchers into nanotechnology, physicist Richard Feynman") - } - if stationFaction == "Human Navy" then - stationFeynman.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationFeynman.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationFeynman.comms_data.trade.medicine = true - stationFeynman.comms_data.trade.food = random(1,100) < 26 - end - return stationFeynman -end -function placeGrasberg() - --Grasberg - if stationStaticAsteroids then - placeRandomAroundPoint(Asteroid,15,1,15000,psx,psy) - end - stationGrasberg = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationGrasberg) - stationGrasberg:setPosition(psx,psy):setCallSign("Grasberg"):setDescription(_("scienceDescription-station", "Mining")) - stationGrasberg.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomComponent()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We mine nearby asteroids for precious minerals and process them for sale"), - history = _("stationStory-comms", "This station's name is inspired by a large gold mine on Earth in Indonesia. The station builders hoped to have a similar amount of minerals found amongst these asteroids") - } - if stationFaction == "Human Navy" then - stationGrasberg.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationGrasberg.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationGrasberg.comms_data.trade.food = true - end - local grasbergGoods = random(1,100) - if grasbergGoods < 20 then - stationGrasberg.comms_data.goods.gold = {quantity = 5, cost = 25} - stationGrasberg.comms_data.goods.cobalt = {quantity = 4, cost = 50} - elseif grasbergGoods < 40 then - stationGrasberg.comms_data.goods.gold = {quantity = 5, cost = 25} - elseif grasbergGoods < 60 then - stationGrasberg.comms_data.goods.cobalt = {quantity = 4, cost = 50} - else - stationGrasberg.comms_data.goods.nickel = {quantity = 5, cost = 47} - end - return stationGrasberg -end -function placeHayden() - --Hayden - stationHayden = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationHayden) - stationHayden:setPosition(psx,psy):setCallSign("Hayden"):setDescription(_("scienceDescription-station", "Observatory and stellar mapping")) - stationHayden.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { nanites = {quantity = 5, cost = 65} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We study the cosmos and map stellar phenomena. We also track moving asteroids. Look out! Just kidding"), - history = _("stationStory-comms", "Statin named in honor of Charles Hayden whose philanthropy continued astrophysical research and education on Earth in the early 20th century") - } - if stationFaction == "Human Navy" then - stationHayden.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationHayden.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationHayden -end -function placeHeyes() - --Heyes - stationHeyes = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationHeyes) - stationHeyes:setPosition(psx,psy):setCallSign("Heyes"):setDescription(_("scienceDescription-station", "Sensor components")) - stationHeyes.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { sensor = {quantity = 5, cost = 72} }, - trade = { food = false, medicine = false, luxury = true }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and manufacture sensor components and systems"), - history = _("stationStory-comms", "The station is named after Tony Heyes the inventor of some of the earliest electromagnetic sensors in the mid 20th century on Earth in the United Kingdom to assist blind human mobility") - } - if stationFaction == "Human Navy" then - stationHeyes.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationHeyes.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationHeyes -end -function placeHossam() - --Hossam - stationHossam = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationHossam) - stationHossam:setPosition(psx,psy):setCallSign("Hossam"):setDescription(_("scienceDescription-station", "Nanite supplier")) - stationHossam.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { nanites = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 63 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide nanites for various organic and non-organic systems"), - history = _("stationStory-comms", "This station is named after the nanotechnologist Hossam Haick from the early 21st century on Earth in Israel") - } - if stationFaction == "Human Navy" then - stationHossam.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationHossam.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationHossam.comms_data.trade.medicine = random(1,100) < 44 - end - else - stationHossam.comms_data.trade.medicine = random(1,100) < 44 - stationHossam.comms_data.trade.food = random(1,100) < 24 - end - return stationHossam -end -function placeImpala() - --Impala - if stationStaticAsteroids then - placeRandomAroundPoint(Asteroid,15,1,15000,psx,psy) - end - stationImpala = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationImpala) - stationImpala:setPosition(psx,psy):setCallSign("Impala"):setDescription(_("scienceDescription-station", "Mining")) - stationImpala.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = true }, - buy = { [randomComponent()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We mine nearby asteroids for precious minerals") - } - local impalaGoods = random(1,100) - if impalaGoods < 20 then - stationImpala.comms_data.goods.gold = {quantity = 5, cost = 25} - stationImpala.comms_data.goods.cobalt = {quantity = 4, cost = 50} - elseif impalaGoods < 40 then - stationImpala.comms_data.goods.gold = {quantity = 5, cost = 25} - elseif impalaGoods < 60 then - stationImpala.comms_data.goods.cobalt = {quantity = 4, cost = 50} - else - stationImpala.comms_data.goods.tritanium = {quantity = 5, cost = 42} - end - if stationFaction == "Human Navy" then - stationImpala.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationImpala.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationImpala.comms_data.trade.medicine = random(1,100) < 28 - end - else - stationImpala.comms_data.trade.food = true - end - return stationImpala -end -function placeKomov() - --Komov - stationKomov = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationKomov) - stationKomov:setPosition(psx,psy):setCallSign("Komov"):setDescription(_("scienceDescription-station", "Xenopsychology training")) - stationKomov.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { filament = {quantity = 5, cost = 46} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide classes and simulation to help train diverse species in how to relate to each other"), - history = _("stationStory-comms", "A continuation of the research initially conducted by Dr. Gennady Komov in the early 22nd century on Venus, supported by the application of these principles") - } - if stationFaction == "Human Navy" then - stationKomov.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationKomov.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationKomov.comms_data.trade.medicine = random(1,100) < 44 - end - else - stationKomov.comms_data.trade.medicine = random(1,100) < 44 - stationKomov.comms_data.trade.food = random(1,100) < 24 - end - return stationKomov -end -function placeKrak() - --Krak - stationKrak = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationKrak) - stationKrak:setPosition(psx,psy):setCallSign("Krak"):setDescription(_("scienceDescription-station", "Mining station")) - if stationStaticAsteroids then - posAxisKrak = random(0,360) - posKrak = random(10000,60000) - negKrak = random(10000,60000) - spreadKrak = random(4000,7000) - negAxisKrak = posAxisKrak + 180 - xPosAngleKrak, yPosAngleKrak = vectorFromAngle(posAxisKrak, posKrak) - posKrakEnd = random(30,70) - createRandomAlongArc(Asteroid, 30+posKrakEnd, psx+xPosAngleKrak, psy+yPosAngleKrak, posKrak, negAxisKrak, negAxisKrak+posKrakEnd, spreadKrak) - xNegAngleKrak, yNegAngleKrak = vectorFromAngle(negAxisKrak, negKrak) - negKrakEnd = random(40,80) - createRandomAlongArc(Asteroid, 30+negKrakEnd, psx+xNegAngleKrak, psy+yNegAngleKrak, negKrak, posAxisKrak, posAxisKrak+negKrakEnd, spreadKrak) - end - stationKrak.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { nickel = {quantity = 5, cost = 20} }, - trade = { food = random(1,100) < 50, medicine = true, luxury = random(1,100) < 50 }, - buy = { [randomComponent()] = math.random(40,200) } - } - local krakGoods = random(1,100) - if krakGoods < 10 then - stationKrak.comms_data.goods.platinum = {quantity = 5, cost = 70} - stationKrak.comms_data.goods.tritanium = {quantity = 5, cost = 50} - stationKrak.comms_data.goods.dilithium = {quantity = 5, cost = 52} - elseif krakGoods < 20 then - stationKrak.comms_data.goods.platinum = {quantity = 5, cost = 70} - stationKrak.comms_data.goods.tritanium = {quantity = 5, cost = 50} - elseif krakGoods < 30 then - stationKrak.comms_data.goods.platinum = {quantity = 5, cost = 70} - stationKrak.comms_data.goods.dilithium = {quantity = 5, cost = 52} - elseif krakGoods < 40 then - stationKrak.comms_data.goods.tritanium = {quantity = 5, cost = 50} - stationKrak.comms_data.goods.dilithium = {quantity = 5, cost = 52} - elseif krakGoods < 50 then - stationKrak.comms_data.goods.dilithium = {quantity = 5, cost = 52} - elseif krakGoods < 60 then - stationKrak.comms_data.goods.platinum = {quantity = 5, cost = 70} - elseif krakGoods < 70 then - stationKrak.comms_data.goods.tritanium = {quantity = 5, cost = 50} - elseif krakGoods < 80 then - stationKrak.comms_data.goods.gold = {quantity = 5, cost = 50} - stationKrak.comms_data.goods.tritanium = {quantity = 5, cost = 50} - elseif krakGoods < 90 then - stationKrak.comms_data.goods.gold = {quantity = 5, cost = 50} - stationKrak.comms_data.goods.dilithium = {quantity = 5, cost = 52} - else - stationKrak.comms_data.goods.gold = {quantity = 5, cost = 50} - end - return stationKrak -end -function placeKruk() - --Kruk - stationKruk = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationKruk) - stationKruk:setPosition(psx,psy):setCallSign("Kruk"):setDescription(_("scienceDescription-station", "Mining station")) - if stationStaticAsteroids then - posAxisKruk = random(0,360) - posKruk = random(10000,60000) - negKruk = random(10000,60000) - spreadKruk = random(4000,7000) - negAxisKruk = posAxisKruk + 180 - xPosAngleKruk, yPosAngleKruk = vectorFromAngle(posAxisKruk, posKruk) - posKrukEnd = random(30,70) - createRandomAlongArc(Asteroid, 30+posKrukEnd, psx+xPosAngleKruk, psy+yPosAngleKruk, posKruk, negAxisKruk, negAxisKruk+posKrukEnd, spreadKruk) - xNegAngleKruk, yNegAngleKruk = vectorFromAngle(negAxisKruk, negKruk) - negKrukEnd = random(40,80) - createRandomAlongArc(Asteroid, 30+negKrukEnd, psx+xNegAngleKruk, psy+yNegAngleKruk, negKruk, posAxisKruk, posAxisKruk+negKrukEnd, spreadKruk) - end - stationKruk.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { nickel = {quantity = 5, cost = math.random(25,35)} }, - trade = { food = random(1,100) < 50, medicine = random(1,100) < 50, luxury = true }, - buy = { [randomComponent()] = math.random(40,200) } - } - local krukGoods = random(1,100) - if krukGoods < 10 then - stationKruk.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKruk.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - stationKruk.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 20 then - stationKruk.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKruk.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 30 then - stationKruk.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKruk.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 40 then - stationKruk.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - stationKruk.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 50 then - stationKruk.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 60 then - stationKruk.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - elseif krukGoods < 70 then - stationKruk.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 80 then - stationKruk.comms_data.goods.gold = {quantity = 5, cost = math.random(45,55)} - stationKruk.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - elseif krukGoods < 90 then - stationKruk.comms_data.goods.gold = {quantity = 5, cost = math.random(45,55)} - stationKruk.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - else - stationKruk.comms_data.goods.gold = {quantity = 5, cost = math.random(45,55)} - end - return stationKruk -end -function placeLipkin() - --Lipkin - stationLipkin = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationLipkin) - stationLipkin:setPosition(psx,psy):setCallSign("Lipkin"):setDescription(_("scienceDescription-station", "Autodoc components")) - stationLipkin.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { autodoc = {quantity = 5, cost = 76} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We build and repair and provide components and upgrades for automated facilities designed for ships where a doctor cannot be a crew member (commonly called autodocs)"), - history = _("stationStory-comms", "The station is named after Dr. Lipkin who pioneered some of the research and application around robot assisted surgery in the area of partial nephrectomy for renal tumors in the early 21st century on Earth") - } - if stationFaction == "Human Navy" then - stationLipkin.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationLipkin.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationLipkin.comms_data.trade.food = true - end - return stationLipkin -end -function placeMadison() - --Madison - stationMadison = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMadison) - stationMadison:setPosition(psx,psy):setCallSign("Madison"):setDescription(_("scienceDescription-station", "Zero gravity sports and entertainment")) - stationMadison.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Come take in a game or two or perhaps see a show"), - history = _("stationStory-comms", "Named after Madison Square Gardens from 21st century Earth, this station was designed to serve similar purposes in space - a venue for sports and entertainment") - } - if stationFaction == "Human Navy" then - stationMadison.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationMadison.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationMadison.comms_data.trade.medicine = true - end - else - stationMadison.comms_data.trade.medicine = true - end - return stationMadison -end -function placeMaiman() - --Maiman - stationMaiman = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMaiman) - stationMaiman:setPosition(psx,psy):setCallSign("Maiman"):setDescription(_("scienceDescription-station", "Energy beam components")) - stationMaiman.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { beam = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomMineral()] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and manufacture energy beam components and systems"), - history = _("stationStory-comms", "The station is named after Theodore Maiman who researched and built the first laser in the mid 20th centuryon Earth") - } - if stationFaction == "Human Navy" then - stationMaiman.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationMaiman.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationMaiman.comms_data.trade.medicine = true - end - else - stationMaiman.comms_data.trade.medicine = true - end - return stationMaiman -end -function placeMarconi() - --Marconi - stationMarconi = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMarconi) - stationMarconi:setPosition(psx,psy):setCallSign("Marconi"):setDescription(_("scienceDescription-station", "Energy Beam Components")) - stationMarconi.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { beam = {quantity = 5, cost = 80} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We manufacture energy beam components"), - history = _("stationStory-comms", "Station named after Guglielmo Marconi an Italian inventor from early 20th century Earth who, along with Nicolo Tesla, claimed to have invented a death ray or particle beam weapon") - } - if stationFaction == "Human Navy" then - stationMarconi.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationMarconi.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationMarconi.comms_data.trade.medicine = true - end - else - stationMarconi.comms_data.trade.medicine = true - stationMarconi.comms_data.trade.food = true - end - return stationMarconi -end -function placeMayo() - --Mayo - stationMayo = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMayo) - stationMayo:setPosition(psx,psy):setCallSign("Mayo"):setDescription(_("scienceDescription-station", "Medical Research")) - stationMayo.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 4.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { autodoc = {quantity = 5, cost = 128}, - food = {quantity = 5, cost = 1}, - medicine = {quantity = 5, cost = 5} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research exotic diseases and other human medical conditions"), - history = _("stationStory-comms", "We continue the medical work started by William Worrall Mayo in the late 19th century on Earth") - } - return stationMayo -end -function placeMiller() - --Miller - stationMiller = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMiller) - stationMiller:setPosition(psx,psy):setCallSign("Miller"):setDescription(_("scienceDescription-station", "Exobiology research")) - stationMiller.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { optic = {quantity = 5, cost = 60} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We study recently discovered life forms not native to Earth"), - history = _("stationStory-comms", "This station was named after one of the early exobiologists from mid 20th century Earth, Dr. Stanley Miller") - } - if stationFaction == "Human Navy" then - stationMiller.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationMiller.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationMiller -end -function placeMuddville() - --Muddville - stationMudd = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMudd) - stationMudd:setPosition(psx,psy):setCallSign("Muddville"):setDescription(_("scienceDescription-station", "Trading station")) - stationMudd.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 60} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Come to Muddvile for all your trade and commerce needs and desires"), - history = _("stationStory-comms", "Upon retirement, Harry Mudd started this commercial venture using his leftover inventory and extensive connections obtained while he traveled the stars as a salesman") - } - if stationFaction == "Human Navy" then - stationMudd.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationMudd.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationMudd -end -function placeNexus6() - --Nexus-6 - stationNexus6 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationNexus6) - stationNexus6:setPosition(psx,psy):setCallSign("Nexus-6"):setDescription(_("scienceDescription-station", "Android components")) - stationNexus6.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.5 }, - goods = { android = {quantity = 5, cost = 93} }, - trade = { food = false, medicine = false, luxury = false }, - buy = { [randomMineral()] = math.random(40,200), - [randomComponent("android")] = math.random(40,200) }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and manufacture android components and systems. Our design our androids to maximize their likeness to humans"), - history = _("stationStory-comms", "We named the station after the ground breaking android model produced by the Tyrell corporation") - } - if stationFaction == "Human Navy" then - stationNexus6.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationNexus6.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationNexus6.comms_data.trade.medicine = true - end - else - stationNexus6.comms_data.trade.medicine = true - end - return stationNexus6 -end -function placeOBrien() - --O'Brien - stationOBrien = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOBrien) - stationOBrien:setPosition(psx,psy):setCallSign("O'Brien"):setDescription(_("scienceDescription-station", "Transporter components")) - stationOBrien.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { transporter = {quantity = 5, cost = 76} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and fabricate high quality transporters and transporter components for use aboard ships"), - history = _("stationStory-comms", "Miles O'Brien started this business after his experience as a transporter chief") - } - if stationFaction == "Human Navy" then - stationOBrien.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationOBrien.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationOBrien.comms_data.trade.medicine = random(1,100) < 34 - end - else - stationOBrien.comms_data.trade.medicine = true - stationOBrien.comms_data.trade.food = random(1,100) < 13 - end - stationOBrien.comms_data.trade.luxury = random(1,100) < 43 - return stationOBrien -end -function placeOlympus() - --Olympus - stationOlympus = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOlympus) - stationOlympus:setPosition(psx,psy):setCallSign("Olympus"):setDescription(_("scienceDescription-station", "Optical components")) - stationOlympus.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { optic = {quantity = 5, cost = 66} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We fabricate optical lenses and related equipment as well as fiber optic cabling and components"), - history = _("stationStory-comms", "This station grew out of the Olympus company based on earth in the early 21st century. It merged with Infinera, then bought several software comapnies before branching out into space based industry") - } - if stationFaction == "Human Navy" then - stationOlympus.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationOlympus.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationOlympus.comms_data.trade.medicine = true - end - else - stationOlympus.comms_data.trade.medicine = true - stationOlympus.comms_data.trade.food = true - end - return stationOlympus -end -function placeOrgana() - --Organa - stationOrgana = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOrgana) - stationOrgana:setPosition(psx,psy):setCallSign("Organa"):setDescription(_("scienceDescription-station", "Diplomatic training")) - stationOrgana.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { luxury = {quantity = 5, cost = 96} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "The premeire academy for leadership and diplomacy training in the region"), - history = _("stationStory-comms", "Established by the royal family so critical during the political upheaval era") - } - return stationOrgana -end -function placeOutpost15() - --Outpost 15 - stationOutpost15 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOutpost15) - stationOutpost15:setPosition(psx,psy):setCallSign("Outpost-15"):setDescription(_("scienceDescription-station", "Mining and trade")) - stationOutpost15.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = true, medicine = false, luxury = false } - } - local outpost15Goods = random(1,100) - if outpost15Goods < 20 then - stationOutpost15.comms_data.goods.gold = {quantity = 5, cost = math.random(22,30)} - stationOutpost15.comms_data.goods.cobalt = {quantity = 4, cost = math.random(45,55)} - elseif outpost15Goods < 40 then - stationOutpost15.comms_data.goods.gold = {quantity = 5, cost = math.random(22,30)} - elseif outpost15Goods < 60 then - stationOutpost15.comms_data.goods.cobalt = {quantity = 4, cost = math.random(45,55)} - else - stationOutpost15.comms_data.goods.platinum = {quantity = 4, cost = math.random(55,65)} - end - if stationFaction == "Human Navy" then - stationOutpost15.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationOutpost15.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationOutpost15.comms_data.trade.medicine = true - end - else - stationOutpost15.comms_data.trade.food = true - end - if stationStaticAsteroids then - placeRandomAroundPoint(Asteroid,15,1,15000,psx,psy) - end - return stationOutpost15 -end -function placeOutpost21() - --Outpost 21 - stationOutpost21 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOutpost21) - stationOutpost21:setPosition(psx,psy):setCallSign("Outpost-21"):setDescription(_("scienceDescription-station", "Mining and gambling")) - if stationStaticAsteroids then - placeRandomAroundPoint(Asteroid,15,1,15000,psx,psy) - end - stationOutpost21.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = true } - } - local outpost21Goods = random(1,100) - if outpost21Goods < 20 then - stationOutpost21.comms_data.goods.gold = {quantity = 5, cost = math.random(22,30)} - stationOutpost21.comms_data.goods.cobalt = {quantity = 4, cost = math.random(45,55)} - elseif outpost21Goods < 40 then - stationOutpost21.comms_data.goods.gold = {quantity = 5, cost = math.random(22,30)} - elseif outpost21Goods < 60 then - stationOutpost21.comms_data.goods.cobalt = {quantity = 4, cost = math.random(45,55)} - else - stationOutpost21.comms_data.goods.dilithium = {quantity = 4, cost = math.random(45,55)} - end - if stationFaction == "Human Navy" then - stationOutpost21.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationOutpost21.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationOutpost21.comms_data.trade.medicine = random(1,100) < 50 - end - else - stationOutpost21.comms_data.trade.food = true - stationOutpost21.comms_data.trade.medicine = random(1,100) < 50 - end - return stationOutpost21 -end -function placeOwen() - --Owen - stationOwen = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOwen) - stationOwen:setPosition(psx,psy):setCallSign("Owen"):setDescription(_("scienceDescription-station", "Load lifters and components")) - stationOwen.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { lifter = {quantity = 5, cost = 61} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide load lifters and components for various ship systems"), - history = _("stationStory-comms", "The station is named after Lars Owen. After his extensive eperience with tempermental machinery on Tatooine, he used his subject matter expertise to expand into building and manufacturing the equipment adding innovations based on his years of experience using load lifters and their relative cousins, moisture vaporators") - } - if stationFaction == "Human Navy" then - stationOwen.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationOwen.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationOwen.comms_data.trade.food = true - end - return stationOwen -end -function placePanduit() - --Panduit - stationPanduit = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationPanduit) - stationPanduit:setPosition(psx,psy):setCallSign("Panduit"):setDescription(_("scienceDescription-station", "Optic components")) - stationPanduit.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { optic = {quantity = 5, cost = 79} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide optic components for various ship systems"), - history = _("stationStory-comms", "This station is an outgrowth of the Panduit corporation started in the mid 20th century on Earth in the United States") - } - if stationFaction == "Human Navy" then - stationPanduit.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationPanduit.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationPanduit.comms_data.trade.medicine = random(1,100) < 33 - end - else - stationPanduit.comms_data.trade.medicine = random(1,100) < 33 - stationPanduit.comms_data.trade.food = random(1,100) < 27 - end - return stationPanduit -end -function placeRipley() - --Ripley - stationRipley = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationRipley) - stationRipley:setPosition(psx,psy):setCallSign("Ripley"):setDescription(_("scienceDescription-station", "Load lifters and components")) - stationRipley.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { lifter = {quantity = 5, cost = 82} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 47 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We provide load lifters and components"), - history = _("stationStory-comms", "The station is named after Ellen Ripley who made creative and effective use of one of our load lifters when defending her ship") - } - if stationFaction == "Human Navy" then - stationRipley.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationRipley.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationRipley.comms_data.trade.medicine = true - end - else - stationRipley.comms_data.trade.food = random(1,100) < 17 - stationRipley.comms_data.trade.medicine = true - end - return stationRipley -end -function placeRutherford() - --Rutherford - stationRutherford = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationRutherford) - stationRutherford:setPosition(psx,psy):setCallSign("Rutherford"):setDescription(_("scienceDescription-station", "Shield components and research")) - stationRutherford.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { shield = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = random(1,100) < 43 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and fabricate components for ship shield systems"), - history = _("stationStory-comms", "This station was named after the national research institution Rutherford Appleton Laboratory in the United Kingdom which conducted some preliminary research into the feasability of generating an energy shield in the late 20th century") - } - if stationFaction == "Human Navy" then - stationRutherford.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationRutherford.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationRutherford.comms_data.trade.medicine = true - end - else - stationRutherford.comms_data.trade.food = true - stationRutherford.comms_data.trade.medicine = true - end - return stationRutherford -end -function placeScience7() - --Science 7 - stationScience7 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationScience7) - stationScience7:setPosition(psx,psy):setCallSign("Science-7"):setDescription(_("scienceDescription-station", "Observatory")) - stationScience7.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { food = {quantity = 2, cost = 1} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationScience7 -end -function placeShawyer() - --Shawyer - stationShawyer = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationShawyer) - stationShawyer:setPosition(psx,psy):setCallSign("Shawyer"):setDescription(_("scienceDescription-station", "Impulse engine components")) - stationShawyer.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { impulse = {quantity = 5, cost = 100} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and manufacture impulse engine components and systems"), - history = _("stationStory-comms", "The station is named after Roger Shawyer who built the first prototype impulse engine in the early 21st century") - } - if stationFaction == "Human Navy" then - stationShawyer.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationShawyer.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationShawyer.comms_data.trade.medicine = true - end - else - stationShawyer.comms_data.trade.medicine = true - end - return stationShawyer -end -function placeShree() - --Shree - stationShree = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationShree) - stationShree:setPosition(psx,psy):setCallSign("Shree"):setDescription(_("scienceDescription-station", "Repulsor and tractor beam components")) - stationShree.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { tractor = {quantity = 5, cost = 90}, - repulsor = {quantity = 5, cost = math.random(85,95)} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We make ship systems designed to push or pull other objects around in space"), - history = _("stationStory-comms", "Our station is named Shree after one of many tugboat manufacturers in the early 21st century on Earth in India. Tugboats serve a similar purpose for ocean-going vessels on earth as tractor and repulsor beams serve for space-going vessels today") - } - if stationFaction == "Human Navy" then - stationShree.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationShree.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationShree.comms_data.trade.medicine = true - end - else - stationShree.comms_data.trade.medicine = true - stationShree.comms_data.trade.food = true - end - return stationShree -end -function placeSoong() - --Soong - stationSoong = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationSoong) - stationSoong:setPosition(psx,psy):setCallSign("Soong"):setDescription(_("scienceDescription-station", "Android components")) - stationSoong.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { android = {quantity = 5, cost = 73} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We create androids and android components"), - history = _("stationStory-comms", "The station is named after Dr. Noonian Soong, the famous android researcher and builder") - } - if stationFaction == "Human Navy" then - stationSoong.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationSoong.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - else - stationSoong.comms_data.trade.food = true - end - return stationSoong -end -function placeTiberius() - --Tiberius - stationTiberius = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationTiberius) - stationTiberius:setPosition(psx,psy):setCallSign("Tiberius"):setDescription(_("scienceDescription-station", "Logistics coordination")) - stationTiberius.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { food = {quantity = 5, cost = 1} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We support the stations and ships in the area with planning and communication services"), - history = _("stationStory-comms", "We recognize the influence of Starfleet Captain James Tiberius Kirk in the 23rd century in our station name") - } - return stationTiberius -end -function placeTokra() - --Tokra - stationTokra = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationTokra) - stationTokra:setPosition(psx,psy):setCallSign("Tokra"):setDescription(_("scienceDescription-station", "Advanced material components")) - whatTrade = random(1,100) - stationTokra.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { filament = {quantity = 5, cost = 42} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We create multiple types of advanced material components. Our most popular products are our filaments"), - history = _("stationStory-comms", "We learned several of our critical industrial processes from the Tokra race, so we honor our fortune by naming the station after them") - } - local whatTrade = random(1,100) - if stationFaction == "Human Navy" then - stationTokra.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationTokra.comms_data.goods.medicine = {quantity = 5, cost = 5} - stationTokra.comms_data.trade.luxury = true - else - if whatTrade < 50 then - stationTokra.comms_data.trade.medicine = true - else - stationTokra.comms_data.trade.luxury = true - end - end - else - if whatTrade < 33 then - stationTokra.comms_data.trade.food = true - elseif whatTrade > 66 then - stationTokra.comms_data.trade.medicine = true - else - stationTokra.comms_data.trade.luxury = true - end - end - return stationTokra -end -function placeToohie() - --Toohie - stationToohie = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationToohie) - stationToohie:setPosition(psx,psy):setCallSign("Toohie"):setDescription(_("scienceDescription-station", "Shield and armor components and research")) - stationToohie.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { shield = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and make general and specialized components for ship shield and ship armor systems"), - history = _("stationStory-comms", "This station was named after one of the earliest researchers in shield technology, Alexander Toohie back when it was considered impractical to construct shields due to the physics involved.") - } - if stationFaction == "Human Navy" then - stationToohie.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationToohie.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationToohie.comms_data.trade.medicine = random(1,100) < 25 - end - else - stationToohie.comms_data.trade.medicine = random(1,100) < 25 - end - return stationToohie -end -function placeUtopiaPlanitia() - --Utopia Planitia - stationUtopiaPlanitia = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationUtopiaPlanitia) - stationUtopiaPlanitia:setPosition(psx,psy):setCallSign("Utopia Planitia"):setDescription(_("scienceDescription-station", "Ship building and maintenance facility")) - stationUtopiaPlanitia.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { warp = {quantity = 5, cost = 167} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We work on all aspects of naval ship building and maintenance. Many of the naval models are researched, designed and built right here on this station. Our design goals seek to make the space faring experience as simple as possible given the tremendous capabilities of the modern naval vessel") - } - if stationFaction == "Human Navy" then - stationUtopiaPlanitia.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationUtopiaPlanitia.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationUtopiaPlanitia -end -function placeVactel() - --Vactel - stationVactel = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationVactel) - stationVactel:setPosition(psx,psy):setCallSign("Vactel"):setDescription(_("scienceDescription-station", "Shielded Circuitry Fabrication")) - stationVactel.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { circuit = {quantity = 5, cost = 50} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We specialize in circuitry shielded from external hacking suitable for ship systems"), - history = _("stationStory-comms", "We started as an expansion from the lunar based chip manufacturer of Earth legacy Intel electronic chips") - } - if stationFaction == "Human Navy" then - stationVactel.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationVactel.comms_data.goods.medicine = {quantity = 5, cost = 5} - end - end - return stationVactel -end -function placeVeloquan() - --Veloquan - stationVeloquan = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationVeloquan) - stationVeloquan:setPosition(psx,psy):setCallSign("Veloquan"):setDescription(_("scienceDescription-station", "Sensor components")) - stationVeloquan.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { sensor = {quantity = 5, cost = 68} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and construct components for the most powerful and accurate sensors used aboard ships along with the software to make them easy to use"), - history = _("stationStory-comms", "The Veloquan company has its roots in the manufacturing of LIDAR sensors in the early 21st century on Earth in the United States for autonomous ground-based vehicles. They expanded research and manufacturing operations to include various sensors for space vehicles. Veloquan was the result of numerous mergers and acquisitions of several companies including Velodyne and Quanergy") - } - if stationFaction == "Human Navy" then - stationVeloquan.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationVeloquan.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationVeloquan.comms_data.trade.medicine = true - end - else - stationVeloquan.comms_data.trade.medicine = true - stationVeloquan.comms_data.trade.food = true - end - return stationVeloquan -end -function placeZefram() - --Zefram - stationZefram = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationZefram) - stationZefram:setPosition(psx,psy):setCallSign("Zefram"):setDescription(_("scienceDescription-station", "Warp engine components")) - stationZefram.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { warp = {quantity = 5, cost = 140} }, - trade = { food = false, medicine = false, luxury = true }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We specialize in the esoteric components necessary to make warp drives function properly"), - history = _("stationStory-comms", "Zefram Cochrane constructed the first warp drive in human history. We named our station after him because of the specialized warp systems work we do") - } - if stationFaction == "Human Navy" then - stationZefram.comms_data.goods.food = {quantity = math.random(5,10), cost = 1} - if random(1,5) <= 1 then - stationZefram.comms_data.goods.medicine = {quantity = 5, cost = 5} - else - stationZefram.comms_data.trade.medicine = random(1,100) < 27 - end - else - stationZefram.comms_data.trade.medicine = random(1,100) < 27 - stationZefram.comms_data.trade.food = random(1,100) < 16 - end - return stationZefram -end --- Generic stations to be placed -- -function placeJabba() - --Jabba - stationJabba = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationJabba) - stationJabba:setPosition(psx,psy):setCallSign("Jabba"):setDescription(_("scienceDescription-station", "Commerce and gambling")) - stationJabba.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Come play some games and shop. House take does not exceed 4 percent") - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationJabba.comms_data.goods.luxury = {quantity = 5, cost = math.random(68,81)} - elseif stationGoodChoice == 2 then - stationJabba.comms_data.goods.gold = {quantity = 5, cost = math.random(61,77)} - else - stationJabba.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,79)} - end - return stationJabba -end -function placeKrik() - --Krik - stationKrik = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationKrik) - stationKrik:setPosition(psx,psy):setCallSign("Krik"):setDescription(_("scienceDescription-station", "Mining station")) - if stationStaticAsteroids then - posAxisKrik = random(0,360) - posKrik = random(30000,80000) - negKrik = random(20000,60000) - spreadKrik = random(5000,8000) - negAxisKrik = posAxisKrik + 180 - xPosAngleKrik, yPosAngleKrik = vectorFromAngle(posAxisKrik, posKrik) - posKrikEnd = random(40,90) - createRandomAlongArc(Asteroid, 30+posKrikEnd, psx+xPosAngleKrik, psy+yPosAngleKrik, posKrik, negAxisKrik, negAxisKrik+posKrikEnd, spreadKrik) - xNegAngleKrik, yNegAngleKrik = vectorFromAngle(negAxisKrik, negKrik) - negKrikEnd = random(30,60) - createRandomAlongArc(Asteroid, 30+negKrikEnd, psx+xNegAngleKrik, psy+yNegAngleKrik, negKrik, posAxisKrik, posAxisKrik+negKrikEnd, spreadKrik) - end - stationKrik.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { nickel = {quantity = 5, cost = 20} }, - trade = { food = true, medicine = true, luxury = random(1,100) < 50 }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "The finest shield and armor manufacturer in the quadrant"), - history = _("stationStory-comms", "We named this station for the pioneering spirit of the 22nd century Starfleet explorer, Captain Jonathan Archer") - } - local krikGoods = random(1,100) - if krikGoods < 10 then - stationKrik.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKrik.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - stationKrik.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 20 then - stationKrik.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKrik.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 30 then - stationKrik.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - stationKrik.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 40 then - stationKrik.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - stationKrik.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 50 then - stationKrik.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 60 then - stationKrik.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,75)} - elseif krikGoods < 70 then - stationKrik.comms_data.goods.tritanium = {quantity = 5, cost = math.random(45,55)} - elseif krikGoods < 80 then - stationKrik.comms_data.goods.cobalt = {quantity = 5, cost = math.random(55,65)} - else - stationKrik.comms_data.goods.cobalt = {quantity = 5, cost = math.random(55,65)} - stationKrik.comms_data.goods.dilithium = {quantity = 5, cost = math.random(45,55)} - end - return stationKrik -end -function placeLando() - --Lando - stationLando = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationLando) - stationLando:setPosition(psx,psy):setCallSign("Lando"):setDescription(_("scienceDescription-station", "Casino and Gambling")) - stationLando.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { shield = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationLando.comms_data.goods.luxury = {quantity = 5, cost = math.random(68,81)} - elseif stationGoodChoice == 2 then - stationLando.comms_data.goods.gold = {quantity = 5, cost = math.random(61,77)} - else - stationLando.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,79)} - end - return stationLando -end -function placeMaverick() - --Maverick - stationMaverick = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationMaverick) - stationMaverick:setPosition(psx,psy):setCallSign("Maverick"):setDescription(_("scienceDescription-station", "Gambling and resupply")) - stationMaverick.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Relax and meet some interesting players") - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationMaverick.comms_data.goods.luxury = {quantity = 5, cost = math.random(68,81)} - elseif stationGoodChoice == 2 then - stationMaverick.comms_data.goods.gold = {quantity = 5, cost = math.random(61,77)} - else - stationMaverick.comms_data.goods.platinum = {quantity = 5, cost = math.random(65,79)} - end - return stationMaverick -end -function placeNefatha() - --Nefatha - stationNefatha = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationNefatha) - stationNefatha:setPosition(psx,psy):setCallSign("Nefatha"):setDescription(_("scienceDescription-station", "Commerce and recreation")) - stationNefatha.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 70} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationNefatha -end -function placeOkun() - --Okun - stationOkun = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOkun) - stationOkun:setPosition(psx,psy):setCallSign("Okun"):setDescription(_("scienceDescription-station", "Xenopsychology research")) - stationOkun.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = false - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationOkun.comms_data.goods.optic = {quantity = 5, cost = math.random(52,65)} - elseif stationGoodChoice == 2 then - stationOkun.comms_data.goods.filament = {quantity = 5, cost = math.random(55,67)} - else - stationOkun.comms_data.goods.lifter = {quantity = 5, cost = math.random(48,69)} - end - return stationOkun -end -function placeOutpost7() - --Outpost 7 - stationOutpost7 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOutpost7) - stationOutpost7:setPosition(psx,psy):setCallSign("Outpost-7"):setDescription(_("scienceDescription-station", "Resupply")) - stationOutpost7.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 80} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationOutpost7 -end -function placeOutpost8() - --Outpost 8 - stationOutpost8 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOutpost8) - stationOutpost8:setPosition(psx,psy):setCallSign("Outpost-8") - stationOutpost8.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationOutpost8.comms_data.goods.impulse = {quantity = 5, cost = math.random(69,75)} - elseif stationGoodChoice == 2 then - stationOutpost8.comms_data.goods.tractor = {quantity = 5, cost = math.random(55,67)} - else - stationOutpost8.comms_data.goods.beam = {quantity = 5, cost = math.random(61,69)} - end - return stationOutpost8 -end -function placeOutpost33() - --Outpost 33 - stationOutpost33 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationOutpost33) - stationOutpost33:setPosition(psx,psy):setCallSign("Outpost-33"):setDescription(_("scienceDescription-station", "Resupply")) - stationOutpost33.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 75} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationOutpost33 -end -function placePrada() - --Prada - stationPrada = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationPrada) - stationPrada:setPosition(psx,psy):setCallSign("Prada"):setDescription(_("scienceDescription-station", "Textiles and fashion")) - stationPrada.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationPrada.comms_data.goods.luxury = {quantity = 5, cost = math.random(69,75)} - elseif stationGoodChoice == 2 then - stationPrada.comms_data.goods.cobalt = {quantity = 5, cost = math.random(55,67)} - else - stationPrada.comms_data.goods.dilithium = {quantity = 5, cost = math.random(61,69)} - end - return stationPrada -end -function placeResearch11() - --Research-11 - stationResearch11 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationResearch11) - stationResearch11:setPosition(psx,psy):setCallSign("Research-11"):setDescription(_("scienceDescription-station", "Stress Psychology Research")) - stationResearch11.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationResearch11.comms_data.goods.warp = {quantity = 5, cost = math.random(85,120)} - elseif stationGoodChoice == 2 then - stationResearch11.comms_data.goods.repulsor = {quantity = 5, cost = math.random(62,75)} - else - stationResearch11.comms_data.goods.robotic = {quantity = 5, cost = math.random(75,89)} - end - return stationResearch11 -end -function placeResearch19() - --Research-19 - stationResearch19 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationResearch19) - stationResearch19:setPosition(psx,psy):setCallSign("Research-19"):setDescription(_("scienceDescription-station", "Low gravity research")) - stationResearch19.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationResearch19.comms_data.goods.transporter = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationResearch19.comms_data.goods.sensor = {quantity = 5, cost = math.random(62,75)} - else - stationResearch19.comms_data.goods.communication = {quantity = 5, cost = math.random(55,89)} - end - return stationResearch19 -end -function placeRubis() - --Rubis - stationRubis = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationRubis) - stationRubis:setPosition(psx,psy):setCallSign("Rubis"):setDescription(_("scienceDescription-station", "Resupply")) - stationRubis.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 76} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Get your energy here! Grab a drink before you go!") - } - return stationRubis -end -function placeScience2() - --Science 2 - stationScience2 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationScience2) - stationScience2:setPosition(psx,psy):setCallSign("Science-2"):setDescription(_("scienceDescription-station", "Research Lab and Observatory")) - stationScience2.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationScience2.comms_data.goods.autodoc = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationScience2.comms_data.goods.android = {quantity = 5, cost = math.random(62,75)} - else - stationScience2.comms_data.goods.nanites = {quantity = 5, cost = math.random(55,89)} - end - return stationScience2 -end -function placeScience4() - --Science 4 - stationScience4 = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationScience4) - stationScience4:setPosition(psx,psy):setCallSign("Science-4"):setDescription(_("scienceDescription-station", "Biotech research")) - stationScience4.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "The finest shield and armor manufacturer in the quadrant"), - history = _("stationStory-comms", "We named this station for the pioneering spirit of the 22nd century Starfleet explorer, Captain Jonathan Archer") - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationScience4.comms_data.goods.software = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationScience4.comms_data.goods.circuit = {quantity = 5, cost = math.random(62,75)} - else - stationScience4.comms_data.goods.battery = {quantity = 5, cost = math.random(55,89)} - end - return stationScience4 -end -function placeSkandar() - --Skandar - stationSkandar = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationSkandar) - stationSkandar:setPosition(psx,psy):setCallSign("Skandar"):setDescription(_("scienceDescription-station", "Routine maintenance and entertainment")) - stationSkandar.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { luxury = {quantity = 5, cost = 87} }, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "Stop by for repairs. Take in one of our juggling shows featuring the four-armed Skandars"), - history = _("stationStory-comms", "The nomadic Skandars have set up at this station to practice their entertainment and maintenance skills as well as build a community where Skandars can relax") - } - return stationSkandar -end -function placeSpot() - --Spot - stationSpot = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationSpot) - stationSpot:setPosition(psx,psy):setCallSign("Spot"):setDescription(_("scienceDescription-station", "Observatory")) - stationSpot.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false } - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationSpot.comms_data.goods.optic = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationSpot.comms_data.goods.software = {quantity = 5, cost = math.random(62,75)} - else - stationSpot.comms_data.goods.sensor = {quantity = 5, cost = math.random(55,89)} - end - return stationSpot -end -function placeStarnet() - --Starnet - stationStarnet = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationStarnet) - stationStarnet:setPosition(psx,psy):setCallSign("Starnet"):setDescription(_("scienceDescription-station", "Automated weapons systems")) - stationStarnet.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "We research and create automated weapons systems to improve ship combat capability") - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationStarnet.comms_data.goods.shield = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationStarnet.comms_data.goods.beam = {quantity = 5, cost = math.random(62,75)} - else - stationStarnet.comms_data.goods.lifter = {quantity = 5, cost = math.random(55,89)} - end - return stationStarnet -end -function placeTandon() - --Tandon - stationTandon = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationTandon) - stationTandon:setPosition(psx,psy):setCallSign("Tandon"):setDescription(_("scienceDescription-station", "Biotechnology research")) - stationTandon.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = {}, - trade = { food = false, medicine = false, luxury = false }, - public_relations = true, - general_information = _("stationGeneralInfo-comms", "The finest shield and armor manufacturer in the quadrant"), - history = _("stationStory-comms", "We named this station for the pioneering spirit of the 22nd century Starfleet explorer, Captain Jonathan Archer") - } - local stationGoodChoice = math.random(1,3) - if stationGoodChoice == 1 then - stationTandon.comms_data.goods.autodoc = {quantity = 5, cost = math.random(85,94)} - elseif stationGoodChoice == 2 then - stationTandon.comms_data.goods.robotic = {quantity = 5, cost = math.random(62,75)} - else - stationTandon.comms_data.goods.android = {quantity = 5, cost = math.random(55,89)} - end - return stationTandon -end -function placeVaiken() - --Vaiken - stationVaiken = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationVaiken) - stationVaiken:setPosition(psx,psy):setCallSign("Vaiken"):setDescription(_("scienceDescription-station", "Ship building and maintenance facility")) - stationVaiken.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "friend", EMP = "friend"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 3.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 0.5 }, - goods = { food = {quantity = 10, cost = 1}, - medicine = {quantity = 5, cost = 5} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationVaiken -end -function placeValero() - --Valero - stationValero = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - setStationComms(stationValero) - stationValero:setPosition(psx,psy):setCallSign("Valero"):setDescription(_("scienceDescription-station", "Resupply")) - stationValero.comms_data = { - friendlyness = random(0,100), - weapons = {Homing = "neutral", HVLI = "neutral", Mine = "neutral", Nuke = "neutral", EMP = "neutral"}, - weapon_available = {Homing = random(1,10)<=(8-difficulty), HVLI = random(1,10)<=(9-difficulty), Mine = random(1,10)<=(7-difficulty), Nuke = random(1,10)<=(5-difficulty), EMP = random(1,10)<=(6-difficulty)}, - weapon_cost = {Homing = math.random(3,4), HVLI = math.random(3,4), Mine = math.random(3,5), Nuke = math.random(15,18), EMP = math.random(5,12)}, - service_cost = {supplydrop = math.random(80,120), reinforcements = math.random(125,175)}, - reputation_cost_multipliers = {friend = 1.0, neutral = 4.0}, - max_weapon_refill_amount = {friend = 1.0, neutral = 1.0 }, - goods = { luxury = {quantity = 5, cost = 90} }, - trade = { food = false, medicine = false, luxury = false } - } - return stationValero -end --- Enemy stations to be placed -- -function placeAramanth() - --Aramanth - stationAramanth = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Aramanth"):setPosition(psx,psy) - return stationAramanth -end -function placeEmpok() - --Empok Nor - stationEmpok = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - stationEmpok:setPosition(psx,psy):setCallSign("Empok Nor") - return stationEmpok -end -function placeGandala() - --Gandala - stationGanalda = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - stationGanalda:setPosition(psx,psy):setCallSign("Ganalda") - return stationGanalda -end -function placeHassenstadt() - --Hassenstadt - stationHassenstadt = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Hassenstadt"):setPosition(psx,psy) - return stationHassenstadt -end -function placeKaldor() - --Kaldor - stationKaldor = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Kaldor"):setPosition(psx,psy) - return stationKaldor -end -function placeMagMesra() - --Magenta Mesra - stationMagMesra = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Magenta Mesra"):setPosition(psx,psy) - return stationMagMesra -end -function placeMosEisley() - --Mos Eisley - stationMosEisley = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Mos Eisley"):setPosition(psx,psy) - return stationMosEisley -end -function placeQuestaVerde() - --Questa Verde - stationQuestaVerde = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Questa Verde"):setPosition(psx,psy) - return stationQuestaVerde -end -function placeRlyeh() - --R'lyeh - stationRlyeh = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("R'lyeh"):setPosition(psx,psy) - return stationRlyeh -end -function placeScarletCit() - --Scarlet Citadel - stationScarletCitadel = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - stationScarletCitadel:setPosition(psx,psy):setCallSign("Scarlet Citadel") - return stationScarletCitadel -end -function placeStahlstadt() - --Stahlstadt - stationStahlstadt = SpaceStation():setTemplate(szt()):setFaction(stationFaction):setCallSign("Stahlstadt"):setPosition(psx,psy) - return stationStahlstadt -end -function placeTic() - --Ticonderoga - stationTic = SpaceStation():setTemplate(szt()):setFaction(stationFaction) - stationTic:setPosition(psx,psy):setCallSign("Ticonderoga") - return stationTic -end -------------------------------------------- --- Inventory button for relay/operations -- -------------------------------------------- -function cargoInventory(delta) - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local cargoHoldEmpty = true - if p.goods ~= nil then - for good, quantity in pairs(p.goods) do - if quantity ~= nil and quantity > 0 then - cargoHoldEmpty = false - break - end - end - end - if not cargoHoldEmpty then - if p:hasPlayerAtPosition("Relay") then - if p.inventoryButton == nil then - local tbi = "inventory" .. p:getCallSign() - p:addCustomButton("Relay",tbi,_("inventory-buttonRelay", "Inventory"),cargoInventoryList[pidx]) - p.inventoryButton = true - end - end - if p:hasPlayerAtPosition("Operations") then - if p.inventoryButton == nil then - local tbi = "inventoryOp" .. p:getCallSign() - p:addCustomButton("Operations",tbi,_("inventory-buttonOperations", "Inventory"),cargoInventoryList[pidx]) - p.inventoryButton = true - end - end - end - end - end -end -function cargoInventoryGivenShip(p) - p:addToShipLog(string.format(_("inventory-shipLog", "%s Current cargo:"),p:getCallSign()),"Yellow") - local cargoHoldEmpty = true - if p.goods ~= nil then - for good, quantity in pairs(p.goods) do - if quantity ~= nil and quantity > 0 then - p:addToShipLog(string.format(_("inventory-shipLog", " %s: %i"),good,math.floor(quantity)),"Yellow") - cargoHoldEmpty = false +function cargoInventoryGivenShip(p) + p:addToShipLog(string.format(_("inventory-shipLog","%s Current cargo:"),p:getCallSign()),"Yellow") + local cargoHoldEmpty = true + if p.goods ~= nil then + for good, quantity in pairs(p.goods) do + if quantity ~= nil and quantity > 0 then + p:addToShipLog(string.format(" %s: %i",good,math.floor(quantity)),"Yellow") + cargoHoldEmpty = false end end end if cargoHoldEmpty then - p:addToShipLog(_("inventory-shipLog", " Empty\n"),"Yellow") + p:addToShipLog(_("inventory-shipLog"," Empty\n"),"Yellow") end - p:addToShipLog(string.format(_("inventory-shipLog", "Available space: %i"),p.cargo),"Yellow") -end -function cargoInventory1() - local p = getPlayerShip(1) - cargoInventoryGivenShip(p) -end -function cargoInventory2() - local p = getPlayerShip(2) - cargoInventoryGivenShip(p) -end -function cargoInventory3() - local p = getPlayerShip(3) - cargoInventoryGivenShip(p) -end -function cargoInventory4() - local p = getPlayerShip(4) - cargoInventoryGivenShip(p) -end -function cargoInventory5() - local p = getPlayerShip(5) - cargoInventoryGivenShip(p) -end -function cargoInventory6() - local p = getPlayerShip(6) - cargoInventoryGivenShip(p) -end -function cargoInventory7() - local p = getPlayerShip(7) - cargoInventoryGivenShip(p) -end -function cargoInventory8() - local p = getPlayerShip(8) - cargoInventoryGivenShip(p) + p:addToShipLog(string.format(_("inventory-shipLog","Available space: %i"),p.cargo),"Yellow") end ---------------------------- -- Station communications -- @@ -5311,6 +3065,9 @@ function commsStation() } }) comms_data = comms_target.comms_data + if not comms_source:isEnemy(comms_target) then + addStationToDatabase(comms_target) + end if stationCommsDiagnostic then print("set players") end setPlayers() if stationCommsDiagnostic then print("set local variable player from comms source") end @@ -5320,7 +3077,7 @@ function commsStation() return false end if comms_target:areEnemiesInRange(5000) then - setCommsMessage(_("station-comms", "We are under attack! No time for chatting!")); + setCommsMessage(_("station-comms","We are under attack! No time for chatting!")) return true end if not comms_source:isDocked(comms_target) then @@ -5336,204 +3093,138 @@ function handleDockedState() if stationCommsDiagnostic then print(string.format("handleDockedState derived name: %s",playerCallSign)) end if comms_source:isFriendly(comms_target) then if ctd.friendlyness > 66 then - oMsg = string.format_("station-comms", ("Greetings %s!\nHow may we help you today?"),comms_source:getCallSign()) + oMsg = string.format(_("station-comms","Greetings %s!\nHow may we help you today?"),comms_source:getCallSign()) elseif ctd.friendlyness > 33 then - oMsg = _("station-comms", "Good day, officer!\nWhat can we do for you today?") + oMsg = _("station-comms","Good day, officer!\nWhat can we do for you today?") else - oMsg = _("station-comms", "Hello, may I help you?") + oMsg = _("station-comms","Hello, may I help you?") end else - oMsg = _("station-comms", "Welcome to our lovely station.") + oMsg = _("station-comms","Welcome to our lovely station.") end if comms_target:areEnemiesInRange(20000) then - oMsg = oMsg .. _("station-comms", "Forgive us if we seem a little distracted. We are carefully monitoring the enemies nearby.") + oMsg = oMsg .. _("station-comms","Forgive us if we seem a little distracted. We are carefully monitoring the enemies nearby.") end setCommsMessage(oMsg) local missilePresence = 0 local missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} - for _, missile_type in ipairs(missile_types) do + for i, missile_type in ipairs(missile_types) do missilePresence = missilePresence + comms_source:getWeaponStorageMax(missile_type) end if missilePresence > 0 then - if (ctd.weapon_available.Nuke and comms_source:getWeaponStorageMax("Nuke") > 0) or - (ctd.weapon_available.EMP and comms_source:getWeaponStorageMax("EMP") > 0) or - (ctd.weapon_available.Homing and comms_source:getWeaponStorageMax("Homing") > 0) or - (ctd.weapon_available.Mine and comms_source:getWeaponStorageMax("Mine") > 0) or - (ctd.weapon_available.HVLI and comms_source:getWeaponStorageMax("HVLI") > 0) then - addCommsReply(_("ammo-comms", "I need ordnance restocked"), function() - local ctd = comms_target.comms_data - if stationCommsDiagnostic then print("in restock function") end - setCommsMessage(_("ammo-comms", "What type of ordnance?")) - if stationCommsDiagnostic then print(string.format("player nuke weapon storage max: %.1f",comms_source:getWeaponStorageMax("Nuke"))) end - if comms_source:getWeaponStorageMax("Nuke") > 0 then - if stationCommsDiagnostic then print("player can fire nukes") end - if ctd.weapon_available.Nuke then - if stationCommsDiagnostic then print("station has nukes available") end - if math.random(1,10) <= 5 then - nukePrompt = _("ammo-comms", "Can you supply us with some nukes? (") - else - nukePrompt = _("ammo-comms", "We really need some nukes (") - end - if stationCommsDiagnostic then print("nuke prompt: " .. nukePrompt) end - addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), nukePrompt, getWeaponCost("Nuke")), function() - if stationCommsDiagnostic then print("going to handle weapon restock function") end - handleWeaponRestock("Nuke") - end) - end --end station has nuke available if branch - end --end player can accept nuke if branch - if comms_source:getWeaponStorageMax("EMP") > 0 then - if ctd.weapon_available.EMP then - if math.random(1,10) <= 5 then - empPrompt = _("ammo-comms", "Please re-stock our EMP missiles. (") - else - empPrompt = _("ammo-comms", "Got any EMPs? (") - end - addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), empPrompt, getWeaponCost("EMP")), function() - handleWeaponRestock("EMP") - end) - end --end station has EMP available if branch - end --end player can accept EMP if branch - if comms_source:getWeaponStorageMax("Homing") > 0 then - if ctd.weapon_available.Homing then - if math.random(1,10) <= 5 then - homePrompt = _("ammo-comms", "Do you have spare homing missiles for us? (") - else - homePrompt = _("ammo-comms", "Do you have extra homing missiles? (") - end - addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), homePrompt, getWeaponCost("Homing")), function() - handleWeaponRestock("Homing") - end) - end --end station has homing for player if branch - end --end player can accept homing if branch - if comms_source:getWeaponStorageMax("Mine") > 0 then - if ctd.weapon_available.Mine then - if math.random(1,10) <= 5 then - minePrompt = _("ammo-comms", "We could use some mines. (") - else - minePrompt = _("ammo-comms", "How about mines? (") - end - addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), minePrompt, getWeaponCost("Mine")), function() - handleWeaponRestock("Mine") - end) - end --end station has mine for player if branch - end --end player can accept mine if branch - if comms_source:getWeaponStorageMax("HVLI") > 0 then - if ctd.weapon_available.HVLI then - if math.random(1,10) <= 5 then - hvliPrompt = _("ammo-comms", "What about HVLI? (") - else - hvliPrompt = _("ammo-comms", "Could you provide HVLI? (") - end - addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), hvliPrompt, getWeaponCost("HVLI")), function() - handleWeaponRestock("HVLI") + if (comms_target.comms_data.weapon_available.Nuke and comms_source:getWeaponStorageMax("Nuke") > 0) or + (comms_target.comms_data.weapon_available.EMP and comms_source:getWeaponStorageMax("EMP") > 0) or + (comms_target.comms_data.weapon_available.Homing and comms_source:getWeaponStorageMax("Homing") > 0) or + (comms_target.comms_data.weapon_available.Mine and comms_source:getWeaponStorageMax("Mine") > 0) or + (comms_target.comms_data.weapon_available.HVLI and comms_source:getWeaponStorageMax("HVLI") > 0) then + addCommsReply(_("ammo-comms","I need ordnance restocked"), function() + setCommsMessage("What type of ordnance do you need?") + local prompts = { + ["Nuke"] = { + _("ammo-comms","Can you supply us with some nukes?"), + _("ammo-comms","We really need some nukes."), + _("ammo-comms","Can you restock our nuclear missiles?"), + }, + ["EMP"] = { + _("ammo-comms","Please restock our EMP missiles."), + _("ammo-comms","Got any EMPs?"), + _("ammo-comms","We need Electro-Magnetic Pulse missiles."), + }, + ["Homing"] = { + _("ammo-comms","Do you have spare homing missiles for us?"), + _("ammo-comms","Do you have extra homing missiles?"), + _("ammo-comms","Please replenish our homing missiles."), + }, + ["Mine"] = { + _("ammo-comms","We could use some mines."), + _("ammo-comms","How about mines?"), + _("ammo-comms","Got mines for us?"), + }, + ["HVLI"] = { + _("ammo-comms","What about HVLI?"), + _("ammo-comms","Could you provide HVLI?"), + _("ammo-comms","We need High Velocity Lead Impactors."), + }, + } + for i, missile_type in ipairs(missile_types) do + if comms_source:getWeaponStorageMax(missile_type) > 0 and comms_target.comms_data.weapon_available[missile_type] then + addCommsReply(string.format(_("ammo-comms","%s (%d rep each)"),prompts[missile_type][math.random(1,#prompts[missile_type])],getWeaponCost(missile_type)), function() + string.format("") + handleWeaponRestock(missile_type) end) - end --end station has HVLI for player if branch - end --end player can accept HVLI if branch - end) --end player requests secondary ordnance comms reply branch - end --end secondary ordnance available from station if branch - end --end missles used on player ship if branch + end + end + addCommsReply(_("Back"), commsStation) + end) + else + oMsg = string.format(_("station-comms","%s\nWe don't have ordnance for you."),oMsg) + end + end if comms_target == primusStation and plotChoiceStation == primusStation and plot1 == nil then - addCommsReply("Visit dispatch office", function() - setCommsMessage(string.format("Excellent work on your last assignment, %s. You may stand down or take another assignment",playerCallSign)) + addCommsReply(_("orders-comms","Visit dispatch office"), function() + setCommsMessage(string.format(_("orders-comms","Excellent work on your last assignment, %s. You may stand down or take another assignment"),playerCallSign)) playVoice("Skyler03") - addCommsReply("Stand down", function() - setCommsMessage("Congratulations and thank you") + addCommsReply(_("orders-comms","Stand down"), function() + setCommsMessage(_("orders-comms","Congratulations and thank you")) playVoice("Pat05") showEndStats() victory("Human Navy") end) if string.find(mission_choice,"Selectable") then - addCommsReply("Move to next region of available missions", function() - setCommsMessage(string.format("Dock with station %s for the details of your next assignment. Beware the asteroids",belt1Stations[1]:getCallSign())) + addCommsReply(_("orders-comms","Move to next region of available missions"), function() + setCommsMessage(string.format(_("orders-comms","Dock with station %s for the details of your next assignment. Beware the asteroids"),belt1Stations[1]:getCallSign())) playVoice("Pat06") plotChoiceStation = belt1Stations[1] mission_region = 2 - primaryOrders = string.format("Dock with station %s",belt1Stations[1]:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with station %s"),belt1Stations[1]:getCallSign()) end) if string.find(mission_choice,"Region") then - if #plotList >= 1 then - addCommsReply("Request next assignment", function() - plotChoice = math.random(1,#plotList) - plot1 = plotList[plotChoice] - setCommsMessage(plotListMessage[plotChoice]) + if #first_plots >= 1 then + addCommsReply(_("orders-comms","Request next assignment"), function() + string.format("") + local first_plot = tableRemoveRandom(first_plots) + plot1 = first_plot.func + setCommsMessage(first_plot.desc) if server_voices then - if plotChoice == 1 then - playVoice(string.format("Pat01%s",planetSecondus:getCallSign())) - end - if plotChoice == 2 then - playVoice(string.format("Pat02%s",planetPrimus:getCallSign())) - end - if plotChoice == 3 then - playVoice("Pat03") - end - if plotChoice == 4 then - playVoice("Pat04") - end + playVoice(first_plot.voice) end - primaryOrders = plotListOrders[plotChoice] - table.remove(plotList,plotChoice) - table.remove(plotListMessage,plotChoice) - table.remove(plotListOrders,plotChoice) + primaryOrders = first_plot.order end) end else - for plot_index=1,#plotList do - addCommsReply(plotListOrders[plot_index], function() - plotChoice = plot_index - plot1 = plotList[plot_index] - setCommsMessage(plotListMessage[plot_index]) - if server_voices then - if plotChoice == 1 then - playVoice(string.format("Pat01%s",planetSecondus:getCallSign())) - end - if plotChoice == 2 then - playVoice(string.format("Pat02%s",planetPrimus:getCallSign())) - end - if plotChoice == 3 then - playVoice("Pat03") - end - if plotChoice == 4 then - playVoice("Pat04") + if #first_plots >= 1 then + for i,first_plot in ipairs(first_plots) do + addCommsReply(first_plot.order, function() + string.format("") + plot1 = first_plot.func + setCommsMessage(first_plot.desc) + if server_voices then + playVoice(first_plot.voice) end - end - primaryOrders = plotListOrders[plot_index] - table.remove(plotList,plot_index) - table.remove(plotListMessage,plot_index) - table.remove(plotListOrders,plot_index) - end) - end + primaryOrders = first_plot.order + first_plots[i] = first_plots[#first_plots] + first_plots[#first_plots] = nil + end) + end + end end else - addCommsReply("Request next assignment", function() - if #plotList < 1 then - setCommsMessage(string.format("Dock with station %s for the details of your next assignment. Beware the asteroids",belt1Stations[1]:getCallSign())) + addCommsReply(_("orders-comms","Request next assignment"), function() + if #first_plots < 1 then + setCommsMessage(string.format(_("orders-comms","Dock with station %s for the details of your next assignment. Beware the asteroids"),belt1Stations[1]:getCallSign())) playVoice("Pat06") plotChoiceStation = belt1Stations[1] mission_region = 2 - primaryOrders = string.format("Dock with station %s",belt1Stations[1]:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with station %s"),belt1Stations[1]:getCallSign()) else - --plotChoice = 4 --force to Exuari marauders - plotChoice = math.random(1,#plotList) - plot1 = plotList[plotChoice] - setCommsMessage(plotListMessage[plotChoice]) + string.format("") + local first_plot = tableRemoveRandom(first_plots) + plot1 = first_plot.func + setCommsMessage(first_plot.desc) if server_voices then - if plotChoice == 1 then - playVoice(string.format("Pat01%s",planetSecondus:getCallSign())) - end - if plotChoice == 2 then - playVoice(string.format("Pat02%s",planetPrimus:getCallSign())) - end - if plotChoice == 3 then - playVoice("Pat03") - end - if plotChoice == 4 then - playVoice("Pat04") - end + playVoice(first_plot.voice) end - primaryOrders = plotListOrders[plotChoice] - table.remove(plotList,plotChoice) - table.remove(plotListMessage,plotChoice) - table.remove(plotListOrders,plotChoice) + primaryOrders = first_plot.order end addCommsReply(_("Back"), commsStation) end) @@ -5542,109 +3233,70 @@ function handleDockedState() end) end --choose mission from dispatch office on primus station if comms_target == belt1Stations[1] and plotChoiceStation == belt1Stations[1] and plot1 == nil then - addCommsReply("Visit dispatch office", function() - setCommsMessage(string.format("Welcome to %s station, %s. We're glad you're here. These are your choices for assignments",belt1Stations[1]:getCallSign(),comms_source:getCallSign())) + addCommsReply(_("orders-comms","Visit dispatch office"), function() + setCommsMessage(string.format(_("orders-comms","Welcome to %s station, %s. We're glad you're here. These are your choices for assignments"),belt1Stations[1]:getCallSign(),comms_source:getCallSign())) playVoice("Tracy02") if string.find(mission_choice,"Selectable") then - addCommsReply(string.format("Move on to missions in %s area",planetTertius:getCallSign()), function() - setCommsMessage(string.format("Dock with station %s for your next assignment",tertiusStation:getCallSign())) + addCommsReply(string.format(_("orders-comms","Move on to missions in %s area"),planetTertius:getCallSign()), function() + setCommsMessage(string.format(_("orders-comms","Dock with station %s for your next assignment"),tertiusStation:getCallSign())) playVoice(string.format("Tracy01%s",planetTertius:getCallSign())) plotChoiceStation = tertiusStation mission_region = 3 - primaryOrders = string.format("Dock with station %s",tertiusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with station %s"),tertiusStation:getCallSign()) end) if string.find(mission_choice,"Region") then - if #plotList2 >= 1 then - addCommsReply("Request next assignment", function() - plotChoice = math.random(1,#plotList2) - plot1 = plotList2[plotChoice] - setCommsMessage(plotListMessage2[plotChoice]) + if #second_plots >= 1 then + addCommsReply(_("orders-comms","Request next assignment"), function() + string.format("") + local second_plot = tableRemoveRandom(second_plots) + plot1 = second_plot.func + setCommsMessage(second_plot.desc) if server_voices then - if plotChoice == 1 then - playVoice("Tracy03") - end - if plotChoice == 2 then - playVoice("Tracy05") - end - if plotChoice == 3 then - local orbit_label = "Outside" - if secondusOrbit > playerSpawnBand then --players spawn inside Secondus - orbit_label = "Inside" - end - playVoice(string.format("Tracy06%s%s",orbit_label,planetSecondus:getCallSign())) - end + playVoice(second_plot.voice) end - primaryOrders = plotListOrders2[plotChoice] - table.remove(plotList2,plotChoice) - table.remove(plotListMessage2,plotChoice) - table.remove(plotListOrders2,plotChoice) + primaryOrders = second_plot.order end) - end + end else - for plot_index=1,#plotList2 do - addCommsReply(plotListOrders2[plot_index], function() - plotChoice = plot_index - plot1 = plotList2[plot_index] - setCommsMessage(plotListMessage2[plot_index]) - if server_voices then - if plotChoice == 1 then - playVoice("Tracy03") - end - if plotChoice == 2 then - playVoice("Tracy05") - end - if plotChoice == 3 then - local orbit_label = "Outside" - if secondusOrbit > playerSpawnBand then --players spawn inside Secondus - orbit_label = "Inside" - end - playVoice(string.format("Tracy06%s%s",orbit_label,planetSecondus:getCallSign())) + if #second_plots >= 1 then + for i,second_plot in ipairs(second_plots) do + addCommsReply(second_plot.order, function() + string.format("") + plot1 = second_plot.func + setCommsMessage(second_plot.desc) + if server_voices then + playVoice(second_plot) end - end - primaryOrders = plotListOrders2[plot_index] - table.remove(plotList2,plot_index) - table.remove(plotListMessage2,plot_index) - table.remove(plotListOrders2,plot_index) - end) - end + primaryOrders = second_plot.order + second_plots[i] = second_plots[#second_plots] + second_plots[#second_plots] = nil + end) + end + end end else - addCommsReply("Request next assignment", function() - if #plotList2 < 1 then - setCommsMessage(string.format("Dock with station %s for your next assignment",tertiusStation:getCallSign())) + addCommsReply(_("orders-comms","Request next assignment"), function() + if #second_plots < 1 then + setCommsMessage(string.format(_("orders-comms","Dock with station %s for your next assignment"),tertiusStation:getCallSign())) playVoice(string.format("Tracy01%s",planetTertius:getCallSign())) plotChoiceStation = tertiusStation mission_region = 3 - primaryOrders = string.format("Dock with station %s",tertiusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with station %s"),tertiusStation:getCallSign()) else - plotChoice = math.random(1,#plotList2) - plot1 = plotList2[plotChoice] - setCommsMessage(plotListMessage2[plotChoice]) + string.format("") + local second_plot = tableRemoveRandom(second_plots) + plot1 = second_plot.func + setCommsMessage(second_plot.desc) if server_voices then - if plotChoice == 1 then - playVoice("Tracy03") - end - if plotChoice == 2 then - playVoice("Tracy05") - end - if plotChoice == 3 then - local orbit_label = "Outside" - if secondusOrbit > playerSpawnBand then --players spawn inside Secondus - orbit_label = "Inside" - end - playVoice(string.format("Tracy06%s%s",orbit_label,planetSecondus:getCallSign())) - end + playVoice(second_plot.voice) end - primaryOrders = plotListOrders2[plotChoice] - table.remove(plotList2,plotChoice) - table.remove(plotListMessage2,plotChoice) - table.remove(plotListOrders2,plotChoice) + primaryOrders = second_plot.order end addCommsReply(_("Back"), commsStation) end) end - addCommsReply("Stand down", function() - setCommsMessage("Congratulations and thank you") + addCommsReply(_("orders-comms","Stand down"), function() + setCommsMessage(_("orders-comms","Congratulations and thank you")) playVoice("Tracy04") showEndStats() victory("Human Navy") @@ -5653,60 +3305,60 @@ function handleDockedState() end) end if comms_target == tertiusStation and plotChoiceStation == tertiusStation and plot1 == nil then - addCommsReply("Visit dispatch office", function() - setCommsMessage(string.format("Welcome, %s. Everything is bigger at %s station. We could use your help with one of these mission options",comms_source:getCallSign(),tertiusStation:getCallSign())) + addCommsReply(_("orders-comms","Visit dispatch office"), function() + setCommsMessage(string.format(_("orders-comms","Welcome, %s. Everything is bigger at %s station. We could use your help with one of these mission options"),comms_source:getCallSign(),tertiusStation:getCallSign())) playVoice("Hayden01") - addCommsReply("Exuari Exterminates Extraterrestrials", function() - setCommsMessage("The Exuari have unlimited resources and continually send more ships of greater and greater power and nastier surprises. No victory condition exists") + addCommsReply(_("orders-comms","Exuari Exterminates Extraterrestrials"), function() + setCommsMessage(_("orders-comms","The Exuari have unlimited resources and continually send more ships of greater and greater power and nastier surprises. No victory condition exists")) playVoice("Hayden02") - addCommsReply("Confirm", function() + addCommsReply(_("orders-comms","Confirm"), function() plot1 = exterminate - setCommsMessage(string.format("The Exuari are on their way. They will target you and the assets in and around %s",planetTertius:getCallSign())) + setCommsMessage(string.format(_("orders-comms","The Exuari are on their way. They will target you and the assets in and around %s"),planetTertius:getCallSign())) playVoice("Hayden03") end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Eliminate Exuari stronghold", function() - setCommsMessage("The Exuari have unlimited resources, but they are constrained to funnel them through their stronghold. Obtain victory by finding and destroying the Exuari stronghold.") + addCommsReply(_("orders-comms","Eliminate Exuari stronghold"), function() + setCommsMessage(_("orders-comms","The Exuari have unlimited resources, but they are constrained to funnel them through their stronghold. Obtain victory by finding and destroying the Exuari stronghold.")) playVoice("Hayden04") - addCommsReply("Confirm", function() + addCommsReply(_("orders-comms","Confirm"), function() plot1 = stronghold - setCommsMessage("Good luck") + setCommsMessage(_("orders-comms","Good luck")) playVoice("Hayden05") end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Survive Exuari offensive", function() - setCommsMessage("The Exuari launch their invasion offensive. You must survive their attack. You will have a limited amount of time during which you must survive") + addCommsReply(_("orders-comms","Survive Exuari offensive"), function() + setCommsMessage(_("orders-comms","The Exuari launch their invasion offensive. You must survive their attack. You will have a limited amount of time during which you must survive")) playVoice("Hayden06") - addCommsReply("15 minutes", function() + addCommsReply(_("orders-comms","15 minutes"), function() plot1 = survive playWithTimeLimit = true gameTimeLimit = 15*60 - setCommsMessage("The countdown has begun") + setCommsMessage(_("orders-comms","The countdown has begun")) playVoice("Hayden07") addCommsReply(_("Back"), commsStation) end) - addCommsReply("30 minutes", function() + addCommsReply(_("orders-comms","30 minutes"), function() plot1 = survive playWithTimeLimit = true gameTimeLimit = 30*60 - setCommsMessage("The countdown has begun") + setCommsMessage(_("orders-comms","The countdown has begun")) playVoice("Hayden07") addCommsReply(_("Back"), commsStation) end) - addCommsReply("45 minutes", function() + addCommsReply(_("orders-comms","45 minutes"), function() plot1 = survive playWithTimeLimit = true gameTimeLimit = 45*60 - setCommsMessage("The countdown has begun") + setCommsMessage(_("orders-comms","The countdown has begun")) playVoice("Hayden07") addCommsReply(_("Back"), commsStation) end) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply("Stand down", function() - setCommsMessage("Congratulations and thank you") + addCommsReply(_("orders-comms","Stand down"), function() + setCommsMessage(_("orders-comms","Congratulations and thank you")) playVoice("Hayden08") showEndStats() victory("Human Navy") @@ -5715,30 +3367,30 @@ function handleDockedState() end) end if comms_target == belt1Stations[5] and plot1 == checkOrbitingArtifactEvents and not astronomerBoardedShip then - addCommsReply("Pick up astronomer Polly Hobbs", function() - setCommsMessage("[Polly Hobbs] Thank you for picking me up. I found the source of the anomalous readings near the end of the inner solar asteroid belt. I've brought specialized scanning instruments, but they must be closer than 1 unit to be effective. Also, we will need baseline scan data from your ship's instruments") + addCommsReply(_("station-comms","Pick up astronomer Polly Hobbs"), function() + setCommsMessage(_("station-comms","[Polly Hobbs] Thank you for picking me up. I found the source of the anomalous readings near the end of the inner solar asteroid belt. I've brought specialized scanning instruments, but they must be closer than 1 unit to be effective. Also, we will need baseline scan data from your ship's instruments")) playVoice("Polly03") - primaryOrders = "Bring astronomer Polly Hobbs close to artifact for additional sensor readings" + primaryOrders = _("station-comms","Bring astronomer Polly Hobbs close to artifact for additional sensor readings") astronomerBoardedShip = true comms_source.astronomer = true addCommsReply(_("Back"), commsStation) end) end if comms_target == belt1Stations[2] and plot1 == checkTransportPrimusResearcherEvents and not researcherBoardedShip then - addCommsReply("Pick up planetologist", function() - setCommsMessage("I'm not sure he's ready. He's not at the dock ready to board or in the transporter room. Our station is undergoing repairs, so several systems are offline") - addCommsReply("Look for planetologist", function() - setCommsMessage("The likeliest places to find him are his quarters, the lab or the observation lounge") - addCommsReply("Try his quarters", function() + addCommsReply(_("planetologist-comms","Pick up planetologist"), function() + setCommsMessage(_("planetologist-comms","I'm not sure he's ready. He's not at the dock ready to board or in the transporter room. Our station is undergoing repairs, so several systems are offline")) + addCommsReply(_("planetologist-comms","Look for planetologist"), function() + setCommsMessage(_("planetologist-comms","The likeliest places to find him are his quarters, the lab or the observation lounge")) + addCommsReply(_("planetologist-comms","Try his quarters"), function() if lastLocationPlanetologist == "his quarters" then planetologistChase = planetologistChase + 1 else planetologistChase = 0 end if random(1,5) + planetologistChase > 4 then - setCommsMessage("[Enrique Flogistan] Yes? What can I do for you? Please be quick about it, I'm in a bit of a hurry") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Yes? What can I do for you? Please be quick about it, I'm in a bit of a hurry")) playVoice("Enrique01") - addCommsReply(string.format("Ready to begin your observations of %s?",planetPrimus:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","Ready to begin your observations of %s?"),planetPrimus:getCallSign()), function() if random(1,100) < 50 then lastLocationPlanetologist = "the lab" playVoice("Enrique02") @@ -5746,23 +3398,23 @@ function handleDockedState() lastLocationPlanetologist = "the observation lounge" playVoice("Enrique03") end - setCommsMessage("[Enrique Flogistan] Almost. Let me grab something from " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] Almost. Let me grab something from %s"),lastLocationPlanetologist)) addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("We are here to transport you to %s",primusStation:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","We are here to transport you to %s"),primusStation:getCallSign()), function() if random(1,100) < 50 then lastLocationPlanetologist = "the lab" else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage("[Enrique Flogistan] You're not my normal transport representative. Besides, I still need to pack a few things.\n\nHe heads off down the corridor towards " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] You're not my normal transport representative. Besides, I still need to pack a few things.\n\nHe heads off down the corridor towards %s"),lastLocationPlanetologist)) playVoice("Enrique04") addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("My ship, %s, is here to transport you",comms_source:getCallSign()), function() - setCommsMessage("Is your ship armed?") + addCommsReply(string.format(_("planetologist-comms","My ship, %s, is here to transport you"),comms_source:getCallSign()), function() + setCommsMessage(_("planetologist-comms","Is your ship armed?")) playVoice("Enrique05") - addCommsReply("Yes, we can handle any Exuari in the area", function() + addCommsReply(_("planetologist-comms","Yes, we can handle any Exuari in the area"), function() local scurry_choice = random(1,100) if scurry_choice < 50 then lastLocationPlanetologist = "the lab" @@ -5770,11 +3422,15 @@ function handleDockedState() lastLocationPlanetologist = "the observation lounge" end if random(1,5) + planetologistChase > 4 then - setCommsMessage("Good. Let's go\n\nHe joins you as you go back to the ship") + if researcherBoardedShip then + setCommsMessage(_("planetologist-comms","He's already boarded a ship")) + else + setCommsMessage(_("planetologist-comms","Good. Let's go\n\nHe joins you as you go back to the ship")) + end researcherBoardedShip = true comms_source.planetologistAboard = true else - setCommsMessage("Good. I still need a couple of items from " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","Good. I still need a couple of items from %s"),lastLocationPlanetologist)) if scurry_choice < 50 then playVoice("Enrique06") else @@ -5791,37 +3447,37 @@ function handleDockedState() else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage("He's not in his quarters. His digital room assistant predicts he went to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","He's not in his quarters. His digital room assistant predicts he went to %s"),lastLocationPlanetologist)) end addCommsReply(_("Back"), commsStation) end) - addCommsReply("Try the lab", function() + addCommsReply(_("planetologist-comms","Try the lab"), function() if lastLocationPlanetologist == "the lab" then planetologistChase = planetologistChase + 1 else planetologistChase = 0 end if random(1,5) + planetologistChase > 4 then - setCommsMessage("[Enrique Flogistan] Hello, welcome to the planetology lab. Can I help you?") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Hello, welcome to the planetology lab. Can I help you?")) playVoice("Enrique08") - addCommsReply(string.format("Ready to go observe %s?",planetPrimus:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","Ready to go observe %s?"),planetPrimus:getCallSign()), function() if random(1,100) < 50 then lastLocationPlanetologist = "his quarters" else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage("[Enrique Flogistan] Almost. Let me get one more thing.\n\nHe leaves the lab for " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] Almost. Let me get one more thing.\n\nHe leaves the lab for %s"),lastLocationPlanetologist)) playVoice("Enrique09") addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("We're ready to transport you to %s",primusStation:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","We're ready to transport you to %s"),primusStation:getCallSign()), function() local tech_choice = random(1,100) if tech_choice < 50 then lastLocationPlanetologist = "his quarters" else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage("[Enrique Flogistan] Already?!\n\nHe quickly leaves the lab. The lab technician looks over as he leaves\n\n[Lab technician] I think he's going to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] Already?!\n\nHe quickly leaves the lab. The lab technician looks over as he leaves\n\n[Lab technician] I think he's going to %s"),lastLocationPlanetologist)) playVoice("Enrique10") if tech_choice < 50 then playVoice("Rory01") @@ -5830,16 +3486,16 @@ function handleDockedState() end addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("%s has docked and is waiting on you",comms_source:getCallSign()), function() - setCommsMessage("Are you aware of the Exuari that have been spotted in the area?") + addCommsReply(string.format(_("planetologist-comms","%s has docked and is waiting on you"),comms_source:getCallSign()), function() + setCommsMessage(_("planetologist-comms","Are you aware of the Exuari that have been spotted in the area?")) playVoice("Enrique11") - addCommsReply("Yes, don't worry about them", function() + addCommsReply(_("planetologist-comms","Yes, don't worry about them"), function() if random(1,100) < 50 then - setCommsMessage("[Enrique Flogistan] Good to know. I need to finishing packing in my quarters") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Good to know. I need to finishing packing in my quarters")) playVoice("Enrique12") lastLocationPlanetologist = "his quarters" else - setCommsMessage("[Enrique Flogistan] Good to know. I left some notes in the observation lounge") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Good to know. I left some notes in the observation lounge")) playVoice("Enrique13") lastLocationPlanetologist = "the observation lounge" end @@ -5855,11 +3511,11 @@ function handleDockedState() lastLocationPlanetologist = "the observation lounge" playVoice("Rory04") end - setCommsMessage("[Lab technician] You just missed him. I think he said he was going to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Lab technician] You just missed him. I think he said he was going to %s"),lastLocationPlanetologist)) end addCommsReply(_("Back"), commsStation) end) - addCommsReply("Try observation lounge", function() + addCommsReply(_("planetologist-comms","Try observation lounge"), function() if planetologistDiagnostic then print("looking in observation lounge") end if lastLocationPlanetologist == "the observation lounge" then planetologistChase = planetologistChase + 1 @@ -5869,43 +3525,43 @@ function handleDockedState() if planetologistDiagnostic then print("check previous location") end if random(1,5) + planetologistChase > 4 then if planetologistDiagnostic then print("found planetologist") end - setCommsMessage(string.format("[Enrique Flogistan] Just take in the gorgeous view of %s from here",planetPrimus:getCallSign())) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] Just take in the gorgeous view of %s from here"),planetPrimus:getCallSign())) playVoice("Enrique14") - addCommsReply(string.format("Ready for a closer view of %s?",planetPrimus:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","Ready for a closer view of %s?"),planetPrimus:getCallSign()), function() if planetologistDiagnostic then print("closer view") end if random(1,100) < 50 then lastLocationPlanetologist = "his quarters" else lastLocationPlanetologist = "the lab" end - setCommsMessage("[Enrique Flogistan] Just about. I forgot to pack something.\n\nHe leaves the observation lounge to go to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Enrique Flogistan] Just about. I forgot to pack something.\n\nHe leaves the observation lounge to go to %s"),lastLocationPlanetologist)) playVoice("Enrique15") addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("We're ready to take you to %s",primusStation:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","We're ready to take you to %s"),primusStation:getCallSign()), function() if planetologistDiagnostic then print("ready to take you") end if random(1,100) < 50 then - setCommsMessage("[Enrique Flogistan] Well I'm not. I just need a few more items from my quarters") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Well I'm not. I just need a few more items from my quarters")) playVoice("Enrique16") lastLocationPlanetologist = "his quarters" else - setCommsMessage("[Enrique Flogistan] Well I'm not. I just need a few more items from the lab") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Well I'm not. I just need a few more items from the lab")) playVoice("Enrique17") lastLocationPlanetologist = "the lab" end addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format("%s has been ordered to get you to %s",comms_source:getCallSign(), primusStation:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","%s has been ordered to get you to %s"),comms_source:getCallSign(), primusStation:getCallSign()), function() if planetologistDiagnostic then print("ordered to get you") end - setCommsMessage("I heard about your encounter with the Exuari. You know they could come back, right?") + setCommsMessage(_("planetologist-comms","I heard about your encounter with the Exuari. You know they could come back, right?")) playVoice("Enrique18") - addCommsReply("Certainly. We'll be ready, don't worry", function() + addCommsReply(_("planetologist-comms","Certainly. We'll be ready, don't worry"), function() if random(1,100) < 50 then - setCommsMessage("[Enrique Flogistan] I admire your confidence. I'll get my things from my quarters") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] I admire your confidence. I'll get my things from my quarters")) playVoice("Enrique19") lastLocationPlanetologist = "his quarters" else - setCommsMessage("[Enrique Flogistan] I admire your confidence. I'll get my research material from the lab") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] I admire your confidence. I'll get my research material from the lab")) playVoice("Enrique20") lastLocationPlanetologist = "the lab" end @@ -5922,20 +3578,20 @@ function handleDockedState() lastLocationPlanetologist = "the lab" playVoice("Parker02") end - setCommsMessage("[Station repair crewman] He just left for " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","[Station repair crewman] He just left for %s"),lastLocationPlanetologist)) end addCommsReply(_("Back"), commsStation) end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact planetologist directly", function() - setCommsMessage("Repair work prevents contact with individual") - addCommsReply("Contact Enrique Flogistan's quarters", function() + addCommsReply(_("planetologist-comms","Contact planetologist directly"), function() + setCommsMessage(_("planetologist-comms","Repair work prevents contact with individual")) + addCommsReply(_("planetologist-comms","Contact Enrique Flogistan's quarters"), function() if random(1,100) < 50 then - setCommsMessage("[Enrique Flogistan] Who is it?") + setCommsMessage(_("planetologist-comms","[Enrique Flogistan] Who is it?")) playVoice("Enrique21") planetologistChase = planetologistChase + 1 - addCommsReply(string.format("This is %s. We are your transportation to %s",comms_source:getCallSign(),primusStation:getCallSign()), function() + addCommsReply(string.format(_("planetologist-comms","This is %s. We are your transportation to %s"),comms_source:getCallSign(),primusStation:getCallSign()), function() if random(1,100) < 50 then lastLocationPlanetologist = "the lab" playVoice("Enrique22") @@ -5943,7 +3599,7 @@ function handleDockedState() lastLocationPlanetologist = "the observation lounge" playVoice("Enrique23") end - setCommsMessage("I'm going to " .. lastLocationPlanetologist .. " before we leave") + setCommsMessage(string.format(_("planetologist-comms","I'm going to %s before we leave"),lastLocationPlanetologist)) addCommsReply(_("Back"), commsStation) end) else @@ -5952,11 +3608,11 @@ function handleDockedState() else planetologistChase = 0 end - setCommsMessage("No reply from Enrique Flogistan's quarters") + setCommsMessage(_("planetologist-comms","No reply from Enrique Flogistan's quarters")) end addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact planetology lab", function() + addCommsReply(_("planetologist-comms","Contact planetology lab"), function() if lastLocationPlanetologist == "the lab" then planetologistChase = planetologistChase + 1 else @@ -5967,10 +3623,10 @@ function handleDockedState() else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage("A lab technician answers and tells you Enrique Flogistan is probably going to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","A lab technician answers and tells you Enrique Flogistan is probably going to %s"),lastLocationPlanetologist)) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact observation lounge", function() + addCommsReply(_("planetologist-comms","Contact observation lounge"), function() if lastLocationPlanetologist == "the observation lounge" then planetologistChase = planetologistChase + 1 else @@ -5981,55 +3637,55 @@ function handleDockedState() else lastLocationPlanetologist = "the lab" end - setCommsMessage("A repair crewman answers and tells you Enrique Flogistan is probably going to " .. lastLocationPlanetologist) + setCommsMessage(string.format(_("planetologist-comms","A repair crewman answers and tells you Enrique Flogistan is probably going to %s"),lastLocationPlanetologist)) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact station galley", function() + addCommsReply(_("planetologist-comms","Contact station galley"), function() planetologistChase = 0 - setCommsMessage("[Cook] Hello, who's there?") + setCommsMessage(_("planetologist-comms","[Cook] Hello, who's there?")) playVoice("Karsyn01") - addCommsReply(string.format("I'm from %s. I'm looking for Enrique Flogistan",comms_source:getCallSign()), function() - setCommsMessage("He was here about an hour ago. You might try his quarters, the observation lounge or the lab") + addCommsReply(string.format(_("planetologist-comms","I'm from %s. I'm looking for Enrique Flogistan"),comms_source:getCallSign()), function() + setCommsMessage(_("planetologist-comms","He was here about an hour ago. You might try his quarters, the observation lounge or the lab")) playVoice("Karsyn02") addCommsReply(_("Back"), commsStation) end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact station security office", function() + addCommsReply(_("planetologist-comms","Contact station security office"), function() planetologistChase = 0 - setCommsMessage("[Security officer] May I help you?") + setCommsMessage(_("planetologist-comms","[Security officer] May I help you?")) playVoice("Taylor01") - addCommsReply("I'm looking for Enrique Flogistan", function() + addCommsReply(_("planetologist-comms","I'm looking for Enrique Flogistan"), function() playVoice("Taylor02") - setCommsMessage("He's not here in the security office. Our records show he often frequents his quarters, the observation lounge and the planetology lab") + setCommsMessage(_("planetologist-comms","He's not here in the security office. Our records show he often frequents his quarters, the observation lounge and the planetology lab")) addCommsReply(_("Back"), commsStation) end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact station maintenance office", function() + addCommsReply(_("planetologist-comms","Contact station maintenance office"), function() planetologistChase = 0 - setCommsMessage("[Maintenance technician] Hi, what's broken?") + setCommsMessage(_("planetologist-comms","[Maintenance technician] Hi, what's broken?")) playVoice("Quinn01") - addCommsReply("Nothing. I'm looking for Enrique Flogistan", function() + addCommsReply(_("planetologist-comms","Nothing. I'm looking for Enrique Flogistan"), function() playVoice("Quinn02") - setCommsMessage("He's not here. Good luck finding him") + setCommsMessage(_("planetologist-comms","He's not here. Good luck finding him")) addCommsReply(_("Back"), commsStation) end) addCommsReply(_("Back"), commsStation) end) - addCommsReply("Contact station operations office", function() + addCommsReply(_("planetologist-comms","Contact station operations office"), function() planetologistChase = 0 - setCommsMessage("[Operations manager] Yes?") + setCommsMessage(_("planetologist-comms","[Operations manager] Yes?")) playVoice("Avery01") - addCommsReply("Can you help me find Enrique Flogistan?", function() + addCommsReply(_("planetologist-comms","Can you help me find Enrique Flogistan?"), function() playVoice("Avery02") - setCommsMessage("He's not here in operations. We are short handed right now with all the repairs going on. I'm afraid you'll have to find him yourself") + setCommsMessage(_("planetologist-comms","He's not here in operations. We are short handed right now with all the repairs going on. I'm afraid you'll have to find him yourself")) addCommsReply(_("Back"), commsStation) end) addCommsReply(_("Back"), commsStation) end) end) - addCommsReply("Scan for planetologist", function() + addCommsReply(_("planetologist-comms","Scan for planetologist"), function() local scanResultChoice = math.random(1,3) if scanResultChoice == 1 then lastLocationPlanetologist = "his quarters" @@ -6038,14 +3694,18 @@ function handleDockedState() else lastLocationPlanetologist = "the observation lounge" end - setCommsMessage(string.format("Sensors show him in %s",lastLocationPlanetologist)) - addCommsReply(string.format("Beam him over from %s",lastLocationPlanetologist), function() + setCommsMessage(string.format(_("planetologist-comms","Sensors show him in %s"),lastLocationPlanetologist)) + addCommsReply(string.format(_("planetologist-comms","Beam him over from %s"),lastLocationPlanetologist), function() if random(1,100) < 5 then - setCommsMessage("He has been beamed aboard") + if researcherBoardedShip then + setCommsMessage(_("planetologist-comms","He's already boarded a ship")) + else + setCommsMessage(_("planetologist-comms","He has been beamed aboard")) + end researcherBoardedShip = true comms_source.planetologistAboard = true else - setCommsMessage("Interference from station repairs prevents a transporter lock") + setCommsMessage(_("planetologist-comms","Interference from station repairs prevents a transporter lock")) planetologistChase = 0 end addCommsReply(_("Back"), commsStation) @@ -6055,25 +3715,25 @@ function handleDockedState() end) end if comms_target == secondusStations[1] and plot1 == checkFixSatelliteEvents and not comms_target.satelliteFixed then - addCommsReply("Satellite problems?", function() - setCommsMessage(string.format("Yes. Our technicians have tracked back the problem to a faulty relay module. However, They are unable to fix it with available parts. They need %s. They've requested delivery, but hear it will take weeks before the next delivery cycle. I don't suppose you could bring us what we need?",comms_target.satelliteFixGood)) + addCommsReply(_("station-comms","Satellite problems?"), function() + setCommsMessage(string.format(_("station-comms","Yes. Our technicians have tracked back the problem to a faulty relay module. However, They are unable to fix it with available parts. They need %s. They've requested delivery, but hear it will take weeks before the next delivery cycle. I don't suppose you could bring us what we need?"),comms_target.satelliteFixGood)) playVoice("Ellis01") local playerCallSign = comms_source:getCallSign() local ctd = comms_target.comms_data if fixSatelliteDiagnostic then print("satellite fix good 1: " .. comms_target.satelliteFixGood) end if fixSatelliteDiagnostic then - if comms_source.goods[ctd.satelliteFixGood] == nil then + if comms_source.goods ~= nil and comms_source.goods[ctd.satelliteFixGood] == nil then print("related player good: nil") else print("related player good: " .. comms_source.goods[ctd.satelliteFixGood]) end end - if comms_source.goods[comms_target.satelliteFixGood] ~= nil and comms_source.goods[comms_target.satelliteFixGood] > 0 then - addCommsReply(string.format("Provide %s",comms_target.satelliteFixGood), function() + if comms_source.goods ~= nil and comms_source.goods[comms_target.satelliteFixGood] ~= nil and comms_source.goods[comms_target.satelliteFixGood] > 0 then + addCommsReply(string.format(_("station-comms","Provide %s"),comms_target.satelliteFixGood), function() comms_source.goods[comms_target.satelliteFixGood] = comms_source.goods[comms_target.satelliteFixGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_target.satelliteFixed = true - setCommsMessage("Thanks. With your help, we fixed the faulty relay module") + setCommsMessage(_("station-comms","Thanks. With your help, we fixed the faulty relay module")) playVoice("Ellis02") comms_source:addReputationPoints(75 - (30*difficulty)) addCommsReply(_("Back"), commsStation) @@ -6083,9 +3743,9 @@ function handleDockedState() end) end if comms_target == secondusStations[2] and plot1 == checkFixSatelliteEvents and not comms_target.satelliteFixed then - addCommsReply("Having satellite trouble?", function() + addCommsReply(_("station-comms","Having satellite trouble?"), function() playVoice("Peyton01") - setCommsMessage(string.format("It seems we've got an outdated servo motor. Replacement will take time. Our repairman says he can fix it with %s, so we don't have to wait. Do you have any?",comms_target.satelliteFixGood)) + setCommsMessage(string.format(_("station-comms","It seems we've got an outdated servo motor. Replacement will take time. Our repairman says he can fix it with %s, so we don't have to wait. Do you have any?"),comms_target.satelliteFixGood)) local playerCallSign = comms_source:getCallSign() local ctd = comms_target.comms_data if fixSatelliteDiagnostic then print("satellite fix good 2: " .. comms_target.satelliteFixGood) end @@ -6096,13 +3756,13 @@ function handleDockedState() print("related player good: " .. comms_source.goods[comms_target.satelliteFixGood]) end end - if comms_source.goods[comms_target.satelliteFixGood] ~= nil and comms_source.goods[comms_target.satelliteFixGood] > 0 then - addCommsReply(string.format("Give %s to %s",comms_target.satelliteFixGood, comms_target:getCallSign()), function() + if comms_source.goods ~= nil and comms_source.goods[comms_target.satelliteFixGood] ~= nil and comms_source.goods[comms_target.satelliteFixGood] > 0 then + addCommsReply(string.format(_("station-comms","Give %s to %s"),comms_target.satelliteFixGood, comms_target:getCallSign()), function() comms_source.goods[comms_target.satelliteFixGood] = comms_source.goods[comms_target.satelliteFixGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_target.satelliteFixed = true playVoice("Peyton02") - setCommsMessage("That worked. Thanks") + setCommsMessage(_("station-comms","That worked. Thanks")) comms_source:addReputationPoints(75 - (30*difficulty)) addCommsReply(_("Back"), commsStation) end) @@ -6111,9 +3771,9 @@ function handleDockedState() end) end if comms_target == secondusStations[3] and plot1 == checkFixSatelliteEvents and not comms_target.satelliteFixed then - addCommsReply("Can we help with your satellite?", function() + addCommsReply(_("station-comms","Can we help with your satellite?"), function() playVoice("Reese01") - setCommsMessage(string.format("Only if you've got %s aboard your ship. Otherwise, we're stuck",comms_target.satelliteFixGood)) + setCommsMessage(string.format(_("station-comms","Only if you've got %s aboard your ship. Otherwise, we're stuck"),comms_target.satelliteFixGood)) local playerCallSign = comms_source:getCallSign() local ctd = comms_target.comms_data if fixSatelliteDiagnostic then print("satellite fix good 3: " .. comms_target.satelliteFixGood) end @@ -6125,12 +3785,12 @@ function handleDockedState() end end if comms_source.goods[comms_target.satelliteFixGood] ~= nil and comms_source.goods[comms_target.satelliteFixGood] > 0 then - addCommsReply(string.format("Provide %s",comms_target.satelliteFixGood), function() + addCommsReply(string.format(_("station-comms","Provide %s"),comms_target.satelliteFixGood), function() comms_source.goods[comms_target.satelliteFixGood] = comms_source.goods[comms_target.satelliteFixGood] - 1 comms_source.cargo = comms_source.cargo + 1 comms_target.satelliteFixed = true playVoice("Reese02") - setCommsMessage("You have saved us a tremendous headache. We thought we'd have to wait two months before we could fix the problem. Thanks") + setCommsMessage(_("station-comms","You have saved us a tremendous headache. We thought we'd have to wait two months before we could fix the problem. Thanks")) comms_source:addReputationPoints(75 - (30*difficulty)) addCommsReply(_("Back"), commsStation) end) @@ -6140,14 +3800,14 @@ function handleDockedState() end if stationCommsDiagnostic then print(ctd.public_relations) end if ctd.public_relations then - addCommsReply(_("station-comms", "Tell me more about your station"), function() - setCommsMessage(_("station-comms", "What would you like to know?")) - addCommsReply(_("stationGeneralInfo-comms", "General information"), function() + addCommsReply(_("stationGeneralInfo-comms","Tell me more about your station"), function() + setCommsMessage(_("stationGeneralInfo-comms","What would you like to know?")) + addCommsReply(_("stationGeneralInfo-comms","General information"), function() setCommsMessage(ctd.general_information) addCommsReply(_("Back"), commsStation) end) if ctd.history ~= nil then - addCommsReply(_("stationStory-comms", "Station history"), function() + addCommsReply(_("stationGeneralInfo-comms","Station history"), function() setCommsMessage(ctd.history) addCommsReply(_("Back"), commsStation) end) @@ -6155,7 +3815,7 @@ function handleDockedState() if comms_source:isFriendly(comms_target) then if ctd.gossip ~= nil then if random(1,100) < (100 - (30 * (difficulty - .5))) then - addCommsReply(_("gossip-comms", "Gossip"), function() + addCommsReply(_("gossip-comms","Gossip"), function() setCommsMessage(ctd.gossip) addCommsReply(_("Back"), commsStation) end) @@ -6166,58 +3826,38 @@ function handleDockedState() end --end public relations if branch if stationCommsDiagnostic then print(ctd.character) end if ctd.character ~= nil then - addCommsReply(string.format(_("characterInfo-comms", "Tell me about %s"),ctd.character), function() + addCommsReply(string.format(_("characterInfo-comms","Tell me about %s"),ctd.character), function() if ctd.characterDescription ~= nil then setCommsMessage(ctd.characterDescription) else if ctd.characterDeadEnd == nil then - local deadEndChoice = math.random(1,5) - if deadEndChoice == 1 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "Never heard of %s"), ctd.character) - elseif deadEndChoice == 2 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "%s died last week. The funeral was yesterday"), ctd.character) - elseif deadEndChoice == 3 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "%s? Who's %s? There's nobody here named %s"),ctd.character,ctd.character,ctd.character) - elseif deadEndChoice == 4 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "We don't talk about %s. They are gone and good riddance"),ctd.character) - else - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "I think %s moved away"),ctd.character) - end + local dead_end_responses = { + string.format(_("characterInfo-comms","Never heard of %s"),ctd.character), + string.format(_("characterInfo-comms","%s died last week. The funeral was yesterday"),ctd.character), + string.format(_("characterInfo-comms","%s? Who's %s? There's nobody here named %s"),ctd.character,ctd.character,ctd.character), + string.format(_("characterInfo-comms","We don't talk about %s. They are gone and good riddance"),ctd.character), + string.format(_("characterInfo-comms","I think %s moved away"),ctd.character), + string.format(_("characterInfo-comms","My aunt's neighbor's second cousin is named %s. However, %s lives far away from here."),ctd.character,ctd.character), + } + ctd.characterDeadEnd = dead_end_responses[math.random(1,#dead_end_responses)] end setCommsMessage(ctd.characterDeadEnd) end - if ctd.characterFunction == "shrinkBeamCycle" then - shrinkBeamCycle() - end - if ctd.characterFunction == "increaseSpin" then - increaseSpin() - end - if ctd.characterFunction == "addAuxTube" then - addAuxTube() - end - if ctd.characterFunction == "coolBeam" then - coolBeam() - end - if ctd.characterFunction == "longerBeam" then - longerBeam() - end - if ctd.characterFunction == "damageBeam" then - damageBeam() - end - if ctd.characterFunction == "moreMissiles" then - moreMissiles() - end - if ctd.characterFunction == "fasterImpulse" then - fasterImpulse() - end - if ctd.characterFunction == "strongerHull" then - strongerHull() - end - if ctd.characterFunction == "efficientBatteries" then - efficientBatteries() - end - if ctd.characterFunction == "strongerShields" then - strongerShields() + local upgrade_function = { + ["shrinkBeamCycle"] = shrinkBeamCycle, + ["increaseSpin"] = increaseSpin, + ["addAuxTube"] = addAuxTube, + ["coolBeam"] = coolBeam, + ["longerBeam"] = longerBeam, + ["damageBeam"] = damageBeam, + ["moreMissiles"] = moreMissiles, + ["fasterImpulse"] = fasterImpulse, + ["strongerHull"] = strongerHull, + ["efficientBatteries"] = efficientBatteries, + ["strongerShields"] = strongerShields, + } + if upgrade_function[ctd.characterFunction] ~= nil then + upgrade_function[ctd.characterFunction]() end addCommsReply(_("Back"), commsStation) end) @@ -6226,40 +3866,40 @@ function handleDockedState() speed_adjust_count = 0 end if random(1,100) < (80 - (speed_adjust_count * 10)) then - addCommsReply("Request access to isolated transporter pad", function() - setCommsMessage("That will damage your reputation. Do you wish to proceed?") - addCommsReply("Proceed regardless of the reputation cost",function() + addCommsReply(_("station-comms","Request access to isolated transporter pad"), function() + setCommsMessage(_("station-comms","That will damage your reputation. Do you wish to proceed?")) + addCommsReply(_("station-comms","Proceed regardless of the reputation cost"),function() local p = getPlayerShip(-1) p:takeReputationPoints(math.floor(p:getReputationPoints()/2)) - setCommsMessage("You are transported to an unknown location. A small man in front of a vast array of virtual monitors showing constantly changing pictures of different planetary systems asks you what you want") - addCommsReply(string.format("Slow orbital speed of %s",planetPrimus:getCallSign()),function() + setCommsMessage(_("station-comms","You are transported to an unknown location. A small man in front of a vast array of virtual monitors showing constantly changing pictures of different planetary systems asks you what you want")) + addCommsReply(string.format(_("station-comms","Slow orbital speed of %s"),planetPrimus:getCallSign()),function() planetPrimus.orbit_speed = planetPrimus.orbit_speed * 1.1 planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed) speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He twists a small dial and says, 'Done.'") + setCommsMessage(_("station-comms","He twists a small dial and says, 'Done.'")) playVoice("Ozzie01") end) - addCommsReply(string.format("Slow orbital speed of the moon orbiting %s",planetPrimus:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of the moon orbiting %s"),planetPrimus:getCallSign()),function() planetPrimusMoonOrbitTime = planetPrimusMoonOrbitTime * 1.1 planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime) speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He moves a slider and says, 'Ok.'") + setCommsMessage(_("station-comms","He moves a slider and says, 'Ok.'")) playVoice("Ozzie02") end) - addCommsReply(string.format("Slow orbital speed of %s",planetSecondus:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of %s"),planetSecondus:getCallSign()),function() planetSecondus.orbit_speed = planetSecondus.orbit_speed * 1.1 planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed) speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He types in a couple of numbers and says, 'Happy?'") + setCommsMessage(_("station-comms","He types in a couple of numbers and says, 'Happy?'")) playVoice("Ozzie03") end) - addCommsReply(string.format("Slow orbital speed of stations orbiting %s",planetSecondus:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of stations orbiting %s"),planetSecondus:getCallSign()),function() secondusStationOrbitIncrement = secondusStationOrbitIncrement * .9 speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He flips a couple of switches and says, 'I love programmable stations'") + setCommsMessage(_("station-comms","He flips a couple of switches and says, 'I love programmable stations'")) playVoice("Ozzie04") end) - addCommsReply(string.format("Slow orbital speed of the inner belt around %s",planetSol:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of the inner belt around %s"),planetSol:getCallSign()),function() belt1OrbitalSpeed = belt1OrbitalSpeed * .9 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -6268,10 +3908,10 @@ function handleDockedState() end end speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He rubs one of the monitors a bit and says 'that should do it.'") + setCommsMessage(_("station-comms","He rubs one of the monitors a bit and says 'that should do it.'")) playVoice("Ozzie05") end) - addCommsReply(string.format("Slow orbital speed of the outer belt around %s",planetSol:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of the outer belt around %s"),planetSol:getCallSign()),function() belt2OrbitalSpeed = belt2OrbitalSpeed * .9 for i=1,#beltAsteroidList do local ta = beltAsteroidList[i] @@ -6280,17 +3920,17 @@ function handleDockedState() end end speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He says, 'if you insist' and opens a small panel in the wall and enters a code on a keypad.") + setCommsMessage(_("station-comms","He says, 'if you insist' and opens a small panel in the wall and enters a code on a keypad.")) playVoice("Ozzie06") end) - addCommsReply(string.format("Slow orbital speed of %s",planetTertius:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of %s"),planetTertius:getCallSign()),function() planetTertius.orbit_speed = planetTertius.orbit_speed * 1.1 planetTertius:setOrbit(planetSol,planetTertius.orbit_speed) speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He sighs, stands up, grabs a large lever and pulls it about two inches towards him then says, 'there.'") + setCommsMessage(_("station-comms","He sighs, stands up, grabs a large lever and pulls it about two inches towards him then says, 'there.'")) playVoice("Ozzie07") end) - addCommsReply(string.format("Slow orbital speed of the inner belt around %s",planetTertius:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of the inner belt around %s"),planetTertius:getCallSign()),function() tertiusOrbitalBodyIncrement = tertiusOrbitalBodyIncrement * .9 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -6299,10 +3939,10 @@ function handleDockedState() end end speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He pulls a keyboard out from under his desk, types a couple of things and says, 'Alright.'") + setCommsMessage(_("station-comms","He pulls a keyboard out from under his desk, types a couple of things and says, 'Alright.'")) playVoice("Ozzie08") end) - addCommsReply(string.format("Slow orbital speed of the outer belt around %s",planetTertius:getCallSign()),function() + addCommsReply(string.format(_("station-comms","Slow orbital speed of the outer belt around %s"),planetTertius:getCallSign()),function() tertiusAsteroidBeltIncrement = tertiusAsteroidBeltIncrement * .9 for i=1,#tertiusAsteroids do local ta = tertiusAsteroids[i] @@ -6317,7 +3957,7 @@ function handleDockedState() end end speed_adjust_count = speed_adjust_count + 1 - setCommsMessage("He dons a couple of purple haptic gloves, makes a couple of arcane gestures and says, 'You asked for it.'") + setCommsMessage(_("station-comms","He dons a couple of purple haptic gloves, makes a couple of arcane gestures and says, 'You asked for it.'")) playVoice("Ozzie09") end) end) @@ -6325,25 +3965,25 @@ function handleDockedState() end if comms_source:isFriendly(comms_target) then if plot1 == checkTransportPrimusResearcherEvents and not researcherBoardedShip then - addCommsReply(string.format("Where is %s? (cost 10 reputation)",belt1Stations[2]:getCallSign()), function() + addCommsReply(string.format(_("station-comms","Where is %s? (cost 10 reputation)"),belt1Stations[2]:getCallSign()), function() if comms_source:takeReputationPoints(10) then if difficulty <= 1 then - setCommsMessage(string.format("%s is near %s",belt1Stations[2]:getCallSign(),belt1Stations[1]:getCallSign())) + setCommsMessage(string.format(_("station-comms","%s is near %s"),belt1Stations[2]:getCallSign(),belt1Stations[1]:getCallSign())) else - setCommsMessage(string.format("%s is along the inner solar asteroid belt",belt1Stations[2])) + setCommsMessage(string.format(_("station-comms","%s is along the inner solar asteroid belt"),belt1Stations[2])) end else - setCommsMessage(_("needRep-comms", "Not enough reputation")) + setCommsMessage(_("needRep-comms","Not enough reputation")) end addCommsReply(_("Back"), commsStation) end) end - addCommsReply(_("orders-comms", "What are my current orders?"), function() + addCommsReply(_("orders-comms","What are my current orders?"), function() setOptionalOrders() setSecondaryOrders() ordMsg = primaryOrders .. "\n" .. secondaryOrders .. optionalOrders if playWithTimeLimit then - ordMsg = ordMsg .. string.format(_("orders-comms", "\n %i Minutes remain in game"),math.floor(gameTimeLimit/60)) + ordMsg = ordMsg .. string.format(_("orders-comms","\n %i Minutes remain in game"),math.floor(gameTimeLimit/60)) end setCommsMessage(ordMsg) addCommsReply(_("Back"), commsStation) @@ -6354,12 +3994,12 @@ function handleDockedState() else hireCost = math.random(45,90) end - addCommsReply(string.format(_("trade-comms", "Recruit repair crew member for %i reputation"),hireCost), function() + addCommsReply(string.format(_("shipAssist-comms","Recruit repair crew member for %i reputation"),hireCost), function() if not comms_source:takeReputationPoints(hireCost) then - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) else comms_source:setRepairCrewCount(comms_source:getRepairCrewCount() + 1) - setCommsMessage(_("trade-comms", "Repair crew member hired")) + setCommsMessage(_("shipAssist-comms","Repair crew member hired")) end addCommsReply(_("Back"), commsStation) end) @@ -6370,12 +4010,12 @@ function handleDockedState() if comms_source:getMaxCoolant() < comms_source.initialCoolant then coolantCost = math.random(30,60) end - addCommsReply(string.format(_("trade-comms", "Purchase coolant for %i reputation"),coolantCost), function() + addCommsReply(string.format(_("shipAssist-comms","Purchase coolant for %i reputation"),coolantCost), function() if not comms_source:takeReputationPoints(coolantCost) then - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) else comms_source:setMaxCoolant(comms_source:getMaxCoolant() + 2) - setCommsMessage(_("trade-comms", "Additional coolant purchased")) + setCommsMessage(_("shipAssist-comms","Additional coolant purchased")) end addCommsReply(_("Back"), commsStation) end) @@ -6389,12 +4029,12 @@ function handleDockedState() else hireCost = math.random(60,120) end - addCommsReply(string.format(_("trade-comms", "Recruit repair crew member for %i reputation"),hireCost), function() + addCommsReply(string.format(_("shipAssist-comms","Recruit repair crew member for %i reputation"),hireCost), function() if not comms_source:takeReputationPoints(hireCost) then - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) else comms_source:setRepairCrewCount(comms_source:getRepairCrewCount() + 1) - setCommsMessage(_("trade-comms", "Repair crew member hired")) + setCommsMessage(_("shipAssist-comms","Repair crew member hired")) end addCommsReply(_("Back"), commsStation) end) @@ -6405,76 +4045,75 @@ function handleDockedState() if comms_source:getMaxCoolant() < comms_source.initialCoolant then coolantCost = math.random(45,90) end - addCommsReply(string.format(_("trade-comms", "Purchase coolant for %i reputation"),coolantCost), function() + addCommsReply(string.format(_("shipAssist-comms","Purchase coolant for %i reputation"),coolantCost), function() if not comms_source:takeReputationPoints(coolantCost) then - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) else comms_source:setMaxCoolant(comms_source:getMaxCoolant() + 1) - setCommsMessage(_("trade-comms", "Additional coolant purchased")) + setCommsMessage(_("shipAssist-comms","Additional coolant purchased")) end addCommsReply(_("Back"), commsStation) end) end end end --end friendly/neutral - addCommsReply(_("cartographyOffice-comms", "Visit cartography office"), function() + addCommsReply(_("areaDescription-comms","Visit cartography office"), function() if comms_target.cartographer_description == nil then - local clerk_choice = math.random(1,3) - if clerk_choice == 1 then - comms_target.cartographer_description = _("cartographyOffice-comms", "The clerk behind the desk looks up briefly at you then goes back to filing her nails.") - elseif clerk_choice == 2 then - comms_target.cartographer_description = _("cartographyOffice-comms", "The clerk behind the desk examines you then returns to grooming her tentacles.") - else - comms_target.cartographer_description = _("cartographyOffice-comms", "The clerk behind the desk glances at you then returns to preening her feathers.") - end - end - setCommsMessage(string.format(_("cartographyOffice-comms", "%s\n\nYou can examine the brochure on the coffee table, talk to the apprentice cartographer or talk to the master cartographer"),comms_target.cartographer_description)) - addCommsReply(_("cartographyOffice-comms", "What's the difference between the apprentice and the master?"), function() - setCommsMessage(_("cartographyOffice-comms", "The clerk responds in a bored voice, 'The apprentice knows the local area and is learning the broader area. The master knows the local and the broader area but can't be bothered with the local area'")) - addCommsReply(_("Back"),commsStation) + local clerk = { + _("areaDescription-comms","The clerk behind the desk looks up briefly at you then goes back to filing her nails."), + _("areaDescription-comms","The clerk behind the desk examines you then returns to grooming her tentacles."), + _("areaDescription-comms","The clerk behind the desk glances at you then returns to preening her feathers."), + _("areaDescription-comms","The clerk behind the desk pauses, points a cluster of antennae at you, then continues manipulating an elaborate keyboard."), + } + comms_target.cartographer_description = clerk[math.random(1,#clerk)] + end + setCommsMessage(string.format(_("areaDescription-comms","%s\n\nYou can examine the brochure on the coffee table, talk to the apprentice cartographer or talk to the master cartographer"),comms_target.cartographer_description)) + addCommsReply(_("areaDescription-comms","What's the difference between the apprentice and the master?"), function() + setCommsMessage(_("areaDescription-comms","The clerk responds in a bored voice, 'The apprentice knows the local area and is learning the broader area. The master knows the local and the broader area but can't be bothered with the local area'")) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("cartographyOffice-comms", "Examine brochure (%i rep)"),getCartographerCost()),function() + addCommsReply(string.format(_("areaDescription-comms","Examine brochure (%i reputation)"),getCartographerCost()),function() if comms_source:takeReputationPoints(1) then - setCommsMessage(_("cartographyOffice-comms", "The brochure has a list of nearby stations and has a list of goods nearby")) - addCommsReply(string.format(_("cartographyOffice-comms", "Examine station list (%i rep)"),getCartographerCost()), function() + setCommsMessage(_("areaDescription-comms","The brochure has a list of nearby stations and has a list of goods nearby")) + addCommsReply(string.format(_("areaDescription-comms","Examine station list (%i reputation)"),getCartographerCost()), function() if comms_source:takeReputationPoints(1) then local brochure_stations = "" local sx, sy = comms_target:getPosition() local nearby_objects = getObjectsInRadius(sx,sy,30000) - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then if brochure_stations == "" then - brochure_stations = string.format(_("cartographyOffice-comms", "%s %s %s"),obj:getSectorName(),obj:getFaction(),obj:getCallSign()) + brochure_stations = string.format("%s %s %s",obj:getSectorName(),obj:getFaction(),obj:getCallSign()) else - brochure_stations = string.format(_("cartographyOffice-comms", "%s\n%s %s %s"),brochure_stations,obj:getSectorName(),obj:getFaction(),obj:getCallSign()) + brochure_stations = string.format("%s\n%s %s %s",brochure_stations,obj:getSectorName(),obj:getFaction(),obj:getCallSign()) end if obj.comms_data.orbit ~= nil then - brochure_stations = string.format(_("cartographyOffice-comms", "%s %s"),brochure_stations,obj.comms_data.orbit) + brochure_stations = string.format("%s %s",brochure_stations,obj.comms_data.orbit) end end end end setCommsMessage(brochure_stations) else - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("cartographyOffice-comms", "Examine goods list (%i rep)"),getCartographerCost()), function() + addCommsReply(string.format(_("areaDescription-comms","Examine goods list (%i reputation)"),getCartographerCost()), function() if comms_source:takeReputationPoints(1) then local brochure_goods = "" local sx, sy = comms_target:getPosition() local nearby_objects = getObjectsInRadius(sx,sy,30000) - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then if obj.comms_data.goods ~= nil then for good, good_data in pairs(obj.comms_data.goods) do if brochure_goods == "" then - brochure_goods = string.format(_("cartographyOffice-comms", "Good, quantity, cost, station:\n%s, %i, %i, %s"),good,good_data["quantity"],good_data["cost"],obj:getCallSign()) + brochure_goods = string.format(_("areaDescription-comms","Good, quantity, cost, station:\n%s, %i, %i, %s"),good,good_data["quantity"],good_data["cost"],obj:getCallSign()) else - brochure_goods = string.format(_("cartographyOffice-comms", "%s\n%s, %i, %i, %s"),brochure_goods,good,good_data["quantity"],good_data["cost"],obj:getCallSign()) + brochure_goods = string.format("%s\n%s, %i, %i, %s",brochure_goods,good,good_data["quantity"],good_data["cost"],obj:getCallSign()) end end end @@ -6483,65 +4122,65 @@ function handleDockedState() end setCommsMessage(brochure_goods) else - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) else - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("cartographyOffice-comms", "Talk to apprentice cartographer (%i rep)"),getCartographerCost("apprentice")), function() + addCommsReply(string.format(_("areaDescription-comms","Talk to apprentice cartographer (%i reputation)"),getCartographerCost("apprentice")), function() if comms_source:takeReputationPoints(1) then - setCommsMessage(_("cartographyOffice-comms", "Hi, would you like for me to locate a station or some goods for you?")) - addCommsReply(_("cartographyOffice-comms", "Locate station"), function() - setCommsMessage(_("cartographyOffice-comms", "These are stations I have learned")) + setCommsMessage(_("areaDescription-comms","Hi, would you like for me to locate a station or some goods for you?")) + addCommsReply(_("areaDescription-comms","Locate station"), function() + setCommsMessage(_("areaDescription-comms","These are stations I have learned about")) local sx, sy = comms_target:getPosition() local nearby_objects = getObjectsInRadius(sx,sy,50000) local stations_known = 0 - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then stations_known = stations_known + 1 addCommsReply(obj:getCallSign(),function() - local station_details = string.format(_("cartographyOffice-comms", "%s %s %s"),obj:getSectorName(),obj:getFaction(),obj:getCallSign()) + local station_details = string.format("%s %s %s",obj:getSectorName(),obj:getFaction(),obj:getCallSign()) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s %s"),station_details,obj.comms_data.orbit) + station_details = string.format("%s %s",station_details,obj.comms_data.orbit) end if obj.comms_data.goods ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nGood, quantity, cost"),station_details) + station_details = string.format(_("areaDescription-comms","%s\nGood, quantity, cost"),station_details) for good, good_data in pairs(obj.comms_data.goods) do - station_details = string.format(_("cartographyOffice-comms", "%s\n %s, %i, %i"),station_details,good,good_data["quantity"],good_data["cost"]) + station_details = string.format("%s\n %s, %i, %i",station_details,good,good_data["quantity"],good_data["cost"]) end end if obj.comms_data.general_information ~= nil then - station_details = string.format(_("stationGeneralInfo-comms", "%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) + station_details = string.format(_("areaDescription-comms","%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) end if obj.comms_data.history ~= nil then - station_details = string.format(_("stationStory-comms", "%s\nHistory:\n %s"),station_details,obj.comms_data.history) + station_details = string.format(_("areaDescription-comms","%s\nHistory:\n %s"),station_details,obj.comms_data.history) end if obj.comms_data.gossip ~= nil then - station_details = string.format(_("gossip-comms", "%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) + station_details = string.format(_("areaDescription-comms","%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) end setCommsMessage(station_details) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) end end end if stations_known == 0 then - setCommsMessage(_("cartographyOffice-comms", "I have learned of no stations yet")) + setCommsMessage(_("areaDescription-comms","I have learned of no stations yet")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(_("cartographyOffice-comms", "Locate goods"), function() - setCommsMessage(_("cartographyOffice-comms", "These are the goods I know about")) + addCommsReply(_("areaDescription-comms","Locate goods"), function() + setCommsMessage(_("areaDescription-comms","These are the goods I know about")) local sx, sy = comms_target:getPosition() local nearby_objects = getObjectsInRadius(sx,sy,50000) local button_count = 0 local by_goods = {} - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then if obj.comms_data.goods ~= nil then @@ -6554,91 +4193,91 @@ function handleDockedState() end for good, obj in pairs(by_goods) do addCommsReply(good, function() - local station_details = string.format(_("cartographyOffice-comms", "%s %s %s"),obj:getSectorName(),obj:getFaction(),obj:getCallSign()) + local station_details = string.format("%s %s %s",obj:getSectorName(),obj:getFaction(),obj:getCallSign()) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s %s"),station_details,obj.comms_data.orbit) + station_details = string.format("%s %s",station_details,obj.comms_data.orbit) end if obj.comms_data.goods ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nGood, quantity, cost"),station_details) + station_details = string.format(_("areaDescription-comms","%s\nGood, quantity, cost"),station_details) for good, good_data in pairs(obj.comms_data.goods) do - station_details = string.format(_("cartographyOffice-comms", "%s\n %s, %i, %i"),station_details,good,good_data["quantity"],good_data["cost"]) + station_details = string.format("%s\n %s, %i, %i",station_details,good,good_data["quantity"],good_data["cost"]) end end if obj.comms_data.general_information ~= nil then - station_details = string.format(_("stationGeneralInfo-comms", "%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) + station_details = string.format(_("areaDescription-comms","%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) end if obj.comms_data.history ~= nil then - station_details = string.format(_("stationStory-comms", "%s\nHistory:\n %s"),station_details,obj.comms_data.history) + station_details = string.format(_("areaDescription-comms","%s\nHistory:\n %s"),station_details,obj.comms_data.history) end if obj.comms_data.gossip ~= nil then - station_details = string.format(_("gossip-comms", "%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) + station_details = string.format(_("areaDescription-comms","%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) end setCommsMessage(station_details) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) button_count = button_count + 1 if button_count >= 20 then break end end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) else - setCommsMessage(_("needRep-comms", "Insufficient reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("cartographyOffice-comms", "Talk to master cartographer (%i rep)"),getCartographerCost("master")), function() + addCommsReply(string.format(_("areaDescription-comms","Talk to master cartographer (%i reputation)"),getCartographerCost("master")), function() if comms_source:getWaypointCount() >= 9 then - setCommsMessage(_("cartographyOffice-comms", "The clerk clears her throat:\n\nMy indicators show you have zero available waypoints. To get the most from the master cartographer, you should delete one or more so that he can update your systems appropriately.\n\nI just want you to get the maximum benefit for the time you spend with him")) - addCommsReply(_("cartographyOffice-comms", "Continue to Master Cartographer"), masterCartographer) + setCommsMessage(_("areaDescription-comms","The clerk clears her throat:\n\nMy indicators show you have zero available waypoints. To get the most from the master cartographer, you should delete one or more so that he can update your systems appropriately.\n\nI just want you to get the maximum benefit for the time you spend with him")) + addCommsReply(_("areaDescription-comms","Continue to Master Cartographer"), masterCartographer) else masterCartographer() end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) local goodCount = 0 for good, goodData in pairs(ctd.goods) do goodCount = goodCount + 1 end if goodCount > 0 then - addCommsReply(_("trade-comms", "Buy, sell, trade"), function() + addCommsReply(_("trade-comms","Buy, sell, trade"), function() local ctd = comms_target.comms_data - local goodsReport = string.format(_("trade-comms", "Station %s:\nGoods or components available for sale: quantity, cost in reputation\n"),comms_target:getCallSign()) + local goodsReport = string.format(_("trade-comms","Station %s:\nGoods or components available for sale: quantity, cost in reputation\n"),comms_target:getCallSign()) for good, goodData in pairs(ctd.goods) do - goodsReport = goodsReport .. string.format(_("trade-comms", " %s: %i, %i\n"),good,goodData["quantity"],goodData["cost"]) + goodsReport = goodsReport .. string.format(" %s: %i, %i\n",good,goodData["quantity"],goodData["cost"]) end if ctd.buy ~= nil then - goodsReport = goodsReport .. _("trade-comms", "Goods or components station will buy: price in reputation\n") + goodsReport = goodsReport .. _("trade-comms","Goods or components station will buy: price in reputation\n") for good, price in pairs(ctd.buy) do - goodsReport = goodsReport .. string.format(_("trade-comms", " %s: %i\n"),good,price) + goodsReport = goodsReport .. string.format(" %s: %i\n",good,price) end end - goodsReport = goodsReport .. string.format(_("trade-comms", "Current cargo aboard %s:\n"),comms_source:getCallSign()) + goodsReport = goodsReport .. string.format(_("trade-comms","Current cargo aboard %s:\n"),comms_source:getCallSign()) local cargoHoldEmpty = true local goodCount = 0 if comms_source.goods ~= nil then for good, goodQuantity in pairs(comms_source.goods) do goodCount = goodCount + 1 - goodsReport = goodsReport .. string.format(_("trade-comms", " %s: %i\n"),good,goodQuantity) + goodsReport = goodsReport .. string.format(" %s: %i\n",good,goodQuantity) end end if goodCount < 1 then - goodsReport = goodsReport .. _("trade-comms", " Empty\n") + goodsReport = goodsReport .. _("trade-comms"," Empty\n") end - goodsReport = goodsReport .. string.format(_("trade-comms", "Available Space: %i, Available Reputation: %i\n"),comms_source.cargo,math.floor(comms_source:getReputationPoints())) + goodsReport = goodsReport .. string.format(_("trade-comms","Available Space: %i, Available Reputation: %i\n"),comms_source.cargo,math.floor(comms_source:getReputationPoints())) setCommsMessage(goodsReport) for good, goodData in pairs(ctd.goods) do - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,goodData["cost"]), function() - local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i, Rep: %i"),good,goodData["quantity"],goodData["cost"]) + addCommsReply(string.format(_("trade-comms","Buy one %s for %i reputation"),good,goodData["cost"]), function() + local goodTransactionMessage = string.format(_("trade-comms","Type: %s, Quantity: %i, Reputation: %i"),good,goodData["quantity"],goodData["cost"]) if comms_source.cargo < 1 then - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient cargo space for purchase") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient cargo space for purchase") elseif goodData["cost"] > math.floor(comms_source:getReputationPoints()) then - goodTransactionMessage = goodTransactionMessage .. _("needRep-comms", "\nInsufficient reputation for purchase") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient reputation for purchase") elseif goodData["quantity"] < 1 then - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient station inventory") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient station inventory") else if comms_source:takeReputationPoints(goodData["cost"]) then comms_source.cargo = comms_source.cargo - 1 @@ -6650,9 +4289,9 @@ function handleDockedState() comms_source.goods[good] = 0 end comms_source.goods[good] = comms_source.goods[good] + 1 - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\npurchased") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\npurchased") else - goodTransactionMessage = goodTransactionMessage .. _("needRep-comms", "\nInsufficient reputation for purchase") + goodTransactionMessage = goodTransactionMessage .. _("needRep-comms","\nInsufficient reputation for purchase") end end setCommsMessage(goodTransactionMessage) @@ -6661,12 +4300,12 @@ function handleDockedState() end if ctd.buy ~= nil then for good, price in pairs(ctd.buy) do - if comms_source.goods[good] ~= nil and comms_source.goods[good] > 0 then - addCommsReply(string.format(_("trade-comms", "Sell one %s for %i reputation"),good,price), function() - local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Reputation price: %i"),good,price) + if comms_source.goods ~= nil and comms_source.goods[good] ~= nil and comms_source.goods[good] > 0 then + addCommsReply(string.format(_("trade-comms","Sell one %s for %i reputation"),good,price), function() + local goodTransactionMessage = string.format(_("trade-comms","Type: %s, Reputation price: %i"),good,price) comms_source.goods[good] = comms_source.goods[good] - 1 comms_source:addReputationPoints(price) - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nOne sold") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nOne sold") comms_source.cargo = comms_source.cargo + 1 setCommsMessage(goodTransactionMessage) addCommsReply(_("Back"), commsStation) @@ -6674,12 +4313,12 @@ function handleDockedState() end end end - if ctd.trade.food and comms_source.goods ~= nil and comms_source.goods.food ~= nil and comms_source.goods.food.quantity > 0 then + if ctd.trade.food and comms_source.goods ~= nil and comms_source.goods.food ~= nil and comms_source.goods.food > 0 then for good, goodData in pairs(ctd.goods) do - addCommsReply(string.format(_("trade-comms", "Trade food for %s"),good), function() - local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good,goodData["quantity"]) + addCommsReply(string.format(_("trade-comms","Trade food for %s"),good), function() + local goodTransactionMessage = string.format(_("trade-comms","Type: %s, Quantity: %i"),good,goodData["quantity"]) if goodData["quantity"] < 1 then - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient station inventory") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient station inventory") else goodData["quantity"] = goodData["quantity"] - 1 if comms_source.goods == nil then @@ -6690,19 +4329,19 @@ function handleDockedState() end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.goods["food"] = comms_source.goods["food"] - 1 - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nTraded") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nTraded") end setCommsMessage(goodTransactionMessage) addCommsReply(_("Back"), commsStation) end) end end - if ctd.trade.medicine and comms_source.goods ~= nil and comms_source.goods.medicine ~= nil and comms_source.goods.medicine.quantity > 0 then + if ctd.trade.medicine and comms_source.goods ~= nil and comms_source.goods.medicine ~= nil and comms_source.goods.medicine > 0 then for good, goodData in pairs(ctd.goods) do - addCommsReply(string.format(_("trade-comms", "Trade medicine for %s"),good), function() - local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good,goodData["quantity"]) + addCommsReply(string.format(_("trade-comms","Trade medicine for %s"),good), function() + local goodTransactionMessage = string.format(_("trade-comms","Type: %s, Quantity: %i"),good,goodData["quantity"]) if goodData["quantity"] < 1 then - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient station inventory") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient station inventory") else goodData["quantity"] = goodData["quantity"] - 1 if comms_source.goods == nil then @@ -6713,19 +4352,19 @@ function handleDockedState() end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.goods["medicine"] = comms_source.goods["medicine"] - 1 - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nTraded") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nTraded") end setCommsMessage(goodTransactionMessage) addCommsReply(_("Back"), commsStation) end) end end - if ctd.trade.luxury and comms_source.goods ~= nil and comms_source.goods.luxury ~= nil and comms_source.goods.luxury.quantity > 0 then + if ctd.trade.luxury and comms_source.goods ~= nil and comms_source.goods.luxury ~= nil and comms_source.goods.luxury > 0 then for good, goodData in pairs(ctd.goods) do - addCommsReply(string.format(_("trade-comms", "Trade luxury for %s"),good), function() - local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good,goodData["quantity"]) + addCommsReply(string.format(_("trade-comms","Trade luxury for %s"),good), function() + local goodTransactionMessage = string.format(_("trade-comms","Type: %s, Quantity: %i"),good,goodData["quantity"]) if goodData[quantity] < 1 then - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient station inventory") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nInsufficient station inventory") else goodData["quantity"] = goodData["quantity"] - 1 if comms_source.goods == nil then @@ -6736,7 +4375,7 @@ function handleDockedState() end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.goods["luxury"] = comms_source.goods["luxury"] - 1 - goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nTraded") + goodTransactionMessage = goodTransactionMessage .. _("trade-comms","\nTraded") end setCommsMessage(goodTransactionMessage) addCommsReply(_("Back"), commsStation) @@ -6745,68 +4384,68 @@ function handleDockedState() end addCommsReply(_("Back"), commsStation) end) - addCommsReply(_("explainGoods-comms", "No tutorial covered goods or cargo. Explain"), function() - setCommsMessage(_("explainGoods-comms", "Different types of cargo or goods may be obtained from stations, freighters or other sources. They go by one word descriptions such as dilithium, optic, warp, etc. Certain mission goals may require a particular type or types of cargo. Each player ship differs in cargo carrying capacity. Goods may be obtained by spending reputation points or by trading other types of cargo (typically food, medicine or luxury)")) + addCommsReply(_("explainGoods...-comms","No tutorial covered goods or cargo. Explain"), function() + setCommsMessage(_("explainGoods...-comms","Different types of cargo or goods may be obtained from stations, freighters or other sources. They go by one word descriptions such as dilithium, optic, warp, etc. Certain mission goals may require a particular type or types of cargo. Each player ship differs in cargo carrying capacity. Goods may be obtained by spending reputation points or by trading other types of cargo (typically food, medicine or luxury)")) addCommsReply(_("Back"), commsStation) end) end end function masterCartographer() if comms_source:takeReputationPoints(getCartographerCost("master")) then - setCommsMessage(_("cartographyOffice-comms", "Greetings,\nMay I help you find a station or goods?")) - addCommsReply(_("cartographyOffice-comms", "Find station"),function() - setCommsMessage(_("cartographyOffice-comms", "What station?")) + setCommsMessage(_("areaDescription-comms","Greetings,\nMay I help you find a station or goods?")) + addCommsReply(_("areaDescription-comms","Find station"),function() + setCommsMessage(_("areaDescription-comms","What station?")) local nearby_objects = getAllObjects() local stations_known = 0 - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then local station_distance = distance(comms_target,obj) if station_distance > 50000 then stations_known = stations_known + 1 addCommsReply(obj:getCallSign(),function() - local station_details = string.format(_("cartographyOffice-comms", "%s %s %s Distance:%.1fU"),obj:getSectorName(),obj:getFaction(),obj:getCallSign(),station_distance/1000) + local station_details = string.format(_("areaDescription-comms","%s %s %s Distance:%.1fU"),obj:getSectorName(),obj:getFaction(),obj:getCallSign(),station_distance/1000) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s %s"),station_details,obj.comms_data.orbit) + station_details = string.format("%s %s",station_details,obj.comms_data.orbit) end if obj.comms_data.goods ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nGood, quantity, cost"),station_details) + station_details = string.format(_("areaDescription-comms","%s\nGood, quantity, cost"),station_details) for good, good_data in pairs(obj.comms_data.goods) do - station_details = string.format(_("cartographyOffice-comms", "%s\n %s, %i, %i"),station_details,good,good_data["quantity"],good_data["cost"]) + station_details = string.format("%s\n %s, %i, %i",station_details,good,good_data["quantity"],good_data["cost"]) end end if obj.comms_data.general_information ~= nil then - station_details = string.format(_("stationGeneralInfo-comms", "%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) + station_details = string.format(_("stationGeneralInfo-comms","%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) end if obj.comms_data.history ~= nil then - station_details = string.format(_("stationStory-comms", "%s\nHistory:\n %s"),station_details,obj.comms_data.history) + station_details = string.format(_("stationGeneralInfo-comms","%s\nHistory:\n %s"),station_details,obj.comms_data.history) end if obj.comms_data.gossip ~= nil then - station_details = string.format(_("gossip-comms", "%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) + station_details = string.format(_("gossip-comms","%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) end local dsx, dsy = obj:getPosition() comms_source:commandAddWaypoint(dsx,dsy) - station_details = string.format(_("cartographyOffice-comms", "%s\nAdded waypoint %i to your navigation system for %s"),station_details,comms_source:getWaypointCount(),obj:getCallSign()) + station_details = string.format(_("areaDescription-comms","%s\nAdded waypoint %i to your navigation system for %s"),station_details,comms_source:getWaypointCount(),obj:getCallSign()) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nNote: this waypoint will be out of date shortly since %s is in motion"),station_details,obj:getCallSign()) + station_details = string.format(_("areaDescription-comms","%s\nNote: this waypoint will be out of date shortly since %s is in motion"),station_details,obj:getCallSign()) end setCommsMessage(station_details) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) end end end end if stations_known == 0 then - setCommsMessage(_("cartographyOffice-comms", "Try the apprentice, I'm tired")) + setCommsMessage(_("areaDescription-comms","Try the apprentice, I'm tired")) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) - addCommsReply(_("cartographyOffice-comms", "Find Goods"), function() - setCommsMessage(_("cartographyOffice-comms", "What goods are you looking for?")) + addCommsReply(_("areaDescription-comms","Find Goods"), function() + setCommsMessage(_("areaDescription-comms","What goods are you looking for?")) local nearby_objects = getAllObjects() local by_goods = {} - for _, obj in ipairs(nearby_objects) do + for i, obj in ipairs(nearby_objects) do if obj.typeName == "SpaceStation" then if not obj:isEnemy(comms_target) then local station_distance = distance(comms_target,obj) @@ -6823,39 +4462,39 @@ function masterCartographer() for good, obj in pairs(by_goods) do addCommsReply(good, function() local station_distance = distance(comms_target,obj) - local station_details = string.format(_("cartographyOffice-comms", "%s %s %s Distance:%.1fU"),obj:getSectorName(),obj:getFaction(),obj:getCallSign(),station_distance/1000) + local station_details = string.format(_("areaDescription-comms","%s %s %s Distance:%.1fU"),obj:getSectorName(),obj:getFaction(),obj:getCallSign(),station_distance/1000) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s %s"),station_details,obj.comms_data.orbit) + station_details = string.format("%s %s",station_details,obj.comms_data.orbit) end if obj.comms_data.goods ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nGood, quantity, cost"),station_details) + station_details = string.format(_("areaDescription-comms","%s\nGood, quantity, cost"),station_details) for good, good_data in pairs(obj.comms_data.goods) do - station_details = string.format(_("cartographyOffice-comms", "%s\n %s, %i, %i"),station_details,good,good_data["quantity"],good_data["cost"]) + station_details = string.format("%s\n %s, %i, %i",station_details,good,good_data["quantity"],good_data["cost"]) end end if obj.comms_data.general_information ~= nil then - station_details = string.format(_("stationGeneralInfo-comms", "%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) + station_details = string.format(_("stationGeneralInfo-comms","%s\nGeneral Information:\n %s"),station_details,obj.comms_data.general_information) end if obj.comms_data.history ~= nil then - station_details = string.format(_("stationStory-comms", "%s\nHistory:\n %s"),station_details,obj.comms_data.history) + station_details = string.format(_("stationGeneralInfo-comms","%s\nHistory:\n %s"),station_details,obj.comms_data.history) end if obj.comms_data.gossip ~= nil then - station_details = string.format(_("gossip-comms", "%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) + station_details = string.format(_("gossip-comms","%s\nGossip:\n %s"),station_details,obj.comms_data.gossip) end local dsx, dsy = obj:getPosition() comms_source:commandAddWaypoint(dsx,dsy) - station_details = string.format(_("cartographyOffice-comms", "%s\nAdded waypoint %i to your navigation system for %s"),station_details,comms_source:getWaypointCount(),obj:getCallSign()) + station_details = string.format(_("areaDescription-comms","%s\nAdded waypoint %i to your navigation system for %s"),station_details,comms_source:getWaypointCount(),obj:getCallSign()) if obj.comms_data.orbit ~= nil then - station_details = string.format(_("cartographyOffice-comms", "%s\nNote: this waypoint will be out of date shortly since %s is in motion"),station_details,obj:getCallSign()) + station_details = string.format(_("areaDescription-comms","%s\nNote: this waypoint will be out of date shortly since %s is in motion"),station_details,obj:getCallSign()) end setCommsMessage(station_details) - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) end - addCommsReply(_("Back"),commsStation) + addCommsReply(_("Back"), commsStation) end) else - setCommsMessage(_("needRep-comms", "Insufficient Reputation")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end end function getCartographerCost(service) @@ -6885,78 +4524,78 @@ function showCurrentStats() stats_exist = true end if stats_exist then - addCommsReply("Show me the current statistics, please", function() - setCommsMessage("What would you like statistics on?") + addCommsReply(_("station-comms","Show me the current statistics, please"), function() + setCommsMessage(_("station-comms","What would you like statistics on?")) if #humanStationDestroyedNameList ~= nil and #humanStationDestroyedNameList > 0 then - addCommsReply("Human Stations Destroyed",function() + addCommsReply(_("station-comms","Human Stations Destroyed"),function() local human_station_stats = "" local station_strength = 0 for i=1,#humanStationDestroyedNameList do human_station_stats = human_station_stats .. string.format("\n%s, %i",humanStationDestroyedNameList[i],humanStationDestroyedValue[i]) station_strength = station_strength + humanStationDestroyedValue[i] end - human_station_stats = string.format("Count: %i, Total strength: %i\n Station Name, Strength",#humanStationDestroyedNameList,station_strength) .. human_station_stats + human_station_stats = string.format(_("station-comms","Count: %i, Total strength: %i\n Station Name, Strength"),#humanStationDestroyedNameList,station_strength) .. human_station_stats setCommsMessage(human_station_stats) addCommsReply(_("Back"), commsStation) end) end if #neutralStationDestroyedNameList ~= nil and #neutralStationDestroyedNameList > 0 then - addCommsReply("Neutral Stations Destroyed",function() + addCommsReply(_("station-comms","Neutral Stations Destroyed"),function() local neutral_station_stats = "" local station_strength = 0 for i=1,#neutralStationDestroyedNameList do neutral_station_stats = neutral_station_stats .. string.format("\n%s, %i",neutralStationDestroyedNameList[i],neutralStationDestroyedValue[i]) station_strength = station_strength + neutralStationDestroyedValue[i] end - neutral_station_stats = string.format("Count: %i, Total strength: %i\n Station Name, Strength",#neutralStationDestroyedNameList,station_strength) .. neutral_station_stats + neutral_station_stats = string.format(_("station-comms","Count: %i, Total strength: %i\n Station Name, Strength"),#neutralStationDestroyedNameList,station_strength) .. neutral_station_stats setCommsMessage(neutral_station_stats) addCommsReply(_("Back"), commsStation) end) end if #kraylorVesselDestroyedNameList ~= nil and #kraylorVesselDestroyedNameList > 0 then - addCommsReply("Kraylor Vessels Destroyed",function() + addCommsReply(_("station-comms","Kraylor Vessels Destroyed"),function() local vessel_stats = "" local vessel_strength = 0 for i=1,#kraylorVesselDestroyedNameList do vessel_stats = vessel_stats .. string.format("\n%s, %s, %i",kraylorVesselDestroyedNameList[i],kraylorVesselDestroyedType[i],kraylorVesselDestroyedValue[i]) vessel_strength = vessel_strength + kraylorVesselDestroyedValue[i] end - vessel_stats = string.format("Count: %i, Total strength: %i\n Vessel Name, Type, Strength",#kraylorVesselDestroyedNameList,vessel_strength) .. vessel_stats + vessel_stats = string.format(_("station-comms","Count: %i, Total strength: %i\n Vessel Name, Type, Strength"),#kraylorVesselDestroyedNameList,vessel_strength) .. vessel_stats setCommsMessage(vessel_stats) addCommsReply(_("Back"), commsStation) end) end if #exuariVesselDestroyedNameList ~= nil and #exuariVesselDestroyedNameList > 0 then - addCommsReply("Exuari Vessels Destroyed",function() + addCommsReply(_("station-comms","Exuari Vessels Destroyed"),function() local vessel_stats = "" local vessel_strength = 0 for i=1,#exuariVesselDestroyedNameList do vessel_stats = vessel_stats .. string.format("\n%s, %s, %i",exuariVesselDestroyedNameList[i],exuariVesselDestroyedType[i],exuariVesselDestroyedValue[i]) vessel_strength = vessel_strength + exuariVesselDestroyedValue[i] end - vessel_stats = string.format("Count: %i, Total strength: %i\n Vessel Name, Type, Strength",#exuariVesselDestroyedNameList,vessel_strength) .. vessel_stats + vessel_stats = string.format(_("station-comms","Count: %i, Total strength: %i\n Vessel Name, Type, Strength"),#exuariVesselDestroyedNameList,vessel_strength) .. vessel_stats setCommsMessage(vessel_stats) addCommsReply(_("Back"), commsStation) end) end if #arlenianVesselDestroyedNameList ~= nil and #arlenianVesselDestroyedNameList > 0 then - addCommsReply("Arlenian Vessels Destroyed",function() + addCommsReply(_("station-comms","Arlenian Vessels Destroyed"),function() local vessel_stats = "" local vessel_strength = 0 for i=1,#arlenianVesselDestroyedNameList do vessel_stats = vessel_stats .. string.format("\n%s, %s, %i",arlenianVesselDestroyedNameList[i],arlenianVesselDestroyedType[i],arlenianVesselDestroyedValue[i]) vessel_strength = vessel_strength + arlenianVesselDestroyedValue[i] end - vessel_stats = string.format("Count: %i, Total strength: %i\n Vessel Name, Type, Strength",#arlenianVesselDestroyedNameList,vessel_strength) .. vessel_stats + vessel_stats = string.format(_("station-comms","Count: %i, Total strength: %i\n Vessel Name, Type, Strength"),#arlenianVesselDestroyedNameList,vessel_strength) .. vessel_stats setCommsMessage(vessel_stats) addCommsReply(_("Back"), commsStation) end) end - addCommsReply("Missions completed",function() + addCommsReply(_("station-comms","Missions completed"),function() if mission_complete_count > 0 then - setCommsMessage(string.format("Missions completed so far: %i",mission_complete_count)) + setCommsMessage(string.format(_("station-comms","Missions completed so far: %i"),mission_complete_count)) else - setCommsMessage("No missions completed yet") + setCommsMessage(_("station-comms","No missions completed yet")) end addCommsReply(_("Back"), commsStation) end) @@ -6981,22 +4620,22 @@ function isAllowedTo(state) end function handleWeaponRestock(weapon) if not comms_source:isDocked(comms_target) then - setCommsMessage(_("station-comms", "You need to stay docked for that action.")) + setCommsMessage(_("ammo-comms","You need to stay docked for that action.")) return end if not isAllowedTo(comms_data.weapons[weapon]) then - if weapon == "Nuke" then setCommsMessage(_("ammo-comms", "We do not deal in weapons of mass destruction.")) - elseif weapon == "EMP" then setCommsMessage(_("ammo-comms", "We do not deal in weapons of mass disruption.")) - else setCommsMessage(_("ammo-comms", "We do not deal in those weapons.")) end + if weapon == "Nuke" then setCommsMessage(_("ammo-comms","We do not deal in weapons of mass destruction.")) + elseif weapon == "EMP" then setCommsMessage(_("ammo-comms","We do not deal in weapons of mass disruption.")) + else setCommsMessage(_("ammo-comms","We do not deal in those weapons.")) end return end local points_per_item = getWeaponCost(weapon) local item_amount = math.floor(comms_source:getWeaponStorageMax(weapon) * comms_data.max_weapon_refill_amount[getFriendStatus()]) - comms_source:getWeaponStorage(weapon) if item_amount <= 0 then if weapon == "Nuke" then - setCommsMessage(_("ammo-comms", "All nukes are charged and primed for destruction.")); + setCommsMessage(_("ammo-comms","All nukes are charged and primed for destruction.")) else - setCommsMessage(_("ammo-comms", "Sorry, sir, but you are as fully stocked as I can allow.")); + setCommsMessage(_("ammo-comms","Sorry, sir, but you are as fully stocked as I can allow.")) end addCommsReply(_("Back"), commsStation) else @@ -7004,33 +4643,33 @@ function handleWeaponRestock(weapon) if comms_source:takeReputationPoints(points_per_item * item_amount) then comms_source:setWeaponStorage(weapon, comms_source:getWeaponStorage(weapon) + item_amount) if comms_source:getWeaponStorage(weapon) == comms_source:getWeaponStorageMax(weapon) then - setCommsMessage(_("ammo-comms", "You are fully loaded and ready to explode things.")) + setCommsMessage(_("ammo-comms","You are fully loaded and ready to explode things.")) else - setCommsMessage(_("ammo-comms", "We generously resupplied you with some weapon charges.\nPut them to good use.")) + setCommsMessage(_("ammo-comms","We generously resupplied you with some weapon charges.\nPut them to good use.")) end else - setCommsMessage(_("needRep-comms", "Not enough reputation.")) + setCommsMessage(_("needRep-comms","Not enough reputation.")) return end else if comms_source:getReputationPoints() > points_per_item then - setCommsMessage(_("ammo-comms", "You can't afford as much as I'd like to give you")) - addCommsReply(_("ammo-comms", "Get just one"), function() + setCommsMessage(_("ammo-comms","You can't afford as much as I'd like to give you")) + addCommsReply(_("ammo-comms","Get just one"), function() if comms_source:takeReputationPoints(points_per_item) then comms_source:setWeaponStorage(weapon, comms_source:getWeaponStorage(weapon) + 1) if comms_source:getWeaponStorage(weapon) == comms_source:getWeaponStorageMax(weapon) then - setCommsMessage(_("ammo-comms", "You are fully loaded and ready to explode things.")) + setCommsMessage(_("ammo-comms","You are fully loaded and ready to explode things.")) else - setCommsMessage(_("ammo-comms", "We generously resupplied you with one weapon charge.\nPut it to good use.")) + setCommsMessage(_("ammo-comms","We generously resupplied you with one weapon charge.\nPut it to good use.")) end else - setCommsMessage(_("needRep-comms", "Not enough reputation.")) + setCommsMessage(_("needRep-comms","Not enough reputation.")) end - return + addCommsReply(_("Back"), commsStation) end) else - setCommsMessage(_("needRep-comms", "Not enough reputation.")) - return + setCommsMessage(_("needRep-comms","Not enough reputation.")) + addCommsReply(_("Back"), commsStation) end end addCommsReply(_("Back"), commsStation) @@ -7045,44 +4684,41 @@ function handleUndockedState() local player = comms_source local ctd = comms_target.comms_data if comms_source:isFriendly(comms_target) then - oMsg = _("station-comms", "Good day, officer.\nIf you need supplies, please dock with us first.") + oMsg = _("station-comms","Good day, officer.\nIf you need supplies, please dock with us first.") else - oMsg = _("station-comms", "Greetings.\nIf you want to do business, please dock with us first.") + oMsg = _("station-comms","Greetings.\nIf you want to do business, please dock with us first.") end if comms_target:areEnemiesInRange(20000) then - oMsg = oMsg .. _("station-comms", "\nBe aware that if enemies in the area get much closer, we will be too busy to conduct business with you.") + oMsg = oMsg .. _("station-comms","\nBe aware that if enemies in the area get much closer, we will be too busy to conduct business with you.") end setCommsMessage(oMsg) if comms_target == belt1Stations[5] and plot1 == checkOrbitingArtifactEvents and not astronomerBoardedShip then - addCommsReply("Contact astronomer Polly Hobbs", function() - setCommsMessage("[Polly Hobbs] I've constructed a sensitive scanning device to gather additional data. However, the device needs to be much closer. Can you transport me closer to the location of the readings?") + addCommsReply(_("station-comms","Contact astronomer Polly Hobbs"), function() + setCommsMessage(_("station-comms","[Polly Hobbs] I've constructed a sensitive scanning device to gather additional data. However, the device needs to be much closer. Can you transport me closer to the location of the readings?")) playVoice("Polly02") addCommsReply(_("Back"), commsStation) end) end - addCommsReply(_("station-comms", "I need information"), function() - setCommsMessage(_("station-comms", "What kind of information do you need?")) + addCommsReply(_("station-comms","I need information"), function() + setCommsMessage(_("station-comms","What kind of information do you need?")) if stationCommsDiagnostic then print("requesting information") end local ctd = comms_target.comms_data if stationCommsDiagnostic then print(ctd.character) end if ctd.character ~= nil then - addCommsReply(string.format(_("characterInfo-comms", "Tell me about %s"),ctd.character), function() + addCommsReply(string.format(_("characterInfo-comms","Tell me about %s"),ctd.character), function() if ctd.characterDescription ~= nil then setCommsMessage(ctd.characterDescription) else if ctd.characterDeadEnd == nil then - local deadEndChoice = math.random(1,5) - if deadEndChoice == 1 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "Never heard of %s"), ctd.character) - elseif deadEndChoice == 2 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "%s died last week. The funeral was yesterday"), ctd.character) - elseif deadEndChoice == 3 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "%s? Who's %s? There's nobody here named %s"),ctd.character,ctd.character,ctd.character) - elseif deadEndChoice == 4 then - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "We don't talk about %s. They are gone and good riddance"),ctd.character) - else - ctd.characterDeadEnd = string.format(_("characterInfo-comms", "I think %s moved away"),ctd.character) - end + local dead_end_responses = { + string.format(_("characterInfo-comms","Never heard of %s"),ctd.character), + string.format(_("characterInfo-comms","%s died last week. The funeral was yesterday"),ctd.character), + string.format(_("characterInfo-comms","%s? Who's %s? There's nobody here named %s"),ctd.character,ctd.character,ctd.character), + string.format(_("characterInfo-comms","We don't talk about %s. They are gone and good riddance"),ctd.character), + string.format(_("characterInfo-comms","I think %s moved away"),ctd.character), + string.format(_("characterInfo-comms","My aunt's neighbor's second cousin is named %s. However, %s lives far away from here."),ctd.character,ctd.character), + } + ctd.characterDeadEnd = dead_end_responses[math.random(1,#dead_end_responses)] end setCommsMessage(ctd.characterDeadEnd) end @@ -7090,48 +4726,48 @@ function handleUndockedState() end) end if comms_source:isFriendly(comms_target) then - addCommsReply(_("orders-comms", "What are my current orders?"), function() + addCommsReply(_("orders-comms","What are my current orders?"), function() setOptionalOrders() setSecondaryOrders() ordMsg = primaryOrders .. "\n" .. secondaryOrders .. optionalOrders if playWithTimeLimit then - ordMsg = ordMsg .. string.format(_("orders-comms", "\n %i Minutes remain in game"),math.floor(gameTimeLimit/60)) + ordMsg = ordMsg .. string.format(_("orders-comms","\n %i Minutes remain in game"),math.floor(gameTimeLimit/60)) end setCommsMessage(ordMsg) addCommsReply(_("Back"), commsStation) end) showCurrentStats() end - addCommsReply(_("ammo-comms", "What ordnance do you have available for restock?"), function() + addCommsReply(_("station-comms","What ordnance do you have available for restock?"), function() local ctd = comms_target.comms_data local missileTypeAvailableCount = 0 local ordnanceListMsg = "" if ctd.weapon_available.Nuke then missileTypeAvailableCount = missileTypeAvailableCount + 1 - ordnanceListMsg = ordnanceListMsg .. _("ammo-comms", "\n Nuke") + ordnanceListMsg = ordnanceListMsg .. _("station-comms","\n Nuke") end if ctd.weapon_available.EMP then missileTypeAvailableCount = missileTypeAvailableCount + 1 - ordnanceListMsg = ordnanceListMsg .. _("ammo-comms", "\n EMP") + ordnanceListMsg = ordnanceListMsg .. _("station-comms","\n EMP") end if ctd.weapon_available.Homing then missileTypeAvailableCount = missileTypeAvailableCount + 1 - ordnanceListMsg = ordnanceListMsg .. _("ammo-comms", "\n Homing") + ordnanceListMsg = ordnanceListMsg .. _("station-comms","\n Homing") end if ctd.weapon_available.Mine then missileTypeAvailableCount = missileTypeAvailableCount + 1 - ordnanceListMsg = ordnanceListMsg .. _("ammo-comms", "\n Mine") + ordnanceListMsg = ordnanceListMsg .. _("station-comms","\n Mine") end if ctd.weapon_available.HVLI then missileTypeAvailableCount = missileTypeAvailableCount + 1 - ordnanceListMsg = ordnanceListMsg .. _("ammo-comms", "\n HVLI") + ordnanceListMsg = ordnanceListMsg .. _("station-comms","\n HVLI") end if missileTypeAvailableCount == 0 then - ordnanceListMsg = _("ammo-comms", "We have no ordnance available for restock") + ordnanceListMsg = _("station-comms","We have no ordnance available for restock") elseif missileTypeAvailableCount == 1 then - ordnanceListMsg = string.format(_("ammo-comms", "We have the following type of ordnance available for restock:%s"), ordnanceListMsg) + ordnanceListMsg = _("station-comms","We have the following type of ordnance available for restock:") .. ordnanceListMsg else - ordnanceListMsg = string.format(_("ammo-comms", "We have the following types of ordnance available for restock:%s"), ordnanceListMsg) + ordnanceListMsg = _("station-comms","We have the following types of ordnance available for restock:") .. ordnanceListMsg end setCommsMessage(ordnanceListMsg) addCommsReply(_("Back"), commsStation) @@ -7145,19 +4781,19 @@ function handleUndockedState() end end if goodsAvailable then - addCommsReply(_("trade-comms", "What goods do you have available for sale or trade?"), function() + addCommsReply(_("station-comms","What goods do you have available for sale or trade?"), function() local ctd = comms_target.comms_data - local goodsAvailableMsg = string.format(_("trade-comms", "Station %s:\nGoods or components available: quantity, cost in reputation"),comms_target:getCallSign()) + local goodsAvailableMsg = string.format(_("station-comms","Station %s:\nGoods or components available: quantity, cost in reputation"),comms_target:getCallSign()) for good, goodData in pairs(ctd.goods) do - goodsAvailableMsg = goodsAvailableMsg .. string.format(_("trade-comms", "\n %14s: %2i, %3i"),good,goodData["quantity"],goodData["cost"]) + goodsAvailableMsg = goodsAvailableMsg .. string.format("\n %14s: %2i, %3i",good,goodData["quantity"],goodData["cost"]) end setCommsMessage(goodsAvailableMsg) addCommsReply(_("Back"), commsStation) end) end - addCommsReply(_("trade-comms", "Where can I find particular goods?"), function() + addCommsReply(_("station-comms","Where can I find particular goods?"), function() local ctd = comms_target.comms_data - gkMsg = _("trade-comms", "Friendly stations often have food or medicine or both. Neutral stations may trade their goods for food, medicine or luxury.") + gkMsg = _("station-comms","Friendly stations often have food or medicine or both. Neutral stations may trade their goods for food, medicine or luxury.") if ctd.goodsKnowledge == nil then ctd.goodsKnowledge = {} local knowledgeCount = 0 @@ -7197,50 +4833,51 @@ function handleUndockedState() local sectorName = ctd.goodsKnowledge[good]["sector"] local goodName = good local goodCost = ctd.goodsKnowledge[good]["cost"] - setCommsMessage(string.format(_("trade-comms", "Station %s in sector %s has %s for %i reputation"),stationName,sectorName,goodName,goodCost)) - addCommsReply(_("Back"), commsStation) + setCommsMessage(string.format(_("station-comms","Station %s in sector %s has %s for %i reputation"),stationName,sectorName,goodName,goodCost)) + addCommsReply("Back", commsStation) end) end if goodsKnowledgeCount > 0 then - gkMsg = gkMsg .. _("trade-comms", "\n\nWhat goods are you interested in?\nI've heard about these:") + gkMsg = gkMsg .. _("station-comms","\n\nWhat goods are you interested in?\nI've heard about these:") else - gkMsg = gkMsg .. _("trade-comms", " Beyond that, I have no knowledge of specific stations") + gkMsg = gkMsg .. _("station-comms"," Beyond that, I have no knowledge of specific stations") end setCommsMessage(gkMsg) addCommsReply(_("Back"), commsStation) end) if ctd.public_relations then - addCommsReply(_("station-comms", "Tell me more about your station"), function() + addCommsReply(_("station-comms","Tell me more about your station"), function() local ctd = comms_target.comms_data - setCommsMessage(_("station-comms", "What would you like to know?")) - addCommsReply(_("stationGeneralInfo-comms", "General information"), function() + setCommsMessage(_("station-comms","What would you like to know?")) + addCommsReply(_("station-comms","General information"), function() setCommsMessage(ctd.general_information) addCommsReply(_("Back"), commsStation) end) if ctd.history ~= nil then - addCommsReply(_("stationStory-comms", "Station history"), function() + addCommsReply(_("station-comms","Station history"), function() setCommsMessage(ctd.history) addCommsReply(_("Back"), commsStation) end) end if ctd.gossip ~= nil then if random(1,100) < 80 then - addCommsReply(_("gossip-comms", "Gossip"), function() + addCommsReply(_("station-comms","Gossip"), function() setCommsMessage(ctd.gossip) addCommsReply(_("Back"), commsStation) end) end end + addCommsReply(_("Back"), commsStation) end) --end station info comms reply branch end --end public relations if branch - addCommsReply(_("stationAssist-comms", "Report status"), function() - msg = string.format(_("stationAssist-comms", "Hull: %d%%\n"), math.floor(comms_target:getHull() / comms_target:getHullMax() * 100)) + addCommsReply(_("station-comms","Report status"), function() + msg = _("station-comms","Hull: ") .. math.floor(comms_target:getHull() / comms_target:getHullMax() * 100) .. "%\n" local shields = comms_target:getShieldCount() if shields == 1 then - msg = msg .. string.format(_("stationpAssist-comms", "Shield: %d%%\n"), math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100)) + msg = msg .. _("station-comms","Shield: ") .. math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100) .. "%\n" else for n=0,shields-1 do - msg = msg .. string.format(_("stationAssist-comms", "Shield %s: %d%%\n"), n, math.floor(comms_target:getShieldLevel(n) / comms_target:getShieldMax(n) * 100)) + msg = msg .. _("station-comms","Shield ") .. n .. ": " .. math.floor(comms_target:getShieldLevel(n) / comms_target:getShieldMax(n) * 100) .. "%\n" end end setCommsMessage(msg); @@ -7248,13 +4885,13 @@ function handleUndockedState() end) end) if isAllowedTo(comms_target.comms_data.services.supplydrop) then - addCommsReply(string.format(_("stationAssist-comms", "Can you send a supply drop? (%d rep)"), getServiceCost("supplydrop")), function() + addCommsReply(string.format(_("stationAssist-comms","Can you send a supply drop? (%s reputation)"),getServiceCost("supplydrop")), function() if comms_source:getWaypointCount() < 1 then - setCommsMessage(_("stationAssist-comms", "You need to set a waypoint before you can request backup.")); + setCommsMessage(_("stationAssist-comms","You need to set a waypoint before you can request backup.")) else - setCommsMessage(_("stationAssist-comms", "To which waypoint should we deliver your supplies?")); + setCommsMessage(_("stationAssist-comms","To which waypoint should we deliver your supplies?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("stationAssist-comms", "WP %d"),n), function() + addCommsReply(string.format(_("stationAssist-comms","Waypoint %s"),n), function() if comms_source:takeReputationPoints(getServiceCost("supplydrop")) then local position_x, position_y = comms_target:getPosition() local target_x, target_y = comms_source:getWaypoint(n) @@ -7262,9 +4899,9 @@ function handleUndockedState() script:setVariable("position_x", position_x):setVariable("position_y", position_y) script:setVariable("target_x", target_x):setVariable("target_y", target_y) script:setVariable("faction_id", comms_target:getFactionId()):run("supply_drop.lua") - setCommsMessage(string.format(_("stationAssist-comms", "We have dispatched a supply ship toward WP %d"), n)); + setCommsMessage(string.format(_("stationAssist-comms","We have dispatched a supply ship toward waypoint %s"),n)) else - setCommsMessage(_("needRep-comms", "Not enough reputation!")); + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsStation) end) @@ -7274,20 +4911,20 @@ function handleUndockedState() end) end if isAllowedTo(comms_target.comms_data.services.reinforcements) then - addCommsReply(string.format(_("stationAssist-comms", "Please send Adder MK5 reinforcements! (%d rep)"),getServiceCost("reinforcements")), function() + addCommsReply(string.format(_("stationAssist-comms","Please send Adder MK5 reinforcements! (%s reputation)"),getServiceCost("reinforcements")), function() if comms_source:getWaypointCount() < 1 then - setCommsMessage(_("stationAssist-comms", "You need to set a waypoint before you can request reinforcements.")); + setCommsMessage(_("stationAssist-comms","You need to set a waypoint before you can request reinforcements.")) else - setCommsMessage(_("stationAssist-comms", "To which waypoint should we dispatch the reinforcements?")); + setCommsMessage(_("stationAssist-comms","To which waypoint should we dispatch the reinforcements?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("stationAssist-comms", "WP %d"),n), function() + addCommsReply(string.format(_("stationAssist-comms","Waypoint %s"),n), function() if comms_source:takeReputationPoints(getServiceCost("reinforcements")) then ship = CpuShip():setFactionId(comms_target:getFactionId()):setPosition(comms_target:getPosition()):setTemplate("Adder MK5"):setScanned(true):orderDefendLocation(comms_source:getWaypoint(n)) ship:setCommsScript(""):setCommsFunction(commsShip):onDestruction(humanVesselDestroyed) table.insert(friendlyHelperFleet,ship) - setCommsMessage(string.format(_("stationAssist-comms", "We have dispatched %s to assist at WP %d"),ship:getCallSign(),n)) + setCommsMessage(string.format(_("stationAssist-comms","We have dispatched %s to assist at waypoint %s"),ship:getCallSign(),n)) else - setCommsMessage(_("needRep-comms", "Not enough reputation!")); + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsStation) end) @@ -7295,20 +4932,20 @@ function handleUndockedState() end addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("stationAssist-comms", "Please send Phobos T3 reinforcements! (%d rep)"),getServiceCost("phobosReinforcements")), function() + addCommsReply(string.format(_("stationAssist-comms","Please send Phobos T3 reinforcements! (%s reputation)"),getServiceCost("phobosReinforcements")), function() if comms_source:getWaypointCount() < 1 then - setCommsMessage(_("stationAssist-comms", "You need to set a waypoint before you can request reinforcements.")); + setCommsMessage(_("stationAssist-comms","You need to set a waypoint before you can request reinforcements.")) else - setCommsMessage(_("stationAssist-comms", "To which waypoint should we dispatch the reinforcements?")); + setCommsMessage(_("stationAssist-comms","To which waypoint should we dispatch the reinforcements?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("stationAssist-comms", "WP %d"),n), function() + addCommsReply(string.format(_("stationAssist-comms","Waypoint %s"),n), function() if comms_source:takeReputationPoints(getServiceCost("phobosReinforcements")) then ship = CpuShip():setFactionId(comms_target:getFactionId()):setPosition(comms_target:getPosition()):setTemplate("Phobos T3"):setScanned(true):orderDefendLocation(comms_source:getWaypoint(n)) ship:setCommsScript(""):setCommsFunction(commsShip):onDestruction(humanVesselDestroyed) table.insert(friendlyHelperFleet,ship) - setCommsMessage(string.format(_("stationAssist-comms", "We have dispatched %s to assist at WP %d"),ship:getCallSign(),n)) + setCommsMessage(string.format(_("stationAssist-comms","We have dispatched %s to assist at waypoint %s"),ship:getCallSign(),n)) else - setCommsMessage(_("needRep-comms", "Not enough reputation!")); + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsStation) end) @@ -7316,20 +4953,20 @@ function handleUndockedState() end addCommsReply(_("Back"), commsStation) end) - addCommsReply(string.format(_("stationAssist-comms", "Please send Stalker Q7 reinforcements! (%d rep)"),getServiceCost("stalkerReinforcements")), function() + addCommsReply(string.format(_("stationAssist-comms","Please send Stalker Q7 reinforcements! (%s reputation)"),getServiceCost("stalkerReinforcements")), function() if comms_source:getWaypointCount() < 1 then - setCommsMessage(_("stationAssist-comms", "You need to set a waypoint before you can request reinforcements.")); + setCommsMessage(_("stationAssist-comms","You need to set a waypoint before you can request reinforcements.")) else - setCommsMessage(_("stationAssist-comms", "To which waypoint should we dispatch the reinforcements?")); + setCommsMessage(_("stationAssist-comms","To which waypoint should we dispatch the reinforcements?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("stationAssist-comms", "WP %d"),n), function() + addCommsReply(string.format(_("stationAssist-comms","Waypoint %s"),n), function() if comms_source:takeReputationPoints(getServiceCost("stalkerReinforcements")) then ship = CpuShip():setFactionId(comms_target:getFactionId()):setPosition(comms_target:getPosition()):setTemplate("Stalker Q7"):setScanned(true):orderDefendLocation(comms_source:getWaypoint(n)) ship:setCommsScript(""):setCommsFunction(commsShip):onDestruction(humanVesselDestroyed) table.insert(friendlyHelperFleet,ship) - setCommsMessage(string.format(_("stationAssist-comms", "We have dispatched %s to assist at WP %d"),ship:getCallSign(),n)) + setCommsMessage(string.format(_("stationAssist-comms","We have dispatched %s to assist at waypoint %s"),ship:getCallSign(),n)) else - setCommsMessage(_("needRep-comms", "Not enough reputation!")); + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsStation) end) @@ -7366,22 +5003,22 @@ function fillStationBrains() tradeString = "" stationTrades = false if tradeMedicine[humanStationList[sti]] ~= nil then - tradeString = _("trade-comms", " and will trade it for medicine") + tradeString = _("trade-comms"," and will trade it for medicine") stationTrades = true end if tradeFood[humanStationList[sti]] ~= nil then if stationTrades then - tradeString = tradeString .. _("trade-comms", " or food") + tradeString = tradeString .. _("trade-comms"," or food") else - tradeString = tradeString .. _("trade-comms", " and will trade it for food") + tradeString = tradeString .. _("trade-comms"," and will trade it for food") stationTrades = true end end if tradeLuxury[humanStationList[sti]] ~= nil then if stationTrades then - tradeString = tradeString .. _("trade-comms", " or luxury") + tradeString = tradeString .. _("trade-comms"," or luxury") else - tradeString = tradeString .. _("trade-comms", " and will trade it for luxury") + tradeString = tradeString .. _("trade-comms"," and will trade it for luxury") end end table.insert(comms_target.goodsKnowledgeTrade,tradeString) @@ -7401,6 +5038,255 @@ function getFriendStatus() return "neutral" end end +function addStationToDatabase(station) + -- Assumes all player ships will be the same faction + local player_faction = "Human Navy" + local stations_key = _("scienceDB","Stations") + local stations_db = queryScienceDatabase(stations_key) + if stations_db == nil then + stations_db = ScienceDatabase():setName(stations_key) + end + local station_db = nil + local station_key = station:getCallSign() + local temp_artifact = Artifact():setFaction(player_faction) + local first_time_entry = false + if station:isFriendly(temp_artifact) then + local friendly_key = _("scienceDB","Friendly") + local friendly_db = queryScienceDatabase(stations_key,friendly_key) + if friendly_db == nil then + stations_db:addEntry(friendly_key) + friendly_db = queryScienceDatabase(stations_key,friendly_key) + friendly_db:setLongDescription(_("scienceDB","Friendly stations share their short range telemetry with your ship on the Relay and Strategic Map consoles. These are the known friendly stations.")) + end + station_db = queryScienceDatabase(stations_key,friendly_key,station_key) + if station_db == nil then + friendly_db:addEntry(station_key) + station_db = queryScienceDatabase(stations_key,friendly_key,station_key) + first_time_entry = true + end + elseif not station:isEnemy(temp_artifact) then + local neutral_key = "Neutral" + local neutral_db = queryScienceDatabase(stations_key,neutral_key) + if neutral_db == nil then + stations_db:addEntry(neutral_key) + neutral_db = queryScienceDatabase(stations_key,neutral_key) + neutral_db:setLongDescription(_("scienceDB","Neutral stations don't share their short range telemetry with your ship, but they do allow for docking. These are the known neutral stations.")) + end + station_db = queryScienceDatabase(stations_key,neutral_key,station_key) + if station_db == nil then + neutral_db:addEntry(station_key) + station_db = queryScienceDatabase(stations_key,neutral_key,station_key) + first_time_entry = true + end + end + if first_time_entry then + local out = "" + if station:getDescription() ~= nil then + out = station:getDescription() + end + if station.comms_data ~= nil then + if station.comms_data.general ~= nil and station.comms_data.general ~= "" then + out = string.format(_("scienceDB","%s\n\nGeneral Information: %s"),out,station.comms_data.general) + end + if station.comms_data.history ~= nil and station.comms_data.history ~= "" then + out = string.format(_("scienceDB","%s\n\nHistory: %s"),out,station.comms_data.history) + end + end + if out ~= "" then + station_db:setLongDescription(out) + end + local station_type = station:getTypeName() + local size_value = "" + local small_station_key = _("scienceDB","Small Station") + local medium_station_key = _("scienceDB","Medium Station") + local large_station_key = _("scienceDB","Large Station") + local huge_station_key = _("scienceDB","Huge Station") + if station_type == small_station_key then + size_value = _("scienceDB","Small") + local small_db = queryScienceDatabase(stations_key,small_station_key) + if small_db ~= nil then + station_db:setImage(small_db:getImage()) + end + station_db:setModelDataName("space_station_4") + elseif station_type == medium_station_key then + size_value = _("scienceDB","Medium") + local medium_db = queryScienceDatabase(stations_key,medium_station_key) + if medium_db ~= nil then + station_db:setImage(medium_db:getImage()) + end + station_db:setModelDataName("space_station_3") + elseif station_type == large_station_key then + size_value = _("scienceDB","Large") + local large_db = queryScienceDatabase(stations_key,large_station_key) + if large_db ~= nil then + station_db:setImage(large_db:getImage()) + end + station_db:setModelDataName("space_station_2") + elseif station_type == huge_station_key then + size_value = _("scienceDB","Huge") + local huge_db = queryScienceDatabase(stations_key,huge_station_key) + if huge_db ~= nil then + station_db:setImage(huge_db:getImage()) + end + station_db:setModelDataName("space_station_1") + end + if size_value ~= "" then + local size_key = _("scienceDB","Size") + station_db:setKeyValue(size_key,size_value) + end + local belt_station = false + local outer_belt_station = false + local tertius_belt_station = false + for i,belt_station in ipairs(belt1Stations) do + if station == belt_station then + belt_station = true + break + end + end + if not belt_station then + for i,belt_station in ipairs(belt2Stations) do + if station == belt_station then + outer_belt_station = true + break + end + end + if not outer_belt_station then + for i,belt_station in ipairs(tertiusAsteroidStations) do + if station == belt_station then + tertius_belt_station = true + end + end + end + end + if belt_station then + local faction_key = _("scienceDB","Faction") + station_db:setKeyValue(faction_key,station:getFaction()) + local primary_orbit_key = _("scienceDB","Orbit around") + station_db:setKeyValue(primary_orbit_key,string.format(_("scienceDB","Star %s in inner asteroid belt"),planetSol:getCallSign())) + elseif outer_belt_station then + local faction_key = _("scienceDB","Faction") + station_db:setKeyValue(faction_key,station:getFaction()) + local primary_orbit_key = _("scienceDB","Orbit around") + station_db:setKeyValue(primary_orbit_key,string.format(_("scienceDB","Star %s in outer asteroid belt"),planetSol:getCallSign())) + elseif station == tertiusStation or tertius_belt_station then + local faction_key = _("scienceDB","Faction") + station_db:setKeyValue(faction_key,station:getFaction()) + local primary_orbit_key = _("scienceDB","Primary orbit") + station_db:setKeyValue(primary_orbit_key,string.format(_("scienceDB","Around planet %s"),planetTertius:getCallSign())) + local secondary_orbit_key = _("scienceDB","Secondary orbit") + station_db:setKeyValue(secondary_orbit_key,string.format(_("scienceDB","Planet %s orbits star %s"),planetTertius:getCallSign(),planetSol:getCallSign())) + elseif station == primusStation then + local faction_key = _("scienceDB","Faction") + station_db:setKeyValue(faction_key,station:getFaction()) + local primary_orbit_key = _("scienceDB","Primary orbit") + station_db:setKeyValue(primary_orbit_key,string.format(_("scienceDB","Around planet %s"),planetPrimus:getCallSign())) + local secondary_orbit_key = _("scienceDB","Secondary orbit") + station_db:setKeyValue(secondary_orbit_key,string.format(_("scienceDB","Planet %s orbits star %s"),planetPrimus:getCallSign(),planetSol:getCallSign())) + elseif station == secondusStations[1] or station == secondusStations[2] or station == secondusStations[3] then + local faction_key = _("scienceDB","Faction") + station_db:setKeyValue(faction_key,station:getFaction()) + local primary_orbit_key = _("scienceDB","Primary orbit") + station_db:setKeyValue(primary_orbit_key,string.format(_("scienceDB","Around planet %s"),planetSecondus:getCallSign())) + local secondary_orbit_key = _("scienceDB","Secondary orbit") + station_db:setKeyValue(secondary_orbit_key,string.format(_("scienceDB","Planet %s orbits star %s"),planetSecondus:getCallSign(),planetSol:getCallSign())) + else + local location_key = _("scienceDB","Location, Faction") + station_db:setKeyValue(location_key,string.format("%s, %s",station:getSectorName(),station:getFaction())) + end + end + local dock_service = "" + local service_count = 0 + if station:getSharesEnergyWithDocked() then + dock_service = _("scienceDB","share energy") + service_count = service_count + 1 + end + if station:getRepairDocked() then + if dock_service == "" then + dock_service = _("scienceDB","repair hull") + else + dock_service = string.format(_("scienceDB","%s, repair hull"),dock_service) + end + service_count = service_count + 1 + end + if station:getRestocksScanProbes() then + if dock_service == "" then + dock_service = _("scienceDB","replenish probes") + else + dock_service = string.format(_("scienceDB","%s, replenish probes"),dock_service) + end + service_count = service_count + 1 + end + if service_count > 0 then + local docking_services_key = _("scienceDB","Docking Services") + if service_count == 1 then + docking_services_key = _("scienceDB","Docking Service") + end + station_db:setKeyValue(docking_services_key,dock_service) + end + if station.comms_data ~= nil then + if station.comms_data.weapon_available ~= nil then + if station.comms_data.weapon_cost == nil then + station.comms_data.weapon_cost = { + Homing = math.random(1,4), + HVLI = math.random(1,3), + Mine = math.random(2,5), + Nuke = math.random(12,18), + EMP = math.random(7,13), + } + end + if station.comms_data.reputation_cost_multipliers == nil then + station.comms_data.reputation_cost_multipliers = { + friend = 1.0, + neutral = 3.0, + } + end + local station_missiles = { + {name = "Homing", key = _("scienceDB","Restock Homing")}, + {name = "HVLI", key = _("scienceDB","Restock HVLI")}, + {name = "Mine", key = _("scienceDB","Restock Mine")}, + {name = "Nuke", key = _("scienceDB","Restock Nuke")}, + {name = "EMP", key = _("scienceDB","Restock EMP")}, + } + for i,sm in ipairs(station_missiles) do + if station.comms_data.weapon_available[sm.name] then + if station.comms_data.weapon_cost[sm.name] ~= nil then + local val = string.format(_("scienceDB","%i reputation each"),math.ceil(station.comms_data.weapon_cost[sm.name] * station.comms_data.reputation_cost_multipliers["friend"])) + station_db:setKeyValue(sm.key,val) + end + end + end + end + if station.comms_data.service_available ~= nil then + local general_service = { + {name = "supplydrop", key = _("scienceDB","Drop supplies")}, + {name = "reinforcements", key = _("scienceDB","Standard reinforcements")}, + {name = "hornet_reinforcements", key = _("scienceDB","Hornet reinforcements")}, + {name = "phobos_reinforcements", key = _("scienceDB","Phobos reinforcements")}, + {name = "amk3_reinforcements", key = _("scienceDB","Adder3 reinforcements")}, + {name = "amk8_reinforcements", key = _("scienceDB","Adder8 reinforcements")}, + {name = "shield_overcharge", key = _("scienceDB","Shield overcharge")}, + } + for i,gs in ipairs(general_service) do + if station.comms_data.service_available[gs.name] then + if station.comms_data.service_cost[gs.name] ~= nil then + local val = string.format(_("scienceDB","%s reputation"),station.comms_data.service_cost[gs.name]) + station_db:setKeyValue(gs.key,val) + end + end + end + end + if station.comms_data.goods ~= nil then + for good, details in pairs(station.comms_data.goods) do + if details.quantity > 0 then + local sell_key = string.format(_("scienceDB","Sells %s"),good) + local sell_value = string.format(_("scienceDB","for %s reputation each"),details.cost) + station_db:setKeyValue(sell_key,sell_value) + end + end + end + end + temp_artifact:destroy() +end ------------------------- -- Ship communication -- ------------------------- @@ -7436,82 +5322,82 @@ function commsShip() end function friendlyComms(comms_data) if comms_data.friendlyness < 20 then - setCommsMessage(_("shipAssist-comms", "What do you want?")); + setCommsMessage(_("ship-comms","What do you want?")) else - setCommsMessage(_("shipAssist-comms", "Sir, how can we assist?")); + setCommsMessage(_("ship-comms","Sir, how can we assist?")) end - addCommsReply(_("shipAssist-comms", "Defend a waypoint"), function() + addCommsReply(_("ship-comms","Defend a waypoint"), function() if comms_source:getWaypointCount() == 0 then - setCommsMessage(_("shipAssist-comms", "No waypoints set. Please set a waypoint first.")); + setCommsMessage(_("ship-comms","No waypoints set. Please set a waypoint first.")) addCommsReply(_("Back"), commsShip) else - setCommsMessage(_("shipAssist-comms", "Which waypoint should we defend?")); + setCommsMessage(_("ship-comms","Which waypoint should we defend?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("shipAssist-comms", "Defend WP %d"), n), function() + addCommsReply(string.format(_("ship-comms","Defend waypoint %s"),n), function() comms_target:orderDefendLocation(comms_source:getWaypoint(n)) - setCommsMessage(string.format(_("shipAssist-comms", "We are heading to assist at WP %d."), n)); + setCommsMessage(string.format(_("ship-comms","We are heading to assist at waypoint %s."),n)) addCommsReply(_("Back"), commsShip) end) end end end) if comms_data.friendlyness > 0.2 then - addCommsReply(_("shipAssist-comms", "Assist me"), function() - setCommsMessage(_("shipAssist-comms", "Heading toward you to assist.")); + addCommsReply(_("ship-comms","Assist me"), function() + setCommsMessage(_("ship-comms","Heading toward you to assist.")) comms_target:orderDefendTarget(comms_source) addCommsReply(_("Back"), commsShip) end) end - addCommsReply(_("shipAssist-comms", "Report status"), function() - msg = string.format(_("shipAssist-comms", "Hull: %d%%\n"), math.floor(comms_target:getHull() / comms_target:getHullMax() * 100)) + addCommsReply(_("ship-comms","Report status"), function() + msg = _("ship-comms","Hull: ") .. math.floor(comms_target:getHull() / comms_target:getHullMax() * 100) .. "%\n" local shields = comms_target:getShieldCount() if shields == 1 then - msg = msg .. string.format(_("shipAssist-comms", "Shield: %d%%\n"), math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100)) + msg = msg .. _("ship-comms","Shield: ") .. math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100) .. "%\n" elseif shields == 2 then - msg = msg .. string.format(_("shipAssist-comms", "Front Shield: %d%%\n"), math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100)) - msg = msg .. string.format(_("shipAssist-comms", "Rear Shield: %d%%\n"), math.floor(comms_target:getShieldLevel(1) / comms_target:getShieldMax(1) * 100)) + msg = msg .. _("ship-comms","Front Shield: ") .. math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100) .. "%\n" + msg = msg .. _("ship-comms","Rear Shield: ") .. math.floor(comms_target:getShieldLevel(1) / comms_target:getShieldMax(1) * 100) .. "%\n" else for n=0,shields-1 do - msg = msg .. string.format(_("shipAssist-comms", "Shield %s: %d%%\n"), n, math.floor(comms_target:getShieldLevel(n) / comms_target:getShieldMax(n) * 100)) + msg = msg .. _("ship-comms","Shield ") .. n .. ": " .. math.floor(comms_target:getShieldLevel(n) / comms_target:getShieldMax(n) * 100) .. "%\n" end end local missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} for i, missile_type in ipairs(missile_types) do if comms_target:getWeaponStorageMax(missile_type) > 0 then - msg = msg .. string.format(_("shipAssist-comms", "%s Missiles: %d/%d\n"), missile_type, math.floor(comms_target:getWeaponStorage(missile_type)), math.floor(comms_target:getWeaponStorageMax(missile_type))) + msg = msg .. missile_type .. _("ship-comms"," Missiles: ") .. math.floor(comms_target:getWeaponStorage(missile_type)) .. "/" .. math.floor(comms_target:getWeaponStorageMax(missile_type)) .. "\n" end end setCommsMessage(msg); addCommsReply(_("Back"), commsShip) end) - for _, obj in ipairs(comms_target:getObjectsInRange(5000)) do + for i, obj in ipairs(comms_target:getObjectsInRange(5000)) do if obj.typeName == "SpaceStation" and not comms_target:isEnemy(obj) then - addCommsReply(string.format(_("shipAssist-comms", "Dock at %s"), obj:getCallSign()), function() - setCommsMessage(string.format(_("shipAssist-comms", "Docking at %s."), obj:getCallSign())); + addCommsReply(string.format(_("ship-comms","Dock at %s"),obj:getCallSign()), function() + setCommsMessage(string.format(_("ship-comms","Docking at %s."),obj:getCallSign())) comms_target:orderDock(obj) addCommsReply(_("Back"), commsShip) end) end end if comms_target.fleet ~= nil then - addCommsReply(string.format(_("shipAssist-comms", "Direct %s"),comms_target.fleet), function() - setCommsMessage(string.format(_("shipAssist-comms", "What command should be given to %s?"),comms_target.fleet)) - addCommsReply(_("shipAssist-comms", "Report hull and shield status"), function() - msg = _("shipAssist-comms", "Fleet status:") - for _, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do + addCommsReply(string.format(_("ship-comms","Direct %s"),comms_target.fleet), function() + setCommsMessage(string.format(_("ship-comms","What command should be given to %s?"),comms_target.fleet)) + addCommsReply(_("ship-comms","Report hull and shield status"), function() + msg = _("ship-comms","Fleet status:") + for i, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do if fleetShip ~= nil and fleetShip:isValid() then - msg = msg .. string.format(_("shipAssist-comms", "\n %s:"), fleetShip:getCallSign()) - msg = msg .. string.format(_("shipAssist-comms", "\n Hull: %d%%"), math.floor(fleetShip:getHull() / fleetShip:getHullMax() * 100)) + msg = msg .. "\n " .. fleetShip:getCallSign() .. ":" + msg = msg .. _("ship-comms","\n Hull: ") .. math.floor(fleetShip:getHull() / fleetShip:getHullMax() * 100) .. "%" local shields = fleetShip:getShieldCount() if shields == 1 then - msg = msg .. string.format(_("shipAssist-comms", "\n Shield: %d%%"), math.floor(fleetShip:getShieldLevel(0) / fleetShip:getShieldMax(0) * 100)) + msg = msg .. _("ship-comms","\n Shield: ") .. math.floor(fleetShip:getShieldLevel(0) / fleetShip:getShieldMax(0) * 100) .. "%" else - msg = msg .. _("shipAssist-comms", "\n Shields: ") + msg = msg .. _("ship-comms","\n Shields: ") if shields == 2 then - msg = msg .. string.format(_("shipAssist-comms", "Front: %d%% Rear: %d%%"), math.floor(fleetShip:getShieldLevel(0) / fleetShip:getShieldMax(0) * 100), math.floor(fleetShip:getShieldLevel(1) / fleetShip:getShieldMax(1) * 100)) + msg = msg .. _("ship-comms","Front:") .. math.floor(fleetShip:getShieldLevel(0) / fleetShip:getShieldMax(0) * 100) .. _("ship-comms","% Rear:") .. math.floor(fleetShip:getShieldLevel(1) / fleetShip:getShieldMax(1) * 100) .. "%" else for n=0,shields-1 do - msg = msg .. string.format(_("shipAssist-comms", " %d:%d%%"), n, math.floor(fleetShip:getShieldLevel(n) / fleetShip:getShieldMax(n) * 100)) + msg = msg .. " " .. n .. ":" .. math.floor(fleetShip:getShieldLevel(n) / fleetShip:getShieldMax(n) * 100) .. "%" end end end @@ -7520,49 +5406,49 @@ function friendlyComms(comms_data) setCommsMessage(msg) addCommsReply(_("Back"), commsShip) end) - addCommsReply(_("shipAssist-comms", "Report missile status"), function() - msg = _("shipAssist-comms", "Fleet missile status:") - for _, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do + addCommsReply(_("ship-comms","Report missile status"), function() + msg = _("ship-comms","Fleet missile status:") + for i, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do if fleetShip ~= nil and fleetShip:isValid() then - msg = msg .. string.format(_("shipAssist-comms", "\n %s:"), fleetShip:getCallSign()) + msg = msg .. "\n " .. fleetShip:getCallSign() .. ":" local missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'} missileMsg = "" - for _, missile_type in ipairs(missile_types) do + for j, missile_type in ipairs(missile_types) do if fleetShip:getWeaponStorageMax(missile_type) > 0 then - missileMsg = missileMsg .. string.format(_("shipAssist-comms", "\n %s: %d/%d"), missile_type, math.floor(fleetShip:getWeaponStorage(missile_type)), math.floor(fleetShip:getWeaponStorageMax(missile_type))) + missileMsg = missileMsg .. "\n " .. missile_type .. ": " .. math.floor(fleetShip:getWeaponStorage(missile_type)) .. "/" .. math.floor(fleetShip:getWeaponStorageMax(missile_type)) end end if missileMsg ~= "" then - msg = msg .. string.format(_("shipAssist-comms", "\n Missiles: %s"), missileMsg) + msg = msg .. _("ship-comms","\n Missiles: ") .. missileMsg end end end setCommsMessage(msg) addCommsReply(_("Back"), commsShip) end) - addCommsReply(_("shipAssist-comms", "Assist me"), function() - for _, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do + addCommsReply(_("ship-comms","Assist me"), function() + for i, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do if fleetShip ~= nil and fleetShip:isValid() then fleetShip:orderDefendTarget(comms_source) end end - setCommsMessage(string.format(_("shipAssist-comms", "%s heading toward you to assist"),comms_target.fleet)) + setCommsMessage(string.format(_("ship-comms","%s heading toward you to assist"),comms_target.fleet)) addCommsReply(_("Back"), commsShip) end) - addCommsReply(_("shipAssist-comms", "Defend a waypoint"), function() + addCommsReply(_("ship-comms","Defend a waypoint"), function() if comms_source:getWaypointCount() == 0 then - setCommsMessage(_("shipAssist-comms", "No waypoints set. Please set a waypoint first.")); + setCommsMessage(_("ship-comms","No waypoints set. Please set a waypoint first.")) addCommsReply(_("Back"), commsShip) else - setCommsMessage(_("shipAssist-comms", "Which waypoint should we defend?")); + setCommsMessage(_("ship-comms","Which waypoint should we defend?")) for n=1,comms_source:getWaypointCount() do - addCommsReply(string.format(_("shipAssist-comms", "Defend WP %d"), n), function() - for _, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do + addCommsReply(string.format(_("ship-comms","Defend waypoint %s"),n), function() + for i, fleetShip in ipairs(friendlyDefensiveFleetList[comms_target.fleet]) do if fleetShip ~= nil and fleetShip:isValid() then fleetShip:orderDefendLocation(comms_source:getWaypoint(n)) end end - setCommsMessage(string.format(_("shipAssist-comms", "We are heading to assist at WP %d."), n)); + setCommsMessage(string.format(_("ship-comms","We are heading to assist at waypoint %s."),n)) addCommsReply(_("Back"), commsShip) end) end @@ -7578,7 +5464,7 @@ function friendlyComms(comms_data) if comms_source.goods ~= nil and comms_source.goods.luxury ~= nil and comms_source.goods.luxury > 0 then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 and good ~= "luxury" then - addCommsReply(string.format(_("trade-comms", "Trade luxury for %s"),good), function() + addCommsReply(string.format(_("ship-comms","Trade luxury for %s"),good), function() goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then comms_source.goods = {} @@ -7588,7 +5474,7 @@ function friendlyComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.goods.luxury = comms_source.goods.luxury - 1 - setCommsMessage(string.format(_("trade-comms", "Traded your luxury for %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Traded your luxury for %s from %s"),good,comms_target:getCallSign())) addCommsReply(_("Back"), commsShip) end) end @@ -7598,7 +5484,7 @@ function friendlyComms(comms_data) if comms_source.cargo > 0 then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() if comms_source:takeReputationPoints(goodData.cost) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7609,9 +5495,9 @@ function friendlyComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation for purchase")) end addCommsReply(_("Back"), commsShip) end) @@ -7623,7 +5509,7 @@ function friendlyComms(comms_data) if shipType:find("Goods") ~= nil or shipType:find("Equipment") ~= nil then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() if comms_source:takeReputationPoints(goodData.cost) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7634,9 +5520,9 @@ function friendlyComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation for purchase")) end addCommsReply(_("Back"), commsShip) end) @@ -7645,7 +5531,7 @@ function friendlyComms(comms_data) else --not goods or equipment freighter for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() if comms_source:takeReputationPoints(goodData.cost*2) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7656,9 +5542,9 @@ function friendlyComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation for purchase")) end addCommsReply(_("Back"), commsShip) end) @@ -7671,7 +5557,7 @@ function friendlyComms(comms_data) if shipType:find("Goods") ~= nil or shipType:find("Equipment") ~= nil then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() if comms_source:takeReputationPoints(goodData.cost*2) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7682,9 +5568,9 @@ function friendlyComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation for purchase")) end addCommsReply(_("Back"), commsShip) end) @@ -7694,13 +5580,13 @@ function friendlyComms(comms_data) end --player has room to get goods end --various friendliness choices else --not close enough to sell - addCommsReply(_("trade-comms", "Do you have cargo you might sell?"), function() + addCommsReply(_("ship-comms","Do you have cargo you might sell?"), function() local goodCount = 0 - local cargoMsg = _("trade-comms", "We've got ") + local cargoMsg = _("ship-comms","We've got ") for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then if goodCount > 0 then - cargoMsg = cargoMsg .. _("trade-comms", ", ") .. good + cargoMsg = cargoMsg .. ", " .. good else cargoMsg = cargoMsg .. good end @@ -7708,7 +5594,7 @@ function friendlyComms(comms_data) goodCount = goodCount + goodData.quantity end if goodCount == 0 then - cargoMsg = cargoMsg .. _("trade-comms", "nothing") + cargoMsg = cargoMsg .. _("ship-comms","nothing") end setCommsMessage(cargoMsg) addCommsReply(_("Back"), commsShip) @@ -7720,48 +5606,52 @@ end function enemyComms(comms_data) if comms_data.friendlyness > 50 then local faction = comms_target:getFaction() - local taunt_option = _("shipEnemy-comms", "We will see to your destruction!") - local taunt_success_reply = _("shipEnemy-comms", "Your bloodline will end here!") - local taunt_failed_reply = _("shipEnemy-comms", "Your feeble threats are meaningless.") - if faction == "Kraylor" then - setCommsMessage(_("shipEnemy-comms", "Ktzzzsss.\nYou will DIEEee weaklingsss!")); - local kraylorTauntChoice = math.random(1,3) - if kraylorTauntChoice == 1 then - taunt_option = _("shipEnemy-comms", "We will destroy you") - taunt_success_reply = _("shipEnemy-comms", "We think not. It is you who will experience destruction!") - elseif kraylorTauntChoice == 2 then - taunt_option = _("shipEnemy-comms", "You have no honor") - taunt_success_reply = _("shipEnemy-comms", "Your insult has brought our wrath upon you. Prepare to die.") - taunt_failed_reply = _("shipEnemy-comms", "Your comments about honor have no meaning to us") - else - taunt_option = _("shipEnemy-comms", "We pity your pathetic race") - taunt_success_reply = _("shipEnemy-comms", "Pathetic? You will regret your disparagement!") - taunt_failed_reply = _("shipEnemy-comms", "We don't care what you think of us") - end - elseif faction == "Arlenians" then - setCommsMessage(_("shipEnemy-comms", "We wish you no harm, but will harm you if we must.\nEnd of transmission.")); - elseif faction == "Exuari" then - setCommsMessage(_("shipEnemy-comms", "Stay out of our way, or your death will amuse us extremely!")); - elseif faction == "Ghosts" then - setCommsMessage(_("shipEnemy-comms", "One zero one.\nNo binary communication detected.\nSwitching to universal speech.\nGenerating appropriate response for target from human language archives.\n:Do not cross us:\nCommunication halted.")); - taunt_option = _("shipEnemy-comms", "EXECUTE: SELFDESTRUCT") - taunt_success_reply = _("shipEnemy-comms", "Rogue command received. Targeting source.") - taunt_failed_reply = _("shipEnemy-comms", "External command ignored.") - elseif faction == "Ktlitans" then - setCommsMessage(_("shipEnemy-comms", "The hive suffers no threats. Opposition to any of us is opposition to us all.\nStand down or prepare to donate your corpses toward our nutrition.")); - taunt_option = _("shipEnemy-comms", "") - taunt_success_reply = _("shipEnemy-comms", "We do not need permission to pluck apart such an insignificant threat.") - taunt_failed_reply = _("shipEnemy-comms", "The hive has greater priorities than exterminating pests.") + local messages = { + ["Kraylor"] = _("shipEnemy-comms","Ktzzzsss.\nYou will DIEEee weaklingsss!"), + ["Arlenians"] = _("shipEnemy-comms","We wish you no harm, but will harm you if we must.\nEnd of transmission."), + ["Exuari"] = _("shipEnemy-comms","Stay out of our way, or your death will amuse us extremely!"), + ["Ghosts"] = _("shipEnemy-comms","One zero one.\nNo binary communication detected.\nSwitching to universal speech.\nGenerating appropriate response for target from human language archives.\n:Do not cross us:\nCommunication halted."), + ["Ktlitans"] = _("shipEnemy-comms","The hive suffers no threats. Opposition to any of us is opposition to us all.\nStand down or prepare to donate your corpses toward our nutrition."), + ["TSN"] = _("shipEnemy-comms","State your business"), + ["USN"] = _("shipEnemy-comms","What do you want? (not that we care)"), + ["CUF"] = _("shipEnemy-comms","Don't waste our time"), + ["Default"] = _("shipEnemy-comms","Mind your own business!"), + } + if messages[faction] ~= nil then + setCommsMessage(messages[faction]) else - setCommsMessage(_("shipEnemy-comms", "Mind your own business!")); - end + setCommsMessage(messages["Default"]) + end + local taunts = { + ["Kraylor"] = { + {option = _("shipEnemy-comms","We will destroy you"), success = _("shipEnemy-comms","We think not. It is you who will experience destruction!"), fail = _("shipEnemy-comms","Your feeble threats are meaningless.")}, + {option = _("shipEnemy-comms","You have no honor"), success = _("shipEnemy-comms","Your insult has brought our wrath upon you. Prepare to die."), fail = _("shipEnemy-comms","Your comments about honor have no meaning to us")}, + {option = _("shipEnemy-comms","We pity your pathetic race"), success = _("shipEnemy-comms","Pathetic? You will regret your disparagement!"), fail = _("shipEnemy-comms","We don't care what you think of us")}, + }, + ["Ghosts"] = { + {option = _("shipEnemy-comms","EXECUTE: SELFDESTRUCT"), success = _("shipEnemy-comms","Rogue command received. Targeting source."), fail = _("shipEnemy-comms","External command ignored.")}, + {option = _("shipEnemy-comms","EXECUTE: AUTOSHUTDOWN"), success = _("shipEnemy-comms","Target source of rogue command."), fail = _("shipEnemy-comms","External command failed security check.")}, + }, + ["Ktlitans"] = { + {option = _("shipEnemy-comms",""), success = _("shipEnemy-comms","We do not need permission to pluck apart such an insignificant threat."),fail = _("shipEnemy-comms","The hive has greater priorities than exterminating pests.")}, + {option = _("shipEnemy-comms","Your queen tastes like elderberries"), success = _("shipEnemy-comms","You will be destroyed for the honor of the hive."), fail = _("shipEnemy-comms","Maggots are beneath our notice.")}, + }, + ["Default"] = { + {option = _("shipEnemy-comms","We will see to your destruction!"), success = _("shipEnemy-comms","Your bloodline will end here!"), fail = _("shipEnemy-comms","Your feeble threats are meaningless.")}, + }, + } comms_data.friendlyness = comms_data.friendlyness - random(0, 10) - addCommsReply(taunt_option, function() - if random(0, 100) < 30 then + local taunt = taunts["Default"][1] + if taunts[faction] ~= nil then + taunt = taunts[faction][math.random(1,#taunts[faction])] + end + addCommsReply(taunt.option,function() + string.format("") + if random(1,100) < 30 then comms_target:orderAttack(comms_source) - setCommsMessage(taunt_success_reply); + setCommsMessage(taunt.success) else - setCommsMessage(taunt_failed_reply); + setCommsMessage(taunt.fail) end end) return true @@ -7771,14 +5661,14 @@ end function neutralComms(comms_data) local shipType = comms_target:getTypeName() if shipType:find("Freighter") ~= nil then - setCommsMessage(_("trade-comms", "Yes?")) - addCommsReply(_("trade-comms", "Do you have cargo you might sell?"), function() + setCommsMessage(_("ship-comms","Yes?")) + addCommsReply(_("ship-comms","Do you have cargo you might sell?"), function() local goodCount = 0 - local cargoMsg = _("trade-comms", "We've got ") + local cargoMsg = _("ship-comms","We've got ") for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then if goodCount > 0 then - cargoMsg = cargoMsg .. _("trade-comms", ", ") .. good + cargoMsg = cargoMsg .. ", " .. good else cargoMsg = cargoMsg .. good end @@ -7786,7 +5676,7 @@ function neutralComms(comms_data) goodCount = goodCount + goodData.quantity end if goodCount == 0 then - cargoMsg = cargoMsg .. _("trade-comms", "nothing") + cargoMsg = cargoMsg .. _("ship-comms","nothing") end setCommsMessage(cargoMsg) end) @@ -7796,7 +5686,7 @@ function neutralComms(comms_data) if shipType:find("Goods") ~= nil or shipType:find("Equipment") ~= nil then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost)), function() if comms_source:takeReputationPoints(goodData.cost) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7807,9 +5697,9 @@ function neutralComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsShip) end) @@ -7818,7 +5708,7 @@ function neutralComms(comms_data) else for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() if comms_source:takeReputationPoints(goodData.cost*2) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7829,9 +5719,9 @@ function neutralComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsShip) end) @@ -7842,7 +5732,7 @@ function neutralComms(comms_data) if shipType:find("Goods") ~= nil or shipType:find("Equipment") ~= nil then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*2)), function() if comms_source:takeReputationPoints(goodData.cost*2) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7853,9 +5743,9 @@ function neutralComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsShip) end) @@ -7864,7 +5754,7 @@ function neutralComms(comms_data) else for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*3)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*3)), function() if comms_source:takeReputationPoints(goodData.cost*3) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7875,9 +5765,9 @@ function neutralComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsShip) end) @@ -7888,7 +5778,7 @@ function neutralComms(comms_data) if shipType:find("Goods") ~= nil or shipType:find("Equipment") ~= nil then for good, goodData in pairs(comms_data.goods) do if goodData.quantity > 0 then - addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good,math.floor(goodData.cost*3)), function() + addCommsReply(string.format(_("ship-comms","Buy one %s for %i reputation"),good,math.floor(goodData.cost*3)), function() if comms_source:takeReputationPoints(goodData.cost*3) then goodData.quantity = goodData.quantity - 1 if comms_source.goods == nil then @@ -7899,9 +5789,9 @@ function neutralComms(comms_data) end comms_source.goods[good] = comms_source.goods[good] + 1 comms_source.cargo = comms_source.cargo - 1 - setCommsMessage(string.format(_("trade-comms", "Purchased %s from %s"),good,comms_target:getCallSign())) + setCommsMessage(string.format(_("ship-comms","Purchased %s from %s"),good,comms_target:getCallSign())) else - setCommsMessage(_("needRep-comms", "Insufficient reputation for purchase")) + setCommsMessage(_("needRep-comms","Insufficient reputation")) end addCommsReply(_("Back"), commsShip) end) @@ -7913,9 +5803,9 @@ function neutralComms(comms_data) end --close enough to sell else --not a freighter if comms_data.friendlyness > 50 then - setCommsMessage(_("ship-comms", "Sorry, we have no time to chat with you.\nWe are on an important mission.")); + setCommsMessage(_("ship-comms","Sorry, we have no time to chat with you.\nWe are on an important mission.")) else - setCommsMessage(_("ship-comms", "We have nothing for you.\nGood day.")); + setCommsMessage(_("ship-comms","We have nothing for you.\nGood day.")) end end --end non-freighter communications else branch return true @@ -7933,16 +5823,33 @@ function playVoice(clip) end function handleVoiceQueue(delta) if #voice_queue > 0 then - voice_delay = voice_delay - delta - if voice_delay < 0 then - playSoundFile(string.format("audio/scenario/48/sa_48_%s.ogg",voice_queue[1])) - voice_delay = voice_delay + delta + 1 + voice_clips[voice_queue[1]] + if voice_play_time == nil then + playSoundFile(string.format("scenario48audio/sa_48_%s.ogg",voice_queue[1])) + if voice_clips[voice_queue[1]] == nil then + print("In the voice clips list,",voice_queue[1],"comes up as nil. Setting play gap to 20") + voice_play_time = getScenarioTime() + 20 + else + voice_play_time = getScenarioTime() + voice_clips[voice_queue[1]] + 1 + end table.remove(voice_queue,1) + elseif getScenarioTime() > voice_play_time then + voice_play_time = nil end - else - voice_delay = delta end end +-- create amount of object_type, at a distance between dist_min and dist_max around the point (x0, y0) +function placeRandomAsteroidAroundPoint(object_type, amount, dist_min, dist_max, x0, y0) + for n=1,amount do + local r = random(0, 360) + local distance = random(dist_min, dist_max) + local x = x0 + math.cos(r / 180 * math.pi) * distance + local y = y0 + math.sin(r / 180 * math.pi) * distance + local obj = object_type():setPosition(x, y) + if obj.typeName == "Asteroid" or obj.typeName == "VisualAsteroid" then + obj:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + end + end +end function createRandomAlongArc(object_type, amount, x, y, distance, startArc, clockwiseEndArc, randomize) -- Create amount of objects of type object_type along arc -- Center defined by x and y @@ -7958,22 +5865,32 @@ function createRandomAlongArc(object_type, amount, x, y, distance, startArc, clo clockwiseEndArc = clockwiseEndArc + 360 arcLen = arcLen + 360 end + local obj = nil if amount > arcLen then for ndex=1,arcLen do local radialPoint = startArc+ndex local pointDist = distance + random(-randomize,randomize) - object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + obj = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + if obj.typeName == "Asteroid" or obj.typeName == "VisualAsteroid" then + obj:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + end end for ndex=1,amount-arcLen do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) - object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + obj = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + if obj.typeName == "Asteroid" or obj.typeName == "VisualAsteroid" then + obj:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + end end else for ndex=1,amount do radialPoint = random(startArc,clockwiseEndArc) pointDist = distance + random(-randomize,randomize) - object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + obj = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist) + if obj.typeName == "Asteroid" or obj.typeName == "VisualAsteroid" then + obj:setSize(random(3,100) + random(3,100) + random(3,100) + random(3,500)) + end end end end @@ -8029,41 +5946,44 @@ function spawnEnemies(xOrigin, yOrigin, danger, enemyFaction, perimeter_min, per if danger == nil then danger = 1 end - local enemyStrength = math.max(danger * difficulty * playerPower(),5) + local enemyStrength = math.max(danger * enemy_power * playerPower(),5) local enemyPosition = 0 local sp = irandom(400,900) --random spacing of spawned group local deployConfig = random(1,100) --randomly choose between squarish formation and hexagonish formation local enemyList = {} - -- Reminder: stsl and stnl are ship template score and name list while enemyStrength > 0 do - local shipTemplateType = irandom(1,#stsl) - while stsl[shipTemplateType] > enemyStrength * 1.1 + 5 do - shipTemplateType = irandom(1,#stsl) - end - local ship = CpuShip():setFaction(enemyFaction):setTemplate(stnl[shipTemplateType]):orderRoaming() + local template_pool = {} + for template,info in pairs(ship_template) do + if info.strength <= (enemyStrength * 1.1 + 5) then + table.insert(template_pool,template) + end + end + local selected_template = template_pool[math.random(1,#template_pool)] + local ship = ship_template[selected_template].create(enemyFaction,selected_template) + ship:orderRoaming() if enemyFaction == "Kraylor" then - rawKraylorShipStrength = rawKraylorShipStrength + stsl[shipTemplateType] + rawKraylorShipStrength = rawKraylorShipStrength + ship_template[selected_template].strength ship:onDestruction(kraylorVesselDestroyed) elseif enemyFaction == "Human Navy" then - rawHumanShipStrength = rawHumanShipStrength + stsl[shipTemplateType] + rawHumanShipStrength = rawHumanShipStrength + ship_template[selected_template].strength ship:onDestruction(humanVesselDestroyed) elseif enemyFaction == "Exuari" then - rawExuariShipStrength = rawExuariShipStrength + stsl[shipTemplateType] + rawExuariShipStrength = rawExuariShipStrength + ship_template[selected_template].strength ship:onDestruction(exuariVesselDestroyed) elseif enemyFaction == "Arlenians" then - rawArlenianShipStrength = rawArlenianShipStrength + stsl[shipTemplateType] + rawArlenianShipStrength = rawArlenianShipStrength + ship_template[selected_template].strength ship:onDestruction(arlenianVesselDestroyed) end enemyPosition = enemyPosition + 1 if deployConfig < 50 then - ship:setPosition(xOrigin+fleetPosDelta1x[enemyPosition]*sp,yOrigin+fleetPosDelta1y[enemyPosition]*sp) + ship:setPosition(xOrigin + formation_delta["square"].x[enemyPosition] * sp, yOrigin + formation_delta["square"].y[enemyPosition] * sp) else - ship:setPosition(xOrigin+fleetPosDelta2x[enemyPosition]*sp,yOrigin+fleetPosDelta2y[enemyPosition]*sp) + ship:setPosition(xOrigin + formation_delta["hexagonal"].x[enemyPosition] * sp, yOrigin + formation_delta["hexagonal"].y[enemyPosition] * sp) end ship:setCommsScript(""):setCommsFunction(commsShip) ship:setCallSign(generateCallSign(nil,enemyFaction)) table.insert(enemyList, ship) - enemyStrength = enemyStrength - stsl[shipTemplateType] + enemyStrength = enemyStrength - ship_template[selected_template].strength end if perimeter_min ~= nil then local enemy_angle = random(0,360) @@ -8072,7 +5992,7 @@ function spawnEnemies(xOrigin, yOrigin, danger, enemyFaction, perimeter_min, per if perimeter_max ~= nil then perimeter_deploy = random(perimeter_min,perimeter_max) end - for _, enemy in pairs(enemyList) do + for i, enemy in pairs(enemyList) do local dex, dey = vectorFromAngle(enemy_angle,perimeter_deploy) enemy:setPosition(xOrigin+dex, yOrigin+dey) enemy_angle = enemy_angle + circle_increment @@ -8177,11 +6097,11 @@ function healthCheck(delta) p:setRepairCrewCount(1) if p:hasPlayerAtPosition("Engineering") then local repairCrewRecovery = "repairCrewRecovery" - p:addCustomMessage("Engineering",repairCrewRecovery,_("repairCrew-msgEngineer", "Medical team has revived one of your repair crew")) + p:addCustomMessage("Engineering",repairCrewRecovery,_("msgEngineer","Medical team has revived one of your repair crew")) end if p:hasPlayerAtPosition("Engineering+") then local repairCrewRecoveryPlus = "repairCrewRecoveryPlus" - p:addCustomMessage("Engineering+",repairCrewRecoveryPlus,_("repairCrew-msgEngineer+", "Medical team has revived one of your repair crew")) + p:addCustomMessage("Engineering+",repairCrewRecoveryPlus,_("msgEngineer+","Medical team has revived one of your repair crew")) end resetPreviousSystemHealth(p) end @@ -8219,22 +6139,22 @@ function crewFate(p, fatalityChance) p:setRepairCrewCount(p:getRepairCrewCount() - 1) if p:hasPlayerAtPosition("Engineering") then local repairCrewFatality = "repairCrewFatality" - p:addCustomMessage("Engineering",repairCrewFatality,_("repairCrew-msgEngineer", "One of your repair crew has perished")) + p:addCustomMessage("Engineering",repairCrewFatality,_("msgEngineer","One of your repair crew has perished")) end if p:hasPlayerAtPosition("Engineering+") then local repairCrewFatalityPlus = "repairCrewFatalityPlus" - p:addCustomMessage("Engineering+",repairCrewFatalityPlus,_("repairCrew-msgEngineer+", "One of your repair crew has perished")) + p:addCustomMessage("Engineering+",repairCrewFatalityPlus,_("msgEngineer+","One of your repair crew has perished")) end else if random(1,100) < 50 then p:setRepairCrewCount(p:getRepairCrewCount() - 1) if p:hasPlayerAtPosition("Engineering") then local repairCrewFatality = "repairCrewFatality" - p:addCustomMessage("Engineering",repairCrewFatality,_("repairCrew-msgEngineer", "One of your repair crew has perished")) + p:addCustomMessage("Engineering",repairCrewFatality,_("msgEngineer","One of your repair crew has perished")) end if p:hasPlayerAtPosition("Engineering+") then local repairCrewFatalityPlus = "repairCrewFatalityPlus" - p:addCustomMessage("Engineering+",repairCrewFatalityPlus,_("repairCrew-msgEngineer+", "One of your repair crew has perished")) + p:addCustomMessage("Engineering+",repairCrewFatalityPlus,_("msgEngineer+","One of your repair crew has perished")) end else local current_coolant = p:getMaxCoolant() @@ -8245,11 +6165,11 @@ function crewFate(p, fatalityChance) end if p:hasPlayerAtPosition("Engineering") then local coolantLoss = "coolantLoss" - p:addCustomMessage("Engineering",coolantLoss,_("coolant-msgEngineer", "Damage has caused a loss of coolant")) + p:addCustomMessage("Engineering",coolantLoss,_("msgEngineer","Damage has caused a loss of coolant")) end if p:hasPlayerAtPosition("Engineering+") then local coolantLossPlus = "coolantLossPlus" - p:addCustomMessage("Engineering+",coolantLossPlus,_("coolant-msgEngineer+", "Damage has caused a loss of coolant")) + p:addCustomMessage("Engineering+",coolantLossPlus,_("msgEngineer+","Damage has caused a loss of coolant")) end end end @@ -8257,766 +6177,86 @@ function crewFate(p, fatalityChance) end -- Gain or lose coolant from nebula functions function coolantNebulae(delta) - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local inside_gain_coolant_nebula = false - for i=1,#coolant_nebula do - if distance(p,coolant_nebula[i]) < 5000 then - if coolant_nebula[i].lose then - p:setMaxCoolant(p:getMaxCoolant()*coolant_loss) - end - if coolant_nebula[i].gain then - inside_gain_coolant_nebula = true - end + for i,p in ipairs(getActivePlayerShips()) do + local inside_gain_coolant_nebula = false + for i,neb in ipairs(coolant_nebula) do + if distance(p,neb) < 5000 then + if neb.lose then + p:setMaxCoolant(p:getMaxCoolant()*coolant_loss) end - end - if inside_gain_coolant_nebula then - if p.get_coolant then - if p.coolant_trigger then - updateCoolantGivenPlayer(p, delta) - end - else - if p:hasPlayerAtPosition("Engineering") then - p.get_coolant_button = "get_coolant_button" - p:addCustomButton("Engineering",p.get_coolant_button,_("coolant-buttonEngineer", "Get Coolant"),get_coolant_function[pidx]) - p.get_coolant = true - end - if p:hasPlayerAtPosition("Engineering+") then - p.get_coolant_button_plus = "get_coolant_button_plus" - p:addCustomButton("Engineering+",p.get_coolant_button_plus,_("coolant-buttonEngineer+", "Get Coolant"),get_coolant_function[pidx]) - p.get_coolant = true - end - end - else - p.get_coolant = false - p.coolant_trigger = false - p.configure_coolant_timer = nil - p.deploy_coolant_timer = nil - if p:hasPlayerAtPosition("Engineering") then - if p.get_coolant_button ~= nil then - p:removeCustom(p.get_coolant_button) - p.get_coolant_button = nil - end - if p.gather_coolant ~= nil then - p:removeCustom(p.gather_coolant) - p.gather_coolant = nil - end - end - if p:hasPlayerAtPosition("Engineering+") then - if p.get_coolant_button_plus ~= nil then - p:removeCustom(p.get_coolant_button_plus) - p.get_coolant_button_plus = nil - end - if p.gather_coolant_plus ~= nil then - p:removeCustom(p.gather_coolant_plus) - p.gather_coolant_plus = nil - end + if neb.gain then + inside_gain_coolant_nebula = true end end end - end -end -function updateCoolantGivenPlayer(p, delta) - if p.configure_coolant_timer == nil then - p.configure_coolant_timer = delta + 5 - end - p.configure_coolant_timer = p.configure_coolant_timer - delta - if p.configure_coolant_timer < 0 then - if p.deploy_coolant_timer == nil then - p.deploy_coolant_timer = delta + 5 - end - p.deploy_coolant_timer = p.deploy_coolant_timer - delta - if p.deploy_coolant_timer < 0 then - gather_coolant_status = _("coolant-tabEngineer", "Gathering Coolant") - p:setMaxCoolant(p:getMaxCoolant() + coolant_gain) - else - gather_coolant_status = string.format(_("coolant-tabEngineer", "Deploying Collectors %i"),math.ceil(p.deploy_coolant_timer - delta)) - end - else - gather_coolant_status = string.format(_("coolant-tabEngineer", "Configuring Collectors %i"),math.ceil(p.configure_coolant_timer - delta)) - end - if p:hasPlayerAtPosition("Engineering") then - p.gather_coolant = "gather_coolant" - p:addCustomInfo("Engineering",p.gather_coolant,gather_coolant_status) - end - if p:hasPlayerAtPosition("Engineering+") then - p.gather_coolant_plus = "gather_coolant_plus" - p:addCustomInfo("Engineering",p.gather_coolant_plus,gather_coolant_status) - end -end -function getCoolantGivenPlayer(p) - if p:hasPlayerAtPosition("Engineering") then - if p.get_coolant_button ~= nil then - p:removeCustom(p.get_coolant_button) - p.get_coolant_button = nil - end - end - if p:hasPlayerAtPosition("Engineering+") then - if p.get_coolant_button_plus ~= nil then - p:removeCustom(p.get_coolant_button_plus) - p.get_coolant_button_plus = nil - end - end - p.coolant_trigger = true -end -function getCoolant1() - local p = getPlayerShip(1) - getCoolantGivenPlayer(p) -end -function getCoolant2() - local p = getPlayerShip(2) - getCoolantGivenPlayer(p) -end -function getCoolant3() - local p = getPlayerShip(3) - getCoolantGivenPlayer(p) -end -function getCoolant4() - local p = getPlayerShip(4) - getCoolantGivenPlayer(p) -end -function getCoolant5() - local p = getPlayerShip(5) - getCoolantGivenPlayer(p) -end -function getCoolant6() - local p = getPlayerShip(6) - getCoolantGivenPlayer(p) -end -function getCoolant7() - local p = getPlayerShip(7) - getCoolantGivenPlayer(p) -end -function getCoolant8() - local p = getPlayerShip(8) - getCoolantGivenPlayer(p) -end ------------------------------------- --- Generate call sign functions -- ------------------------------------- -function generateCallSign(prefix,faction) - if faction == nil then - if prefix == nil then - prefix = generateCallSignPrefix() - end - else - if prefix == nil then - prefix = getFactionPrefix(faction) - else - prefix = string.format("%s %s",getFactionPrefix(faction),prefix) - end - end - suffix_index = suffix_index + math.random(1,3) - if suffix_index > 999 then - suffix_index = 1 - end - return string.format("%s%i",prefix,suffix_index) -end -function generateCallSignPrefix(length) - if call_sign_prefix_pool == nil then - call_sign_prefix_pool = {} - prefix_length = prefix_length + 1 - if prefix_length > 3 then - prefix_length = 1 - end - fillPrefixPool() - end - if length == nil then - length = prefix_length - end - local prefix_index = 0 - local prefix = "" - for i=1,length do - if #call_sign_prefix_pool < 1 then - fillPrefixPool() - end - prefix_index = math.random(1,#call_sign_prefix_pool) - prefix = prefix .. call_sign_prefix_pool[prefix_index] - table.remove(call_sign_prefix_pool,prefix_index) - end - return prefix -end -function fillPrefixPool() - for i=1,26 do - table.insert(call_sign_prefix_pool,string.char(i+64)) - end -end -function getFactionPrefix(faction) - local faction_prefix = nil - if faction == "Kraylor" then - if kraylor_names == nil then - setKraylorNames() - else - if #kraylor_names < 1 then - setKraylorNames() + if inside_gain_coolant_nebula then + if p.coolant_trigger then + updateCoolantGivenPlayer(p, delta) + else + p.get_coolant_button_eng = "get_coolant_button_eng" + p:addCustomButton("Engineering",p.get_coolant_button_eng,_("coolant-buttonEngineer","Get Coolant"),function() + string.format("") + getCoolantGivenPlayer(p) + end,7) + p.get_coolant_button_epl = "get_coolant_button_epl" + p:addCustomButton("Engineering+",p.get_coolant_button_epl,_("coolant-buttonEngineer+","Get Coolant"),function() + string.format("") + getCoolantGivenPlayer(p) + end,7) end - end - local kraylor_name_choice = math.random(1,#kraylor_names) - faction_prefix = kraylor_names[kraylor_name_choice] - table.remove(kraylor_names,kraylor_name_choice) - end - if faction == "Exuari" then - if exuari_names == nil then - setExuariNames() else - if #exuari_names < 1 then - setExuariNames() + p.coolant_trigger = false + p.coolant_deploy_time = nil + p.coolant_configure_time = nil + if p.get_coolant_button_eng ~= nil then + p:removeCustom(p.get_coolant_button_eng) + p.get_coolant_button_eng = nil + end + if p.get_coolant_button_epl ~= nil then + p:removeCustom(p.get_coolant_button_epl) + p.get_coolant_button_epl = nil + end + if p.gather_coolant_banner_eng ~= nil then + p:removeCustom(p.gather_coolant_banner_eng) + p.gather_coolant_banner_eng = nil + end + if p.gather_coolant_banner_epl ~= nil then + p:removeCustom(p.gather_coolant_banner_epl) + p.gather_coolant_banner_epl = nil end end - local exuari_name_choice = math.random(1,#exuari_names) - faction_prefix = exuari_names[exuari_name_choice] - table.remove(exuari_names,exuari_name_choice) end - if faction == "Ghosts" then - if ghosts_names == nil then - setGhostsNames() - else - if #ghosts_names < 1 then - setGhostsNames() - end - end - local ghosts_name_choice = math.random(1,#ghosts_names) - faction_prefix = ghosts_names[ghosts_name_choice] - table.remove(ghosts_names,ghosts_name_choice) +end +function updateCoolantGivenPlayer(p, delta) + if p.coolant_configure_time == nil then + p.coolant_configure_time = getScenarioTime() + 5 end - if faction == "Independent" then - if independent_names == nil then - setIndependentNames() - else - if #independent_names < 1 then - setIndependentNames() - end + p.gather_coolant_status = string.format(_("coolant-tabEngineer","Configuring Collectors %i"),math.ceil(p.coolant_configure_time - getScenarioTime())) + if getScenarioTime() > p.coolant_configure_time then + if p.coolant_deploy_time == nil then + p.coolant_deploy_time = getScenarioTime() + 5 + end + p.gather_coolant_status = string.format(_("coolant-tabEngineer","Deploying Collectors %i"),math.ceil(p.coolant_deploy_time - getScenarioTime())) + if getScenarioTime() > p.coolant_deploy_time then + p.gather_coolant_status = _("coolant-tabEngineer","Gathering Coolant") + p:setMaxCoolant(p:getMaxCoolant() + coolant_gain) end - local independent_name_choice = math.random(1,#independent_names) - faction_prefix = independent_names[independent_name_choice] - table.remove(independent_names,independent_name_choice) end - if faction == "Human Navy" then - if human_names == nil then - setHumanNames() - else - if #human_names < 1 then - setHumanNames() - end - end - local human_name_choice = math.random(1,#human_names) - faction_prefix = human_names[human_name_choice] - table.remove(human_names,human_name_choice) - end - if faction_prefix == nil then - faction_prefix = generateCallSignPrefix() - end - return faction_prefix -end -function setGhostsNames() - ghosts_names = {} - table.insert(ghosts_names,"Abstract") - table.insert(ghosts_names,"Ada") - table.insert(ghosts_names,"Assemble") - table.insert(ghosts_names,"Assert") - table.insert(ghosts_names,"Backup") - table.insert(ghosts_names,"BASIC") - table.insert(ghosts_names,"Big Iron") - table.insert(ghosts_names,"BigEndian") - table.insert(ghosts_names,"Binary") - table.insert(ghosts_names,"Bit") - table.insert(ghosts_names,"Block") - table.insert(ghosts_names,"Boot") - table.insert(ghosts_names,"Branch") - table.insert(ghosts_names,"BTree") - table.insert(ghosts_names,"Bubble") - table.insert(ghosts_names,"Byte") - table.insert(ghosts_names,"Capacitor") - table.insert(ghosts_names,"Case") - table.insert(ghosts_names,"Chad") - table.insert(ghosts_names,"Charge") - table.insert(ghosts_names,"COBOL") - table.insert(ghosts_names,"Collate") - table.insert(ghosts_names,"Compile") - table.insert(ghosts_names,"Control") - table.insert(ghosts_names,"Construct") - table.insert(ghosts_names,"Cycle") - table.insert(ghosts_names,"Data") - table.insert(ghosts_names,"Debug") - table.insert(ghosts_names,"Decimal") - table.insert(ghosts_names,"Decision") - table.insert(ghosts_names,"Default") - table.insert(ghosts_names,"DIMM") - table.insert(ghosts_names,"Displacement") - table.insert(ghosts_names,"Edge") - table.insert(ghosts_names,"Exit") - table.insert(ghosts_names,"Factor") - table.insert(ghosts_names,"Flag") - table.insert(ghosts_names,"Float") - table.insert(ghosts_names,"Flow") - table.insert(ghosts_names,"FORTRAN") - table.insert(ghosts_names,"Fullword") - table.insert(ghosts_names,"GIGO") - table.insert(ghosts_names,"Graph") - table.insert(ghosts_names,"Hack") - table.insert(ghosts_names,"Hash") - table.insert(ghosts_names,"Halfword") - table.insert(ghosts_names,"Hertz") - table.insert(ghosts_names,"Hexadecimal") - table.insert(ghosts_names,"Indicator") - table.insert(ghosts_names,"Initialize") - table.insert(ghosts_names,"Integer") - table.insert(ghosts_names,"Integrate") - table.insert(ghosts_names,"Interrupt") - table.insert(ghosts_names,"Java") - table.insert(ghosts_names,"Lisp") - table.insert(ghosts_names,"List") - table.insert(ghosts_names,"Logic") - table.insert(ghosts_names,"Loop") - table.insert(ghosts_names,"Lua") - table.insert(ghosts_names,"Magnetic") - table.insert(ghosts_names,"Mask") - table.insert(ghosts_names,"Memory") - table.insert(ghosts_names,"Mnemonic") - table.insert(ghosts_names,"Micro") - table.insert(ghosts_names,"Model") - table.insert(ghosts_names,"Nibble") - table.insert(ghosts_names,"Octal") - table.insert(ghosts_names,"Order") - table.insert(ghosts_names,"Operator") - table.insert(ghosts_names,"Parameter") - table.insert(ghosts_names,"Pascal") - table.insert(ghosts_names,"Pattern") - table.insert(ghosts_names,"Pixel") - table.insert(ghosts_names,"Point") - table.insert(ghosts_names,"Polygon") - table.insert(ghosts_names,"Port") - table.insert(ghosts_names,"Process") - table.insert(ghosts_names,"RAM") - table.insert(ghosts_names,"Raster") - table.insert(ghosts_names,"Rate") - table.insert(ghosts_names,"Redundant") - table.insert(ghosts_names,"Reference") - table.insert(ghosts_names,"Refresh") - table.insert(ghosts_names,"Register") - table.insert(ghosts_names,"Resistor") - table.insert(ghosts_names,"ROM") - table.insert(ghosts_names,"Routine") - table.insert(ghosts_names,"Ruby") - table.insert(ghosts_names,"SAAS") - table.insert(ghosts_names,"Sequence") - table.insert(ghosts_names,"Share") - table.insert(ghosts_names,"Silicon") - table.insert(ghosts_names,"SIMM") - table.insert(ghosts_names,"Socket") - table.insert(ghosts_names,"Sort") - table.insert(ghosts_names,"Structure") - table.insert(ghosts_names,"Switch") - table.insert(ghosts_names,"Symbol") - table.insert(ghosts_names,"Trace") - table.insert(ghosts_names,"Transistor") - table.insert(ghosts_names,"Value") - table.insert(ghosts_names,"Vector") - table.insert(ghosts_names,"Version") - table.insert(ghosts_names,"View") - table.insert(ghosts_names,"WYSIWYG") - table.insert(ghosts_names,"XOR") -end -function setExuariNames() - exuari_names = {} - table.insert(exuari_names,"Astonester") - table.insert(exuari_names,"Ametripox") - table.insert(exuari_names,"Bakeltevex") - table.insert(exuari_names,"Baropledax") - table.insert(exuari_names,"Batongomox") - table.insert(exuari_names,"Bekilvimix") - table.insert(exuari_names,"Benoglopok") - table.insert(exuari_names,"Bilontipur") - table.insert(exuari_names,"Bolictimik") - table.insert(exuari_names,"Bomagralax") - table.insert(exuari_names,"Buteldefex") - table.insert(exuari_names,"Catondinab") - table.insert(exuari_names,"Chatorlonox") - table.insert(exuari_names,"Culagromik") - table.insert(exuari_names,"Dakimbinix") - table.insert(exuari_names,"Degintalix") - table.insert(exuari_names,"Dimabratax") - table.insert(exuari_names,"Dokintifix") - table.insert(exuari_names,"Dotandirex") - table.insert(exuari_names,"Dupalgawax") - table.insert(exuari_names,"Ekoftupex") - table.insert(exuari_names,"Elidranov") - table.insert(exuari_names,"Fakobrovox") - table.insert(exuari_names,"Femoplabix") - table.insert(exuari_names,"Fibatralax") - table.insert(exuari_names,"Fomartoran") - table.insert(exuari_names,"Gateldepex") - table.insert(exuari_names,"Gamutrewal") - table.insert(exuari_names,"Gesanterux") - table.insert(exuari_names,"Gimardanax") - table.insert(exuari_names,"Hamintinal") - table.insert(exuari_names,"Holangavak") - table.insert(exuari_names,"Igolpafik") - table.insert(exuari_names,"Inoklomat") - table.insert(exuari_names,"Jamewtibex") - table.insert(exuari_names,"Jepospagox") - table.insert(exuari_names,"Kajortonox") - table.insert(exuari_names,"Kapogrinix") - table.insert(exuari_names,"Kelitravax") - table.insert(exuari_names,"Kipaldanax") - table.insert(exuari_names,"Kodendevex") - table.insert(exuari_names,"Kotelpedex") - table.insert(exuari_names,"Kutandolak") - table.insert(exuari_names,"Lakirtinix") - table.insert(exuari_names,"Lapoldinek") - table.insert(exuari_names,"Lavorbonox") - table.insert(exuari_names,"Letirvinix") - table.insert(exuari_names,"Lowibromax") - table.insert(exuari_names,"Makintibix") - table.insert(exuari_names,"Makorpohox") - table.insert(exuari_names,"Matoprowox") - table.insert(exuari_names,"Mefinketix") - table.insert(exuari_names,"Motandobak") - table.insert(exuari_names,"Nakustunux") - table.insert(exuari_names,"Nequivonax") - table.insert(exuari_names,"Nitaldavax") - table.insert(exuari_names,"Nobaldorex") - table.insert(exuari_names,"Obimpitix") - table.insert(exuari_names,"Owaklanat") - table.insert(exuari_names,"Pakendesik") - table.insert(exuari_names,"Pazinderix") - table.insert(exuari_names,"Pefoglamuk") - table.insert(exuari_names,"Pekirdivix") - table.insert(exuari_names,"Potarkadax") - table.insert(exuari_names,"Pulendemex") - table.insert(exuari_names,"Quatordunix") - table.insert(exuari_names,"Rakurdumux") - table.insert(exuari_names,"Ralombenik") - table.insert(exuari_names,"Regosporak") - table.insert(exuari_names,"Retordofox") - table.insert(exuari_names,"Rikondogox") - table.insert(exuari_names,"Rokengelex") - table.insert(exuari_names,"Rutarkadax") - table.insert(exuari_names,"Sakeldepex") - table.insert(exuari_names,"Setiftimix") - table.insert(exuari_names,"Siparkonal") - table.insert(exuari_names,"Sopaldanax") - table.insert(exuari_names,"Sudastulux") - table.insert(exuari_names,"Takeftebex") - table.insert(exuari_names,"Taliskawit") - table.insert(exuari_names,"Tegundolex") - table.insert(exuari_names,"Tekintipix") - table.insert(exuari_names,"Tiposhomox") - table.insert(exuari_names,"Tokaldapax") - table.insert(exuari_names,"Tomuglupux") - table.insert(exuari_names,"Tufeldepex") - table.insert(exuari_names,"Unegremek") - table.insert(exuari_names,"Uvendipax") - table.insert(exuari_names,"Vatorgopox") - table.insert(exuari_names,"Venitribix") - table.insert(exuari_names,"Vobalterix") - table.insert(exuari_names,"Wakintivix") - table.insert(exuari_names,"Wapaltunix") - table.insert(exuari_names,"Wekitrolax") - table.insert(exuari_names,"Wofarbanax") - table.insert(exuari_names,"Xeniplofek") - table.insert(exuari_names,"Yamaglevik") - table.insert(exuari_names,"Yakildivix") - table.insert(exuari_names,"Yegomparik") - table.insert(exuari_names,"Zapondehex") - table.insert(exuari_names,"Zikandelat") -end -function setKraylorNames() - kraylor_names = {} - table.insert(kraylor_names,"Abroten") - table.insert(kraylor_names,"Ankwar") - table.insert(kraylor_names,"Bakrik") - table.insert(kraylor_names,"Belgor") - table.insert(kraylor_names,"Benkop") - table.insert(kraylor_names,"Blargvet") - table.insert(kraylor_names,"Bloktarg") - table.insert(kraylor_names,"Bortok") - table.insert(kraylor_names,"Bredjat") - table.insert(kraylor_names,"Chankret") - table.insert(kraylor_names,"Chatork") - table.insert(kraylor_names,"Chokarp") - table.insert(kraylor_names,"Cloprak") - table.insert(kraylor_names,"Coplek") - table.insert(kraylor_names,"Cortek") - table.insert(kraylor_names,"Daltok") - table.insert(kraylor_names,"Darpik") - table.insert(kraylor_names,"Dastek") - table.insert(kraylor_names,"Dotark") - table.insert(kraylor_names,"Drambok") - table.insert(kraylor_names,"Duntarg") - table.insert(kraylor_names,"Earklat") - table.insert(kraylor_names,"Ekmit") - table.insert(kraylor_names,"Fakret") - table.insert(kraylor_names,"Fapork") - table.insert(kraylor_names,"Fawtrik") - table.insert(kraylor_names,"Fenturp") - table.insert(kraylor_names,"Feplik") - table.insert(kraylor_names,"Figront") - table.insert(kraylor_names,"Floktrag") - table.insert(kraylor_names,"Fonkack") - table.insert(kraylor_names,"Fontreg") - table.insert(kraylor_names,"Foondrap") - table.insert(kraylor_names,"Frotwak") - table.insert(kraylor_names,"Gastonk") - table.insert(kraylor_names,"Gentouk") - table.insert(kraylor_names,"Gonpruk") - table.insert(kraylor_names,"Gortak") - table.insert(kraylor_names,"Gronkud") - table.insert(kraylor_names,"Hewtang") - table.insert(kraylor_names,"Hongtag") - table.insert(kraylor_names,"Hortook") - table.insert(kraylor_names,"Indrut") - table.insert(kraylor_names,"Iprant") - table.insert(kraylor_names,"Jakblet") - table.insert(kraylor_names,"Jonket") - table.insert(kraylor_names,"Jontot") - table.insert(kraylor_names,"Kandarp") - table.insert(kraylor_names,"Kantrok") - table.insert(kraylor_names,"Kiptak") - table.insert(kraylor_names,"Kortrant") - table.insert(kraylor_names,"Krontgat") - table.insert(kraylor_names,"Lobreck") - table.insert(kraylor_names,"Lokrant") - table.insert(kraylor_names,"Lomprok") - table.insert(kraylor_names,"Lutrank") - table.insert(kraylor_names,"Makrast") - table.insert(kraylor_names,"Moklahft") - table.insert(kraylor_names,"Morpug") - table.insert(kraylor_names,"Nagblat") - table.insert(kraylor_names,"Nokrat") - table.insert(kraylor_names,"Nomek") - table.insert(kraylor_names,"Notark") - table.insert(kraylor_names,"Ontrok") - table.insert(kraylor_names,"Orkpent") - table.insert(kraylor_names,"Peechak") - table.insert(kraylor_names,"Plogrent") - table.insert(kraylor_names,"Pokrint") - table.insert(kraylor_names,"Potarg") - table.insert(kraylor_names,"Prangtil") - table.insert(kraylor_names,"Quagbrok") - table.insert(kraylor_names,"Quimprill") - table.insert(kraylor_names,"Reekront") - table.insert(kraylor_names,"Ripkort") - table.insert(kraylor_names,"Rokust") - table.insert(kraylor_names,"Rontrait") - table.insert(kraylor_names,"Saknep") - table.insert(kraylor_names,"Sengot") - table.insert(kraylor_names,"Skitkard") - table.insert(kraylor_names,"Skopgrek") - table.insert(kraylor_names,"Sletrok") - table.insert(kraylor_names,"Slorknat") - table.insert(kraylor_names,"Spogrunk") - table.insert(kraylor_names,"Staklurt") - table.insert(kraylor_names,"Stonkbrant") - table.insert(kraylor_names,"Swaktrep") - table.insert(kraylor_names,"Tandrok") - table.insert(kraylor_names,"Takrost") - table.insert(kraylor_names,"Tonkrut") - table.insert(kraylor_names,"Torkrot") - table.insert(kraylor_names,"Trablok") - table.insert(kraylor_names,"Trokdin") - table.insert(kraylor_names,"Unkelt") - table.insert(kraylor_names,"Urjop") - table.insert(kraylor_names,"Vankront") - table.insert(kraylor_names,"Vintrep") - table.insert(kraylor_names,"Volkerd") - table.insert(kraylor_names,"Vortread") - table.insert(kraylor_names,"Wickurt") - table.insert(kraylor_names,"Xokbrek") - table.insert(kraylor_names,"Yeskret") - table.insert(kraylor_names,"Zacktrope") -end -function setIndependentNames() - independent_names = {} - table.insert(independent_names,"Akdroft") --faux Kraylor - table.insert(independent_names,"Bletnik") --faux Kraylor - table.insert(independent_names,"Brogfent") --faux Kraylor - table.insert(independent_names,"Cruflech") --faux Kraylor - table.insert(independent_names,"Dengtoct") --faux Kraylor - table.insert(independent_names,"Fiklerg") --faux Kraylor - table.insert(independent_names,"Groftep") --faux Kraylor - table.insert(independent_names,"Hinkflort") --faux Kraylor - table.insert(independent_names,"Irklesht") --faux Kraylor - table.insert(independent_names,"Jotrak") --faux Kraylor - table.insert(independent_names,"Kargleth") --faux Kraylor - table.insert(independent_names,"Lidroft") --faux Kraylor - table.insert(independent_names,"Movrect") --faux Kraylor - table.insert(independent_names,"Nitrang") --faux Kraylor - table.insert(independent_names,"Poklapt") --faux Kraylor - table.insert(independent_names,"Raknalg") --faux Kraylor - table.insert(independent_names,"Stovtuk") --faux Kraylor - table.insert(independent_names,"Trongluft") --faux Kraylor - table.insert(independent_names,"Vactremp") --faux Kraylor - table.insert(independent_names,"Wunklesp") --faux Kraylor - table.insert(independent_names,"Yentrilg") --faux Kraylor - table.insert(independent_names,"Zeltrag") --faux Kraylor - table.insert(independent_names,"Avoltojop") --faux Exuari - table.insert(independent_names,"Bimartarax") --faux Exuari - table.insert(independent_names,"Cidalkapax") --faux Exuari - table.insert(independent_names,"Darongovax") --faux Exuari - table.insert(independent_names,"Felistiyik") --faux Exuari - table.insert(independent_names,"Gopendewex") --faux Exuari - table.insert(independent_names,"Hakortodox") --faux Exuari - table.insert(independent_names,"Jemistibix") --faux Exuari - table.insert(independent_names,"Kilampafax") --faux Exuari - table.insert(independent_names,"Lokuftumux") --faux Exuari - table.insert(independent_names,"Mabildirix") --faux Exuari - table.insert(independent_names,"Notervelex") --faux Exuari - table.insert(independent_names,"Pekolgonex") --faux Exuari - table.insert(independent_names,"Rifaltabax") --faux Exuari - table.insert(independent_names,"Sobendeyex") --faux Exuari - table.insert(independent_names,"Tinaftadax") --faux Exuari - table.insert(independent_names,"Vadorgomax") --faux Exuari - table.insert(independent_names,"Wilerpejex") --faux Exuari - table.insert(independent_names,"Yukawvalak") --faux Exuari - table.insert(independent_names,"Zajiltibix") --faux Exuari - table.insert(independent_names,"Alter") --faux Ghosts - table.insert(independent_names,"Assign") --faux Ghosts - table.insert(independent_names,"Brain") --faux Ghosts - table.insert(independent_names,"Break") --faux Ghosts - table.insert(independent_names,"Boundary") --faux Ghosts - table.insert(independent_names,"Code") --faux Ghosts - table.insert(independent_names,"Compare") --faux Ghosts - table.insert(independent_names,"Continue") --faux Ghosts - table.insert(independent_names,"Core") --faux Ghosts - table.insert(independent_names,"CRUD") --faux Ghosts - table.insert(independent_names,"Decode") --faux Ghosts - table.insert(independent_names,"Decrypt") --faux Ghosts - table.insert(independent_names,"Device") --faux Ghosts - table.insert(independent_names,"Encode") --faux Ghosts - table.insert(independent_names,"Encrypt") --faux Ghosts - table.insert(independent_names,"Event") --faux Ghosts - table.insert(independent_names,"Fetch") --faux Ghosts - table.insert(independent_names,"Frame") --faux Ghosts - table.insert(independent_names,"Go") --faux Ghosts - table.insert(independent_names,"IO") --faux Ghosts - table.insert(independent_names,"Interface") --faux Ghosts - table.insert(independent_names,"Kilo") --faux Ghosts - table.insert(independent_names,"Modify") --faux Ghosts - table.insert(independent_names,"Pin") --faux Ghosts - table.insert(independent_names,"Program") --faux Ghosts - table.insert(independent_names,"Purge") --faux Ghosts - table.insert(independent_names,"Retrieve") --faux Ghosts - table.insert(independent_names,"Store") --faux Ghosts - table.insert(independent_names,"Unit") --faux Ghosts - table.insert(independent_names,"Wire") --faux Ghosts -end -function setHumanNames() - human_names = {} - table.insert(human_names,"Achilles") - table.insert(human_names,"Agamemnon") - table.insert(human_names,"Aloof") - table.insert(human_names,"Atlas") - table.insert(human_names,"Bent Lament") - table.insert(human_names,"Blue Suede Shoes") - table.insert(human_names,"Blade") - table.insert(human_names,"Blue Sky") - table.insert(human_names,"Bright Light") - table.insert(human_names,"Charon") - table.insert(human_names,"Cloudy Sky") - table.insert(human_names,"Contingency") - table.insert(human_names,"Corner Office") - table.insert(human_names,"Cutter") - table.insert(human_names,"d'Artagnan") - table.insert(human_names,"Dante") - table.insert(human_names,"Dark Star") - table.insert(human_names,"Dreamer") - table.insert(human_names,"Eager Beaver") - table.insert(human_names,"Earnest Plea") - table.insert(human_names,"Exodous") - table.insert(human_names,"Expedition") - table.insert(human_names,"Faint Praise") - table.insert(human_names,"Far Cry") - table.insert(human_names,"Fashion Sense") - table.insert(human_names,"Final Frontier") - table.insert(human_names,"Finn") - table.insert(human_names,"First Try") - table.insert(human_names,"Free Lunch") - table.insert(human_names,"Formidable") - table.insert(human_names,"Gargantuan") - table.insert(human_names,"Glide Path") - table.insert(human_names,"Grand Plan") - table.insert(human_names,"Gremlin") - table.insert(human_names,"Guiding Light") - table.insert(human_names,"Hades") - table.insert(human_names,"Haughty") - table.insert(human_names,"Heavenly Body") - table.insert(human_names,"Hermes") - table.insert(human_names,"Highlander") - table.insert(human_names,"Holy Cow") - table.insert(human_names,"Hunter") - table.insert(human_names,"Hypertension") - table.insert(human_names,"Indifferent") - table.insert(human_names,"Insatiable") - table.insert(human_names,"Insidious") - table.insert(human_names,"Instigator") - table.insert(human_names,"Invincible") - table.insert(human_names,"J. B. Sloop") - table.insert(human_names,"Kipling") - table.insert(human_names,"Knowledge Fount") - table.insert(human_names,"Kremlin") - table.insert(human_names,"Lady Luck") - table.insert(human_names,"Last Chance") - table.insert(human_names,"Lurker") - table.insert(human_names,"Malady") - table.insert(human_names,"Manticore") - table.insert(human_names,"Mars") - table.insert(human_names,"Medusa") - table.insert(human_names,"Mercury") - table.insert(human_names,"Minnow") - table.insert(human_names,"Morpheus") - table.insert(human_names,"Murphy's Law") - table.insert(human_names,"Murphy's Corollary") - table.insert(human_names,"Mystery") - table.insert(human_names,"Near Horizon") - table.insert(human_names,"Near Term") - table.insert(human_names,"Neo") - table.insert(human_names,"Nightshade") - table.insert(human_names,"Nineva") - table.insert(human_names,"North Star") - table.insert(human_names,"Occam's Razor") - table.insert(human_names,"Opulent") - table.insert(human_names,"Ostentatious") - table.insert(human_names,"Outlander") - table.insert(human_names,"Pentagon") - table.insert(human_names,"Persistent") - table.insert(human_names,"Persnickety") - table.insert(human_names,"Phoebus") - table.insert(human_names,"Plumbline") - table.insert(human_names,"Portent") - table.insert(human_names,"Purple People Eater") - table.insert(human_names,"Quatrain") - table.insert(human_names,"Raider") - table.insert(human_names,"Reflection") - table.insert(human_names,"Red Baron") - table.insert(human_names,"Red Dawn") - table.insert(human_names,"Safari") - table.insert(human_names,"Sawyer") - table.insert(human_names,"Schoolgirl") - table.insert(human_names,"Scupper") - table.insert(human_names,"Seeker") - table.insert(human_names,"Shadow") - table.insert(human_names,"Silvery Moon") - table.insert(human_names,"Snake Eyes") - table.insert(human_names,"Solaris") - table.insert(human_names,"Stream of Consciousness") - table.insert(human_names,"Teluride") - table.insert(human_names,"Throckwaddle") - table.insert(human_names,"Tramp") - table.insert(human_names,"Tracker") - table.insert(human_names,"Tried and True") - table.insert(human_names,"Tripe") - table.insert(human_names,"Tripper") - table.insert(human_names,"Trixie") - table.insert(human_names,"Underbelly") - table.insert(human_names,"Urgent") - table.insert(human_names,"Vacuous") - table.insert(human_names,"Venial") - table.insert(human_names,"Veritas") - table.insert(human_names,"Ways and Means") - table.insert(human_names,"Weeping Widow") - table.insert(human_names,"Wolfman") + p.gather_coolant_banner_eng = "gather_coolant_banner_eng" + p:addCustomInfo("Engineering",p.gather_coolant_banner_eng,p.gather_coolant_status,8) + p.gather_coolant_banner_epl = "gather_coolant_banner_epl" + p:addCustomInfo("Engineering+",p.gather_coolant_banner_epl,p.gather_coolant_status,8) +end +function getCoolantGivenPlayer(p) + if p.get_coolant_button_eng ~= nil then + p:removeCustom(p.get_coolant_button_eng) + p.get_coolant_button_eng = nil + end + if p.get_coolant_button_epl ~= nil then + p:removeCustom(p.get_coolant_button_epl) + p.get_coolant_button_epl = nil + end + p.coolant_trigger = true end ---------------------------- -- Plot related functions -- @@ -9024,14 +6264,11 @@ end -- INITIAL PLOT Defend primus station function startDefendPrimusStation() setUpDefendPrimusStation = "done" - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("[%s orbiting %s currently in %s] We could use help taking care of nearby Exuari",primusStation:getCallSign(),planetPrimus:getCallSign(),primusStation:getSectorName()),"Magenta") - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","[%s orbiting %s currently in %s] We could use help taking care of nearby Exuari"),primusStation:getCallSign(),planetPrimus:getCallSign(),primusStation:getSectorName()),"Magenta") end playVoice("Skyler01") - primaryOrders = string.format("Remove Exuari near %s",primusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Remove Exuari near %s"),primusStation:getCallSign()) rawExuariShipStrength = 0 rawKraylorShipStrength = 0 rawHumanShipStrength = 0 @@ -9052,11 +6289,11 @@ function startDefendPrimusStation() pla = random(0,360) pmx, pmy = vectorFromAngle(pla,random(8000,12000)) enemyFleet = spawnEnemies(prx+pmx,pry+pmy,1,"Exuari") - for _, enemy in ipairs(enemyFleet) do + for i, enemy in ipairs(enemyFleet) do enemy:orderAttack(primusStation) end reinforcementInterval = 60 - reinforcementTimer = reinforcementInterval + reinforcementTimer = getScenarioTime() + reinforcementInterval reinforcementCount = 3 end function defendPrimusStation(delta) @@ -9068,16 +6305,15 @@ end function checkDefendPrimusStationEvents(delta) local perceivePlayer = false local remainingEnemyCount = 0 - for _, enemy in ipairs(enemyFleet) do + local perceived_player = nil + for i, enemy in ipairs(enemyFleet) do if enemy ~= nil and enemy:isValid() then remainingEnemyCount = remainingEnemyCount + 1 - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if distance(p,enemy) < 8000 then - perceivePlayer = true - break - end + for j,p in ipairs(getActivePlayerShips()) do + if distance(p,enemy) < 8000 then + perceivePlayer = true + perceived_player = p + break end end end @@ -9087,41 +6323,37 @@ function checkDefendPrimusStationEvents(delta) end if remainingEnemyCount > 0 then if perceivePlayer then - reinforcementTimer = reinforcementTimer - delta - if reinforcementTimer < 0 then + if getScenarioTime() > reinforcementTimer then if reinforcementCount > 0 then if reinforcementCount == 3 then - for _, enemy in ipairs(enemyFleet) do - enemy:orderAttack(p) + for i, enemy in ipairs(enemyFleet) do + enemy:orderAttack(perceived_player) end else - prx, pry = p:getPosition() + prx, pry = perceived_player:getPosition() pmx, pmy = vectorFromAngle(random(0,360),random(6000,8000)) local tempFleet = spawnEnemies(prx+pmx,pry+pmy,1,"Exuari") - for _, enemy in ipairs(tempFleet) do - enemy:orderAttack(p) + for i, enemy in ipairs(tempFleet) do + enemy:orderAttack(perceived_player) table.insert(enemyFleet,enemy) end end reinforcementCount = reinforcementCount - 1 end - reinforcementTimer = delta + reinforcementInterval + reinforcementTimer = getScenarioTime() + reinforcementInterval end else - reinforcementTimer = delta + reinforcementInterval + reinforcementTimer = getScenarioTime() + reinforcementInterval end else --no enemies remain if missionCloseMessage == nil then missionCloseMessage = "sent" - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("[%s] All station personnel thank you for your assistance. Dock with us for further orders",primusStation:getCallSign()),"Magenta") - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","[%s] All station personnel thank you for your assistance. Dock with us for further orders"),primusStation:getCallSign()),"Magenta") end playVoice("Skyler02") - primaryOrders = string.format("Dock with %s",primusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),primusStation:getCallSign()) end initialMission = false plot1 = nil @@ -9138,7 +6370,7 @@ function startOrbitingArtifact() artifactSensorDataGathered = false artifact_sensor_data_timer_button = false readingTimerMax = 20*difficulty - artifactSensorReadingTimer = readingTimerMax + artifactSensorReadingTimer = getScenarioTime() + readingTimerMax accumulatedReadings = 0 end function orbitingArtifact(delta) @@ -9149,97 +6381,89 @@ function orbitingArtifact(delta) end function checkOrbitingArtifactEvents(delta) if astronomerBoardedShip and belt1Artifact:isScannedByFaction("Human Navy") then - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if p.astronomer then - if not artifact_sensor_data_timer_button and not artifactSensorDataGathered then - artifact_sensor_data_timer_button = true - sensor_data_timer_button = "sensor_data_timer_button" - p:addCustomButton("Relay",sensor_data_timer_button,_("-buttonRelay", "Polly Scan Time"),function() - for pidx=1,8 do - p = getPlayerShip(pidx) - if p.astronomer then - p:addToShipLog(string.format("%.1f seconds remain to be scanned",artifactSensorReadingTimer),"Yellow") - end - end - end) - end - local sensor_status = "Range" - if distance(p,belt1Artifact) < 1000 then - sensor_status = "In " .. sensor_status - local batchMsg = false - if not artifactInvestigateRange then - artifactInvestigateRange = true - p:addToShipLog(string.format("[Polly Hobbs] We are in range for additional sensor readings. Gathering data now. We will need to stay in range for %s seconds to complete the sensor readings",readingTimerMax),"Magenta") - playVoice(string.format("Polly01%i",readingTimerMax)) - end - artifactSensorReadingTimer = artifactSensorReadingTimer - delta - if pollyDiagnostic then print("In range. Timer: " .. artifactSensorReadingTimer) end - if artifactSensorReadingTimer < 0 then - artifactSensorDataGathered = true - if analyzeGatheredDataMsg == nil then - analyzeGatheredDataMsg = "sent" - p:addToShipLog("[Polly Hobbs] The data gathering phase is complete. Analyzing data","Magenta") - playVoice("Polly04") - artifactDataAnalysisTimer = delta + random(10,20) - end - end - else - sensor_status = "Out of " .. sensor_status - --artifactSensorReadingTimer = delta + readingTimerMax - artifactSensorReadingTimer = delta + artifactSensorReadingTimer - if artifactSensorReadingTimer > readingTimerMax then - artifactSensorReadingTimer = readingTimerMax + local player_with_astronomer = nil + for i,p in ipairs(getActivePlayerShips()) do + if p.astronomer then + player_with_astronomer = p + local remaining_scan_time = artifactSensorReadingTimer - getScenarioTime() + if not artifact_sensor_data_timer_button and not artifactSensorDataGathered then + artifact_sensor_data_timer_button = true + sensor_data_timer_button = "sensor_data_timer_button" + p:addCustomButton("Relay",sensor_data_timer_button,_("buttonRelay","Polly Scan Time"),function() + string.format("") + if getScenarioTime() > artifactSensorReadingTimer then + p:addToShipLog(_("goal-shipLog","Scan complete","Yellow")) + else + p:addToShipLog(string.format(_("goal-shipLog","%.1f seconds remain to be scanned"),remaining_scan_time),"Yellow") end - if not batchMsg then - batchMsg = true - p:addToShipLog(string.format(_("-shipLog", "[Polly Hobbs] %.1f seconds remain to be scanned"),artifactSensorReadingTimer),"Magenta") + end,11) + end + local sensor_status = _("tabHelmTactical","Range") + if distance(p,belt1Artifact) < 1000 then + sensor_status = string.format(_("tabHelmTactical","In %s"),sensor_status) + if not artifactInvestigateRange then + artifactInvestigateRange = true + p:addToShipLog(string.format(_("goal-shipLog","[Polly Hobbs] We are in range for additional sensor readings. Gathering data now. We will need to stay in range for %s seconds to complete the sensor readings"),readingTimerMax),"Magenta") + playVoice(string.format("Polly01%i",readingTimerMax)) + end + if getScenarioTime() > artifactSensorReadingTimer then + artifactSensorDataGathered = true + if analyzeGatheredDataMsg == nil then + analyzeGatheredDataMsg = "sent" + p:addToShipLog(_("goal-shipLog","[Polly Hobbs] The data gathering phase is complete. Analyzing data."),"Magenta") + playVoice("Polly04") + artifactDataAnalysisTimer = getScenarioTime() + random(10,20) end - if pollyDiagnostic then print("Out of range. Timer: " .. artifactSensorReadingTimer) end end - sensor_status = string.format(_("-tabHelms&Tactical", "%s: %i"),sensor_status,math.ceil(artifactSensorReadingTimer)) - if p:hasPlayerAtPosition("Helms") then - p.sensor_status = "sensor_status" - p:addCustomInfo("Helms",p.sensor_status,sensor_status) - end - if p:hasPlayerAtPosition("Tactical") then - p.sensor_status_tactical = "sensor_status_tactical" - p:addCustomInfo("Tactical",p.sensor_status_tactical,sensor_status) + else + sensor_status = string.format(_("tabHelmTactical","Out of %s"),sensor_status) + artifactSensorReadingTimer = getScenarioTime() + readingTimerMax + remaining_scan_time = artifactSensorReadingTimer - getScenarioTime() + if batch_msg == nil then + batch_msg = "sent" + p:addToShipLog(string.format("[Polly Hobbs] %.1f seconds remain to be scanned",remaining_scan_time),"Magenta") end - if artifact_sensor_data_timer_button and artifactSensorDataGathered then - p:removeCustom(sensor_data_timer_button) - artifact_sensor_data_timer_button = false + end + remaining_scan_time = artifactSensorReadingTimer - getScenarioTime() + sensor_status = string.format("%s: %i",sensor_status,math.ceil(remaining_scan_time)) + if p:hasPlayerAtPosition("Helms") then + p.sensor_status = "sensor_status" + p:addCustomInfo("Helms",p.sensor_status,sensor_status,10) + end + if p:hasPlayerAtPosition("Tactical") then + p.sensor_status_tactical = "sensor_status_tactical" + p:addCustomInfo("Tactical",p.sensor_status_tactical,sensor_status,10) + end + if artifact_sensor_data_timer_button and artifactSensorDataGathered then + p:removeCustom(sensor_data_timer_button) + artifact_sensor_data_timer_button = false + end + if artifactSensorDataGathered then + if p.sensor_status ~= nil then + p:removeCustom(p.sensor_status) + p.sensor_status = nil end - if artifactSensorDataGathered then - if p.sensor_status ~= nil then - p:removeCustom(p.sensor_status) - p.sensor_status = nil - end - if p.sensor_status_tactical then - p:removeCustom(p.sensor_status_tactical) - p.sensor_status_tactical = nil - end + if p.sensor_status_tactical then + p:removeCustom(p.sensor_status_tactical) + p.sensor_status_tactical = nil end - break end - end + break + end end if artifactSensorDataGathered then - artifactDataAnalysisTimer = artifactDataAnalysisTimer - delta - if artifactDataAnalysisTimer < 0 then - if p ~= nil and p:isValid() then + if getScenarioTime() > artifactDataAnalysisTimer then + if player_with_astronomer ~= nil and player_with_astronomer:isValid() then if artifactAnalysisMessage == nil then artifactAnalysisMessage = "sent" - p:addToShipLog("[Polly Hobbs] Readings indicate that not only does this object not belong here physically, it seems to not belong here temporally either. Portions of it are phasing in and out of our time continuum","Magenta") + player_with_astronomer:addToShipLog(_("goal-shipLog","[Polly Hobbs] Readings indicate that not only does this object not belong here physically, it seems to not belong here temporally either. Portions of it are phasing in and out of our time continuum"),"Magenta") playVoice("Polly05") - independentReleaseTimer = delta + random(20,40) + independentReleaseTimer = getScenarioTime() + random(20,40) end end end if artifactAnalysisMessage == "sent" then - independentReleaseTimer = independentReleaseTimer - delta - if independentReleaseTimer < 0 and lostIndependentFleet == nil then + if getScenarioTime() > independentReleaseTimer and lostIndependentFleet == nil then lostIndependentFleet = {} local tempBase = nearStations(belt1Artifact,playerSpawnBandStations) local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"} @@ -9259,38 +6483,36 @@ function checkOrbitingArtifactEvents(delta) tempShip = CpuShip():setTemplate("Adder MK4"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsShip):setPosition(tpmx,tpmy):orderDock(tempBase) tempShip.targetDock = tempBase table.insert(lostIndependentFleet,tempShip) - releaseMessageTimer = delta + 5 + releaseMessageTimer = getScenarioTime() + 5 end end if lostIndependentFleet ~= nil then - releaseMessageTimer = releaseMessageTimer - delta - if releaseMessageTimer < 0 then + if getScenarioTime() > releaseMessageTimer then if releaseMsg == nil then releaseMsg = "sent" - if p ~= nil and p:isValid() then - p:addToShipLog("[Polly Hobbs] There was a surge of chroniton particles from the artifact just before those Independent ships appeared. I think they were somehow released or transported by the artifact","Magenta") + if player_with_astronomer ~= nil and player_with_astronomer:isValid() then + player_with_astronomer:addToShipLog(_("goal-shipLog","[Polly Hobbs] There was a surge of chroniton particles from the artifact just before those Independent ships appeared. I think they were somehow released or transported by the artifact"),"Magenta") playVoice("Polly06") - timeSignatureMessageTimer = delta + 10 + timeSignatureMessageTimer = getScenarioTime() + 10 end end end end if releaseMsg == "sent" then - timeSignatureMessageTimer = timeSignatureMessageTimer - delta - if timeSignatureMessageTimer < 0 then + if getScenarioTime() > timeSignatureMessageTimer then if timeSignatureMsg == nil then timeSignatureMsg = "sent" - if p ~= nil and p:isValid() then - p:addToShipLog("[Polly Hobbs] Those ships show time signatures from history. I'm not sure why such old ships have suddenly appeared. I have gathered as much data as I can on this phenomenon. Thank you for your assistance","Magenta") + if player_with_astronomer ~= nil and player_with_astronomer:isValid() then + player_with_astronomer:addToShipLog(_("goal-shipLog","[Polly Hobbs] Those ships show time signatures from history. I'm not sure why such old ships have suddenly appeared. I have gathered as much data as I can on this phenomenon. Thank you for your assistance"),"Magenta") playVoice("Polly07") end - exuariInterestTimer = 30 + exuariInterestTimer = getScenarioTime() + 30 plot2 = exuariInterest plot3 = transportCleanup plot1 = nil mission_complete_count = mission_complete_count + 1 plotChoiceStation = primusStation - primaryOrders = string.format("Dock with %s",primusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),primusStation:getCallSign()) end end end @@ -9301,7 +6523,7 @@ end function transportCleanup(delta) local lostIndependentFleetCount = 0 if lostIndependentFleet ~= nil then - for _, tempShip in pairs(lostIndependentFleet) do + for i, tempShip in pairs(lostIndependentFleet) do if tempShip ~= nil and tempShip:isValid() then lostIndependentFleetCount = lostIndependentFleetCount + 1 if tempShip:isDocked(tempShip.targetDock) then @@ -9314,7 +6536,7 @@ function transportCleanup(delta) end local secondLostFleetCount = 0 if secondLostFleet ~= nil then - for _, tempShip in pairs(secondLostFleet) do + for i, tempShip in pairs(secondLostFleet) do if tempShip ~= nil and tempShip:isValid() then secondLostFleetCount = secondLostFleetCount + 1 if tempShip.targetDock ~= nil then @@ -9333,10 +6555,9 @@ function transportCleanup(delta) end -- PRIMUS STATION PLOT Plot 2 time travel and related conflict (branch of orbiting artifact plot) function exuariInterest(delta) - exuariInterestTimer = exuariInterestTimer - delta - if exuariInterestTimer < 0 then + if getScenarioTime() > exuariInterestTimer then plot2 = secondRelease - secondReleaseTimer = 600 + secondReleaseTimer = getScenarioTime() + 600 for i=1,#lostIndependentFleet do local tempShip = lostIndependentFleet[i] if tempShip ~= nil and tempShip:isValid() then @@ -9345,14 +6566,13 @@ function exuariInterest(delta) end end local tempFleet = spawnEnemies(pmx, pmy, 2, "Exuari") - for _, enemy in ipairs(tempFleet) do + for i, enemy in ipairs(tempFleet) do enemy:orderRoaming() end end end function secondRelease(delta) - secondReleaseTimer = secondReleaseTimer - delta - if secondReleaseTimer < 0 then + if getScenarioTime() > secondReleaseTimer then secondLostFleet = {} local tempBase = nearStations(belt1Artifact,playerSpawnBandStations) local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"} @@ -9394,18 +6614,17 @@ function secondRelease(delta) name = name .. " Freighter " .. math.random(1, 5) end local tempShip = CpuShip():setTemplate(name):setFaction('Exuari'):setCommsScript(""):setCommsFunction(commsShip) - ship:setCallSign(generateCallSign(nil,"Exuari")) + tempShip:setCallSign(generateCallSign(nil,"Exuari")) tempShip:setPosition(tpmx,tpmy):orderDock(tempBase) tempShip.targetDock = tempBase table.insert(secondLostFleet,tempShip) end plot2 = secondExuariInterest - secondInterestTimer = 30 + secondInterestTimer = getScenarioTime() + 30 end end function secondExuariInterest(delta) - secondInterestTimer = secondInterestTimer - delta - if secondInterestTimer < 0 then + if getScenarioTime() > secondInterestTimer then plot2 = nil for i=1,#secondLostFleet do local tempShip = secondLostFleet[i] @@ -9415,7 +6634,7 @@ function secondExuariInterest(delta) end end local tempFleet = spawnEnemies(tpmx, tpmy, 5, "Exuari") - for _, enemy in ipairs(tempFleet) do + for i, enemy in ipairs(tempFleet) do enemy:orderRoaming() end end @@ -9426,11 +6645,8 @@ function startTransportPrimusResearcher() researcherBoardedShip = false lastLocationPlanetologist = "unknown" planetologistChase = 0 - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p.planetologistAboard = false - end + for i,p in ipairs(getActivePlayerShips()) do + p.planetologistAboard = false end enemyFleet = {} end @@ -9442,41 +6658,40 @@ function transportPrimusResearcher(delta) end function checkTransportPrimusResearcherEvents(delta) if researcherBoardedShip then - primaryOrders = string.format("Transport planetologist by docking with %s",primusStation:getCallSign()) - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil then - if p:isValid() then - if p.planetologistAboard then - if p:isDocked(primusStation) then - primaryOrders = string.format("Dock with %s",primusStation:getCallSign()) - plot1 = nil - mission_complete_count = mission_complete_count + 1 - plotChoiceStation = primusStation - p:addToShipLog("Enrique Flogistan profusely thanked you as he dashed to his observation laboratory. He discussed his research on some unique properties of dilithium with your engineer before he left. Consequently, engineering has improved battery efficiency by ten percent","Magenta") - p:setMaxEnergy(p:getMaxEnergy()*1.1) - p:addReputationPoints(50) - end - break - end - else - if p.planetologistAboard then - --player ship with planetologist aboard was destroyed - showEndStats("Planetologist perished") - victory("Exuari") - end + primaryOrders = string.format(_("orders-comms","Transport planetologist by docking with %s"),primusStation:getCallSign()) + if player_ship_with_planetologist == nil then + for i,p in ipairs(getActivePlayerShips()) do + if p.planetologistAboard then + player_ship_with_planetologist = p + break + end + end + end + if player_ship_with_planetologist ~= nil then + if player_ship_with_planetologist:isValid() then + if player_ship_with_planetologist:isDocked(primusStation) then + primaryOrders = string.format(_("orders-comms","Dock with %s"),primusStation:getCallSign()) + plot1 = nil + mission_complete_count = mission_complete_count + 1 + plotChoiceStation = primusStation + p:addToShipLog(_("goal-shipLog","Enrique Flogistan profusely thanked you as he dashed to his observation laboratory. He discussed his research on some unique properties of dilithium with your engineer before he left. Consequently, engineering has improved battery efficiency by ten percent"),"Magenta") + p:setMaxEnergy(p:getMaxEnergy()*1.1) + p:addReputationPoints(50) end + else + --player ship with planetologist aboard was destroyed + showEndStats(_("msgMainscreen","Planetologist perished")) + victory("Exuari") end end - planetologistAssassinTimer = planetologistAssassinTimer - delta - if planetologistAssassinTimer < 0 then + if getScenarioTime() > planetologistAssassinTimer then if planetologistAssassin == nil then planetologistAssassin = "spawned" - prx, pry = p:getPosition() + prx, pry = player_ship_with_planetologist:getPosition() pmx, pmy = primusStation:getPosition() enemyFleet = spawnEnemies((prx+pmx)/2,(pry+pmy)/2,1,"Exuari") - for _, enemy in ipairs(enemyFleet) do - enemy:orderAttack(p) + for i, enemy in ipairs(enemyFleet) do + enemy:orderAttack(player_ship_with_planetologist) if difficulty >= 1 then enemy:setWarpDrive(true) end @@ -9484,7 +6699,7 @@ function checkTransportPrimusResearcherEvents(delta) end end else - planetologistAssassinTimer = delta + random(10,30) + planetologistAssassinTimer = getScenarioTime() + random(10,30) end end -- PRIMUS STATION PLOT Fix satellites @@ -9520,6 +6735,7 @@ function startFixSatellites() end if fixSatelliteDiagnostic then print("satellite good 1: " .. satelliteGood) end secondusStations[2].satelliteFixGood = satelliteGood + print(secondusStations[1]:getCallSign(),"has",satelliteGood,"at",secondusStations[1].comms_data.goods[satelliteGood].cost,"reputation each which",secondusStations[2]:getCallSign(),"needs") --station 2 has what station 3 needs satelliteGood = nil ctd = secondusStations[2].comms_data @@ -9550,6 +6766,7 @@ function startFixSatellites() end if fixSatelliteDiagnostic then print("satellite good 2: " .. satelliteGood) end secondusStations[3].satelliteFixGood = satelliteGood + print(secondusStations[2]:getCallSign(),"has",satelliteGood,"at",secondusStations[2].comms_data.goods[satelliteGood].cost,"reputation each which",secondusStations[3]:getCallSign(),"needs") --station 3 has what station 1 needs satelliteGood = nil ctd = secondusStations[3].comms_data @@ -9580,8 +6797,9 @@ function startFixSatellites() end if fixSatelliteDiagnostic then print("satellite good 3: " .. satelliteGood) end secondusStations[1].satelliteFixGood = satelliteGood + print(secondusStations[3]:getCallSign(),"has",satelliteGood,"at",secondusStations[3].comms_data.goods[satelliteGood].cost,"reputation each which",secondusStations[1]:getCallSign(),"needs") fixHarassInterval = 300 - fixHarassTimer = fixHarassInterval + fixHarassTimer = getScenarioTime() + fixHarassInterval fixHarassCount = 0 enemyFleet = {} if fixSatelliteDiagnostic then print("end of start fix satellite") end @@ -9594,7 +6812,7 @@ function fixSatellites(delta) end function checkFixSatelliteEvents(delta) local remainingEnemyCount = 0 - for _, enemy in ipairs(enemyFleet) do + for i, enemy in ipairs(enemyFleet) do if enemy ~= nil and enemy:isValid() then remainingEnemyCount = remainingEnemyCount + 1 end @@ -9605,42 +6823,65 @@ function checkFixSatelliteEvents(delta) mission_complete_count = mission_complete_count + 1 plotChoiceStation = primusStation local reputationPending = true - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog("[Engineering Technician] For helping to fix their satellites, the satellite station technicians have doubled our impulse engine's top speed","Magenta") - p:addToShipLog(string.format("Dock with %s",primusStation:getCallSign()),"Magenta") - p:setImpulseMaxSpeed(p:getImpulseMaxSpeed()*2) - if reputationPending then - p:addReputationPoints(50) - reputationPending = false - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(_("goal-shipLog","[Engineering Technician] For helping to fix their satellites, the satellite station technicians have doubled our impulse engine's top speed"),"Magenta") + p:addToShipLog(string.format(_("goal-shipLog","Dock with %s"),primusStation:getCallSign()),"Magenta") + p:setImpulseMaxSpeed(p:getImpulseMaxSpeed()*2) + if reputationPending then + p:addReputationPoints(50) + reputationPending = false end end playVoice("Jamie01") - primaryOrders = string.format("Dock with %s",primusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),primusStation:getCallSign()) end if remainingEnemyCount > 0 then - fixHarassTimer = delta + fixHarassInterval + fixHarassTimer = getScenarioTime() + fixHarassInterval else - fixHarassTimer = fixHarassTimer - delta - if fixHarassTimer < 0 then - fixHarassTimer = delta + fixHarassInterval - p = closestPlayerTo(planetSecondus) - if p == nil then - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - break + local got_rep = true + if secondusStations[1].comms_data.goods[secondusStations[2].satelliteFixGood].cost > getPlayerShip(-1):getReputationPoints() then + got_rep = false + end + if secondusStations[2].comms_data.goods[secondusStations[3].satelliteFixGood].cost > getPlayerShip(-1):getReputationPoints() then + got_rep = false + end + if secondusStations[3].comms_data.goods[secondusStations[1].satelliteFixGood].cost > getPlayerShip(-1):getReputationPoints() then + got_rep = false + end + if getScenarioTime() > fixHarassTimer or not got_rep then + fixHarassTimer = getScenarioTime() + fixHarassInterval + if fixHarassCount % 2 > 0 then + local satellite_templates = { + "Stalker Q7", + "Stalker Q5", + "Waddle 5", + "Fiend G4", + "Fiend G6", + } + enemyFleet = {} + for i,p in ipairs(getActivePlayerShips()) do + local px, py = p:getPosition() + for j=1,math.random(2,5) do + local selected_template = satellite_templates[math.random(1,#satellite_templates)] + local ship = ship_template[selected_template].create("Exuari",selected_template) + local vx, vy = vectorFromAngle(random(0,360),random(10000,20000)) + ship:setPosition(px + vx, py + vy):orderAttack(p) + table.insert(enemyFleet,ship) end end - end - local hps = nearStations(p, secondusStations) - prx, pry = p:getPosition() - pmx, pmy = vectorFromAngle(hps.angle,random(5100,6000)) - enemyFleet = spawnEnemies(prx+pmx,pry+pmy,1+(difficulty*fixHarassCount),"Exuari") - for _, enemy in ipairs(enemyFleet) do - enemy:orderAttack(p) + else + harass_player_ship = closestPlayerTo(planetSecondus) + if harass_player_ship == nil then + local harass_players = getActivePlayerShips() + harass_player_ship = harass_players[math.random(1,#harass_players)] + end + local hps = nearStations(harass_player_ship, secondusStations) + prx, pry = harass_player_ship:getPosition() + pmx, pmy = vectorFromAngle(hps.angle,random(5100,6000)) + enemyFleet = spawnEnemies(prx+pmx,pry+pmy,1+(difficulty*fixHarassCount*.4),"Exuari") + for i, enemy in ipairs(enemyFleet) do + enemy:orderAttack(harass_player_ship) + end end fixHarassCount = fixHarassCount + 1 end @@ -9652,7 +6893,8 @@ function startDefendSpawnBandStation() repeat protect_station = playerSpawnBandStations[math.random(1,#playerSpawnBandStations)] until(protect_station ~= nil and protect_station:isValid()) - primaryOrders = string.format("Protect %s from marauding Exuari",protect_station:getCallSign()) + protect_station_name = protect_station:getCallSign() + primaryOrders = string.format(_("orders-comms","Protect %s from marauding Exuari"),protect_station_name) end function defendSpawnBandStation(delta) if set_up_defend_spawn_band_station == nil then @@ -9662,92 +6904,88 @@ function defendSpawnBandStation(delta) end function marauderHorizon(delta) if marauder_horizon_timer == nil then - marauder_horizon_timer = delta + 100 + marauder_horizon_timer = getScenarioTime() + 100 end - marauder_horizon_timer = marauder_horizon_timer - delta - if marauder_horizon_timer < 0 then + if getScenarioTime() > marauder_horizon_timer then if protect_station ~= nil and protect_station:isValid() then plot1 = marauderSpawn else + showEndStats(string.format(_("msgMainscreen","Station %s destroyed"),protect_station_name)) victory("Exuari") end end end function marauderSpawn(delta) if protect_station ~= nil and protect_station:isValid() then - local cp = nil - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if cp == nil then - cp = p - else - if distance(p,protect_station) < distance(cp,protect_station) then - cp = p - end + local closest_protective_player = nil + for i,p in ipairs(getActivePlayerShips()) do + if closest_protective_player == nil then + closest_protective_player = p + else + if distance(p,protect_station) < distance(closest_protective_player,protect_station) then + closest_protective_player = p end end end - if cp ~= nil then - protect_station.marauder_choice = cp - local px, py = cp:getPosition() + if closest_protective_player ~= nil then + protect_station.marauder_choice = closest_protective_player + local px, py = closest_protective_player:getPosition() local sx, sy = protect_station:getPosition() protect_station.initial_marauder_fleet = spawnEnemies((px+sx)/2,(py+sy)/2,1,"Exuari") - for _, enemy in ipairs(protect_station.initial_marauder_fleet) do + for i, enemy in ipairs(protect_station.initial_marauder_fleet) do enemy:orderAttack(protect_station) end plot1 = marauderApproach end else - showEndStats(string.format("Station %s destroyed",protect_station:getCallSign())) + showEndStats(string.format(_("msgMainscreen","Station %s destroyed"),protect_station_name)) victory("Exuari") end end function marauderApproach(delta) if protect_station ~= nil and protect_station:isValid() then + local sx, sy = protect_station:getPosition() if protect_station.marauder_warning == nil then - for _, enemy in pairs(protect_station.initial_marauder_fleet) do + for i, enemy in pairs(protect_station.initial_marauder_fleet) do if enemy ~= nil and enemy:isValid() then if distance(enemy,protect_station) < 30000 then + local ex, ey = enemy:getPosition() + local marauder_bearing = angleFromVectorNorth(ex, ey, sx, sy) if protect_station.marauder_choice ~= nil and protect_station.marauder_choice:isValid() then - protect_station.marauder_choice:addToShipLog(string.format("[%s in %s] The Exuari are coming",protect_station:getCallSign(),protect_station:getSectorName()),"Magenta") + protect_station.marauder_choice:addToShipLog(string.format(_("goal-shipLog","[%s in %s] The Exuari are coming! We detected them on bearing %.1f from us."),protect_station_name,protect_station:getSectorName(),marauder_bearing),"Magenta") + protect_station.marauder_warning = "done" else - local cp = nil - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if cp == nil then - cp = p - else - if distance(p,protect_station) < distance(cp,protect_station) then - cp = p - end + local closest_protective_player = nil + for j,p in ipairs(getActivePlayerShips()) do + if closest_protective_player == nil then + closest_protective_player = p + else + if distance(p,protect_station) < distance(closest_protective_player,protect_station) then + closest_protective_player = p end end end - if cp ~= nil then - protect_station.marauder_choice = cp - protect_station.marauder_choice:addToShipLog(string.format("[%s in %s] The Exuari are coming",protect_station:getCallSign(),protect_station:getSectorName()),"Magenta") + if closest_protective_player ~= nil then + protect_station.marauder_choice = closest_protective_player + protect_station.marauder_choice:addToShipLog(string.format(_("goal-shipLog","[%s in %s] The Exuari are coming! We detected them on bearing %.1f from us."),protect_station_name,protect_station:getSectorName(),marauder_bearing),"Magenta") + protect_station.marauder_warning = "done" end end - protect_station.marauder_warning = "done" break end end end end - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() and distance(p,protect_station) < 25000 then + for i,p in ipairs(getActivePlayerShips()) do + if distance(p,protect_station) < 25000 then if protect_station.marauder_station_fleet == nil then local px, py = p:getPosition() - local sx, sy = protect_station:getPosition() protect_station.marauder_station_fleet = spawnEnemies((px+sx)/2,(py+sy)/2,1,"Exuari") - for _, enemy in ipairs(protect_station.marauder_station_fleet) do + for i, enemy in ipairs(protect_station.marauder_station_fleet) do enemy:orderAttack(protect_station) end protect_station.marauder_player_fleet = spawnEnemies((px+sx)/2,(py+sy)/2,1,"Exuari") - for _, enemy in ipairs(protect_station.marauder_player_fleet) do + for i, enemy in ipairs(protect_station.marauder_player_fleet) do enemy:orderAttack(p) end end @@ -9756,52 +6994,51 @@ function marauderApproach(delta) end end else - showEndStats(string.format("Station %s destroyed",protect_station:getCallSign())) + showEndStats(string.format(_("msgMainscreen","Station %s destroyed"),protect_station_name)) victory("Exuari") end end function marauderVanguard(delta) if protect_station ~= nil and protect_station:isValid() then if protect_station.vanguard_timer == nil then - protect_station.vanguard_timer = delta + 300 + protect_station.vanguard_timer = getScenarioTime() + 300 end - protect_station.vanguard_timer = protect_station.vanguard_timer - delta - if protect_station.vanguard_timer < 0 then + if getScenarioTime() < protect_station.vanguard_timer then local vx, vy = vectorFromAngle(random(0,360),random(9000,14000)) local sx, sy = protect_station:getPosition() protect_station.vanguard_fleet = spawnEnemies(vx+sx,vy+sy,2*difficulty,"Exuari") - for _, enemy in ipairs(protect_station.vanguard_fleet) do + for i, enemy in ipairs(protect_station.vanguard_fleet) do enemy:orderFlyTowards(sx,sy) end plot1 = marauderFleetDestroyed end else - showEndStats(string.format("Station %s destroyed",protect_station:getCallSign())) + showEndStats(string.format(_("msgMainscreen","Station %s destroyed"),protect_station_name)) victory("Exuari") end end function marauderFleetDestroyed(delta) if protect_station ~= nil and protect_station:isValid() then local marauder_count = 0 - for _, enemy in pairs(protect_station.initial_marauder_fleet) do + for i, enemy in pairs(protect_station.initial_marauder_fleet) do if enemy ~= nil and enemy:isValid() then marauder_count = marauder_count + 1 break end end - for _, enemy in pairs(protect_station.marauder_station_fleet) do + for i, enemy in pairs(protect_station.marauder_station_fleet) do if enemy ~= nil and enemy:isValid() then marauder_count = marauder_count + 1 break end end - for _, enemy in pairs(protect_station.marauder_player_fleet) do + for i, enemy in pairs(protect_station.marauder_player_fleet) do if enemy ~= nil and enemy:isValid() then marauder_count = marauder_count + 1 break end end - for _, enemy in pairs(protect_station.vanguard_fleet) do + for i, enemy in pairs(protect_station.vanguard_fleet) do if enemy ~= nil and enemy:isValid() then marauder_count = marauder_count + 1 break @@ -9812,23 +7049,20 @@ function marauderFleetDestroyed(delta) mission_complete_count = mission_complete_count + 1 plotChoiceStation = primusStation local reputationPending = true - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("[Engineering Technician] For helping against the Exuari marauders, %s has provided us details on improving our maneuvering speed.",protect_station:getCallSign()),"Magenta") - p:addToShipLog(string.format("Dock with %s",primusStation:getCallSign()),"Magenta") - p:setRotationMaxSpeed(p:getRotationMaxSpeed()*2) - if reputationPending then - p:addReputationPoints(50) - reputationPending = false - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","[Engineering Technician] For helping against the Exuari marauders, %s has provided us details on improving our maneuvering speed."),protect_station_name),"Magenta") + p:addToShipLog(string.format(_("goal-shipLog","Dock with %s"),primusStation:getCallSign()),"Magenta") + p:setRotationMaxSpeed(p:getRotationMaxSpeed()*2) + if reputationPending then + p:addReputationPoints(50) + reputationPending = false end end playVoice("Jamie02") - primaryOrders = string.format("Dock with %s",primusStation:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),primusStation:getCallSign()) end else - showEndStats(string.format("Station %s destroyed",protect_station:getCallSign())) + showEndStats(string.format(_("msgMainscreen","Station %s destroyed"),protect_station_name)) victory("Exuari") end end @@ -9839,16 +7073,13 @@ function startPiracy() local tpmx, tpmy = protectTransport:getPosition() local pirx, piry = vectorFromAngle(random(0,360),random(10000,20000)-(3000*difficulty)) piracyFleet = spawnEnemies(tpmx+pirx, tpmy+piry, 1, "Exuari") - for _, enemy in ipairs(piracyFleet) do + for i, enemy in ipairs(piracyFleet) do enemy:orderFlyTowards(tpmx, tpmy) end - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("%s in %s reports Exuari pirates threatening them",protectTransport:getCallSign(),protectTransport:getSectorName()),"Magenta") - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","%s in %s reports Exuari pirates threatening them."),protectTransport:getCallSign(),protectTransport:getSectorName()),"Magenta") end - primaryOrders = string.format("Protect %s from Exuari pirates. Last reported in %s",protectTransport:getCallSign(),protectTransport:getSectorName()) + primaryOrders = string.format(_("orders-comms","Protect %s from Exuari pirates. Last reported in %s"),protectTransport:getCallSign(),protectTransport:getSectorName()) end function piracyPlot(delta) if setUpPiracy == nil then @@ -9858,12 +7089,12 @@ function piracyPlot(delta) end function checkPiracyEvents(delta) if protectTransport == nil or not protectTransport:isValid() then - showEndStats("Transport destroyed") + showEndStats(_("msgMainscreen","Transport destroyed")) victory("Exuari") end local piracyFleetCount = 0 if piracyFleet ~= nil then - for _, enemy in pairs(piracyFleet) do + for i, enemy in pairs(piracyFleet) do if enemy ~= nil and enemy:isValid() then piracyFleetCount = piracyFleetCount + 1 break @@ -9873,13 +7104,15 @@ function checkPiracyEvents(delta) plot1 = nil mission_complete_count = mission_complete_count + 1 plotChoiceStation = belt1Stations[1] - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("[%s] Thanks for dealing with those Exuari pirates",protectTransport:getCallSign()),"Magenta") + local reputation_pending = true + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","[%s] Thanks for dealing with those Exuari pirates"),protectTransport:getCallSign()),"Magenta") + if reputation_pending then + p:addReputationPoints(50) + reputation_pending = false end end - primaryOrders = string.format("Dock with %s",belt1Stations[1]:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),belt1Stations[1]:getCallSign()) piracy = "done" end end @@ -9888,19 +7121,16 @@ end function startVirus() set_up_virus = "done" local virus_player_count = 0 - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p.virus_cure = false - p.virus_cure_button = "empty" - virus_player_count = virus_player_count + 1 - end + for i,p in ipairs(getActivePlayerShips()) do + p.virus_cure = false + p.virus_cure_button = "empty" + virus_player_count = virus_player_count + 1 end - for i=1,#belt1Stations do - belt1Stations[i].virus_cure = false + for i,station in ipairs(belt1Stations) do + station.virus_cure = false end - virus_timer = (720 - difficulty*120)/virus_player_count - max_virus_timer = virus_timer + max_virus_timer = (720 - difficulty*120)/virus_player_count + virus_time = getScenarioTime() + max_virus_timer virus_harass = false end function virusOutbreak(delta) @@ -9910,154 +7140,119 @@ function virusOutbreak(delta) plot1 = checkVirusEvents end function checkVirusEvents(delta) - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if p:isDocked(belt1Stations[4]) and not p.virus_cure then - p.virus_cure = true - p:addToShipLog(string.format("[%s medical quartermaster] Anti-virus loaded aboard your ship",belt1Stations[4]:getCallSign()),"Magenta") - playVoice("Phoenix01") - belt1Stations[4].virus_cure = true - end - if p.virus_cure then - if p.virus_cure_button == "empty" then - p.virus_cure_button = "virus_cure_button" .. p:getCallSign() - p:addCustomButton("Relay",p.virus_cure_button,_("-buttonRelay", "Virus status"),virus_status_functions[pidx]) - end - for i=1,#belt1Stations do - local current_belt1_station = belt1Stations[i] - if p:isDocked(current_belt1_station) and not current_belt1_station.virus_cure then - current_belt1_station.virus_cure = true - p:addToShipLog(string.format("[%s Medical Team] Received Anti-virus. Administering to station personnel. Thanks %s",current_belt1_station:getCallSign(),p:getCallSign()),"Magenta") - end + for i,p in ipairs(getActivePlayerShips()) do + if p:isDocked(belt1Stations[4]) and not p.virus_cure then + p.virus_cure = true + p:addToShipLog(string.format(_("goal-shipLog","[%s medical quartermaster] Anti-virus loaded aboard your ship"),belt1Stations[4]:getCallSign()),"Magenta") + playVoice("Phoenix01") + belt1Stations[4].virus_cure = true + end + if p.virus_cure then + p.virus_cure_button_rel = "virus_cure_button_rel" + p:addCustomButton("Relay",p.virus_cure_button_rel,_("buttonRelay","Virus status"),function() + string.format("") + virusStatus(p) + end, 9) + p.virus_cure_button_ops = "virus_cure_button_ops" + p:addCustomButton("Operations",p.virus_cure_button_ops,_("buttonOperations","Virus status"),function() + string.format("") + virusStatus(p) + end, 9) + for j,station in ipairs(belt1Stations) do + if p:isDocked(station) and not station.virus_cure then + station.virus_cure = true + p:addToShipLog(string.format(_("goal-shipLog","[%s Medical Team] Received Anti-virus. Administering to station personnel. Thanks %s"),current_belt1_station:getCallSign(),p:getCallSign()),"Magenta") end end end end local station_cure_count = 0 - for i=1,#belt1Stations do - if belt1Stations[i].virus_cure then + for i,station in ipairs(belt1Stations) do + if station.virus_cure then station_cure_count = station_cure_count + 1 end end if station_cure_count < #belt1Stations then - virus_timer = virus_timer - delta - if virus_timer < 0 then + if getScenarioTime() > virus_time then playVoice("Tracy13") - showEndStats("Pandemic") + showEndStats(_("msgMainscreen","Pandemic")) victory("Exuari") else + local virus_timer = virus_time - getScenarioTime() if station_cure_count >= 3 and not virus_harass then - --add harassing Exuari here virus_harass = true local per_station = max_virus_timer/5 if virus_timer < (max_virus_timer - (3 * per_station)) then playVoice("Tracy12") end - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() and p.virus_cure then - local phx, phy = p:getPosition() - local virus_fleet = spawnEnemies(phx, phy, 1, "Exuari", 2000 - difficulty*100, 4000) - for enemy in pairs(virus_fleet) do - enemy:orderAttack(p) - end + for i,p in ipairs(getActivePlayerShips()) do + local phx, phy = p:getPosition() + local virus_fleet = spawnEnemies(phx, phy, 1, "Exuari", 2000 - difficulty*100, 4000) + for enemy in pairs(virus_fleet) do + enemy:orderAttack(p) end end end local virus_minutes = math.floor(virus_timer / 60) local virus_seconds = math.floor(virus_timer % 60) - local virus_status = _("-tabScience&Operations", "Virus Fatality") + local virus_status = _("tabScience&Operations","Virus Fatality") if virus_minutes <= 0 then - virus_status = string.format(_("-tabScience&Operations", "%s: %i"),virus_status,virus_seconds) + virus_status = string.format("%s: %i",virus_status,virus_seconds) else - virus_status = string.format(_("-tabScience&Operations", "%s: %i:%.2i"),virus_status,virus_minutes,virus_seconds) - end - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if p:hasPlayerAtPosition("Science") then - p.virus_status = "virus_status" - p:addCustomInfo("Science",p.virus_status,virus_status) - end - if p:hasPlayerAtPosition("Operations") then - p.virus_status_operations = "virus_status_operations" - p:addCustomInfo("Operations",p.virus_status_operations,virus_status) - end - end + virus_status = string.format("%s: %i:%.2i",virus_status,virus_minutes,virus_seconds) + end + for i,p in ipairs(getActivePlayerShips()) do + p.virus_status_sci = "virus_status_sci" + p:addCustomInfo("Science",p.virus_status_sci,virus_status,4) + p.virus_status_ops = "virus_status_ops" + p:addCustomInfo("Operations",p.virus_status_ops,virus_status,4) end end else plot1 = nil mission_complete_count = mission_complete_count + 1 plotChoiceStation = belt1Stations[1] - primaryOrders = string.format("Dock with %s",belt1Stations[1]:getCallSign()) - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog(string.format("Stations have been saved from the virus outbreak. Dock with %s for further orders",belt1Stations[1]:getCallSign()),"Magenta") - if p.virus_cure_button ~= nil and p.virus_cure_button ~= "empty" then - p:removeCustom(p.virus_cure_button) - p.virus_cure_button = "empty" - end - if p.virus_status ~= nil then - p:removeCustom(p.virus_status) - p.virus_status = nil - end - if p.virus_status_operations ~= nil then - p:removeCustom(p.virus_status_operations) - p.virus_status_operations = nil - end + primaryOrders = string.format(_("orders-comms","Dock with %s"),belt1Stations[1]:getCallSign()) + local reputation_pending = true + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("goal-shipLog","Stations have been saved from the virus outbreak. Dock with %s for further orders"),belt1Stations[1]:getCallSign()),"Magenta") + if reputation_pending then + p:addReputationPoints(50) + reputation_pending = false + end + if p.virus_cure_button_rel ~= nil then + p:removeCustom(p.virus_cure_button_rel) + p.virus_cure_button_rel = nil + end + if p.virus_cure_button_ops ~= nil then + p:removeCustom(p.virus_cure_button_ops) + p.virus_cure_button_ops = nil + end + if p.virus_status_sci ~= nil then + p:removeCustom(p.virus_status_sci) + p.virus_status_sci = nil + end + if p.virus_status_ops ~= nil then + p:removeCustom(p.virus_status_ops) + p.virus_status_ops = nil end end playVoice("Tracy07") end end -function virusStatusP1() - local p = getPlayerShip(1) - virusStatus(p) -end -function virusStatusP2() - local p = getPlayerShip(2) - virusStatus(p) -end -function virusStatusP3() - local p = getPlayerShip(3) - virusStatus(p) -end -function virusStatusP4() - local p = getPlayerShip(4) - virusStatus(p) -end -function virusStatusP5() - local p = getPlayerShip(5) - virusStatus(p) -end -function virusStatusP6() - local p = getPlayerShip(6) - virusStatus(p) -end -function virusStatusP7() - local p = getPlayerShip(7) - virusStatus(p) -end -function virusStatusP8() - local p = getPlayerShip(8) - virusStatus(p) -end function virusStatus(p) + local virus_timer = virus_time - getScenarioTime() local virus_minutes = math.floor(virus_timer / 60) - local status_message = "First virus fatality in" + local status_message = _("goal-shipLog","First virus fatality in") if virus_minutes < 1 then - status_message = string.format("%s %.f seconds.",status_message,virus_timer) + status_message = string.format(_("goal-shipLog","%s %.f seconds."),status_message,virus_timer) else - status_message = string.format("%s %i minutes.",status_message,virus_minutes) + status_message = string.format(_("goal-shipLog","%s %i minutes."),status_message,virus_minutes) end - local stations_needing_antivirus = ". Stations needing anti-virus: " - for i=1,#belt1Stations do - local current_belt1_station = belt1Stations[i] - if not current_belt1_station.virus_cure then - stations_needing_antivirus = stations_needing_antivirus .. current_belt1_station:getCallSign() .. " " + local stations_needing_antivirus = _("goal-shipLog",". Stations needing anti-virus:") + for i,station in ipairs(belt1Stations) do + if not station.virus_cure then + stations_needing_antivirus = string.format("%s %s",stations_needing_antivirus,station:getCallSign()) end end status_message = status_message .. stations_needing_antivirus @@ -10066,28 +7261,39 @@ end -- BELT STATION PLOT Exuari Target Intelligence function startTargetIntel() set_up_target_intel = "done" - for pidx=1,8 do - p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p.target_intel = false - end + for i,p in ipairs(getActivePlayerShips()) do + p.target_intel = false end - intel_station = playerSpawnBandStations[1] - local intel_station_index = 1 - intel_station = playerSpawnBandStations[intel_station_index] - while (intel_station_index <= 6 and intel_station == nil) do - intel_station_index = intel_station_index + 1 - intel_station = playerSpawnBandStations[intel_station_index] - end - if intel_station_index > 6 then + local clean_list = true + repeat + for i,station in ipairs(playerSpawnBandStations) do + if station ~= nil then + if not station:isValid() then + playerSpawnBandStations[i] = playerSpawnBandStations[#playerSpawnBandStations] + playerSpawnBandStations[#playerSpawnBandStations] = nil + clean_list = false + break + end + end + end + until(clean_list or #playerSpawnBandStations < 2) + if #playerSpawnBandStations >= 2 then + local station_pool = {} + for i,station in ipairs(playerSpawnBandStations) do + table.insert(station_pool,station) + end + intel_station = tableRemoveRandom(station_pool) + target_station = tableRemoveRandom(station_pool) + primaryOrders = string.format(_("orders-comms","Dock with %s in %s for Exuari intelligence"),intel_station:getCallSign(),intel_station:getSectorName()) + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog(string.format(_("orders-comms","Dock with %s in %s for Exuari intelligence"),intel_station:getCallSign(),intel_station:getSectorName()),"Magenta") + end + intel_attack = false + else playVoice("Tracy11") - showEndStats("Exuari destroyed target station") + showEndStats(_("msgMainscreen","Exuari destroyed station")) victory("Exuari") - return end - target_station = playerSpawnBandStations[intel_station_index + 2] - primaryOrders = string.format("Dock with %s in %s for Exuari intelligence",intel_station:getCallSign(),intel_station:getSectorName()) - intel_attack = false end function targetIntel(delta) if set_up_target_intel == nil then @@ -10098,87 +7304,84 @@ end function checkTargetIntelEvents(delta) if intel_station == nil or not intel_station:isValid() or target_station == nil or not target_station:isValid() then playVoice("Tracy10") - showEndStats("Exuari destroyed station") + showEndStats(_("msgMainscreen","Exuari destroyed station")) victory("Exuari") end local iwpx, iwpy = target_station:getPosition() - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if p:isDocked(intel_station) and p.intel_message == nil then - p.target_intel = true - p:addToShipLog(string.format("Intelligence report: the Exuari have chosen %s in %s as their next target for attack. Make sure they do not succeed",target_station:getCallSign(),target_station:getSectorName()),"Magenta") - p.intel_message = "sent" - if p:getWaypointCount() < 9 and p.intel_waypoint == nil then - p:commandAddWaypoint(iwpx,iwpy) - p:addToShipLog(string.format("Added waypoint %i to your navigation system for %s",p:getWaypointCount(),target_station:getCallSign()),"Magenta") - playVoice("Tracy08") - p.intel_waypoint = "added" + for i,p in ipairs(getActivePlayerShips()) do + if p:isDocked(intel_station) and p.intel_message == nil then + p.target_intel = true + p:addToShipLog(string.format(_("goal-shipLog","Intelligence report: the Exuari have chosen %s in %s as their next target for attack. Make sure they do not succeed"),target_station:getCallSign(),target_station:getSectorName()),"Magenta") + p.intel_message = "sent" + if p:getWaypointCount() < 9 and p.intel_waypoint == nil then + p:commandAddWaypoint(iwpx,iwpy) + p:addToShipLog(string.format("Added waypoint %i to your navigation system for %s",p:getWaypointCount(),target_station:getCallSign()),"Magenta") + playVoice("Tracy08") + p.intel_waypoint = "added" + end + else + if p.target_intel and not intel_attack then + local plx, ply = p:getPosition() + intel_fleet_player = spawnEnemies((plx+iwpx)/2, (ply+iwpy)/2, 1, "Exuari") + for i, enemy in ipairs(intel_fleet_player) do + enemy:orderFlyTowards(plx,ply) end - else - if p.target_intel and not intel_attack then - local plx, ply = p:getPosition() - intel_fleet_player = spawnEnemies((plx+iwpx)/2, (ply+iwpy)/2, 1, "Exuari") - for _, enemy in ipairs(intel_fleet_player) do - enemy:orderFlyTowards(plx,ply) - end - intel_fleet_station = spawnEnemies((plx+iwpx)/2 + 1000, (ply+iwpy)/2 + 1000, 1, "Exuari") - for _, enemy in ipairs(intel_fleet_station) do - enemy:orderFlyTowards(iwpx,iwpy) - end - intel_attack = true + intel_fleet_station = spawnEnemies((plx+iwpx)/2 + 1000, (ply+iwpy)/2 + 1000, 1, "Exuari") + for i, enemy in ipairs(intel_fleet_station) do + enemy:orderFlyTowards(iwpx,iwpy) end + intel_attack = true end end end if intel_attack then local intel_fleet_count = 0 - for _, enemy in pairs(intel_fleet_player) do + for i, enemy in pairs(intel_fleet_player) do if enemy ~= nil and enemy:isValid() then intel_fleet_count = intel_fleet_count + 1 - break + local current_order = enemy:getOrder() + if current_order ~= nil and (current_order == "Idle" or current_order == "Defend Location") then + enemy:orderRoaming() + end end end - for _, enemy in pairs(intel_fleet_station) do + for i, enemy in pairs(intel_fleet_station) do if enemy ~= nil and enemy:isValid() then intel_fleet_count = intel_fleet_count + 1 - break + local current_order = enemy:getOrder() + if current_order ~= nil and (current_order == "Idle" or current_order == "Defend Location") then + enemy:orderRoaming() + end end end if intel_fleet_count < 1 then plot1 = nil mission_complete_count = mission_complete_count + 1 plotChoiceStation = belt1Stations[1] - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - p:addToShipLog("Looks like you thwarted that Exuari attack","Magenta") - end + for i,p in ipairs(getActivePlayerShips()) do + p:addToShipLog("Looks like you thwarted that Exuari attack","Magenta") end playVoice("Tracy09") - primaryOrders = string.format("Dock with %s",belt1Stations[1]:getCallSign()) + primaryOrders = string.format(_("orders-comms","Dock with %s"),belt1Stations[1]:getCallSign()) end end end -- TERTIUS PLOT Exuari Exterminate Extraterrestrials function startExterminate() set_up_exterminate = "done" - primaryOrders = "Make a good showing for the Human Navy against the Exuari invasion" + primaryOrders = _("orders-comms","Make a good showing for the Human Navy against the Exuari invasion") exterminate_interval = 300 - 50*difficulty - exterminate_timer = exterminate_interval + exterminate_timer = getScenarioTime() + exterminate_interval docked_with_tertius = true exterminate_fleet_list = {} exuari_danger = 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local plx, ply = p:getPosition() - local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end - table.insert(exterminate_fleet_list,eFleet) + for i,p in ipairs(getActivePlayerShips()) do + local plx, ply = p:getPosition() + local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) + for i, enemy in ipairs(eFleet) do + enemy:orderAttack(p) end + table.insert(exterminate_fleet_list,eFleet) end end function exterminate(delta) @@ -10191,46 +7394,41 @@ function checkExterminateEvents(delta) if docked_with_tertius then if tertiusStation:isValid() then docked_with_tertius = false - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - if p:isDocked(tertiusStation) then - docked_with_tertius = true - break - end + for i,p in ipairs(getActivePlayerShips()) do + if p:isDocked(tertiusStation) then + docked_with_tertius = true + break end end else docked_with_tertius = false end - else - exterminate_timer = exterminate_timer - delta + if exterminate_timer > getScenarioTime() then + exterminate_timer = exterminate_timer + delta + end end - if exterminate_timer < 0 then + if getScenarioTime() > exterminate_timer then exuari_danger = exuari_danger + 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local plx, ply = p:getPosition() - local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",2000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end - table.insert(exterminate_fleet_list,eFleet) + for i,p in ipairs(getActivePlayerShips()) do + local plx, ply = p:getPosition() + local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",2000,6000) + for i, enemy in ipairs(eFleet) do + enemy:orderAttack(p) end + table.insert(exterminate_fleet_list,eFleet) end plx, ply = vectorFromAngle(random(0,360),tertiusMoonOrbit+1000) local tx, ty = planetTertius:getPosition() eFleet = spawnEnemies(tx+plx,ty+ply,exuari_danger*2,"Exuari") - for _, enemy in ipairs(eFleet) do + for i, enemy in ipairs(eFleet) do enemy:orderRoaming() end table.insert(exterminate_fleet_list,eFleet) - exterminate_timer = delta + exterminate_interval + exterminate_timer = getScenarioTime() + exterminate_interval end local exuari_enemy_count = 0 - for _, fleet in pairs(exterminate_fleet_list) do - for _, enemy in pairs(fleet) do + for i, fleet in pairs(exterminate_fleet_list) do + for j, enemy in pairs(fleet) do if enemy ~= nil and enemy:isValid() then exuari_enemy_count = exuari_enemy_count + 1 end @@ -10238,45 +7436,37 @@ function checkExterminateEvents(delta) end if exuari_enemy_count < exuari_danger then exuari_danger = exuari_danger + 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - plx, ply = p:getPosition() - eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",2000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end - table.insert(exterminate_fleet_list,eFleet) + for i,p in ipairs(getActivePlayerShips()) do + plx, ply = p:getPosition() + eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",2000,6000) + for i, enemy in ipairs(eFleet) do + enemy:orderAttack(p) end + table.insert(exterminate_fleet_list,eFleet) end end end -- TERTIUS PLOT Eliminate Exuari stronghold function startStronghold() set_up_stronghold = "done" - primaryOrders = "Find and eliminate the Exuari station that is sending all these ships after us" + primaryOrders = _("orders-comms","Find and eliminate the Exuari station that is sending all these ships after us") local esx, esy = vectorFromAngle(random(10,80),random(tertiusOrbit + tertiusMoonOrbit + 50000,tertiusOrbit + tertiusMoonOrbit + 100000)) psx = solX+esx psy = solY+esy stationFaction = "Exuari" stationStaticAsteroids = true - si = math.random(1,#placeEnemyStation) --station index - pStation = placeEnemyStation[si]() --place selected station - table.remove(placeEnemyStation,si) --remove station from placement list + pStation = placeUVStation(psx,psy,"Sinister") table.insert(stationList,pStation) --save station in general station list table.insert(exuariStationList,pStation) --save station in exuari station list exuari_stronghold = pStation stronghold_interval = 300 - 50*difficulty - stronghold_timer = stronghold_interval + stronghold_timer = getScenarioTime() + stronghold_interval exuari_danger = 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local plx, ply = p:getPosition() - local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end + for i,p in ipairs(getActivePlayerShips()) do + local plx, ply = p:getPosition() + local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) + for j, enemy in ipairs(eFleet) do + enemy:orderAttack(p) end end end @@ -10289,17 +7479,16 @@ end function checkStrongholdEvents(delta) if exuari_stronghold == nil or not exuari_stronghold:isValid() then mission_complete_count = mission_complete_count + 1 - showEndStats("Exuari stronghold destroyed") + showEndStats(_("msgMainscreen","Exuari stronghold destroyed")) victory("Human Navy") end - stronghold_timer = stronghold_timer - delta - if stronghold_timer < 0 then + if getScenarioTime() > stronghold_timer then local p = closestPlayerTo(exuari_stronghold) if p ~= nil then local plx, ply = p:getPosition() if random(1,100) < 50 then local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do + for i, enemy in ipairs(eFleet) do enemy:orderAttack(p) end if random(1,100) < 50 then @@ -10308,36 +7497,33 @@ function checkStrongholdEvents(delta) else local esx, esy = exuari_stronghold:getPosition() eFleet = spawnEnemies((plx+esx)/2,(ply+esy)/2,exuari_danger,"Exuari") - for _, enemy in ipairs(eFleet) do + for i, enemy in ipairs(eFleet) do enemy:orderRoaming() end end else local plx, ply = exuari_stronghold:getPosition() local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do + for i, enemy in ipairs(eFleet) do enemy:orderStandGround() end end exuari_danger = exuari_danger + 1 - stronghold_timer = delta + stronghold_interval + stronghold_timer = getScenarioTime() + stronghold_interval end end --- TERTIUS PLOT Eliminate Exuari stronghold +-- TERTIUS PLOT Survive Exuari attack function startSurvive() set_up_survive = "done" - primaryOrders = "Survive until the game time runs out" + primaryOrders = _("orders-comms","Survive until the game time runs out") survive_interval = 300 - 50*difficulty - survive_timer = survive_interval + survive_timer = getScenarioTime() + survive_interval exuari_danger = 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local plx, ply = p:getPosition() - local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end + for i,p in ipairs(getActivePlayerShips()) do + local plx, ply = p:getPosition() + local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) + for i, enemy in ipairs(eFleet) do + enemy:orderAttack(p) end end end @@ -10348,37 +7534,38 @@ function survive(delta) plot1 = checkSurviveEvents end function checkSurviveEvents(delta) - gameTimeLimit = gameTimeLimit - delta - if gameTimeLimit < 0 then + if game_over_time == nil then + game_over_time = getScenarioTime() + gameTimeLimit + end + if getScenarioTime() > game_over_time then mission_complete_count = mission_complete_count + 1 - showEndStats("Survived Exuari Attacks") + showEndStats(_("msgMainscreen","Survived Exuari Attacks")) victory("Human Navy") else - survive_timer = survive_timer - delta - if survive_timer < 0 then + if getScenarioTime() > survive_timer then exuari_danger = exuari_danger + 1 - for pidx=1,8 do - local p = getPlayerShip(pidx) - if p ~= nil and p:isValid() then - local plx, ply = p:getPosition() - local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) - for _, enemy in ipairs(eFleet) do - enemy:orderAttack(p) - end - if random(1,100) < 50 then - WarpJammer():setRange(8000):setLocation(plx+3000,ply-3000):setFaction("Exuari") - end + for i,p in ipairs(getActivePlayerShips()) do + local plx, ply = p:getPosition() + local eFleet = spawnEnemies(plx,ply,exuari_danger,"Exuari",4000,6000) + for i, enemy in ipairs(eFleet) do + enemy:orderAttack(p) + end + if random(1,100) < 50 then + WarpJammer():setRange(8000):setLocation(plx+3000,ply-3000):setFaction("Exuari") end end - survive_timer = delta + survive_interval + survive_timer = getScenarioTime() + survive_interval end end end -- Working transports plot function workingTransports(delta) - transportCheckDelayTimer = transportCheckDelayTimer - delta - if transportCheckDelayTimer < 0 then - for _, wt in pairs(transportsInPlayerSpawnBandList) do + if transport_delay_time == nil then + transport_delay_time = getScenarioTime() + random(4,12) + end + if getScenarioTime() > transport_delay_time then + transport_delay_time = nil + for i, wt in pairs(transportsInPlayerSpawnBandList) do if wt ~= nil and wt:isValid() then if wt.targetStart ~= nil and wt.targetStart:isValid() then if wt:isDocked(wt.targetStart) then @@ -10396,7 +7583,7 @@ function workingTransports(delta) end end end - for _, wt in pairs(transportsOutsideBelt2List) do + for i, wt in pairs(transportsOutsideBelt2List) do if wt ~= nil and wt:isValid() then if wt.targetStart ~= nil and wt.targetStart:isValid() then if wt:isDocked(wt.targetStart) then @@ -10414,43 +7601,33 @@ function workingTransports(delta) end end end - transportCheckDelayTimer = delta + transportCheckDelayInterval end end -- Manage plots function setPlots() - plotList = {fixSatellites, - transportPrimusResearcher, - orbitingArtifact, - defendSpawnBandStation} - plotListMessage = {string.format("Satellite stations %s, %s and %s orbiting %s have been reporting periodic problems. See what you can do to help them out",secondusStations[1]:getCallSign(),secondusStations[2]:getCallSign(),secondusStations[3]:getCallSign(),planetSecondus:getCallSign()), - string.format("Planetologist Enrique Flogistan plans to study %s. However, his transport refuses to travel in the area due to increased Exuari activity. Dock with %s and transport the planetologist to %s",planetPrimus:getCallSign(),belt1Stations[2]:getCallSign(),primusStation:getCallSign()), - string.format("Analysis of sightings and readings taken by civilian astronmer Polly Hobbs shows anomalous readings in this area. She lives on station %s according to her published research. Find her, get the source data and investigate. Solicit her assistance if she's willing",belt1Stations[5]:getCallSign()), - "Intelligence indicates an imminent attack by the Exuari on a station in the area. Your mission is to protect the station"} - plotListOrders = {string.format("Fix satellites orbiting %s",planetSecondus:getCallSign()), - string.format("Transport planetologist from %s to %s",belt1Stations[2]:getCallSign(),primusStation:getCallSign()), - string.format("Dock with %s to investigate astronomer's unusual data",belt1Stations[5]:getCallSign()), - "Defend station from Exuari attack"} - maxPlotCount = #plotList + first_plots = { + {func = fixSatellites, desc = string.format(_("orders-comms","Satellite stations %s, %s and %s orbiting %s have been reporting periodic problems. See what you can do to help them out"),secondusStations[1]:getCallSign(),secondusStations[2]:getCallSign(),secondusStations[3]:getCallSign(),planetSecondus:getCallSign()), order = string.format(_("orders-comms","Fix satellites orbiting %s"),planetSecondus:getCallSign()), voice = string.format("Pat01%s",planetSecondus:getCallSign()), }, + {func = transportPrimusResearcher, desc = string.format(_("orders-comms","Planetologist Enrique Flogistan plans to study %s. However, his transport refuses to travel in the area due to increased Exuari activity. Dock with %s and transport the planetologist to %s"),planetPrimus:getCallSign(),belt1Stations[2]:getCallSign(),primusStation:getCallSign()), order = string.format(_("orders-comms","Transport planetologist from %s to %s"),belt1Stations[2]:getCallSign(),primusStation:getCallSign()), voice = string.format("Pat02%s",planetPrimus:getCallSign()), }, + {func = orbitingArtifact, desc = string.format(_("orders-comms","Analysis of sightings and readings taken by civilian astronmer Polly Hobbs shows anomalous readings in this area. She lives on station %s according to her published research. Find her, get the source data and investigate. Solicit her assistance if she's willing"),belt1Stations[5]:getCallSign()), order = string.format(_("orders-comms","Dock with %s to investigate astronomer's unusual data"),belt1Stations[5]:getCallSign()), voice = "Pat03", }, + {func = defendSpawnBandStation, desc = _("orders-comms","Intelligence indicates an imminent attack by the Exuari on a station in the area. Your mission is to protect the station"), order = _("orders-comms","Defend station from Exuari attack"), voice = "Pat04", }, + } initialMission = true - plotList2 = {piracyPlot, - virusOutbreak, - targetIntel} - plotListMessage2 = {"A transport reports Exuari pirates threatening them", - string.format("Stations %s, %s, %s, %s and %s all report outbreaks of a variant of Rathgar's space virus. %s has developed an effective anti-virus, but it needs to be delivered to all the stations quickly",belt1Stations[1]:getCallSign(),belt1Stations[2]:getCallSign(),belt1Stations[3]:getCallSign(),belt1Stations[4]:getCallSign(),belt1Stations[5]:getCallSign(),belt1Stations[4]:getCallSign()), - string.format("Station %s in %s has intelligence on where the Exuari are attacking next",playerSpawnBandStations[1]:getCallSign(),playerSpawnBandStations[1]:getSectorName())} - plotListOrders2 = {"Protect transport from Exuari pirates", - string.format("Dock with %s to pick up anti-virus",belt1Stations[4]:getCallSign()), - string.format("Dock with %s in %s for Exuari intelligence",playerSpawnBandStations[1]:getCallSign(),playerSpawnBandStations[1]:getSectorName())} + local orbit_label = "Outside" + if secondusOrbit > playerSpawnBand then + orbit_label = "Inside" + end + second_plots = { + {func = piracyPlot, desc = _("orders-comms","A transport reports Exuari pirates threatening them"), order = _("orders-comms","Protect transport from Exuari pirates"), voice = "Tracy03", }, + {func = virusOutbreak, desc = string.format(_("orders-comms","Stations %s, %s, %s, %s and %s all report outbreaks of a variant of Rathgar's space virus. %s has developed an effective anti-virus, but it needs to be delivered to all the stations quickly"),belt1Stations[1]:getCallSign(),belt1Stations[2]:getCallSign(),belt1Stations[3]:getCallSign(),belt1Stations[4]:getCallSign(),belt1Stations[5]:getCallSign(),belt1Stations[4]:getCallSign()), order = string.format(_("orders-comms","Dock with %s to pick up anti-virus"),belt1Stations[4]:getCallSign()), voice = "Tracy05", }, + {func = targetIntel, desc = _("orders-comms","We've picked up intelligence on the next Exuari attack. Check your ship log for details. Protect the target station."), order = _("orders-comms","Dock with designated station for Exuari intelligence"), voice = string.format("Tracy06%s%s",orbit_label,planetSecondus:getCallSign()), }, + } piracy = "available" - plotCI = cargoInventory --manage button on relay/operations to show cargo inventory end function plotDelay(delta) if plotDelayTimer == nil then - plotDelayTimer = delta + random(10,30) + plotDelayTimer = getScenarioTime() + random(10,30) end - plotDelayTimer = plotDelayTimer - delta - if plotDelayTimer < 0 then + if getScenarioTime() > plotDelayTimer then plotDelayTimer = nil plotManager = plotChoose end @@ -10467,7 +7644,7 @@ function plotChoose(delta) else if not plotChoiceStation:isValid() then --migratory headquarters destroyed - showEndStats("Critical station destroyed") + showEndStats(_("msgMainscreen","Critical station destroyed")) victory("Exuari") end end @@ -10480,314 +7657,212 @@ function plotRun(delta) end -- End of plot related functions function showEndStats(reason) - local stat_message = _("msgMainscreen", "Human stations destroyed: ") + local stat_message = _("msgMainscreen","Human stations destroyed: ") if #humanStationDestroyedNameList ~= nil and #humanStationDestroyedNameList > 0 then stat_message = stat_message .. #humanStationDestroyedNameList local station_strength = 0 for i=1,#humanStationDestroyedNameList do - station_strength = station_strength + humanStationDestroyedValue[i] + if humanStationDestroyedValue[i] ~= nil then + station_strength = station_strength + humanStationDestroyedValue[i] + else + print("station",humanStationDestroyedNameList[i]," has nil value in human station destroyed value list") + end end - stat_message = stat_message .. string.format(_("msgMainscreen", " (total strength: %i)"),station_strength) + stat_message = stat_message .. string.format(_("msgMainscreen"," (total strength: %i)"),station_strength) else - stat_message = stat_message .. _("msgMainscreen", "none") + stat_message = stat_message .. _("msgMainscreen","none") end - stat_message = stat_message .. _("msgMainscreen", "\nNeutral stations destroyed: ") + stat_message = stat_message .. _("msgMainscreen","\nNeutral stations destroyed: ") if #neutralStationDestroyedNameList ~= nil and #neutralStationDestroyedNameList > 0 then stat_message = stat_message .. #neutralStationDestroyedNameList station_strength = 0 for i=1,#neutralStationDestroyedNameList do - station_strength = station_strength + neutralStationDestroyedValue[i] + if neutralStationDestroyedValue[i] ~= nil then + station_strength = station_strength + neutralStationDestroyedValue[i] + else + print("station:",neutralStationDestroyedNameList[i],"has a nil value in neutral station destroyed value list") + end end - stat_message = stat_message .. string.format(_("msgMainscreen", " (total strength: %i)"),station_strength) + stat_message = stat_message .. string.format(_("msgMainscreen"," (total strength: %i)"),station_strength) else - stat_message = stat_message .. _("msgMainscreen", "none") + stat_message = stat_message .. _("msgMainscreen","none") end - stat_message = stat_message .. _("msgMainscreen", "\nKraylor vessels destroyed: ") + stat_message = stat_message .. _("msgMainscreen","\nKraylor vessels destroyed: ") if #kraylorVesselDestroyedNameList ~= nil and #kraylorVesselDestroyedNameList > 0 then stat_message = stat_message .. #kraylorVesselDestroyedNameList station_strength = 0 for i=1,#kraylorVesselDestroyedNameList do - station_strength = station_strength + kraylorVesselDestroyedValue[i] + if kraylorVesselDestroyedValue[i] ~= nil then + station_strength = station_strength + kraylorVesselDestroyedValue[i] + else + print("vessel:",kraylorVesselDestroyedNameList[i]," has nil value in kraylor vessel destroyed value list") + end end - stat_message = stat_message .. string.format(_("msgMainscreen", " (total strength: %i)"),station_strength) + stat_message = stat_message .. string.format(_("msgMainscreen"," (total strength: %i)"),station_strength) else - stat_message = stat_message .. _("msgMainscreen", "none") + stat_message = stat_message .. _("msgMainscreen","none") end - stat_message = stat_message .. _("msgMainscreen", "\n\n\n\nExuari vessels destroyed: ") + stat_message = stat_message .. _("msgMainscreen","\nExuari vessels destroyed: ") if #exuariVesselDestroyedNameList ~= nil and #exuariVesselDestroyedNameList > 0 then stat_message = stat_message .. #exuariVesselDestroyedNameList station_strength = 0 for i=1,#exuariVesselDestroyedNameList do - station_strength = station_strength + exuariVesselDestroyedValue[i] + if exuariVesselDestroyedValue[i] ~= nil then + station_strength = station_strength + exuariVesselDestroyedValue[i] + else + print("vessel:",exuariVesselDestroyedNameList[i]," has nil value in exuari vessel destroyed value list") + end end - stat_message = stat_message .. string.format(_("msgMainscreen", " (total strength: %i)"),station_strength) + stat_message = stat_message .. string.format(_("msgMainscreen"," (total strength: %i)"),station_strength) else - stat_message = stat_message .. _("msgMainscreen", "none") + stat_message = stat_message .. _("msgMainscreen","none") end - stat_message = stat_message .. _("msgMainscreen", "\nArlenian vessels destroyed: ") + stat_message = stat_message .. _("msgMainscreen","\nArlenian vessels destroyed: ") if #arlenianVesselDestroyedNameList ~= nil and #arlenianVesselDestroyedNameList > 0 then stat_message = stat_message .. #arlenianVesselDestroyedNameList station_strength = 0 for i=1,#arlenianVesselDestroyedNameList do - station_strength = station_strength + arlenianVesselDestroyedValue[i] + if arlenianVesselDestroyedValue[i] ~= nil then + station_strength = station_strength + arlenianVesselDestroyedValue[i] + else + print("vessel:",arlenianVesselDestroyedNameList[i]," has nil value in arlenian vessel destroyed value list") + end end - stat_message = stat_message .. string.format(_("msgMainscreen", " (total strength: %i)"),station_strength) + stat_message = stat_message .. string.format(_("msgMainscreen"," (total strength: %i)"),station_strength) else - stat_message = stat_message .. _("msgMainscreen", "none") + stat_message = stat_message .. _("msgMainscreen","none") + end + stat_message = stat_message .. string.format(_("msgMainscreen","\nMissions completed: %i"),mission_complete_count) +-- optional_missions[comms_source:getCallSign()] = optional_missions[comms_source:getCallSign()] + 1 + local opt_msg = "" + for player,count in pairs(optional_missions) do + if count ~= nil and count > 0 then + if opt_msg == "" then + opt_msg = string.format("Optional missions completed: %s:%i",player,count) + else + opt_msg = string.format("%s, %s:%i",opt_msg,player,count) + end + end + end + if opt_msg ~= "" then + stat_message = string.format("%s\n%s",stat_message,opt_msg) end - stat_message = stat_message .. string.format(_("msgMainscreen", "\nMissions completed: %i"),mission_complete_count) if reason ~= nil then - stat_message = stat_message .. _("msgMainscreen", "\n") .. reason + stat_message = stat_message .. "\n" .. reason end globalMessage(stat_message) end +function tableRemoveRandom(array) +-- Remove random element from array and return it. + -- Returns nil if the array is empty, + -- analogous to `table.remove`. + local array_item_count = #array + if array_item_count == 0 then + return nil + end + local selected_item = math.random(array_item_count) + local temp = array[selected_item] + array[selected_item] = array[array_item_count] + array[array_item_count] = temp + return table.remove(array) +end function setPlayers() - local concurrentPlayerCount = 0 - for p1idx=1,8 do - pobj = getPlayerShip(p1idx) - if pobj ~= nil and pobj:isValid() then - concurrentPlayerCount = concurrentPlayerCount + 1 - if pobj.initialRep == nil then - pobj:addReputationPoints(200-(difficulty*40)) - pobj.initialRep = true - end - if not pobj.nameAssigned then - pobj.nameAssigned = true - local tempPlayerType = pobj:getTypeName() - if p1idx % 2 == 0 then - pobj:setPosition(playerSpawn1X,playerSpawn1Y) - else - pobj:setPosition(playerSpawn2X,playerSpawn2Y) + for i,pobj in ipairs(getActivePlayerShips()) do + if pobj.initialRep == nil then + pobj:addReputationPoints(200-(difficulty*40)) + pobj.initialRep = true + end + if not pobj.nameAssigned then + pobj.nameAssigned = true + local tempPlayerType = pobj:getTypeName() + if i % 2 == 0 then + pobj:setPosition(playerSpawn1X,playerSpawn1Y) + else + pobj:setPosition(playerSpawn2X,playerSpawn2Y) + end + local ship_name = tableRemoveRandom(playerShipNamesFor[tempPlayerType]) + if ship_name == nil then + ship_name = tableRemoveRandom(playerShipNamesFor["Leftovers"]) + end + if ship_name ~= nil then + pobj:setCallSign(ship_name) + end + if optional_missions == nil then + optional_missions = {} + end + optional_missions[pobj:getCallSign()] = 0 + pobj.maxCargo = player_ship_stats[tempPlayerType].cargo + pobj.shipScore = player_ship_stats[tempPlayerType].strength + pobj:setLongRangeRadarRange(player_ship_stats[tempPlayerType].long_range_radar) + pobj:setShortRangeRadarRange(player_ship_stats[tempPlayerType].short_range_radar) + if tempPlayerType == "MP52 Hornet" then + pobj.autoCoolant = false + pobj:setWarpDrive(true) + elseif tempPlayerType == "Phobos M3P" then + pobj:setWarpDrive(true) + elseif tempPlayerType == "Player Fighter" then + pobj.autoCoolant = false + pobj:setJumpDrive(true) + pobj:setJumpDriveRange(3000,40000) + elseif tempPlayerType == "Striker" then + if pobj:getImpulseMaxSpeed() == 45 then + pobj:setImpulseMaxSpeed(90) end - if tempPlayerType == "MP52 Hornet" then - if #playerShipNamesForMP52Hornet > 0 then - local ni = math.random(1,#playerShipNamesForMP52Hornet) - pobj:setCallSign(playerShipNamesForMP52Hornet[ni]) - table.remove(playerShipNamesForMP52Hornet,ni) - end - pobj.shipScore = 7 - pobj.maxCargo = 3 - pobj.autoCoolant = false - pobj:setWarpDrive(true) - elseif tempPlayerType == "Piranha" then - if #playerShipNamesForPiranha > 0 then - ni = math.random(1,#playerShipNamesForPiranha) - pobj:setCallSign(playerShipNamesForPiranha[ni]) - table.remove(playerShipNamesForPiranha,ni) - end - pobj.shipScore = 16 - pobj.maxCargo = 8 - elseif tempPlayerType == "Flavia P.Falcon" then - if #playerShipNamesForFlaviaPFalcon > 0 then - ni = math.random(1,#playerShipNamesForFlaviaPFalcon) - pobj:setCallSign(playerShipNamesForFlaviaPFalcon[ni]) - table.remove(playerShipNamesForFlaviaPFalcon,ni) - end - pobj.shipScore = 13 - pobj.maxCargo = 15 - elseif tempPlayerType == "Phobos M3P" then - if #playerShipNamesForPhobosM3P > 0 then - ni = math.random(1,#playerShipNamesForPhobosM3P) - pobj:setCallSign(playerShipNamesForPhobosM3P[ni]) - table.remove(playerShipNamesForPhobosM3P,ni) - end - pobj.shipScore = 19 - pobj.maxCargo = 10 - pobj:setWarpDrive(true) - elseif tempPlayerType == "Atlantis" then - if #playerShipNamesForAtlantis > 0 then - ni = math.random(1,#playerShipNamesForAtlantis) - pobj:setCallSign(playerShipNamesForAtlantis[ni]) - table.remove(playerShipNamesForAtlantis,ni) - end - pobj.shipScore = 52 - pobj.maxCargo = 6 - elseif tempPlayerType == "Player Cruiser" then - if #playerShipNamesForCruiser > 0 then - ni = math.random(1,#playerShipNamesForCruiser) - pobj:setCallSign(playerShipNamesForCruiser[ni]) - table.remove(playerShipNamesForCruiser,ni) - end - pobj.shipScore = 40 - pobj.maxCargo = 6 - elseif tempPlayerType == "Player Missile Cr." then - if #playerShipNamesForMissileCruiser > 0 then - ni = math.random(1,#playerShipNamesForMissileCruiser) - pobj:setCallSign(playerShipNamesForMissileCruiser[ni]) - table.remove(playerShipNamesForMissileCruiser,ni) - end - pobj.shipScore = 45 - pobj.maxCargo = 8 - elseif tempPlayerType == "Player Fighter" then - if #playerShipNamesForFighter > 0 then - ni = math.random(1,#playerShipNamesForFighter) - pobj:setCallSign(playerShipNamesForFighter[ni]) - table.remove(playerShipNamesForFighter,ni) - end - pobj.shipScore = 7 - pobj.maxCargo = 3 - pobj.autoCoolant = false - pobj:setJumpDrive(true) - pobj:setJumpDriveRange(3000,40000) - elseif tempPlayerType == "Benedict" then - if #playerShipNamesForBenedict > 0 then - ni = math.random(1,#playerShipNamesForBenedict) - pobj:setCallSign(playerShipNamesForBenedict[ni]) - table.remove(playerShipNamesForBenedict,ni) - end - pobj.shipScore = 10 - pobj.maxCargo = 9 - elseif tempPlayerType == "Kiriya" then - if #playerShipNamesForKiriya > 0 then - ni = math.random(1,#playerShipNamesForKiriya) - pobj:setCallSign(playerShipNamesForKiriya[ni]) - table.remove(playerShipNamesForKiriya,ni) - end - pobj.shipScore = 10 - pobj.maxCargo = 9 - elseif tempPlayerType == "Striker" then - if #playerShipNamesForStriker > 0 then - ni = math.random(1,#playerShipNamesForStriker) - pobj:setCallSign(playerShipNamesForStriker[ni]) - table.remove(playerShipNamesForStriker,ni) - end - if pobj:getImpulseMaxSpeed() == 45 then - pobj:setImpulseMaxSpeed(90) - end - if pobj:getBeamWeaponCycleTime(0) == 6 then - local bi = 0 - repeat - local tempArc = pobj:getBeamWeaponArc(bi) - local tempDir = pobj:getBeamWeaponDirection(bi) - local tempRng = pobj:getBeamWeaponRange(bi) - local tempDmg = pobj:getBeamWeaponDamage(bi) - pobj:setBeamWeapon(bi,tempArc,tempDir,tempRng,5,tempDmg) - bi = bi + 1 - until(pobj:getBeamWeaponRange(bi) < 1) - end - pobj.shipScore = 8 - pobj.maxCargo = 4 - pobj:setJumpDrive(true) - pobj:setJumpDriveRange(3000,40000) - elseif tempPlayerType == "ZX-Lindworm" then - if #playerShipNamesForLindworm > 0 then - ni = math.random(1,#playerShipNamesForLindworm) - pobj:setCallSign(playerShipNamesForLindworm[ni]) - table.remove(playerShipNamesForLindworm,ni) - end - pobj.shipScore = 8 - pobj.maxCargo = 3 - pobj.autoCoolant = false - pobj:setWarpDrive(true) - elseif tempPlayerType == "Repulse" then - if #playerShipNamesForRepulse > 0 then - ni = math.random(1,#playerShipNamesForRepulse) - pobj:setCallSign(playerShipNamesForRepulse[ni]) - table.remove(playerShipNamesForRepulse,ni) - end - pobj.shipScore = 14 - pobj.maxCargo = 12 - elseif tempPlayerType == "Ender" then - if #playerShipNamesForEnder > 0 then - ni = math.random(1,#playerShipNamesForEnder) - pobj:setCallSign(playerShipNamesForEnder[ni]) - table.remove(playerShipNamesForEnder,ni) - end - pobj.shipScore = 100 - pobj.maxCargo = 20 - elseif tempPlayerType == "Nautilus" then - if #playerShipNamesForNautilus > 0 then - ni = math.random(1,#playerShipNamesForNautilus) - pobj:setCallSign(playerShipNamesForNautilus[ni]) - table.remove(playerShipNamesForNautilus,ni) - end - pobj.shipScore = 12 - pobj.maxCargo = 7 - elseif tempPlayerType == "Hathcock" then - if #playerShipNamesForHathcock > 0 then - ni = math.random(1,#playerShipNamesForHathcock) - pobj:setCallSign(playerShipNamesForHathcock[ni]) - table.remove(playerShipNamesForHathcock,ni) - end - pobj.shipScore = 30 - pobj.maxCargo = 6 - elseif tempPlayerType == "Atlantis II" then - if #playerShipNamesForAtlantisII > 0 then - ni = math.random(1,#playerShipNamesForAtlantisII) - pobj:setCallSign(playerShipNamesForAtlantisII[ni]) - table.remove(playerShipNamesForAtlantisII,ni) - end - pobj.shipScore = 60 - pobj.maxCargo = 5 - elseif tempPlayerType == "Proto-Atlantis" then - if #playerShipNamesForProtoAtlantis > 0 then - ni = math.random(1,#playerShipNamesForProtoAtlantis) - pobj:setCallSign(playerShipNamesForProtoAtlantis[ni]) - table.remove(playerShipNamesForProtoAtlantis,ni) - end - pobj.shipScore = 40 - pobj.maxCargo = 4 - elseif tempPlayerType == "Surkov" then - if #playerShipNamesForSurkov > 0 then - ni = math.random(1,#playerShipNamesForSurkov) - pobj:setCallSign(playerShipNamesForSurkov[ni]) - table.remove(playerShipNamesForSurkov,ni) - end - pobj.shipScore = 35 - pobj.maxCargo = 6 - elseif tempPlayerType == "Redhook" then - if #playerShipNamesForRedhook > 0 then - ni = math.random(1,#playerShipNamesForRedhook) - pobj:setCallSign(playerShipNamesForRedhook[ni]) - table.remove(playerShipNamesForRedhook,ni) - end - pobj.shipScore = 18 - pobj.maxCargo = 8 - else - if #playerShipNamesForLeftovers > 0 then - ni = math.random(1,#playerShipNamesForLeftovers) - pobj:setCallSign(playerShipNamesForLeftovers[ni]) - table.remove(playerShipNamesForLeftovers,ni) - end - pobj.shipScore = 24 - pobj.maxCargo = 5 - pobj:setWarpDrive(true) + if pobj:getBeamWeaponCycleTime(0) == 6 then + local bi = 0 + repeat + local tempArc = pobj:getBeamWeaponArc(bi) + local tempDir = pobj:getBeamWeaponDirection(bi) + local tempRng = pobj:getBeamWeaponRange(bi) + local tempDmg = pobj:getBeamWeaponDamage(bi) + pobj:setBeamWeapon(bi,tempArc,tempDir,tempRng,5,tempDmg) + bi = bi + 1 + until(pobj:getBeamWeaponRange(bi) < 1) end - local playerCallSign = pobj:getCallSign() - goods[playerCallSign] = {} - if pobj.cargo == nil then - pobj.cargo = pobj.maxCargo - pobj.maxRepairCrew = pobj:getRepairCrewCount() - pobj.healthyShield = 1.0 - pobj.prevShield = 1.0 - pobj.healthyReactor = 1.0 - pobj.prevReactor = 1.0 - pobj.healthyManeuver = 1.0 - pobj.prevManeuver = 1.0 - pobj.healthyImpulse = 1.0 - pobj.prevImpulse = 1.0 - if pobj:getBeamWeaponRange(0) > 0 then - pobj.healthyBeam = 1.0 - pobj.prevBeam = 1.0 - end - if pobj:getWeaponTubeCount() > 0 then - pobj.healthyMissile = 1.0 - pobj.prevMissile = 1.0 - end - if pobj:hasWarpDrive() then - pobj.healthyWarp = 1.0 - pobj.prevWarp = 1.0 - end - if pobj:hasJumpDrive() then - pobj.healthyJump = 1.0 - pobj.prevJump = 1.0 - end + pobj:setJumpDrive(true) + pobj:setJumpDriveRange(3000,40000) + elseif tempPlayerType == "ZX-Lindworm" then + pobj.autoCoolant = false + pobj:setWarpDrive(true) + else + pobj.shipScore = 24 + pobj.maxCargo = 5 + pobj:setWarpDrive(true) + end + local playerCallSign = pobj:getCallSign() + goods[playerCallSign] = {} + if pobj.cargo == nil then + pobj.goods = {} + pobj.cargo = pobj.maxCargo + pobj.maxRepairCrew = pobj:getRepairCrewCount() + pobj.healthyShield = 1.0 + pobj.prevShield = 1.0 + pobj.healthyReactor = 1.0 + pobj.prevReactor = 1.0 + pobj.healthyManeuver = 1.0 + pobj.prevManeuver = 1.0 + pobj.healthyImpulse = 1.0 + pobj.prevImpulse = 1.0 + if pobj:getBeamWeaponRange(0) > 0 then + pobj.healthyBeam = 1.0 + pobj.prevBeam = 1.0 + end + if pobj:getWeaponTubeCount() > 0 then + pobj.healthyMissile = 1.0 + pobj.prevMissile = 1.0 + end + if pobj:hasWarpDrive() then + pobj.healthyWarp = 1.0 + pobj.prevWarp = 1.0 + end + if pobj:hasJumpDrive() then + pobj.healthyJump = 1.0 + pobj.prevJump = 1.0 end end - pobj.initialCoolant = pobj:getMaxCoolant() end + pobj.initialCoolant = pobj:getMaxCoolant() end - return concurrentPlayerCount end function update(delta) if delta == 0 then --game paused @@ -10795,9 +7870,8 @@ function update(delta) return end if updateDiagnostic then print("set players") end - local concurrentPlayerCount = setPlayers() - if updateDiagnostic then print("concurrent player count: " .. concurrentPlayerCount) end - if concurrentPlayerCount < 1 then --do nothing until player ship is spawned + setPlayers() + if #getActivePlayerShips() < 1 then --do nothing until player ship is spawned return end if updateDiagnostic then print("plotManager") end @@ -10816,24 +7890,13 @@ function update(delta) if plot3 ~= nil then --transport cleanup plot3(delta) end - if updateDiagnostic then print("plotT") end - if plotT ~= nil then --working transports - plotT(delta) - end - if updateDiagnostic then print("plotM") end - if plotM ~= nil then --moving objects - plotM(delta) - end - if plotCI ~= nil then --cargo inventory - plotCI(delta) - end - if plotH ~= nil then --health - plotH(delta) - end - if plotCN ~= nil then --coolant via nebula - plotCN(delta) - end - if plotV ~= nil then --voice handling - plotV(delta) - end -end \ No newline at end of file + if updateDiagnostic then print("working transports") end + workingTransports(delta) + if updateDiagnostic then print("moving objects") end + movingObjects(delta) + cargoInventory() + healthCheck(delta) + coolantNebulae(delta) + handleVoiceQueue(delta) +end +