Skip to content

Escape Scenario Updates #2329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions scripts/scenario_53_escape.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
-- Name: Escape
-- Description: Escape imprisonment and return home.
--- Mission consists of one ship with a full crew. Engineer and Science will be busy.
--- Version 5 switches to the max health system, preserves some sensor data in the final phase
--- and uses the place station scenario utility.
---
--- Version 5
---
--- USN Discord: https://discord.gg/PntGG3a where you can join a game online. There's one every weekend. All experience levels are welcome.
-- Type: Replayable Mission
-- Author: Xansta
Expand All @@ -22,7 +23,7 @@ require("place_station_scenario_utility.lua")
-- Initialization routines --
-------------------------------
function init()
scenario_version = "5.0.10"
scenario_version = "5.0.12"
ee_version = "2024.12.08"
print(string.format(" ---- Scenario: Escape ---- Version %s ---- Tested with EE version %s",scenario_version,ee_version))
if _VERSION ~= nil then
Expand Down Expand Up @@ -478,7 +479,7 @@ function placeRandomAsteroidsAroundPoint(object_type, amount, 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
if isObjectType(obj,"Asteroid") or isObjectType(obj,"VisualAsteroid") then
obj:setSize(random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20))
end
end
Expand Down Expand Up @@ -1583,7 +1584,7 @@ function handleDockedState()
local scanned_ships = {}
local fully_scanned_ships = {}
for i,obj in ipairs(objects) do
if obj.typeName == "CpuShip" then
if isObjectType(obj,"CpuShip") then
if obj:isScannedBy(playerRepulse) then
table.insert(scanned_ships,obj)
end
Expand Down Expand Up @@ -1845,7 +1846,7 @@ 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
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
Expand Down Expand Up @@ -1908,7 +1909,7 @@ function handleDockedState()
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"])
if goodData[quantity] < 1 then
if goodData["quantity"] < 1 then
goodTransactionMessage = goodTransactionMessage .. _("trade-comms", "\nInsufficient station inventory")
else
goodData["quantity"] = goodData["quantity"] - 1
Expand Down Expand Up @@ -2568,7 +2569,7 @@ function friendlyComms(comms_data)
addCommsReply(_("Back"), commsShip)
end)
for idx, obj in ipairs(comms_target:getObjectsInRange(5000)) do
if obj.typeName == "SpaceStation" and not comms_target:isEnemy(obj) then
if isObjectType(obj,"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()));
comms_target:orderDock(obj)
Expand Down Expand Up @@ -3263,23 +3264,25 @@ end
function cumulativeHarassment(delta)
harassment_timer = harassment_timer - delta
if harassment_timer < 0 then
local total_health = playerRepulse:getSystemHealth("reactor")
total_health = total_health + playerRepulse:getSystemHealth("beamweapons")
total_health = total_health + playerRepulse:getSystemHealth("maneuver")
total_health = total_health + playerRepulse:getSystemHealth("missilesystem")
total_health = total_health + playerRepulse:getSystemHealth("impulse")
total_health = total_health + playerRepulse:getSystemHealth("jumpdrive")
total_health = total_health + playerRepulse:getSystemHealth("frontshield")
total_health = total_health + playerRepulse:getSystemHealth("rearshield")
total_health = total_health + playerRepulse:getSystemHealth("warp")
total_health = total_health/9
local cpx, cpy = playerRepulse:getPosition()
local dpx, dpy = vectorFromAngle(random(0,360),playerRepulse:getLongRangeRadarRange()+500)
local fleet = spawnEnemies(cpx+dpx,cpy+dpy,total_health,"Exuari")
for idx, enemy in ipairs(fleet) do
enemy:orderAttack(playerRepulse)
end
harassment_timer = delta + 200 - (difficulty*20)
if playerRepulse:getReputationPoints() < 150 then
local total_health = playerRepulse:getSystemHealth("reactor")
total_health = total_health + playerRepulse:getSystemHealth("beamweapons")
total_health = total_health + playerRepulse:getSystemHealth("maneuver")
total_health = total_health + playerRepulse:getSystemHealth("missilesystem")
total_health = total_health + playerRepulse:getSystemHealth("impulse")
total_health = total_health + playerRepulse:getSystemHealth("jumpdrive")
total_health = total_health + playerRepulse:getSystemHealth("frontshield")
total_health = total_health + playerRepulse:getSystemHealth("rearshield")
total_health = total_health + playerRepulse:getSystemHealth("warp")
total_health = total_health/9
local cpx, cpy = playerRepulse:getPosition()
local dpx, dpy = vectorFromAngle(random(0,360),playerRepulse:getLongRangeRadarRange()+500)
local fleet = spawnEnemies(cpx+dpx,cpy+dpy,total_health,"Exuari")
for idx, enemy in ipairs(fleet) do
enemy:orderAttack(playerRepulse)
end
end
harassment_timer = delta + 240 - (difficulty*20)
end
end
function showCrewFixers()
Expand Down
Loading