Skip to content

Commit

Permalink
Fix crash on loading a save that had an old version of Blueprint Exte…
Browse files Browse the repository at this point in the history
…nsions.
  • Loading branch information
dewiniaid committed Apr 1, 2019
1 parent ec54d8c commit 4583e54
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ discussion page, and messages posted there will likely be ignored.**

## Changelog

### 0.4.1 (2019-04-01)
* Fix a crash when loading a save that had an old version of Blueprint Extensions installed.

### 0.4.0 (2019-04-01)
* New feature: Add landfill to every tile of a blueprint that needs it.
* Removed code that disabled blueprint flipping and mirroring when a competing mod was installed.
Expand All @@ -54,7 +57,6 @@ discussion page, and messages posted there will likely be ignored.**
* Substantially overhauled internal event handling code.
* Lots of code cleanup.


### 0.3.2 (2019-03-02)
* Fix issues (including a possible crash) involving setting up the blueprint mirroring buttons in a new save.

Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Version: 0.4.1
---------------------------------------------------------------------------------------------------
Date: 01. 04. 2019
Bugfixes:
- Fix crash on loading a save that had an old version of Blueprint Extensions.

Version: 0.4.0
---------------------------------------------------------------------------------------------------
Date: 01. 04. 2019
New features:
- Add support for landfilling every tile of a blueprint that needs one.
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": "BlueprintExtensions",
"version": "0.4.0",
"version": "0.4.1",
"title": "Blueprint Extensions",
"author": "Dewin",
"contact": "https://github.com/dewiniaid/BlueprintExtensions",
Expand Down
15 changes: 8 additions & 7 deletions modules/landfill.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ local get_overlapping_tiles = Geom2D.get_overlapping_tiles


function Landfill.compute_prototype_overrides()
--game.print("Landfill.compute_prototype_overrides")
-- Some entities require special arguments when created. We skip those; they're unlikely to come up in blueprints
-- anyways
local type_blacklist = {
Expand Down Expand Up @@ -71,7 +70,7 @@ function Landfill.compute_prototype_overrides()
end
t[d] = data

log("... [" .. name .. "][" .. d .. "] = " .. serpent.line(t[d]))
--log("... [" .. name .. "][" .. d .. "] = " .. serpent.line(t[d]))
end
e.destroy()
end
Expand All @@ -89,10 +88,12 @@ end

function Landfill.on_load()
Landfill.prototype_overrides = global.prototype_overrides
for ent, dirs in pairs(Landfill.prototype_overrides) do
for dir, rects in pairs(dirs) do
for _, rect in pairs(rects) do
setmetatable(rect, Rect.__mt)
if Landfill.prototype_overrides then
for ent, dirs in pairs(Landfill.prototype_overrides) do
for dir, rects in pairs(dirs) do
for _, rect in pairs(rects) do
setmetatable(rect, Rect.__mt)
end
end
end
end
Expand Down Expand Up @@ -162,7 +163,7 @@ function Landfill.landfill_action(player, event, action)
y = (entity.position.y or 0) + offset
dir = entity.direction or 0

override = (overrides[name] and overrides[name][dir]) or nil
override = (overrides and overrides[name] and overrides[name][dir]) or nil

if override then
for _, source in pairs(override) do
Expand Down

0 comments on commit 4583e54

Please sign in to comment.