Skip to content

Commit 4583e54

Browse files
committed
Fix crash on loading a save that had an old version of Blueprint Extensions.
1 parent ec54d8c commit 4583e54

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ discussion page, and messages posted there will likely be ignored.**
4646

4747
## Changelog
4848

49+
### 0.4.1 (2019-04-01)
50+
* Fix a crash when loading a save that had an old version of Blueprint Extensions installed.
51+
4952
### 0.4.0 (2019-04-01)
5053
* New feature: Add landfill to every tile of a blueprint that needs it.
5154
* Removed code that disabled blueprint flipping and mirroring when a competing mod was installed.
@@ -54,7 +57,6 @@ discussion page, and messages posted there will likely be ignored.**
5457
* Substantially overhauled internal event handling code.
5558
* Lots of code cleanup.
5659

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

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
Version: 0.4.1
12
---------------------------------------------------------------------------------------------------
3+
Date: 01. 04. 2019
4+
Bugfixes:
5+
- Fix crash on loading a save that had an old version of Blueprint Extensions.
6+
27
Version: 0.4.0
8+
---------------------------------------------------------------------------------------------------
39
Date: 01. 04. 2019
410
New features:
511
- Add support for landfilling every tile of a blueprint that needs one.

info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "BlueprintExtensions",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"title": "Blueprint Extensions",
55
"author": "Dewin",
66
"contact": "https://github.com/dewiniaid/BlueprintExtensions",

modules/landfill.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ local get_overlapping_tiles = Geom2D.get_overlapping_tiles
1515

1616

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

74-
log("... [" .. name .. "][" .. d .. "] = " .. serpent.line(t[d]))
73+
--log("... [" .. name .. "][" .. d .. "] = " .. serpent.line(t[d]))
7574
end
7675
e.destroy()
7776
end
@@ -89,10 +88,12 @@ end
8988

9089
function Landfill.on_load()
9190
Landfill.prototype_overrides = global.prototype_overrides
92-
for ent, dirs in pairs(Landfill.prototype_overrides) do
93-
for dir, rects in pairs(dirs) do
94-
for _, rect in pairs(rects) do
95-
setmetatable(rect, Rect.__mt)
91+
if Landfill.prototype_overrides then
92+
for ent, dirs in pairs(Landfill.prototype_overrides) do
93+
for dir, rects in pairs(dirs) do
94+
for _, rect in pairs(rects) do
95+
setmetatable(rect, Rect.__mt)
96+
end
9697
end
9798
end
9899
end
@@ -162,7 +163,7 @@ function Landfill.landfill_action(player, event, action)
162163
y = (entity.position.y or 0) + offset
163164
dir = entity.direction or 0
164165

165-
override = (overrides[name] and overrides[name][dir]) or nil
166+
override = (overrides and overrides[name] and overrides[name][dir]) or nil
166167

167168
if override then
168169
for _, source in pairs(override) do

0 commit comments

Comments
 (0)