Skip to content

Commit

Permalink
scenarios: bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piglit committed Aug 22, 2024
1 parent 0091489 commit 26a4dc1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts-piglit/plots/wh_reputation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function wh_reputation:requestReputation()
local player = getPlayerShip(-1)
player:addReputationPoints(amount)
--]]
self.done == true
self.done = true
end
end

Expand Down
13 changes: 7 additions & 6 deletions scripts-piglit/scenario_00_basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ require("utils.lua")
-- Returns the bearing between first object/coordinate and second object/coordinate.

require("plots/wh_reputation.lua")
require("plots/wh_artifacts.lua")

-- Global variables for this scenario
local enemyList
Expand All @@ -40,8 +41,6 @@ local stationList
local playerList
local addWavesToGMPosition -- If set to true, add wave will require GM to click on the map to position, where the wave should be spawned.
local startEnemyCount = nil
local lastReportedProgress
local lastReportedTime

local gametimeleft = nil -- Maximum game time in seconds.
local timewarning = nil -- Used for checking when to give a warning, and to update it so the warning happens once.
Expand Down Expand Up @@ -303,7 +302,7 @@ end

--- Initialize scenario.
function init()

wh_artifacts:init()
--[[
-- Spawn a player Atlantis.
player = PlayerSpaceship():setFaction("Human Navy"):setTemplate(getScenarioSetting("PlayerShip"))
Expand All @@ -317,8 +316,6 @@ function init()
friendlyList = {}
stationList = {}
playerList = {}
lastReportedProgress = 0
lastReportedTime = 0

onNewPlayerShip(function(ship)
table.insert(playerList, ship)
Expand Down Expand Up @@ -553,8 +550,12 @@ function update(delta)
local player_count = countValid(playerList)
if startEnemyCount == nil then
startEnemyCount = enemy_count
lastEnemyCount = enemy_count
end
sendProgressToCampaignServer(enemy_count, startEnemyCount)
if lastEnemyCount ~= enemy_count then
lastEnemyCount = enemy_count
sendProgressToCampaignServer(startEnemyCount - enemy_count, startEnemyCount)
end

-- If not playing the Empty variation, declare victory for the
-- Humans (players) once all enemies are destroyed. Note that players can win
Expand Down
4 changes: 2 additions & 2 deletions scripts-piglit/scenario_20_training1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ function finished(delta)
name = "Exuari warp drive",
description = "Some Exuari ships are equipped with a warp drive. They use it to ambush their targets or to escape from a sector with valuable cargo.",
}
sendMessageToCampaignServer("artifact", toJson(artDetails))
sendMessageToCampaignServer("artifact", toJSON(artDetails))
else
bonusString = bonusString .. _("msgMainscreen-bonusTarget"," Artifact was destroyed.")
end
end
globalMessage(string.format(_("msgMainscreen", [[Mission Complete.
Your Time: %d
Your Time: %s
Bonus target %s]]), formatTime(timer), bonusString))
end
end
Expand Down

0 comments on commit 26a4dc1

Please sign in to comment.