Skip to content

Commit

Permalink
The Omicron Plague scenario update (#2051)
Browse files Browse the repository at this point in the history
- Fix missing warp jammer default range
- Fix bad variable name causing goods purchase failure
- Add repair crew transport buttons to damage control console
- Fix bad return value from the available for comms routine
  • Loading branch information
Xansta authored Mar 17, 2024
1 parent 159daa9 commit 9b95632
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions scripts/scenario_74_omicron.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require("place_station_scenario_utility.lua")
-- Initialization --
--------------------
function init()
scenario_version = "0.0.1"
scenario_version = "1.0.2"
print(string.format(" ----- Scenario: Omicron ----- Version %s -----",scenario_version))
print(_VERSION)
spawn_enemy_diagnostic = false
Expand Down Expand Up @@ -1695,6 +1695,7 @@ function constructEnvironment()
local mwj = WarpJammer():setPosition(barrier_center_x + mwj_x, barrier_center_y + mwj_y):setRange(warp_jammer_a.range + 1200):setFaction(station:getFaction())
warp_jammer_info[station:getFaction()].count = warp_jammer_info[station:getFaction()].count + 1
mwj:setCallSign(string.format("%sWJ%i",warp_jammer_info[station:getFaction()].id,warp_jammer_info[station:getFaction()].count))
mwj.range = warp_jammer_a.range + 1200
table.insert(warp_jammer_list,mwj)
local nd_angle = random(0,360)
local bn_x, bn_y = vectorFromAngle(nd_angle,random(1000,4000))
Expand Down Expand Up @@ -1774,6 +1775,7 @@ function constructEnvironment()
local mwj = WarpJammer():setPosition(barrier_center_x + mwj_x, barrier_center_y + mwj_y):setRange(warp_jammer_a.range + 1200):setFaction(station:getFaction())
warp_jammer_info[station:getFaction()].count = warp_jammer_info[station:getFaction()].count + 1
mwj:setCallSign(string.format("%sWJ%i",warp_jammer_info[station:getFaction()].id,warp_jammer_info[station:getFaction()].count))
mwj.range = warp_jammer_a.range + 1200
table.insert(warp_jammer_list,mwj)
local nd_angle = random(0,360)
local bn_x, bn_y = vectorFromAngle(nd_angle,random(1000,4000))
Expand Down Expand Up @@ -2996,11 +2998,20 @@ end
function warpJammerMaintenance()
if #warp_jammer_list > 0 then
for wj_index, wj in ipairs(warp_jammer_list) do
local set_default_range = false
if wj ~= nil and wj:isValid() then
if wj.reset_time ~= nil then
if getScenarioTime() > wj.reset_time then
if wj.range == nil then
wj.range = wj:getRange()
print("warp jammer did not have range value set, so setting it to current value:")
set_default_range = true
end
wj:setRange(wj.range)
wj.reset_time = nil
if set_default_range then
print("warp jammer call sign:",wj:getCallSign())
end
end
end
else
Expand Down Expand Up @@ -5190,7 +5201,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(good_data.cost)), function()
addCommsReply(string.format(_("trade-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
Expand All @@ -5215,7 +5226,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(good_data.cost)), function()
addCommsReply(string.format(_("trade-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
Expand Down Expand Up @@ -5854,7 +5865,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(good_data.cost)), function()
addCommsReply(string.format(_("trade-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
Expand Down Expand Up @@ -9505,6 +9516,11 @@ function checkFreighter()
string.format("")
sendRepairCrewToFreighter(p)
end)
p.send_repair_crew_to_freighter_dmg = "send_repair_crew_to_freighter_dmg"
p:addCustomButton("DamageControl",p.send_repair_crew_to_freighter_dmg,_("crewTransfer-buttonDamageControl", "Send Repair Crew"),function()
string.format("")
sendRepairCrewToFreighter(p)
end)
end
critical_transport:setSystemHealthMax("impulse",.01)
critical_transport:setSystemHealthMax("jumpdrive",.01)
Expand Down Expand Up @@ -9558,6 +9574,7 @@ function getRepairCrewFromFreighter(p)
for pidx2, p2 in ipairs(getActivePlayerShips()) do
p2:removeCustom(p2.get_repair_crew_from_freighter_eng)
p2:removeCustom(p2.get_repair_crew_from_freighter_plus)
p2:removeCustom(p2.get_repair_crew_from_freighter_dmg)
end
end
end
Expand Down Expand Up @@ -9614,6 +9631,7 @@ function sendRepairCrewToFreighter(p)
p2:addToShipLog(string.format(_("crewTransfer-shipLog", "%s has transported one of her repair crew to %s. They report that the engines should be fixed in a minute or two."),p:getCallSign(),critical_transport:getCallSign()),"Magenta")
p2:removeCustom(p2.send_repair_crew_to_freighter_eng)
p2:removeCustom(p2.send_repair_crew_to_freighter_plus)
p2:removeCustom(p2.send_repair_crew_to_freighter_dmg)
p2.get_repair_crew_from_freighter_eng = "get_repair_crew_from_freighter_eng"
p2:addCustomButton("Engineering",p2.get_repair_crew_from_freighter_eng,_("crewTransfer-buttonEngineer", "Get Repair Crew"),function()
string.format("")
Expand All @@ -9624,6 +9642,11 @@ function sendRepairCrewToFreighter(p)
string.format("")
getRepairCrewFromFreighter(p2)
end)
p2.get_repair_crew_from_freighter_dmg = "get_repair_crew_from_freighter_dmg"
p2:addCustomButton("DamageControl",p2.get_repair_crew_from_freighter_dmg,_("crewTransfer-buttonEngineer+", "Get Repair Crew"),function()
string.format("")
getRepairCrewFromFreighter(p2)
end)
end
else
p.not_enough_repair_crew_eng = "not_enough_repair_crew_eng"
Expand Down Expand Up @@ -9841,7 +9864,7 @@ function availableForComms(p)
return false
end
if p:isCommsChatOpenToPlayer() then
return
return false
end
if p:isCommsScriptOpen() then
return false
Expand Down

2 comments on commit 9b95632

@daid-tinyci
Copy link

@daid-tinyci daid-tinyci bot commented on 9b95632 Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyCI build failure:

[ninja -j 2 package] returned [1]:


FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o 

/usr/bin/c++  -I/data/tinyci_build/daid/EmptyEpsilon/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_build/daid/SeriousProton/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_build/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_build/daid/SeriousProton/libs/glad -I/data/tinyci_build/daid/SeriousProton/libs/lua/.. -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_build/daid/SeriousProton/libs/freetype2/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_build/daid/SeriousProton/libs/libopus/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o -c /data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp: In member function ‘virtual void ScriptErrorRenderer::render(sp::RenderTarget&)’:

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:7: error: ‘ScriptObject’ was not declared in this scope; did you mean ‘scriptBindObject’?

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |       ^~~~~~~~~~~~

      |       scriptBindObject

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:19: error: template argument 1 is invalid

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |                   ^

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:47: error: cannot convert ‘P<PObject>’ to ‘int’ in initialization

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

      |                                               |

      |                                               P<PObject>

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:20:26: error: base operand of ‘->’ is not a pointer

   20 |     string error = script->getError();

      |                          ^~

[2/172] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o 

/usr/bin/c++  -I/data/tinyci_build/daid/EmptyEpsilon/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_build/daid/SeriousProton/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_build/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_build/daid/SeriousProton/libs/glad -I/data/tinyci_build/daid/SeriousProton/libs/lua/.. -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_build/daid/SeriousProton/libs/freetype2/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_build/daid/SeriousProton/libs/libopus/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o -c /data/tinyci_build/daid/EmptyEpsilon/src/gui/hotkeyConfig.cpp

In file included from /data/tinyci_build/daid/EmptyEpsilon/src/shipTemplate.h:13,

                 from /data/tinyci_build/daid/EmptyEpsilon/src/gui/hotkeyConfig.cpp:4:

/data/tinyci_build/daid/EmptyEpsilon/src/missileWeaponData.h:25:41: error: expected constructor, destructor, or type conversion before ‘;’ token

   25 | REGISTER_MULTIPLAYER_ENUM(EMissileSizes);

      |                                         ^

/data/tinyci_build/daid/EmptyEpsilon/src/shipTemplate.h:209:35: error: expected constructor, destructor, or type conversion before ‘;’ token

  209 | REGISTER_MULTIPLAYER_ENUM(ESystem);

      |                                   ^

ninja: build stopped: subcommand failed.

@daid-tinyci
Copy link

@daid-tinyci daid-tinyci bot commented on 9b95632 Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyCI build failure:

[ninja -j 2 package] returned [1]:


FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o 

/usr/bin/c++  -I/data/tinyci_build/daid/EmptyEpsilon/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_build/daid/SeriousProton/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_build/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_build/daid/SeriousProton/libs/glad -I/data/tinyci_build/daid/SeriousProton/libs/lua/.. -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_build/daid/SeriousProton/libs/freetype2/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_build/daid/SeriousProton/libs/libopus/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/scriptError.cpp.o -c /data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp: In member function ‘virtual void ScriptErrorRenderer::render(sp::RenderTarget&)’:

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:7: error: ‘ScriptObject’ was not declared in this scope; did you mean ‘scriptBindObject’?

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |       ^~~~~~~~~~~~

      |       scriptBindObject

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:19: error: template argument 1 is invalid

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |                   ^

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:13:47: error: cannot convert ‘P<PObject>’ to ‘int’ in initialization

   13 |     P<ScriptObject> script = engine->getObject("scenario");

      |                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

      |                                               |

      |                                               P<PObject>

/data/tinyci_build/daid/EmptyEpsilon/src/gui/scriptError.cpp:20:26: error: base operand of ‘->’ is not a pointer

   20 |     string error = script->getError();

      |                          ^~

[2/172] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o 

/usr/bin/c++  -I/data/tinyci_build/daid/EmptyEpsilon/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_build/daid/SeriousProton/src -I/data/tinyci_build/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_build/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_build/daid/SeriousProton/libs/glad -I/data/tinyci_build/daid/SeriousProton/libs/lua/.. -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_build/daid/SeriousProton/libs/freetype2/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_build/daid/SeriousProton/libs/libopus/include -I/home/tinyci/builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyConfig.cpp.o -c /data/tinyci_build/daid/EmptyEpsilon/src/gui/hotkeyConfig.cpp

In file included from /data/tinyci_build/daid/EmptyEpsilon/src/shipTemplate.h:13,

                 from /data/tinyci_build/daid/EmptyEpsilon/src/gui/hotkeyConfig.cpp:4:

/data/tinyci_build/daid/EmptyEpsilon/src/missileWeaponData.h:25:41: error: expected constructor, destructor, or type conversion before ‘;’ token

   25 | REGISTER_MULTIPLAYER_ENUM(EMissileSizes);

      |                                         ^

/data/tinyci_build/daid/EmptyEpsilon/src/shipTemplate.h:209:35: error: expected constructor, destructor, or type conversion before ‘;’ token

  209 | REGISTER_MULTIPLAYER_ENUM(ESystem);

      |                                   ^

ninja: build stopped: subcommand failed.

Please sign in to comment.