Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions scripts/scenario_27_liberation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,9 @@ function finalNovaExplosion()
if final_nova_objects_index < #nova_objects then
for i=final_nova_objects_index,#nova_objects do
local obj=nova_objects[i]
if obj.nova_dist <= rescue_star_radius then
if not obj:isValid() then
-- destroyed since it was measured: its fields are gone (nova_dist nil), skip it
elseif obj.nova_dist <= rescue_star_radius then
if obj.check_boom == nil then
obj.check_boom = true
local chance = original_star_radius/rescue_star_radius
Expand Down Expand Up @@ -3354,7 +3356,9 @@ function novaDemoArtifact()
if nova_objects_index < #nova_objects then
for i=nova_objects_index,#nova_objects do
local obj=nova_objects[i]
if obj.nova_dist <= star_radius then
if not obj:isValid() then
-- destroyed since it was measured: its fields are gone (nova_dist nil), skip it
elseif obj.nova_dist <= star_radius then
if obj.check_boom == nil then
obj.check_boom = true
local chance = original_star_radius/star_radius
Expand Down
4 changes: 2 additions & 2 deletions scripts/scenario_39_locusts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ function gatherSwarm()
local spawn_distance = 1000
local j = 0
for i,ship in ipairs(swarm_ships) do
if ship ~= lead_ship then
if ship ~= lead_ship and ship:isValid() then
j = j + 1
local form = hex_ring_positions[j]
local form_prime_x, form_prime_y = vectorFromAngle(form.angle, form.dist * spawn_distance)
Expand Down Expand Up @@ -1349,7 +1349,7 @@ function gatherSwarm()
local spawn_distance = 1000
local j = 0
for i,ship in ipairs(swarm_ships) do
if ship ~= lead_ship then
if ship ~= lead_ship and ship:isValid() then
j = j + 1
local form = hex_ring_positions[j]
local form_prime_x, form_prime_y = vectorFromAngle(form.angle, form.dist * spawn_distance)
Expand Down
1 change: 1 addition & 0 deletions scripts/scenario_47_scavenger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ function setConstants()
end
function setPlayer()
player = getPlayerShip(-1)
if not player:isValid() then return end -- ship destroyed: a destroyed entity has no methods
if not player.name_assigned then
if player:getTypeName() == "Striker" then
if #playerShipNamesForStriker > 0 then
Expand Down
2 changes: 1 addition & 1 deletion scripts/scenario_58_race.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3152,7 +3152,7 @@ function gatherStats(final_score)
local score_list = {}
for pidx=1,32 do
local p = getPlayerShip(pidx)
if p ~= nil then
if p ~= nil and p:isValid() then
score_list[p:getCallSign()] = {laps = p.laps, goal = p.goal, drone_points = 0, rank = 0, score = 0, time = 0}
local participant = false
if p.participant == "participant" then
Expand Down
2 changes: 1 addition & 1 deletion scripts/scenario_79_kessler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function no_reply()
end

function mission_start_state(delta)
if player1:getReputationPoints() >= reputation_threshold and debris_interactions>=interaction_threshold then
if player1:isValid() and player1:getReputationPoints() >= reputation_threshold and debris_interactions>=interaction_threshold then
mission_state=unusual_readings
end
if not areBeamShieldFrequenciesUsed() then
Expand Down
8 changes: 4 additions & 4 deletions scripts/scenario_81_pvp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ function update(delta)
end

-- Increment reputation for both sides.
gallipoli:addReputationPoints(delta * 0.3)
crusader:addReputationPoints(delta * 0.3)
if gallipoli:isValid() then gallipoli:addReputationPoints(delta * 0.3) end
if crusader:isValid() then crusader:addReputationPoints(delta * 0.3) end

-- If a faction has no station or flagship, it loses.
-- If a faction scores 50 points, it wins.
Expand All @@ -334,7 +334,7 @@ function update(delta)

The pathetic Human flagship has been disabled. Go for the victory!]])
)
crusader:addReputationPoints(50)
if crusader:isValid() then crusader:addReputationPoints(50) end
points_kraylor = points_kraylor + 5
respawn_human = 0
end
Expand All @@ -346,7 +346,7 @@ The pathetic Human flagship has been disabled. Go for the victory!]])

With the Kraylor flagship out of the way, we can land the final blow!]])
)
gallipoli:addReputationPoints(50)
if gallipoli:isValid() then gallipoli:addReputationPoints(50) end
points_human = points_human + 5
respawn_kraylor = 0
end
Expand Down