diff --git a/changelog.txt b/changelog.txt index 3101616..482f974 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.2.3 +Date: 2021-02-28 + Features: + - Optional entity: lead chest. Default off +--------------------------------------------------------------------------------------------------- Version: 0.2.2 Date: 2021-01-29 Fixes: diff --git a/data.lua b/data.lua index 3d5231d..b13861e 100644 --- a/data.lua +++ b/data.lua @@ -1,6 +1,7 @@ require("lead-ore") require("lead-ore-particle") require("lead-recipe") +require("other-entities") require("lead-enriched") -- Enriched Ti for Krastorio 2 require("lead-recipe-se") -- Space Exploration special recipes (depends on K2 if present) diff --git a/graphics/entity/hr-lead-chest.png b/graphics/entity/hr-lead-chest.png new file mode 100644 index 0000000..ac891c2 Binary files /dev/null and b/graphics/entity/hr-lead-chest.png differ diff --git a/graphics/entity/hr-lead-chest.xcf b/graphics/entity/hr-lead-chest.xcf new file mode 100644 index 0000000..094f0b6 Binary files /dev/null and b/graphics/entity/hr-lead-chest.xcf differ diff --git a/graphics/entity/lead-chest.png b/graphics/entity/lead-chest.png new file mode 100644 index 0000000..727f43a Binary files /dev/null and b/graphics/entity/lead-chest.png differ diff --git a/graphics/icons/iron-chest.png b/graphics/icons/iron-chest.png new file mode 100644 index 0000000..e29d9d2 Binary files /dev/null and b/graphics/icons/iron-chest.png differ diff --git a/graphics/icons/lead-chest.png b/graphics/icons/lead-chest.png new file mode 100644 index 0000000..f27fe6b Binary files /dev/null and b/graphics/icons/lead-chest.png differ diff --git a/graphics/icons/lead-chest.xcf b/graphics/icons/lead-chest.xcf new file mode 100644 index 0000000..7600b55 Binary files /dev/null and b/graphics/icons/lead-chest.xcf differ diff --git a/info.json b/info.json index 71adbde..4353fd7 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzlead", - "version": "0.2.2", + "version": "0.2.3", "factorio_version": "1.1", "title": "Lead", "author": "Brevven", diff --git a/locale/en/lead.cfg b/locale/en/lead.cfg index cbd8ec6..f64a845 100644 --- a/locale/en/lead.cfg +++ b/locale/en/lead.cfg @@ -1,5 +1,6 @@ [entity-name] lead-ore=Lead +lead-chest=Lead chest [autoplace-control-names] lead-ore=Lead ore @@ -10,6 +11,7 @@ lead-dust=Lead dust lead-plate=Lead plate lead-alloy=__ITEM__lead-plate__ enriched-lead=Enriched lead +lead-chest=Lead chest [item-description] lead-ore=Can be smelted into lead plates @@ -32,3 +34,11 @@ dirty-water-filtration-lead=Filter dirty water [item=lead-ore] enriched-lead=Enrich lead ore, purifying with sulfuric acid [fluid=sulfuric-acid] and water [fluid=water], improving the final yield. Produce dirty water [fluid=dirty-water] as a byproduct. dirty-water-filtration-lead=Filter dirty water, giving lead ore [item=lead-ore], copper ore [item=coppper-ore] and stone [item=stone] (probabilistically). + +# Settings + +[mod-setting-name] +bzlead-more-entities=Experimental: Lead entities + +[mod-setting-description] +bzlead-more-entities=Adds lead entities (currently just a lead chest). Currently "experimental", long-term support not guaranteed. diff --git a/other-entities.lua b/other-entities.lua new file mode 100644 index 0000000..071012a --- /dev/null +++ b/other-entities.lua @@ -0,0 +1,130 @@ +local leadutil = require("__bzlead__.util"); +require("util") + +if leadutil.more_entities() then +data:extend({ + + { + type = "item", + name = "lead-chest", + icon = "__bzlead__/graphics/icons/lead-chest.png", + icon_size = 64, icon_mipmaps = 4, + subgroup = "storage", + order = "a[items]-az[lead-chest]", + place_result = "lead-chest", + stack_size = 50 + }, + { + type = "recipe", + name = "lead-chest", + enabled = true, + ingredients = {{"lead-plate", 8}}, + result = "lead-chest" + }, +{ + type = "container", + name = "lead-chest", + icon = "__bzlead__/graphics/icons/lead-chest.png", + icon_size = 64, icon_mipmaps = 4, + flags = {"placeable-neutral", "player-creation"}, + minable = {mining_time = 0.2, result = "lead-chest"}, + max_health = 150, + corpse = "small-remnants", + open_sound = { filename = "__base__/sound/metallic-chest-open.ogg", volume=0.65 }, + close_sound = { filename = "__base__/sound/metallic-chest-close.ogg", volume = 0.7 }, + resistances = + { + { + type = "fire", + percent = 80 + }, + }, + collision_box = {{-0.35, -0.35}, {0.35, 0.35}}, + selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, + fast_replaceable_group = "container", + inventory_size = 24, + vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, + picture = + { + layers = + { + { + filename = "__bzlead__/graphics/entity/lead-chest.png", + priority = "extra-high", + width = 33, + height = 38, + shift = util.by_pixel(0, -0.5), + hr_version = + { + filename = "__bzlead__/graphics/entity/hr-lead-chest.png", + priority = "extra-high", + width = 66, + height = 76, + shift = util.by_pixel(-0.5, -0.5), + scale = 0.5 + } + }, + { + filename = "__base__/graphics/entity/iron-chest/iron-chest-shadow.png", + priority = "extra-high", + width = 56, + height = 26, + shift = util.by_pixel(10, 6.5), + draw_as_shadow = true, + hr_version = + { + filename = "__base__/graphics/entity/iron-chest/hr-iron-chest-shadow.png", + priority = "extra-high", + width = 110, + height = 50, + shift = util.by_pixel(10.5, 6), + draw_as_shadow = true, + scale = 0.5 + } + } + } + }, + circuit_wire_connection_point = circuit_connector_definitions["chest"].points, + circuit_connector_sprites = circuit_connector_definitions["chest"].sprites, + circuit_wire_max_distance = default_circuit_wire_max_distance + }, + { + type = "corpse", + name = "lead-chest-remnants", + icon = "__base__/graphics/icons/iron-chest.png", + icon_size = 64, icon_mipmaps = 4, + flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"}, + subgroup = "storage-remnants", + order = "a-b-a", + selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, + tile_width = 1, + tile_height = 1, + selectable_in_game = false, + time_before_removed = 60 * 60 * 15, -- 15 minutes + final_render_layer = "remnants", + remove_on_tile_placement = false, + animation = + { + filename = "__base__/graphics/entity/iron-chest/remnants/iron-chest-remnants.png", + line_length = 1, + width = 64, + height = 40, + frame_count = 1, + direction_count = 1, + shift = util.by_pixel(12, 0), + hr_version = + { + filename = "__base__/graphics/entity/iron-chest/remnants/hr-iron-chest-remnants.png", + line_length = 1, + width = 126, + height = 78, + frame_count = 1, + direction_count = 1, + shift = util.by_pixel(12, 0), + scale = 0.5 + } + } + }, + +}) +end diff --git a/settings.lua b/settings.lua new file mode 100644 index 0000000..9573acc --- /dev/null +++ b/settings.lua @@ -0,0 +1,10 @@ +data:extend( +{ + { + type = "string-setting", + name = "bzlead-more-entities", + setting_type = "startup", + default_value = "no", + allowed_values = {"yes", "no"}, + }, +}) diff --git a/util.lua b/util.lua index a52c838..75cb125 100644 --- a/util.lua +++ b/util.lua @@ -3,6 +3,17 @@ local util = {} util.lead_ore = "lead-ore" util.lead_plate = "lead-plate" +function util.get_setting(name) + if settings.startup[name] == nil then + return nil + end + return settings.startup[name].value +end + +function util.more_entities() + return util.get_setting("bzlead-more-entities") == "yes" +end + function util.get_stack_size(default) if mods["Krastorio2"] then size = tonumber(krastorio.general.getSafeSettingValue("kr-stack-size"))