From 2fb362f245c1e0b2a396040db73b682e290917ed Mon Sep 17 00:00:00 2001 From: Hein Wessels <39875036+heinwessels@users.noreply.github.com> Date: Sun, 14 Apr 2024 13:37:02 +0200 Subject: [PATCH] Improve Better Victory Screen Compatibility (#23) Adds a global.finished, because BVS does not set either the two conditions you currently check for. If this is not added then nothing will go wrong because BVS does this internally already. But it will prevent edge cases, for example if BVS is removed after FF victory is achieved, then you'll be able to trigger the victory again. --------- Co-authored-by: Tom Burrows --- scripts/endgame.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/endgame.lua b/scripts/endgame.lua index a2f6c1a..94cf218 100644 --- a/scripts/endgame.lua +++ b/scripts/endgame.lua @@ -8,10 +8,11 @@ local function on_rocket_launched(event) local rocket = event.rocket if not (rocket and rocket.valid) then return end - if game.finished or game.finished_but_continuing then return end + if game.finished or game.finished_but_continuing or global.finished then return end local inventory = rocket.get_inventory(defines.inventory.rocket) if inventory.get_item_count("ff-interstellar-communicator") > 0 then + global.finished = true if remote.interfaces["better-victory-screen"] and remote.interfaces["better-victory-screen"]["trigger_victory"] then remote.call("better-victory-screen", "trigger_victory", rocket.force) @@ -51,4 +52,4 @@ Endgame.events = { Endgame.on_init = disable_rocket_victory Endgame.on_configuration_changed = disable_rocket_victory -return Endgame \ No newline at end of file +return Endgame