From: Someone Date: Tue, 22 Oct 2024 13:32:02 +0000 (+0200) Subject: RELEASE 2.0.0 - Initial compatibility with Factorio 2.0 X-Git-Url: https://git.somenet.org/factorio/Waterbomb.git/commitdiff_plain?ds=sidebyside RELEASE 2.0.0 - Initial compatibility with Factorio 2.0 --- diff --git a/changelog.txt b/changelog.txt index 36b3a9b..1f508b9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +--------------------------------------------------------------------------------------------------- +Version: 2.0.0 +Date: 2024-10-21 + + Changed: + - Initial compatibility with Factorio 2.0 + --------------------------------------------------------------------------------------------------- Version: 1.1.3 Date: 2024-01-02 diff --git a/control.lua b/control.lua index b27e0b3..649c008 100644 --- a/control.lua +++ b/control.lua @@ -1,5 +1,5 @@ -local bombs +local waterbombs local replaceableTiles = { ["water"] = "grass-1", ["deepwater"] = "grass-1", @@ -9,25 +9,25 @@ local replaceableTiles = { script.on_configuration_changed(function(data) - if global.waterbombs ~= nil then + if waterbombs ~= nil then script.on_event(defines.events.on_tick, tickBombs) end end) script.on_load(function(event) - if global.waterbombs ~= nil then + if waterbombs ~= nil then script.on_event(defines.events.on_tick, tickBombs) end end) script.on_event(defines.events.on_built_entity, function(event) - if event.created_entity.name == "waterbomb" then - global.waterbombs = {} + if event.entity.name == "waterbomb" then + waterbombs = {} for _, surface in pairs(game.surfaces) do for _, entity in pairs(surface.find_entities_filtered{name="waterbomb"}) do - table.insert(global.waterbombs, entity) + table.insert(waterbombs, entity) end end script.on_event(defines.events.on_tick, tickBombs) @@ -37,9 +37,9 @@ end) function tickBombs(event) if event.tick % 20 == 0 then - for k,e in pairs(global.waterbombs) do + for k,e in pairs(waterbombs) do if not e.valid then - table.remove(global.waterbombs, k) + table.remove(waterbombs, k) elseif e.energy > 49000000 then local epos, x, y, distX, distY, surface @@ -67,7 +67,7 @@ function tickBombs(event) -- bomb explodes e.destroy() - table.remove(global.waterbombs, k) + table.remove(waterbombs, k) -- water is created createWater(x, y, explosionRadius, surface) @@ -82,8 +82,8 @@ function tickBombs(event) end -- nothing more to be exploded. Stop ticking. - if #global.waterbombs == 0 then - global.waterbombs = nil + if #waterbombs == 0 then + waterbombs = nil script.on_event(defines.events.on_tick, nil) end end diff --git a/info.json b/info.json index 4ab7d66..14f067b 100644 --- a/info.json +++ b/info.json @@ -1,10 +1,10 @@ { "name": "Waterbomb", - "version": "1.1.3", + "version": "2.0.0", "title": "Dihydrogen Monoxide Bomb (Waterbomb)", "author": "someone1337", "homepage": "https://git.somenet.org/factorio/Waterbomb.git", "description": "Use explosions/bombs to create water. (Originally 'Landfill' by Rseding91)", - "dependencies": ["base>=1.1.0"], - "factorio_version": "1.1" + "factorio_version": "2.0", + "dependencies": ["base>=2.0.0"] } diff --git a/migrations/Waterbomb_0.16.5.json b/migrations/Waterbomb_0.16.5.json deleted file mode 100644 index bf022a7..0000000 --- a/migrations/Waterbomb_0.16.5.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "entity": - [ - ["water-bomb", "waterbomb"], - ["water-bomb-area", "waterbomb"] - ], - "item": - [ - ["water-bomb", "waterbomb"], - ["water-bomb-area", "waterbomb"] - ] -} diff --git a/migrations/Waterbomb_0.16.5.lua b/migrations/Waterbomb_0.16.5.lua deleted file mode 100644 index 85a319c..0000000 --- a/migrations/Waterbomb_0.16.5.lua +++ /dev/null @@ -1,3 +0,0 @@ -for index, force in pairs(game.forces) do - force.recipes["waterbomb"].enabled = true -end diff --git a/prototypes/recipes.lua b/prototypes/recipes.lua index 8474431..32119bf 100644 --- a/prototypes/recipes.lua +++ b/prototypes/recipes.lua @@ -3,17 +3,17 @@ data:extend({ type = "recipe", name = "waterbomb", energy_required = 5, - enabled = "false", + enabled = false, category = "crafting-with-fluid", ingredients = { - {"steel-plate", 32}, - {"electric-engine-unit", 4}, - {"processing-unit", 1}, + {type="item", name="steel-plate", amount=32}, + {type="item", name="electric-engine-unit", amount=4}, + {type="item", name="processing-unit", amount=1}, {type="fluid", name="water", amount=32}, - {"explosives", 24}, + {type="item", name="explosives", amount=24} }, - result = "waterbomb" + results = {{type="item", name="waterbomb", amount=1}} } })