diff --git a/changelog.txt b/changelog.txt index 0c9cf874..59358282 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.1.10 +Date: 2024-1-?? + Changes: + - Add compatibility for Better Victory Screen. +--------------------------------------------------------------------------------------------------- Version: 2.1.9 Date: 2024-1-8 Changes: diff --git a/control.lua b/control.lua index e7668b1b..2049bf8c 100644 --- a/control.lua +++ b/control.lua @@ -32,25 +32,28 @@ Event.register(Event.core_events.init, function() debris_items['copper-plate'] = 50 remote.call('freeplay', 'set_debris_items', debris_items) end - - if remote.interfaces['silo_script'] then - remote.call('silo_script', 'set_no_victory', true) - end end) Event.register(defines.events.on_research_finished, function(event) + if global.finished then return end local tech = event.research if tech.name == 'pyrrhic' and game.tick ~= 0 then local force = tech.force for _, player in pairs(game.connected_players) do if player.force == force then player.opened = nil end end - game.set_game_state{ - game_finished = true, - player_won = true, - can_continue = true, - victorious_force = force - } + + 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", force) + else + game.set_game_state{ + game_finished = true, + player_won = true, + can_continue = true, + victorious_force = force + } + end end end) @@ -234,6 +237,12 @@ end) Event.register(Event.core_events.init_and_config, function() global.beacon_interference_icons = global.beacon_interference_icons or {} + + for _, interface in pairs{"silo_script", "better-victory-screen"} do + if remote.interfaces[interface] and remote.interfaces[interface]["set_no_victory"] then + remote.call(interface, "set_no_victory", true) + end + end end) local function enable_beacon(beacon) diff --git a/info.json b/info.json index 2a9986b3..6e1e8066 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "pycoalprocessing", - "version": "2.1.9", + "version": "2.1.10", "factorio_version": "1.1", "title": "Pyanodons Coal Processing", "author": "Pyanodon, Nexela, Kingarthur, notnotmelon, Mootykins, ShadowGlass, Archezekiel, Quintuple",