Skip to content

Commit

Permalink
YARM 1.0.2 bugfix release
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed Dec 18, 2024
1 parent 9f5783e commit edcb271
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.0.2
Bugfixes:
- maybe fix a crash where a site doesn't have a site.force (this should not have been possible)
- for maximum certainty, set site force to `game.forces.player` if not available in `player.force`
---------------------------------------------------------------------------------------------------
Version: 1.0.1
Bugfixes:
- fix crash when renaming a site without a name tag (e.g., new site)
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "YARM",
"version": "1.0.1",
"version": "1.0.2",
"factorio_version": "2.0",
"title": "YARM - Resource Monitor",
"author": "Mithaldu (current maintainer) and Narc",
Expand Down
16 changes: 15 additions & 1 deletion resmon/migrations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ local migrations = {
function migrations_module.default_versions()
---@type {[string]: number}
local default_versions = {
force_data = 2,
force_data = 3,
ore_tracker = 2,
player_data = 1,
versions = 1,
Expand Down Expand Up @@ -121,4 +121,18 @@ function migrations.force_data.v1()
return 2
end

---2024-12-18, YARM v1.0.2:<br>
--- - Reset site.force for all sites, hopefully resolving an issue where at least one site in someone's game didn't have it
function migrations.force_data.v2()
for _, force in pairs(game.forces) do
local force_data = storage.force_data[force.name]
if force_data and force_data.ore_sites then
for _, site in pairs(force_data.ore_sites) do
site.force = force
end
end
end
return 3
end

return migrations_module
2 changes: 1 addition & 1 deletion resmon/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function types_module.new_site(player, entity)
name_tag = "", -- Player-set name tag added to the site display name
added_at = game.tick,
surface = entity.surface, ---@type LuaSurface
force = player.force,
force = player.force or game.forces.player,
center = { x = 0, y = 0 },
first_center = { x = 0, y = 0 },
ore_type = entity.name, ---@type string Resource entity prototype name
Expand Down

0 comments on commit edcb271

Please sign in to comment.