Skip to content

Commit

Permalink
Merge pull request #40 from jpanther/feature-itemgroup
Browse files Browse the repository at this point in the history
Add new feature for separate item group
  • Loading branch information
jpanther authored Nov 21, 2017
2 parents 6595f85 + ff00189 commit a51140c
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 36 deletions.
4 changes: 4 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ DECT.ENABLED = {
["painted-concrete"] = settings.startup["dectorio-painted-concrete"].value,
["signs"] = settings.startup["dectorio-signs"].value,
["decoratives"] = settings.startup["dectorio-decoratives"].value,
["item-group"] = settings.startup["dectorio-item-group"].value,
}

-- The subgroups for all items in the mod
DECT.ITEM_GROUP = DECT.ENABLED["item-group"] and "dectorio" or "logistics"

DECT.CONFIG.SETTINGS = {
["decorative_removal_probability"] = settings.startup["dectorio-decorative-removal-probability"].value,
["vanilla_hazard_concrete"] = settings.startup["dectorio-vanilla-hazard-concrete-style"].value,
Expand Down
1 change: 1 addition & 0 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require("prototypes.entity.signs")
require("prototypes.entity.walls")
require("prototypes.entity.decoratives")

require("prototypes.item.item-group")
require("prototypes.item.flooring")
require("prototypes.item.lamp")
require("prototypes.item.landscaping")
Expand Down
Binary file added graphics/item-group/dectorio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions locale/en/dectorio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dectorio-flooring=Enable Floorings
dectorio-painted-concrete=Enable Painted Concrete
dectorio-signs=Enable Signs
dectorio-decoratives=Enable Decoratives
dectorio-item-group=Separate Crafting Tab
dectorio-vanilla-hazard-concrete-style=Use default Factorio Hazard concrete style
dectorio-landscaping-blueprintable=Landscaping items are blueprintable
dectorio-decorative-removal-probability=Decoration removal probability
Expand All @@ -27,6 +28,7 @@ dectorio-flooring=Enables the ability to craft flooring types including wooden f
dectorio-painted-concrete=Enables painted concrete styles that replace the base Hazard concrete
dectorio-signs=Enables the ability to place signs
dectorio-decoratives=Enables the ability to craft decorative items for your factory
dectorio-item-group=Moves all decorative items into a dedicated crafting tab in the inventory
dectorio-vanilla-hazard-concrete-style=When enabled, Painted Hazard concrete will look like the default Factorio Hazard concrete when placed (requires Painted Concrete to be enabled)
dectorio-landscaping-blueprintable=When enabled, blueprints will include landscaping features as tiles
dectorio-decorative-removal-probability=The probability that decorations, such as bushes and grasses, are removed when flooring tiles are placed (1 = 100% are removed (default), 0.5 = 50%, 0 = none are removed)
Expand Down Expand Up @@ -70,6 +72,9 @@ misc-finish=Finish
misc-gears=Gears
misc-star=Star

[item-group-name]
dectorio=Dectorio

[item-name]
dect-base-dirt=Dirt
dect-base-sand=Sand
Expand Down
26 changes: 12 additions & 14 deletions prototypes/item/decoratives.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@

if DECT.ENABLED["decoratives"] then

-- -- Add subgroup for decoratives
-- data:extend({
-- {
-- type = "item-subgroup",
-- name = "decoratives",
-- group = "logistics",
-- order = "g-b"
-- }
-- })
-- Add subgroup for decoratives
data:extend({
{
type = "item-subgroup",
name = "decoratives",
group = DECT.ITEM_GROUP,
order = "e-b"
}
})

data:extend({
{
type = "item",
name = "dect-traffic-bollard",
icon = "__Dectorio__/graphics/icons/traffic-bollard.png",
flags = {"goes-to-quickbar"},
-- subgroup = "decoratives",
-- order = "a[traffic-bollard]",
subgroup = "terrain",
order = "w[traffic-bollard]",
subgroup = "decoratives",
order = "a[traffic-bollard]",
place_result = "dect-traffic-bollard",
stack_size = 50
}
})

end
end
18 changes: 9 additions & 9 deletions prototypes/item/flooring.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ if DECT.ENABLED["painted-concrete"] then
data:extend({
{
type = "item-subgroup",
name = "concrete-paint",
group = "logistics",
order = "i"
name = "flooring",
group = DECT.ITEM_GROUP,
order = "i-b"
}
})

Expand All @@ -26,7 +26,7 @@ if DECT.ENABLED["painted-concrete"] then
name = "dect-paint-"..variant,
icon = "__Dectorio__/graphics/icons/paint-"..variant..".png",
flags = {"goes-to-main-inventory"},
subgroup = "concrete-paint",
subgroup = "flooring",
order = _.."[paint-"..variant.."]",
stack_size = DECT.CONFIG.SETTINGS["flooring_stack_size"],
place_as_tile = {
Expand All @@ -40,10 +40,10 @@ if DECT.ENABLED["painted-concrete"] then

-- Move base hazard concrete item under painted concrete
local base_hazard_item = data.raw["item"]["hazard-concrete"]
base_hazard_item.subgroup = "concrete-paint"
base_hazard_item.subgroup = "flooring"
base_hazard_item.order = "00[a-hazard-concrete]"
base_hazard_item.stack_size = DECT.CONFIG.SETTINGS["flooring_stack_size"]

if not DECT.CONFIG.SETTINGS["vanilla_hazard_concrete"] then
base_hazard_item.icon = "__Dectorio__/graphics/icons/paint-hazard.png"
end
Expand All @@ -60,8 +60,8 @@ if DECT.ENABLED["wood-floor"] then
flags = {"goes-to-main-inventory"},
fuel_category = "chemical",
fuel_value = "2MJ",
subgroup = "terrain",
order = "a[stone-brick]-b[wood-floor]",
subgroup = "flooring",
order = "00[0-wood-floor]",
stack_size = DECT.CONFIG.SETTINGS["flooring_stack_size"],
place_as_tile = {
result = "dect-wood-floor",
Expand Down Expand Up @@ -104,4 +104,4 @@ if DECT.ENABLED["gravel"] then
condition = { "water-tile" }
}

end
end
15 changes: 15 additions & 0 deletions prototypes/item/item-group.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- item/item-group

if DECT.ENABLED["item-group"] then

data:extend({
{
type = "item-group",
name = "dectorio",
order = "d-a",
icon = "__Dectorio__/graphics/item-group/dectorio.png",
icon_size = 64,
}
})

end
14 changes: 7 additions & 7 deletions prototypes/item/landscaping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if DECT.ENABLED["landscaping"] then
{
type = "item-subgroup",
name = "landscaping",
group = "logistics",
order = "g-a"
group = DECT.ITEM_GROUP,
order = "l-a"
}
})

