add optional lead chest

This commit is contained in:
Brevven 2021-02-28 20:29:53 -08:00
parent 69e6fc798e
commit 45d0116c73
13 changed files with 168 additions and 1 deletions

View file

@ -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:

View file

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

View file

@ -1,6 +1,6 @@
{
"name": "bzlead",
"version": "0.2.2",
"version": "0.2.3",
"factorio_version": "1.1",
"title": "Lead",
"author": "Brevven",

View file

@ -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.

130
other-entities.lua Normal file
View file

@ -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

10
settings.lua Normal file
View file

@ -0,0 +1,10 @@
data:extend(
{
{
type = "string-setting",
name = "bzlead-more-entities",
setting_type = "startup",
default_value = "no",
allowed_values = {"yes", "no"},
},
})

View file

@ -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"))