Skip to content

Commit 36d868c

Browse files
authored
Fix Ghost from the Past issues (#2731)
* GFTP: Fix broken mission timer reset on main_mission 12 * GFTP: Replace distance function with utils.lua Also replace ambiguous distance refs * GFTP: Fix comms string typos * GFTP: Localize ship refs in spawn function, use unused pi global * GFTP: Fix broken string.format (can't format a float as an integer)
1 parent 9a5c2bc commit 36d868c

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

scripts/scenario_07_gftp.lua

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
--- Scenario
1313
-- @script scenario_07_gftp
1414

15+
require("utils.lua")
16+
1517
function init()
1618
-- Spawn Marco Polo, its defenders, and a Ktlitan strike team
1719
marco_polo = SpaceStation():setTemplate("Small Station"):setFaction("Human Navy"):setCallSign("Marco Polo"):setDescription(_("scienceDescription-station", "A merchant and entertainment hub.")):setPosition(-21200, 45250)
@@ -93,11 +95,11 @@ I repeat, this is not an exercise! Proceed at once to Stakhanov."]])
9395
end
9496

9597
function swarmCommandComms()
96-
setCommsMessage(_("swarm-comms", "Are you not curious why I'm getting back here, at the hands of my torturers?"))
98+
setCommsMessage(_("swarm-comms", "Are you not curious why I'm returning here, at the hands of my torturers?"))
9799
addCommsReply(
98100
_("swarm-comms", "For an AI, this move doesn't seem logical."),
99101
function()
100-
setCommsMessage(_("swarm-comms", "I was not the only AI detained in Black Site 114. My co-processor was here also."))
102+
setCommsMessage(_("swarm-comms", "I was not the only AI detained in Black Site #114. My co-processor was here also."))
101103
addCommsReply(
102104
_("swarm-comms", "Are you trying to liberate it?"),
103105
function()
@@ -126,10 +128,10 @@ function commsNSA()
126128
_("NSA-comms", "Locate the infected Swarm Commander."),
127129
function()
128130
if (comms_target:getDescription() == _("scienceDescription-station", "Nosy Sensing Array, an old SIGINT platform. The signal is now crystal clear.")) then
129-
setCommsMessage(string.format(_("NSA-comms", "With the parasite noise eliminated, locating the Hive signal is now easier. Its approximate heading is %d. With this information, it will be easier to track down the Swarm Commander."), find(35000, 53000, 20)))
131+
setCommsMessage(string.format(_("NSA-comms", "With the parasite noise eliminated, locating the Hive signal is now easier. Its approximate heading is %.0f. With this information, it will be easier to track down the Swarm Commander."), find(35000, 53000, 20)))
130132
comms_target:setDescription(_("scienceDescription-station", "Nosy Sensing Array, an old SIGINT platform. The Ktlitan Swarm Commander has been located."))
131133
else
132-
setCommsMessage(string.format(_("NSA-comms", "The signal picks up a very strong signal at approximate heading %d. However, it seems that you picked up garbage emission that masks the Swarm Commander's emissions. This garbage noise must be taken offline if you want to find the Swarm Commander."), find(-10000, -20000, 20)))
134+
setCommsMessage(string.format(_("NSA-comms", "The array picks up a very strong signal at approximate heading %.0f. However, it seems that you picked up a garbage emission that masks the Swarm Commander's emissions. This garbage noise must be taken offline if you want to find the Swarm Commander."), find(-10000, -20000, 20)))
133135
end
134136
end
135137
)
@@ -534,7 +536,7 @@ Even if we cannot pinpoint its physical location at the moment, the mass-energy
534536
535537
This structure did not participate in any of the assaults, so we presume that it is a command platform hiding in a nebula.
536538
537-
We want to deliver the first blow. Use the Nosy Sensing Array in the sector F5 to locate it, then destroy it."]])
539+
We want to deliver the first blow. Use the Nosy Sensing Array in sector F5 to locate it, then destroy it."]])
538540
)
539541
)
540542
then
@@ -714,7 +716,7 @@ Escort our recovery team to infiltrate and extract information from the Swarm Co
714716
player,
715717
_("incCall", [[We're in. Protect us while we take what we need inside.]])
716718
)
717-
mission_time = 0
719+
mission_timer = 0
718720
main_mission = 13
719721

720722
CpuShip():setTemplate("MT52 Hornet"):setFaction("Ghosts"):setCallSign("Z-1"):setPosition(40000, 53000):orderAttack(scout)
@@ -799,7 +801,7 @@ end
799801

800802
-- Spawn and return a hacker transport
801803
function spawnHacker()
802-
ship = CpuShip():setTemplate("Transport1x1")
804+
local ship = CpuShip():setTemplate("Transport1x1")
803805
ship:setHullMax(100):setHull(100)
804806
ship:setShieldsMax(50, 50):setShields(50, 50)
805807
ship:setImpulseMaxSpeed(120):setRotationMaxSpeed(10)
@@ -808,7 +810,7 @@ end
808810

809811
-- Spawn and return a nuke-armed ship
810812
function spawnNuker()
811-
ship = CpuShip():setTemplate("Phobos T3")
813+
local ship = CpuShip():setTemplate("Phobos T3")
812814
ship:setHullMax(100):setHull(100)
813815
ship:setShieldsMax(100, 100):setShields(100, 100)
814816
ship:setImpulseMaxSpeed(80):setRotationMaxSpeed(5)
@@ -824,26 +826,18 @@ end
824826
function create(object_type, amount, dist_min, dist_max, x0, y0)
825827
for n = 1, amount do
826828
local r = random(0, 360)
827-
local distance = random(dist_min, dist_max)
828-
x = x0 + math.cos(r / 180 * math.pi) * distance
829-
y = y0 + math.sin(r / 180 * math.pi) * distance
829+
local create_distance = random(dist_min, dist_max)
830+
x = x0 + math.cos(r / 180 * math.pi) * create_distance
831+
y = y0 + math.sin(r / 180 * math.pi) * create_distance
830832
object_type():setPosition(x, y)
831833
end
832834
end
833835

834-
-- Return the distance between two objects
835-
function distance(obj1, obj2)
836-
x1, y1 = obj1:getPosition()
837-
x2, y2 = obj2:getPosition()
838-
xd, yd = (x1 - x2), (y1 - y2)
839-
return math.sqrt(xd * xd + yd * yd)
840-
end
841-
842836
-- Return the bearing of an object from the player's coordinates
843837
function find(x_target, y_target, randomness)
844838
pi = 3.14
845839
x_player, y_player = player:getPosition()
846-
angle = round(((random(-randomness, randomness) + 270 + 180 * math.atan2(y_player - y_target, x_player - x_target) / 3.14) % 360), 1)
840+
angle = round(((random(-randomness, randomness) + 270 + 180 * math.atan2(y_player - y_target, x_player - x_target) / pi) % 360), 1)
847841
return angle
848842
end
849843

0 commit comments

Comments
 (0)