Expand Down Expand Up @@ -41,9 +41,9 @@ if DECT.ENABLED["landscaping"] then
data:extend({
{
type = "item-subgroup",
name = "landscaping2",
group = "logistics",
order = "g-b"
name = "landscaping-rocks",
group = DECT.ITEM_GROUP,
order = "l-b"
}
})

Expand All @@ -62,7 +62,7 @@ if DECT.ENABLED["landscaping"] then
name = "dect-base-"..rock,
icon = data.raw["simple-entity"][rock].icon,
flags = {"goes-to-main-inventory"},
subgroup = "landscaping2",
subgroup = "landscaping-rocks",
order = _.."[base-"..rock.."]",
stack_size = DECT.CONFIG.SETTINGS["landscaping_stack_size"],
place_result = rock,
Expand All @@ -77,4 +77,4 @@ if DECT.ENABLED["landscaping"] then
base_landfill.order = "7[landfill]"
base_landfill.stack_size = DECT.CONFIG.SETTINGS["landscaping_stack_size"]

end
end
20 changes: 15 additions & 5 deletions prototypes/item/signs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

if DECT.ENABLED["signs"] then

-- Add subgroup for signs
data:extend({
{
type = "item-subgroup",
name = "signs",
group = DECT.ITEM_GROUP,
order = "0"
}
})

data:extend({
{
type = "item",
name = "dect-sign-wood",
icon = "__Dectorio__/graphics/icons/sign-wood.png",
flags = {"goes-to-quickbar"},
subgroup = "terrain",
order = "x[sign-wood]",
subgroup = "signs",
order = "a[sign-wood]",
place_result = "dect-sign-wood",
stack_size = 50
},
Expand All @@ -18,11 +28,11 @@ if DECT.ENABLED["signs"] then
name = "dect-sign-steel",
icon = "__Dectorio__/graphics/icons/sign-steel.png",
flags = {"goes-to-quickbar"},
subgroup = "terrain",
order = "y[sign-steel]",
subgroup = "signs",
order = "b[sign-steel]",
place_result = "dect-sign-steel",
stack_size = 50
}
})

end
end
2 changes: 1 addition & 1 deletion prototypes/item/walls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ if DECT.ENABLED["walls"] then
base_stone_wall.stack_size = DECT.CONFIG.SETTINGS["walls_stack_size"]
base_stone_wall.order = "a[b-stone-wall]"

end
end
7 changes: 7 additions & 0 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ data:extend({
default_value = true,
order = "a-g"
},
{
type = "bool-setting",
name = "dectorio-item-group",
setting_type = "startup",
default_value = true,
order = "a-h"
},
{
type = "bool-setting",
name = "dectorio-vanilla-hazard-concrete-style",
Expand Down

0 comments on commit a51140c

Please sign in to comment.