Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions LandfillPainting/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 0.6.0
Date: 23.11.2024
Changes:
- Update for Factorio 2.0
- Allowed landfill to be placed over any existing tile (including other landfill types and concrete)
---------------------------------------------------------------------------------------------------
Version: 0.5.3
Date: 02.12.2023
Bugfixes:
Expand Down
17 changes: 0 additions & 17 deletions LandfillPainting/data-updates.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
for _,v in pairs(data.raw.tile) do
if v.minable then
local found = false
for _,c in pairs(v.collision_mask or {}) do
if c == LANDFILL_PAINTING_LAYER then
found = true
end
end
if not found then
if not v.collision_mask then
v.collision_mask = {}
end
table.insert(v.collision_mask, LANDFILL_PAINTING_LAYER)
end
end
end

local technology = data.raw.technology['water-washing-2']

if technology and technology.effects then
Expand Down
49 changes: 29 additions & 20 deletions LandfillPainting/data.lua
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
require "util"
local collision_mask_util = require("collision-mask-util")

LANDFILL_PAINTING_LAYER = collision_mask_util.get_first_unused_layer()

local function findname(t, name)
for i,v in ipairs(t) do
if v.name == name then
return v
end
end
end
-- Collision masks have been replaced with CollisionMaskConnector prototypes in 2.0, which contains a property "layers"
-- Settings layers to empty means that the tile can be placed on top of anything
LANDFILL_COLLISION_MASK_CONNECTOR = {
layers = {}
}

-- Define the names of each terrain type we're adding
local terrains = {
"dry-dirt",
"dirt-4",
"grass-1",
"red-desert-1",
"sand-3"
}

-- Define the localised names of each terrain type we're adding, additional localised names can be added in lanfillpainting/locale
local names = {
["dry-dirt"] = "tile-name.dry-dirt",
["dirt-4"] = "autoplace-control-names.dirt",
["grass-1"] = "autoplace-control-names.grass",
["red-desert-1"] = "autoplace-control-names.desert",
["sand-3"] = "autoplace-control-names.sand"
["dry-dirt"] ="tile-name.dry-dirt",
["dirt-4"] = "tile-name.dirt",
["grass-1"] = "tile-name.grass",
["red-desert-1"] = "tile-name.desert",
["sand-3"] = "tile-name.sand"
}

-- Get the vanilla landfill recipe and technology prototypes
local baserecipe = data.raw.recipe['landfill']
local technology = data.raw.technology['landfill']

Expand All @@ -52,11 +51,12 @@ else
baserecipe.subgroup = "terrain-landfill"
end

for _,v in ipairs(terrains) do
-- Add new items and recipes for each terrain type
for i,v in ipairs(terrains) do
local item = {
type = "item",
name = "landfill-" .. v,
localised_name = {names[v]},
localised_name = {v .. '-name.name'},
localised_description = {"item-description.landfill"},
icon = "__LandfillPainting__/graphics/icons/landfill-" .. v .. ".png",
icon_size = 64, icon_mipmaps = 4,
Expand All @@ -67,8 +67,8 @@ for _,v in ipairs(terrains) do
{
result = v,
condition_size = 1,
condition = {LANDFILL_PAINTING_LAYER}
}
condition = LANDFILL_COLLISION_MASK_CONNECTOR
},
}
local recipe = util.table.deepcopy(baserecipe)
recipe.name = "landfill-" .. v
Expand All @@ -83,8 +83,10 @@ for _,v in ipairs(terrains) do
table.insert(technology.effects, { type = "unlock-recipe", recipe = "landfill-" .. v })
end



data.raw.item['landfill'].icon = "__LandfillPainting__/graphics/icons/landfill-landfill.png"
data.raw.item['landfill'].place_as_tile.condition = {LANDFILL_PAINTING_LAYER}
data.raw.item['landfill'].place_as_tile.condition = LANDFILL_COLLISION_MASK_CONNECTOR

-- dry-dirt -> dirt-1 -> dirt-2 ->dirt-3
-- dirt-4 -> dirt-5 -> dirt-6 -> dirt-7
Expand Down Expand Up @@ -144,4 +146,11 @@ local allterrain = {
}
for _,v in pairs(allterrain) do
data.raw.tile[v].can_be_part_of_blueprint = nil

-- Enable vanilla landfill to be replace all types of terrain that LandfillPainter allows the player to create
if data.raw.item['landfill'].place_as_tile.tile_condition then
table.insert(data.raw.item['landfill'].place_as_tile.tile_condition, v)
else
data.raw.item['landfill'].place_as_tile.tile_condition = {v}
end
end
4 changes: 2 additions & 2 deletions LandfillPainting/info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LandfillPainting",
"version": "0.5.3",
"factorio_version": "1.1",
"version": "0.6.0",
"factorio_version": "2.0",
"title": "Landfill Painting",
"author": "Trainwreck",
"description": "Adds some different types of terrain landfill, allows landfill to overwrite existing terrain",
Expand Down
15 changes: 15 additions & 0 deletions LandfillPainting/locale/en/LandfillPainting.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
[item-description]
landfillR=Press __CONTROL__rotate__ with item in hand to cycle terrain variations

[dry-dirt-name]
name=Dry dirt

[dirt-4-name]
name=Dirt

[grass-1-name]
name=Grass

[red-desert-1-name]
name=Red desert

[sand-3-name]
name=Sand

[mod-setting-name]
landfillpainting-use-rotation=Rotate to select landfill variation

Expand Down
27 changes: 19 additions & 8 deletions LandfillPainting/migrations/LandfillPainting_0.1.3.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
-- Define the names of each terrain type we're adding
local terrains = {
"dry-dirt",
"dirt-4",
"grass-1",
"red-desert-1",
"sand-3"
}

for _, force in pairs(game.forces) do
force.reset_technologies()
force.reset_recipes()

-- Get appropriate technology
local tech = force.technologies['landfill']
if force.technologies['water-washing'] and force.technologies['water-washing'].enabled then
if force.technologies['water-washing'] and
force.technologies['water-washing'].enabled then
tech = force.technologies['water-washing']
end
if tech.researched then
for _,v in ipairs(tech.effects) do
if v.type == 'unlock-recipe' then
force.recipes[v.recipe].enabled = true
end

-- Enable recipes if technology is researched
if tech and tech.researched then
for i,v in ipairs(terrains) do
force.recipes['landfill-' .. v].enabled = true
end
end
end

end