Skip to content

Commit

Permalink
Add ability to place trees
Browse files Browse the repository at this point in the history
  • Loading branch information
jpanther committed Dec 20, 2017
1 parent 03143c8 commit 340cb7c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Version: 0.8.3
Date: 20. 12. 2017
Added:
- Ability to place deep water and green deep water tiles
- Ability to place trees
- Map colours for all the painted concrete variants
Changed:
- Adjusted concrete layering to allow grid concrete and normal concrete to merge nicely
Expand Down
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ DECT.CONFIG.SIGN_CATEGORIES = {"item", "fluid", "tool", "ammo", "armor", "capsul
DECT.CONFIG.SIGN_BLACKLIST = {"barrel", "loader", "simple%-entity", "player%-port", "computer", "coin", "small%-plane", "railgun", "vehicle%-machine%-gun", "tank%-machine%-gun", "factory%-1%-", "factory%-2%-", "factory%-3%-"}
DECT.CONFIG.BASE_TILES = {"dry-dirt", "dirt-1", "dirt-2", "dirt-3", "dirt-4", "dirt-5", "dirt-6", "dirt-7", "sand-1", "sand-2", "sand-3", "grass-1", "grass-2", "grass-3", "grass-4", "red-desert-0", "red-desert-1", "red-desert-2", "red-desert-3"}
DECT.CONFIG.BASE_WATER_TILES = {"water", "deepwater", "water-green", "deepwater-green"}
DECT.CONFIG.BASE_TREES = {"tree-01", "tree-02", "tree-03", "tree-04", "tree-05", "tree-06", "tree-07", "tree-08", "tree-09", "dead-dry-hairy-tree", "dead-grey-trunk", "dead-tree-desert", "dry-hairy-tree", "dry-tree"}
DECT.CONFIG.BASE_ROCKS = {"rock-huge", "rock-big", "sand-rock-big"}

DECT.INCOMPATIBLE = {}
Expand Down
16 changes: 16 additions & 0 deletions migrations/0.8.3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,21 @@ for index, force in pairs(game.forces) do
rec["dect-base-deepwater"].enabled = true
rec["dect-base-deepwater-green"].enabled = true
end
if tech["dect-landscaping"].researched then
rec["dect-base-tree-01"].enabled = true
rec["dect-base-tree-02"].enabled = true
rec["dect-base-tree-03"].enabled = true
rec["dect-base-tree-04"].enabled = true
rec["dect-base-tree-05"].enabled = true
rec["dect-base-tree-06"].enabled = true
rec["dect-base-tree-07"].enabled = true
rec["dect-base-tree-08"].enabled = true
rec["dect-base-tree-09"].enabled = true
rec["dect-base-dead-dry-hairy-tree"].enabled = true
rec["dect-base-dead-grey-trunk"].enabled = true
rec["dect-base-dead-tree-desert"].enabled = true
rec["dect-base-dry-hairy-tree"].enabled = true
rec["dect-base-dry-tree"].enabled = true
end
end
end
31 changes: 30 additions & 1 deletion prototypes/item/landscaping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,42 @@ if DECT.ENABLED["landscaping"] then
end
end

-- Add subgroup for base trees
data:extend({
{
type = "item-subgroup",
name = "landscaping-trees",
group = DECT.ITEM_GROUP,
order = "l-c"
}
})

-- Add items for placing trees
local base_trees = DECT.CONFIG.BASE_TREES
for _, tree in pairs(base_trees) do
data:extend({
{
type = "item",
name = "dect-base-"..tree,
icon = data.raw["tree"][tree].icon,
icon_size = 32,
flags = {"goes-to-main-inventory"},
subgroup = "landscaping-trees",
order = "a[base-"..tree.."]",
stack_size = DECT.CONFIG.SETTINGS["landscaping_stack_size"],
place_result = tree,
localised_name = {"entity-name."..tree}
}
})
end

-- Add subgroup for base rocks
data:extend({
{
type = "item-subgroup",
name = "landscaping-rocks",
group = DECT.ITEM_GROUP,
order = "l-c"
order = "l-d"
}
})

Expand Down
19 changes: 19 additions & 0 deletions prototypes/recipe/landscaping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if DECT.ENABLED["landscaping"] then

local base_tiles = DECT.CONFIG.BASE_TILES
local water_tiles = DECT.CONFIG.BASE_WATER_TILES
local base_trees = DECT.CONFIG.BASE_TREES
local base_rocks = DECT.CONFIG.BASE_ROCKS

-- Create new landscaping recipes for base ground tiles
Expand Down Expand Up @@ -48,6 +49,24 @@ if DECT.ENABLED["landscaping"] then
end
end

-- Create new landscaping recipes for base trees
for _, tree in pairs(base_trees) do
data:extend({
{
type = "recipe",
name = "dect-base-"..tree,
energy_required = 2,
enabled = false,
category = "crafting",
ingredients = {
{ data.raw["tree"][tree].minable.result, data.raw["tree"][tree].minable.count * 1.5 }
},
result = "dect-base-"..tree,
result_count = 1
}
})
end

-- Create new landscaping recipes for base rock decoratives
for _, rock in pairs(base_rocks) do
local base_rock_loot = data.raw["simple-entity"][rock].loot
Expand Down
6 changes: 6 additions & 0 deletions prototypes/technology/landscaping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if DECT.ENABLED["landscaping"] then

local base_tiles = DECT.CONFIG.BASE_TILES
local water_tiles = DECT.CONFIG.BASE_WATER_TILES
local base_trees = DECT.CONFIG.BASE_TREES
local base_rocks = DECT.CONFIG.BASE_ROCKS

-- Add new Landscaping technoogy
Expand All @@ -13,6 +14,11 @@ if DECT.ENABLED["landscaping"] then
table.insert(landscaping_effects, {type = "unlock-recipe", recipe = "dect-base-"..tile})
end
end
for _, tree in pairs(base_trees) do
if data.raw["tree"][tree] then
table.insert(landscaping_effects, {type = "unlock-recipe", recipe = "dect-base-"..tree})
end
end
for _, rock in pairs(base_rocks) do
if data.raw["simple-entity"][rock] then
table.insert(landscaping_effects, {type = "unlock-recipe", recipe = "dect-base-"..rock})
Expand Down

0 comments on commit 340cb7c

Please sign in to comment.