diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index bbf3e21..0000000 --- a/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -[*] -indent_style = space -indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 723ef36..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea \ No newline at end of file diff --git a/bzfoundry2/LICENSE b/LICENSE similarity index 100% rename from bzfoundry2/LICENSE rename to LICENSE diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..11be59f --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# General makefile for factorio mods. +# +# Presumes the development work is done in a /dev// +# directory where this makefile resides. This directory must be parallel to +# the /mods/ directory where mods are installed. Run `make +# install` from dev/ to install the mod as a zip file. That zip file +# should also be ready to upload to the mod portal + +.PHONY: copy lint-changelog install + +libdir = "../bzlib" +libfiles = $(shell ls $(libdir)/*.lua | grep -o '[^/]*.lua') +pwd = $(shell pwd) +v = $(shell basename "$(pwd)")_$(shell jq -r .version info.json) + +link: + for f in $(libfiles) ; do \ + echo "using $(libdir)/$$f" ;\ + cp $(libdir)/$$f .; \ + done; + +copy: link + rm -rf ../$(v) + mkdir -p ../$(v) + cp -rf * ../$(v) + rm -f ../$(v).zip + cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak" -x "*.blend*" + +install: lint-changelog copy + cp -f ../$(v).zip ../../mods/ + +lint-changelog: copy + python3 ../da-changelog-tools_0.0.14/changelog-checker.py --changelog ../$(v).zip + +zorro: + python3 ../da-changelog-tools_0.0.14/changelog-checker.py --zorro --changelog ../$(v).zip + diff --git a/README.md b/README.md index fce99fe..e570eca 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,9 @@ This work is released under a CC license instead of MIT. Contact me on github if Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) See LICENSE -## Credits +## Created by -- [brevven](https://mods.factorio.com/user/brevven) (code, design) -- [cackling fiend](https://mods.factorio.com/user/cackling.fiend) (Update to 2.0) -- Wube (Graphics) +- [brevven](https://mods.factorio.com/user/brevven) (code, design, graphics) ### Localization diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png deleted file mode 100644 index 05442be..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png deleted file mode 100644 index 30bfc2c..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua deleted file mode 100644 index 18e2ef4..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua +++ /dev/null @@ -1,12 +0,0 @@ -return -{ - width = 442, - height = 356, - shift = util.by_pixel( 30.5, -7.5), - line_length = 8, - filenames = { - "-1.png", - "-2.png", - }, - lines_per_file = 8, -} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png deleted file mode 100644 index e00bae3..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png deleted file mode 100644 index c56d7f3..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua deleted file mode 100644 index 9783293..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua +++ /dev/null @@ -1,12 +0,0 @@ -return -{ - width = 376, - height = 398, - shift = util.by_pixel( 0.0, -6.0), - line_length = 8, - filenames = { - "-1.png", - "-2.png", - }, - lines_per_file = 8, -} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua deleted file mode 100644 index 28a41b5..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua +++ /dev/null @@ -1,7 +0,0 @@ -return -{ - width = 38, - height = 46, - shift = util.by_pixel( -0.5, 6.5), - line_length = 1, -} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png deleted file mode 100644 index e851180..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png deleted file mode 100644 index 04e9b7c..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png deleted file mode 100644 index 5d6859c..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png deleted file mode 100644 index b22657e..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua deleted file mode 100644 index 15673da..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua +++ /dev/null @@ -1,12 +0,0 @@ -return -{ - width = 514, - height = 214, - shift = util.by_pixel( 47.5, 29.0), - line_length = 6, - filenames = { - "-1.png", - "-2.png", - }, - lines_per_file = 11, -} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua deleted file mode 100644 index c5f5b9d..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua +++ /dev/null @@ -1,7 +0,0 @@ -return -{ - width = 122, - height = 142, - shift = util.by_pixel( 26.5, -42.5), - line_length = 1, -} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png deleted file mode 100644 index 549a2d3..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png deleted file mode 100644 index 203413f..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png deleted file mode 100644 index 3486d1e..0000000 Binary files a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua deleted file mode 100644 index 53a1c56..0000000 --- a/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua +++ /dev/null @@ -1,12 +0,0 @@ -return -{ - width = 314, - height = 290, - shift = util.by_pixel( 25.0, -9.5), - line_length = 8, - filenames = { - "-1.png", - "-2.png", - }, - lines_per_file = 8, -} diff --git a/bzfoundry2/graphics/entity/foundry/foundry-main-1.png b/bzfoundry2/graphics/entity/foundry/foundry-main-1.png deleted file mode 100644 index d163387..0000000 Binary files a/bzfoundry2/graphics/entity/foundry/foundry-main-1.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/foundry/foundry-main-2.png b/bzfoundry2/graphics/entity/foundry/foundry-main-2.png deleted file mode 100644 index ceb411b..0000000 Binary files a/bzfoundry2/graphics/entity/foundry/foundry-main-2.png and /dev/null differ diff --git a/bzfoundry2/graphics/entity/foundry/foundry-remnants.png b/bzfoundry2/graphics/entity/foundry/foundry-remnants.png deleted file mode 100644 index 334a31d..0000000 Binary files a/bzfoundry2/graphics/entity/foundry/foundry-remnants.png and /dev/null differ diff --git a/bzfoundry2/graphics/icons/electric-foundry.png b/bzfoundry2/graphics/icons/electric-foundry.png deleted file mode 100644 index da78bc2..0000000 Binary files a/bzfoundry2/graphics/icons/electric-foundry.png and /dev/null differ diff --git a/bzfoundry2/graphics/icons/foundry.afphoto b/bzfoundry2/graphics/icons/foundry.afphoto deleted file mode 100644 index a42754a..0000000 Binary files a/bzfoundry2/graphics/icons/foundry.afphoto and /dev/null differ diff --git a/bzfoundry2/graphics/icons/foundry.png b/bzfoundry2/graphics/icons/foundry.png deleted file mode 100644 index f54b677..0000000 Binary files a/bzfoundry2/graphics/icons/foundry.png and /dev/null differ diff --git a/bzfoundry2/graphics/icons/technology/electric-foundry.png b/bzfoundry2/graphics/icons/technology/electric-foundry.png deleted file mode 100644 index 4fe8669..0000000 Binary files a/bzfoundry2/graphics/icons/technology/electric-foundry.png and /dev/null differ diff --git a/bzfoundry2/graphics/icons/technology/foundry.png b/bzfoundry2/graphics/icons/technology/foundry.png deleted file mode 100644 index c645699..0000000 Binary files a/bzfoundry2/graphics/icons/technology/foundry.png and /dev/null differ diff --git a/bzfoundry2/prototypes/entity/electric-foundry.lua b/bzfoundry2/prototypes/entity/electric-foundry.lua deleted file mode 100644 index d0cc05b..0000000 --- a/bzfoundry2/prototypes/entity/electric-foundry.lua +++ /dev/null @@ -1,337 +0,0 @@ -require("util") -local futil = require("data-util") -require ("sound-util") -require ("circuit-connector-sprites") -local hit_effects = require("__base__.prototypes.entity.hit-effects") -local sounds = require("__base__.prototypes.entity.sounds") -local explosion_animations = require("__base__/prototypes/entity/explosion-animations") -local particle_animations = require("__base__/prototypes/particle-animations") - -data:extend({ - { - type = "assembling-machine", - name = "electric-foundry", - icon = "__bzfoundry__/graphics/icons/electric-foundry.png", - icon_size = 64, - flags = {"placeable-neutral","player-creation"}, - minable = {mining_time = 0.2, result = "electric-foundry"}, - max_health = 300, - fast_replaceable_group = "foundry", - corpse = "electric-foundry-remnants", - dying_explosion = "foundry-explosion", - circuit_wire_max_distance = assembling_machine_circuit_wire_max_distance, - circuit_connector = circuit_connector_definitions["foundry"], - collision_box = {{-1.7, -1.7}, {1.7, 1.7}}, - selection_box = {{-2, -2}, {2, 2}}, - crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil}, - energy_usage = "360kW", - drain = "12kW", - crafting_speed = 4, - energy_source = - { - type = "electric", - emissions_per_minute = { pollution = 2 }, - usage_priority = "secondary-input", - }, - allowed_effects = {"consumption", "speed", "productivity", "pollution"}, - damaged_trigger_effect = hit_effects.entity(), - drawing_box_vertical_extension = 1.3, - module_slots = 3, - icon_draw_specification = {scale = 2, shift = {0, -0.3}}, - icons_positioning = - { - {inventory_index = defines.inventory.assembling_machine_modules, shift = {0, 1.25}} - }, - perceived_performance = {minimum = 0.25, maximum = 20}, - graphics_set = require("foundry-pictures").graphics_set, - open_sound = sounds.steam_open, - close_sound = sounds.steam_close, - working_sound = - { - sound = - { - filename = "__bzfoundry__/sound/entity/foundry/foundry.ogg", - volume = 0.5, - audible_distance_modifier = 0.6 - }, - fade_in_ticks = 4, - fade_out_ticks = 20, - sound_accents = - { - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-pipe-out.ogg", volume = 0.9, audible_distance_modifier = 0.4}, frame = 2}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-close.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 18}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-clamp.ogg", volume = 0.45, audible_distance_modifier = 0.3}, frame = 39}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-stop.ogg", volume = 0.7, audible_distance_modifier = 0.4}, frame = 43}, - {sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-fire-whoosh", 3, 0.8), audible_distance_modifier = 0.3}, frame = 64}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-metal-clunk.ogg", volume = 0.65, audible_distance_modifier = 0.4}, frame = 64}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-open.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 74}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-pipe-in.ogg", volume = 0.75, audible_distance_modifier = 0.4}, frame = 106}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-smoke-puff.ogg", volume = 0.8, audible_distance_modifier = 0.3}, frame = 106}, - {sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-pour", 2, 0.7)}, frame = 110}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-rocks.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 120}, - {sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-blade.ogg", volume = 0.7}, frame = 126}, - }, - max_sounds_per_prototype = 2 - }, - water_reflection = - { - pictures = util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-reflection", - { - scale = 4, - shift = {0,2} - }), - rotate = false - } - }, - { - type = "corpse", - name = "electric-foundry-remnants", - icon = "__bzfoundry__/graphics/icons/electric-foundry.png", - flags = {"placeable-neutral", "not-on-map"}, - hidden_in_factoriopedia = true, - subgroup = "smelting-machine-remnants", - order = "d[foundry]", - selection_box = {{-2.5, -2.5}, {2.5, 2.5}}, - tile_width = 5, - tile_height = 5, - selectable_in_game = false, - time_before_removed = 60 * 60 * 15, -- 15 minutes - expires = false, - final_render_layer = "remnants", - remove_on_tile_placement = false, - animation = - { - filename = "__bzfoundry__/graphics/entity/electric-foundry/foundry-remnants.png", - line_length = 1, - width = 494, - height = 478, - frame_count = 1, - direction_count = 1, - shift = util.by_pixel( -1.5, -5.5), - scale = 0.4 - } - }, - { - type = "explosion", - name = "foundry-explosion", - icon = "__bzfoundry__/graphics/icons/electric-foundry.png", - flags = {"not-on-map"}, - hidden = true, - subgroup = "smelting-machine-explosions", - order = "d[foundry]", - height = 0, - animations = explosion_animations.big_explosion(), - smoke = "smoke-fast", - smoke_count = 2, - smoke_slow_down_factor = 1, - sound = sounds.large_explosion(0.7, 1.0), - created_effect = - { - type = "direct", - action_delivery = - { - type = "instant", - target_effects = - { - { - type = "create-particle", - repeat_count = 10, - probability = 1, - particle_name = "oil-refinery-metal-particle-big", - offsets = - { - { 0.7734, -0.6484 }, - { -0.7266, 0.5859 } - }, - offset_deviation = { { -0.6875, -0.6875 }, { 0.6875, 0.6875 } }, - initial_height = 0.8, - initial_height_deviation = 0.49, - initial_vertical_speed = 0.088, - initial_vertical_speed_deviation = 0.05, - speed_from_center = 0.03, - speed_from_center_deviation = 0.05 - }, - { - type = "create-particle", - repeat_count = 38, - probability = 1, - particle_name = "oil-refinery-metal-particle-medium", - offsets = { { 0, 0 } }, - offset_deviation = { { -0.9805, -0.8867 }, { 0.9805, 0.8867 } }, - initial_height = 0.6, - initial_height_deviation = 0.5, - initial_vertical_speed = 0.098, - initial_vertical_speed_deviation = 0.05, - speed_from_center = 0.07, - speed_from_center_deviation = 0.05 - }, - { - type = "create-particle", - repeat_count = 10, - probability = 1, - particle_name = "foundry-metal-particle-big", - offsets = - { - { -1.492, -1.453 }, - { 1.555, -1.469 }, - { 1.477, 1.469 }, - { -0.6172, 0.3281 } - }, - offset_deviation = { { -0.9961, -0.5938 }, { 0.9961, 0.5938 } }, - initial_height = 0.4, - initial_height_deviation = 0.5, - initial_vertical_speed = 0.075, - initial_vertical_speed_deviation = 0.05, - speed_from_center = 0.04, - speed_from_center_deviation = 0.05 - }, - { - type = "create-particle", - repeat_count = 35, - probability = 1, - particle_name = "foundry-metal-particle-medium", - offsets = - { - { -0.02344, -0.8984 } - }, - offset_deviation = { { -0.5, -0.2969 }, { 0.5, 0.2969 } }, - initial_height = 0.7, - initial_height_deviation = 0.15, - initial_vertical_speed = 0.166, - initial_vertical_speed_deviation = 0.047, - speed_from_center = 0.05, - speed_from_center_deviation = 0.005 - }, - { - type = "create-particle", - repeat_count = 20, - particle_name = "foundry-metal-particle-small", - offset_deviation = { { -0.5, -0.5 }, { 0.5, 0.5 } }, - initial_height = 0.5, - initial_height_deviation = 0.5, - initial_vertical_speed = 0.06, - initial_vertical_speed_deviation = 0.05, - speed_from_center = 0.04, - speed_from_center_deviation = 0.05 - }, - } - } - } - } -}) - -local make_particle = function(params) - return { - type = "optimized-particle", - name = params.name, - life_time = 60 * 15, - render_layer = "object", - render_layer_when_on_ground = "corpse", - - regular_trigger_effect_frequency = 2, - regular_trigger_effect = params.regular_trigger_effect, - ended_in_water_trigger_effect = { - { - type = "create-particle", - probability = 1, - affects_target = false, - show_in_tooltip = false, - particle_name = "tintable-water-particle", - apply_tile_tint = "secondary", - offset_deviation = { { -0.05, -0.05 }, { 0.05, 0.05 } }, - initial_height = 0, - initial_height_deviation = 0.02, - initial_vertical_speed = 0.05, - initial_vertical_speed_deviation = 0.05, - speed_from_center = 0.01, - speed_from_center_deviation = 0.006, - frame_speed = 1, - frame_speed_deviation = 0, - tail_length = 2, - tail_length_deviation = 1, - tail_width = 3, - only_when_visible = true - }, - { - type = "create-particle", - repeat_count = 10, - repeat_count_deviation = 6, - probability = 0.03, - affects_target = false, - show_in_tooltip = false, - particle_name = "tintable-water-particle", - apply_tile_tint = "primary", - offsets = - { - { 0, 0 }, - { 0.01563, -0.09375 }, - { 0.0625, 0.09375 }, - { -0.1094, 0.0625 } - }, - offset_deviation = { { -0.2969, -0.1992 }, { 0.2969, 0.1992 } }, - initial_height = 0, - initial_height_deviation = 0.02, - initial_vertical_speed = 0.053, - initial_vertical_speed_deviation = 0.005, - speed_from_center = 0.02, - speed_from_center_deviation = 0.006, - frame_speed = 1, - frame_speed_deviation = 0, - tail_length = 9, - tail_length_deviation = 0, - tail_width = 1, - only_when_visible = true - }, - { - type = "play-sound", - sound = sounds.small_splash - } - }, - pictures = params.pictures, - shadows = params.shadows, - } -end - -local small_smoke_trigger_effect = function() - return - { - type = "create-trivial-smoke", - smoke_name = "smoke-explosion-particle-small", - starting_frame_deviation = 0, - offset_deviation = {{-0.03, -0.03}, {0.03, 0.03}}, - speed_from_center = nil - } -end - -local default_smoke_trigger_effect = function() - return - { - type = "create-trivial-smoke", - smoke_name = "smoke-explosion-particle", - starting_frame_deviation = 5, - offset_deviation = {{-0.06, -0.06}, {0.06, 0.06}}, - speed_from_center = 0.007 - } -end - -data:extend({ - make_particle({ - name = "foundry-metal-particle-small", - pictures = particle_animations.get_metal_particle_small_pictures({tint = {0.606, 0.408, 0.512, 1}}), - shadows = particle_animations.get_metal_particle_small_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}), - regular_trigger_effect = nil, - }), - make_particle({ - name = "foundry-metal-particle-medium", - pictures = particle_animations.get_metal_particle_medium_pictures({tint = {0.5, 0.5, 0.5, 1}}), - shadows = particle_animations.get_metal_particle_medium_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}), - regular_trigger_effect = small_smoke_trigger_effect() - }), - make_particle({ - name = "foundry-metal-particle-big", - pictures = particle_animations.get_metal_particle_big_pictures({tint = {0.65, 0.40, 0.35, 1}}), - regular_trigger_effect = default_smoke_trigger_effect() - }) -}) - -futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding") diff --git a/bzfoundry2/prototypes/entity/foundry-pictures.lua b/bzfoundry2/prototypes/entity/foundry-pictures.lua deleted file mode 100644 index 7018d00..0000000 --- a/bzfoundry2/prototypes/entity/foundry-pictures.lua +++ /dev/null @@ -1,111 +0,0 @@ -local foundry_animation_speed = 0.16 -local frames = 128 - -local function foundry_main_pictures() - return util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-main", - { - animation_speed = foundry_animation_speed, - frame_count = frames, - scale = 0.4 - }) -end - -local function foundry_main_shadow_pictures() - return util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-shadow", - { - animation_speed = foundry_animation_speed, - frame_count = frames, - draw_as_shadow = true, - scale = 0.4 - }) -end - -local function foundry_working_pictures() - return - { - fadeout = true, - animation = - util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-working", - { - animation_speed = foundry_animation_speed, - frame_count = frames, - scale = 0.4 - } - ) - } -end - -local function foundry_lights_pictures() - return - { - effect = "flicker", - fadeout = true, - animation = - util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-lights", - { - draw_as_glow = true, - animation_speed = foundry_animation_speed, - frame_count = frames, - blend_mode = "additive", - scale = 0.4 - } - ) - } -end - -local function foundry_status_lamp_pictures() - return - { - animation = - util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-status-lamp", - { - draw_as_glow = true, - repeat_count = frames, - blend_mode = "additive", - scale = 0.4 - } - ) - } -end - -local function foundry_chimney_smoke() - return - { - fadeout = true, - constant_speed = true, - render_layer = "wires", - animation = - { - filename = "__base__/graphics/entity/chemical-plant/chemical-plant-smoke-outer.png", - frame_count = 47, - line_length = 16, - width = 90, - height = 188, - animation_speed = 0.5, - shift = util.by_pixel(52, -131), - tint = {0.4, 0.4, 0.4, 1}, - scale = 0.4 - } - } -end - -return { - graphics_set = - { - animation = - { - layers = - { - foundry_main_pictures(), - foundry_main_shadow_pictures() - } - }, - working_visualisations = - { - foundry_working_pictures(), - foundry_lights_pictures(), - foundry_status_lamp_pictures(), - foundry_chimney_smoke() - } - } -} diff --git a/bzfoundry2/prototypes/entity/foundry.lua b/bzfoundry2/prototypes/entity/foundry.lua deleted file mode 100644 index 2f828a4..0000000 --- a/bzfoundry2/prototypes/entity/foundry.lua +++ /dev/null @@ -1,71 +0,0 @@ -require("util") -local futil = require("data-util") -local meld = require("meld") - -local fuel = {"chemical"} -if mods.Krastorio2 then table.insert(fuel, "kr-vehicle-fuel") end -if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end - -local foundry = table.deepcopy(data.raw["assembling-machine"]["electric-foundry"]) -meld(foundry, { - name = "foundry", - next_upgrade = "electric-foundry", - icon = "__bzfoundry__/graphics/icons/foundry.png", - minable = {mining_time = 0.2, result = "foundry"}, - energy_usage = "180kW", - energy_source = { - type = "burner", - fuel_categories = fuel, - effectivity = 1, - emissions_per_minute = { pollution = 8 }, - fuel_inventory_size = 1, - smoke = - { - { - name = "smoke", - frequency = 20, - position = {1, -1.7}, - starting_vertical_speed = 0.1, - starting_frame_deviation = 60 - } - } - }, -}) -foundry.graphics_set.animation.layers[1].filenames = { - "__bzfoundry__/graphics/entity/foundry/foundry-main-1.png", - "__bzfoundry__/graphics/entity/foundry/foundry-main-2.png" -} - -data:extend({ - foundry, - { - type = "corpse", - name = "foundry-remnants", - icon = "__bzfoundry__/graphics/icons/foundry.png", - flags = {"placeable-neutral", "not-on-map"}, - hidden_in_factoriopedia = true, - subgroup = "smelting-machine-remnants", - order = "d[foundry]", - selection_box = {{-2.5, -2.5}, {2.5, 2.5}}, - tile_width = 5, - tile_height = 5, - selectable_in_game = false, - time_before_removed = 60 * 60 * 15, -- 15 minutes - expires = false, - final_render_layer = "remnants", - remove_on_tile_placement = false, - animation = - { - filename = "__bzfoundry__/graphics/entity/foundry/foundry-remnants.png", - line_length = 1, - width = 494, - height = 478, - frame_count = 1, - direction_count = 1, - shift = util.by_pixel( -1.5, -5.5), - scale = 0.4 - } - } -}) - -futil.add_crafting_category("assembling-machine", "foundry", "basic-founding") diff --git a/bzfoundry2/sound/entity/foundry/foundry-blade.ogg b/bzfoundry2/sound/entity/foundry/foundry-blade.ogg deleted file mode 100644 index 55b8cfa..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-blade.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg b/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg deleted file mode 100644 index 4af3ab0..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg deleted file mode 100644 index 0468045..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg deleted file mode 100644 index 81dd873..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg deleted file mode 100644 index de49d67..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg b/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg deleted file mode 100644 index d9930a2..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg b/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg deleted file mode 100644 index 2c8e75c..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg b/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg deleted file mode 100644 index 0b99e4d..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg b/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg deleted file mode 100644 index 739c03f..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg b/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg deleted file mode 100644 index dcbd613..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg b/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg deleted file mode 100644 index 8b97744..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg b/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg deleted file mode 100644 index da5c514..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg deleted file mode 100644 index e8818d9..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg deleted file mode 100644 index 42d8f1b..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg deleted file mode 100644 index 23fc4ae..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg b/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg deleted file mode 100644 index 218802d..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg and /dev/null differ diff --git a/bzfoundry2/sound/entity/foundry/foundry.ogg b/bzfoundry2/sound/entity/foundry/foundry.ogg deleted file mode 100644 index 806eaa7..0000000 Binary files a/bzfoundry2/sound/entity/foundry/foundry.ogg and /dev/null differ diff --git a/bzfoundry2/changelog.txt b/changelog.txt similarity index 82% rename from bzfoundry2/changelog.txt rename to changelog.txt index 1b1200e..d0e2aae 100644 --- a/bzfoundry2/changelog.txt +++ b/changelog.txt @@ -1,32 +1,4 @@ --------------------------------------------------------------------------------------------------- -Version: 0.2.14 -Date: 2024-02-07 - Fixes: - - Attempt to fix a rare compatibility issue related to indexing nil value ---------------------------------------------------------------------------------------------------- -Version: 0.2.13 -Date: 2023-12-28 - Changes: - - Some recipes moved in crafting menus, they were defaulting to appearing at the top: - - In vanilla: recipes for certain intermediates created in foundries moved after - "raw-material" recipes (such as most plates, etc), and before "intermediate-product" - recipes (eg circuits). There's not a perfect place for this right now, but this seems to be - thematically a decent place to put it. - - In Space Exploration (SE): Similar to above, but after gears, sticks, etc - - In vanilla and SE: recipes for foundry entities moved after furnace entities but before - assemblers. This seems to be the right location, thematically. - Localization: - - ja locale updates thanks to Sakuro ---------------------------------------------------------------------------------------------------- -Version: 0.2.12 -Date: 2023-04-18 - Features: - - Default upgrade planner now upgrades foundry to electric foundry. ---------------------------------------------------------------------------------------------------- -Version: 0.2.11 - Fixes: - - Fix some minor recipe ordering issues ---------------------------------------------------------------------------------------------------- Version: 0.2.10 Date: 2023-03-06 Features: diff --git a/bzfoundry2/control-util.lua b/control-util.lua similarity index 100% rename from bzfoundry2/control-util.lua rename to control-util.lua diff --git a/bzfoundry2/data-final-fixes.lua b/data-final-fixes.lua similarity index 100% rename from bzfoundry2/data-final-fixes.lua rename to data-final-fixes.lua diff --git a/bzfoundry2/data-updates.lua b/data-updates.lua similarity index 100% rename from bzfoundry2/data-updates.lua rename to data-updates.lua diff --git a/bzfoundry2/data-util.lua b/data-util.lua similarity index 80% rename from bzfoundry2/data-util.lua rename to data-util.lua index 4547d4f..6b923b4 100644 --- a/bzfoundry2/data-util.lua +++ b/data-util.lua @@ -64,7 +64,17 @@ function util.fe_plus(sub) end end -function util.k2assets() +function util.get_stack_size(default) + if mods.Krastorio2 then + local size = get_setting("kr-stack-size") + if size and tonumber(size) then + return tonumber(size) + end + end + return default +end + +function util.k2assets() if mods["Krastorio2Assets"] then return "__Krastorio2Assets__" end @@ -101,8 +111,8 @@ function util.se_landfill(params) category = "hard-recycling", order = "z-b-"..params.ore, subgroup = "terrain", - results = {{type="item", name="landfill", amount=1}}, - ingredients = {{type="item", name=params.ore, amount=50}}, + result = "landfill", + ingredients = {{params.ore, 50}}, } }) util.add_unlock("se-recycling-facility", lname) @@ -113,7 +123,7 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} function util.k2matter(params) - local matter = require("__Krastorio2__/prototypes/libraries/matter") + local matter = require("__Krastorio2__/lib/public/data-stages/matter-util") if mods["space-exploration"] then params.k2matter.need_stabilizer = true end @@ -121,13 +131,6 @@ function util.k2matter(params) params.k2matter.minimum_conversion_quantity = 10 end if not data.raw.technology[params.k2matter.unlocked_by_technology] then - local icon = "" - if params.k2baseicon then - icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png" - else - icon = util.k2assets().."/technologies/backgrounds/matter.png" - end - data:extend( { { @@ -136,7 +139,7 @@ function util.k2matter(params) icons = { { - icon = icon, + icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png", icon_size = 256, }, params.icon, @@ -145,29 +148,18 @@ function util.k2matter(params) unit = { count = 350, - ingredients = mods["space-exploration"] and - { - {"automation-science-pack", 1}, - {"logistic-science-pack", 1}, - {"chemical-science-pack", 1}, - {"se-astronomic-science-pack-4", 1}, - {"se-energy-science-pack-4", 1}, - {"se-material-science-pack-4", 1}, - {"se-deep-space-science-pack-2", 1}, - {"se-kr-matter-science-pack-2", 1}, - } or + ingredients = { {"production-science-pack", 1}, {"utility-science-pack", 1}, - {"kr-matter-tech-card", 1} + {"matter-tech-card", 1} }, time = 45, - }, - localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, + } }, }) end - matter.make_recipes(params.k2matter) + matter.createMatterRecipe(params.k2matter) end @@ -201,16 +193,16 @@ function util.se_matter(params) energy_required = params.energy_required, enabled = false, ingredients = { - {type="item", name=sedata, amount=1}, + {sedata, 1}, {type="fluid", name="se-particle-stream", amount=50}, {type="fluid", name="se-space-coolant-supercooled", amount=25}, }, results = { - {type="item", name=params.ore, amount=params.quant_out}, - {type="item", name="se-contaminated-scrap", amount=1}, - {type="item", name=sedata, amount=1, probability=.99}, - {type="item", name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_productivity=25, ignored_by_stats=25}, + {params.ore, params.quant_out}, + {"se-contaminated-scrap", 1}, + {type=item, name=sedata, amount=1, probability=.99}, + {type=item, name=sejunk, amount=1, probability=.01}, + {type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, } } }) @@ -240,14 +232,14 @@ function util.se_matter(params) energy_required = 30, enabled = false, ingredients = { - {type="item", name="se-kr-matter-liberation-data", amount=1}, - {type="item", name=params.ore, amount=params.quant_in}, + {"se-kr-matter-liberation-data", 1}, + {params.ore, params.quant_in}, {type="fluid", name="se-particle-stream", amount=50}, }, results = { - {type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99}, - {type="item", name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_productivity=50, ignored_by_stats=50}, + {type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99}, + {type=item, name=sejunk, amount=1, probability=.01}, + {type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, } } }) @@ -274,7 +266,7 @@ function util.se_matter(params) {"se-astronomic-science-pack-4", 1}, {"se-energy-science-pack-4", 1}, {"se-material-science-pack-4", 1}, - {"kr-matter-tech-card", 1}, + {"matter-tech-card", 1}, {"se-deep-space-science-pack-1", 1}, } @@ -288,6 +280,18 @@ function util.se_matter(params) end end +-- Get the normal prototype for a recipe -- either .normal or the recipe itself +function util.get_normal(recipe_name) + if data.raw.recipe[recipe_name] then + recipe = data.raw.recipe[recipe_name] + if recipe.normal and recipe.normal.ingredients then + return recipe.normal + elseif recipe.ingredients then + return recipe + end + end +end + -- Set/override a technology's prerequisites function util.set_prerequisite(technology_name, prerequisites) local technology = data.raw.technology[technology_name] @@ -354,7 +358,7 @@ function util.add_unlock(technology_name, recipe) end -- Check if a tech unlocks a recipe -function util.check_unlock(technology_name, recipe) +function util.check_unlock(technology_name, recipe_name) local technology = data.raw.technology[technology_name] if technology and technology.effects then for i, effect in pairs(technology.effects) do @@ -399,13 +403,17 @@ end function util.set_enabled(recipe_name, enabled) if data.raw.recipe[recipe_name] then - data.raw.recipe[recipe_name].enabled = enabled + if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end + if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end + if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end end end function util.set_hidden(recipe_name) if data.raw.recipe[recipe_name] then - data.raw.recipe[recipe_name].hidden = true + if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end + if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.hidden = true end + if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].hidden = true end end end @@ -415,6 +423,8 @@ function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity, option if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then me.add_modified(recipe_name) add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) + add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity) + add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) end end @@ -437,6 +447,8 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options) if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then me.add_modified(recipe_name) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) + add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid) + add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid) end end @@ -450,7 +462,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid) if is_fluid then table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) else - table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity}) + table.insert(recipe.ingredients, {ingredient, quantity}) end end end @@ -461,6 +473,8 @@ function util.add_ingredient_raw(recipe_name, ingredient, options) if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then me.add_modified(recipe_name) add_ingredient_raw(data.raw.recipe[recipe_name], ingredient) + add_ingredient_raw(data.raw.recipe[recipe_name].normal, ingredient) + add_ingredient_raw(data.raw.recipe[recipe_name].expensive, ingredient) end end @@ -484,6 +498,8 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options) if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then me.add_modified(recipe_name) set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) + set_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity) + set_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) end end @@ -507,18 +523,29 @@ end -- Only works for recipes with multiple products function util.add_product(recipe_name, product, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and - (data.raw.item[product.name] or data.raw.fluid[product.name]) then + if data.raw.recipe[recipe_name] and + (data.raw.item[product[1]] or data.raw.item[product.name] or + data.raw.fluid[product[1]] or data.raw.fluid[product.name] + ) then add_product(data.raw.recipe[recipe_name], product) + add_product(data.raw.recipe[recipe_name].normal, product) + add_product(data.raw.recipe[recipe_name].expensive, product) end end function add_product(recipe, product) if recipe ~= nil then - if recipe.results == nil then - recipe.results = {} + if (product[1] and data.raw.item[product[1]]) or + (product.name and data.raw[product.type][product.name]) then + if not recipe.normal then + if recipe.results == nil then + recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} + end + recipe.result = nil + recipe.result_count = nil + table.insert(recipe.results, product) end - table.insert(recipe.results, product) + end end end @@ -526,13 +553,18 @@ end function util.get_ingredient_amount(recipe_name, ingredient_name) local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.ingredients then + if recipe.normal and recipe.normal.ingredients then + for i, ingredient in pairs(recipe.normal.ingredients) do + if ingredient[1] == ingredient_name then return ingredient[2] end + if ingredient.name == ingredient_name then return ingredient.amount end + end + elseif recipe.ingredients then for i, ingredient in pairs(recipe.ingredients) do if ingredient[1] == ingredient_name then return ingredient[2] end if ingredient.name == ingredient_name then return ingredient.amount end end end - return 1 + return 0 end return 0 end @@ -542,7 +574,14 @@ function util.get_amount(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.results then + if recipe.normal and recipe.normal.results then + for i, result in pairs(recipe.normal.results) do + if result[1] == product then return result[2] end + if result.name == product then return result.amount end + end + elseif recipe.normal and recipe.normal.result_count then + return recipe.normal.result_count + elseif recipe.results then for i, result in pairs(recipe.results) do if result[1] == product then return result[2] end if result.name == product then return result.amount end @@ -560,7 +599,9 @@ function util.get_result_count(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.results then + if recipe.normal and recipe.normal.results then + return #(recipe.normal.results) + elseif recipe.results then return #(recipe.results) end return 1 @@ -575,6 +616,8 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then me.add_modified(recipe_name) replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) + replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount, multiply) + replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount, multiply) end end @@ -616,6 +659,8 @@ function util.remove_ingredient(recipe_name, old, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) remove_ingredient(data.raw.recipe[recipe_name], old) + remove_ingredient(data.raw.recipe[recipe_name].normal, old) + remove_ingredient(data.raw.recipe[recipe_name].expensive, old) end end @@ -641,23 +686,28 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) + replace_some_product(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid) + replace_some_product(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid) end end -function replace_some_product(recipe, old, old_amount, new, new_amount, is_fluid) +function replace_some_product(recipe, old, old_amount, new, new_amount) if recipe ~= nil then if recipe.result == new then return end if recipe.results then for i, existing in pairs(recipe.results) do - if existing.name == new then + if existing[1] == new or existing.name == new then return end end end - add_product(recipe, {type=is_fluid and "fluid" or "item", name=new, amount=new_amount}) + add_product(recipe, {new, new_amount}) for i, product in pairs(recipe.results) do if product.name == old then product.amount = math.max(1, product.amount - old_amount) + end + if product[1] == old then + product[2] = math.max(1, product[2] - old_amount) end end end @@ -670,6 +720,8 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) + replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid) + replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid) end end @@ -698,6 +750,8 @@ function util.set_product_amount(recipe_name, product, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then set_product_amount(data.raw.recipe[recipe_name], product, amount) + set_product_amount(data.raw.recipe[recipe_name].normal, product, amount) + set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -736,6 +790,8 @@ function util.multiply_recipe(recipe_name, multiple, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then multiply_recipe(data.raw.recipe[recipe_name], multiple) + multiply_recipe(data.raw.recipe[recipe_name].normal, multiple) + multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple) end end @@ -743,6 +799,8 @@ function multiply_recipe(recipe, multiple) if recipe then if recipe.energy_required then recipe.energy_required = recipe.energy_required * multiple + else + recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default end if recipe.result_count then recipe.result_count = recipe.result_count * multiple @@ -757,11 +815,8 @@ function multiply_recipe(recipe, multiple) result.amount_min = result.amount_min * multiple result.amount_max = result.amount_max * multiple end - if result.ignored_by_productivity then - result.ignored_by_productivity = result.ignored_by_productivity * multiple - end - if result.ignored_by_stats then - result.ignored_by_stats = result.ignored_by_stats * multiple + if result.catalyst_amount then + result.catalyst_amount = result.catalyst_amount * multiple end end if result[1] then @@ -788,8 +843,9 @@ end -- Returns true if a recipe has an ingredient function util.has_ingredient(recipe_name, ingredient) - return data.raw.recipe[recipe_name] and - has_ingredient(data.raw.recipe[recipe_name], ingredient) + return data.raw.recipe[recipe_name] and ( + has_ingredient(data.raw.recipe[recipe_name], ingredient) or + has_ingredient(data.raw.recipe[recipe_name].normal, ingredient)) end function has_ingredient(recipe, ingredient) @@ -809,6 +865,8 @@ function util.remove_product(recipe_name, old, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then remove_product(data.raw.recipe[recipe_name], old) + remove_product(data.raw.recipe[recipe_name].normal, old) + remove_product(data.raw.recipe[recipe_name].expensive, old) end end @@ -831,6 +889,8 @@ function util.set_main_product(recipe_name, product, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then set_main_product(data.raw.recipe[recipe_name], product) + set_main_product(data.raw.recipe[recipe_name].normal, product) + set_main_product(data.raw.recipe[recipe_name].expensive, product) end end @@ -844,11 +904,13 @@ end function util.replace_product(recipe_name, old, new, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then - replace_product(data.raw.recipe[recipe_name], old, new) + replace_product(data.raw.recipe[recipe_name], old, new, options) + replace_product(data.raw.recipe[recipe_name].normal, old, new, options) + replace_product(data.raw.recipe[recipe_name].expensive, old, new, options) end end -function replace_product(recipe, old, new) +function replace_product(recipe, old, new, options) if recipe then if recipe.main_product == old then recipe.main_product = new @@ -888,6 +950,8 @@ function util.set_recipe_time(recipe_name, time, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then set_recipe_time(data.raw.recipe[recipe_name], time) + set_recipe_time(data.raw.recipe[recipe_name].normal, time) + set_recipe_time(data.raw.recipe[recipe_name].expensive, time) end end @@ -905,6 +969,8 @@ function util.multiply_time(recipe_name, factor, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then multiply_time(data.raw.recipe[recipe_name], factor) + multiply_time(data.raw.recipe[recipe_name].normal, factor) + multiply_time(data.raw.recipe[recipe_name].expensive, factor) end end @@ -922,6 +988,8 @@ function util.add_time(recipe_name, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then add_time(data.raw.recipe[recipe_name], amount) + add_time(data.raw.recipe[recipe_name].normal, amount) + add_time(data.raw.recipe[recipe_name].expensive, amount) end end @@ -945,7 +1013,7 @@ end -- Set recipe subgroup function util.set_subgroup(recipe_name, subgroup, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] then + if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then me.add_modified(recipe_name) data.raw.recipe[recipe_name].subgroup = subgroup end @@ -964,16 +1032,34 @@ function util.add_icon(recipe_name, icon, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then - data.raw.recipe[recipe_name].icons = {} - if data.raw.recipe[recipe_name].icon then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.recipe[recipe_name].icon, - icon_size=data.raw.recipe[recipe_name].icon_size, - icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, - }} - data.raw.recipe[recipe_name].icon = nil - data.raw.recipe[recipe_name].icon_size = nil - end + if data.raw.recipe[recipe_name].icon then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.recipe[recipe_name].icon, + icon_size=data.raw.recipe[recipe_name].icon_size, + icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, + }} + elseif data.raw.item[data.raw.recipe[recipe_name].main_product] then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.item[data.raw.recipe[recipe_name].main_product].icon, + icon_size=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_size, + icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_mipmaps, + }} + elseif data.raw.item[data.raw.recipe[recipe_name].result] then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.item[data.raw.recipe[recipe_name].result].icon, + icon_size=data.raw.item[data.raw.recipe[recipe_name].result].icon_size, + icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].result].icon_mipmaps, + }} + elseif data.raw.recipe[recipe_name].normal and + data.raw.item[data.raw.recipe[recipe_name].normal.result] then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon, + icon_size=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_size, + icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_mipmaps, + }} + end + data.raw.recipe[recipe_name].icon = nil + data.raw.recipe[recipe_name].icon_size = nil end table.insert(data.raw.recipe[recipe_name].icons, icon) end @@ -1033,6 +1119,8 @@ function util.add_to_ingredient(recipe, ingredient, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe] then add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) + add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount) + add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount) end end @@ -1055,6 +1143,8 @@ function util.add_to_product(recipe_name, product, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then add_to_product(data.raw.recipe[recipe_name], product, amount) + add_to_product(data.raw.recipe[recipe_name].normal, product, amount) + add_to_product(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -1177,8 +1267,10 @@ function remove_prior_unlocks(tech, recipe) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) + if string.sub(prerequisite, 1, 3) ~= 'ei_' then + -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) + end end end end @@ -1220,7 +1312,9 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| - replace_ingredients_prior_to(prerequisite, old, new, multiplier) + if string.sub(prerequisite, 1, 3) ~= 'ei_' then + replace_ingredients_prior_to(prerequisite, old, new, multiplier) + end end end end diff --git a/bzfoundry2/data.lua b/data.lua similarity index 100% rename from bzfoundry2/data.lua rename to data.lua index 05aea8a..ad46555 100644 --- a/bzfoundry2/data.lua +++ b/data.lua @@ -5,6 +5,6 @@ require("prototypes/categories") if util.me.enable() then require("prototypes/coke") require("prototypes/foundry") - require("prototypes/entity/electric-foundry") require("prototypes/entity/foundry") + require("prototypes/entity/electric-foundry") end diff --git a/bzfoundry2/foundry-updates.lua b/foundry-updates.lua similarity index 92% rename from bzfoundry2/foundry-updates.lua rename to foundry-updates.lua index 2b97a61..67a9c34 100644 --- a/bzfoundry2/foundry-updates.lua +++ b/foundry-updates.lua @@ -10,8 +10,8 @@ if util.me.enable() then util.add_ingredient("tungsten-carbide", util.me.carbon(), 1) util.set_to_founding("cuw") - util.set_to_founding(mods.Krastorio2 and "kr-silicon" or "silicon") - util.add_ingredient(mods.Krastorio2 and "kr-silicon" or "silicon", util.me.carbon(), 1) + util.set_to_founding("silicon") + util.add_ingredient("silicon", util.me.carbon(), 1) util.set_to_founding("cermet") -- from zirconium util.set_to_founding("crucible") -- from graphite diff --git a/graphics/entity/electric-foundry-glow.png b/graphics/entity/electric-foundry-glow.png new file mode 100644 index 0000000..cada06d Binary files /dev/null and b/graphics/entity/electric-foundry-glow.png differ diff --git a/graphics/entity/electric-foundry-glow.xcf b/graphics/entity/electric-foundry-glow.xcf new file mode 100644 index 0000000..50e36e3 Binary files /dev/null and b/graphics/entity/electric-foundry-glow.xcf differ diff --git a/graphics/entity/electric-foundry.png b/graphics/entity/electric-foundry.png new file mode 100644 index 0000000..29447ef Binary files /dev/null and b/graphics/entity/electric-foundry.png differ diff --git a/graphics/entity/electric-foundry.xcf b/graphics/entity/electric-foundry.xcf new file mode 100644 index 0000000..ac61109 Binary files /dev/null and b/graphics/entity/electric-foundry.xcf differ diff --git a/graphics/entity/foundry.png b/graphics/entity/foundry.png new file mode 100644 index 0000000..ae391eb Binary files /dev/null and b/graphics/entity/foundry.png differ diff --git a/graphics/entity/foundry.xcf b/graphics/entity/foundry.xcf new file mode 100644 index 0000000..25b4b75 Binary files /dev/null and b/graphics/entity/foundry.xcf differ diff --git a/graphics/entity/hr-electric-foundry-1.png b/graphics/entity/hr-electric-foundry-1.png new file mode 100644 index 0000000..18e9d1b Binary files /dev/null and b/graphics/entity/hr-electric-foundry-1.png differ diff --git a/graphics/entity/hr-electric-foundry-2.png b/graphics/entity/hr-electric-foundry-2.png new file mode 100644 index 0000000..237e82d Binary files /dev/null and b/graphics/entity/hr-electric-foundry-2.png differ diff --git a/graphics/entity/hr-electric-foundry-3.png b/graphics/entity/hr-electric-foundry-3.png new file mode 100644 index 0000000..c6ddb8e Binary files /dev/null and b/graphics/entity/hr-electric-foundry-3.png differ diff --git a/graphics/entity/hr-electric-foundry-4.png b/graphics/entity/hr-electric-foundry-4.png new file mode 100644 index 0000000..b4fa48a Binary files /dev/null and b/graphics/entity/hr-electric-foundry-4.png differ diff --git a/graphics/entity/hr-electric-foundry-animation.png b/graphics/entity/hr-electric-foundry-animation.png new file mode 100644 index 0000000..0b05c3d Binary files /dev/null and b/graphics/entity/hr-electric-foundry-animation.png differ diff --git a/graphics/entity/hr-electric-foundry.png b/graphics/entity/hr-electric-foundry.png new file mode 100644 index 0000000..2b4490c Binary files /dev/null and b/graphics/entity/hr-electric-foundry.png differ diff --git a/graphics/entity/hr-foundry.png b/graphics/entity/hr-foundry.png new file mode 100644 index 0000000..6aec925 Binary files /dev/null and b/graphics/entity/hr-foundry.png differ diff --git a/bzfoundry2/graphics/icons/coke-1.png b/graphics/icons/coke-1.png similarity index 100% rename from bzfoundry2/graphics/icons/coke-1.png rename to graphics/icons/coke-1.png diff --git a/sources/graphics/icons/coke-1.xcf b/graphics/icons/coke-1.xcf similarity index 100% rename from sources/graphics/icons/coke-1.xcf rename to graphics/icons/coke-1.xcf diff --git a/bzfoundry2/graphics/icons/coke-2.png b/graphics/icons/coke-2.png similarity index 100% rename from bzfoundry2/graphics/icons/coke-2.png rename to graphics/icons/coke-2.png diff --git a/sources/graphics/icons/coke-2.xcf b/graphics/icons/coke-2.xcf similarity index 100% rename from sources/graphics/icons/coke-2.xcf rename to graphics/icons/coke-2.xcf diff --git a/bzfoundry2/graphics/icons/coke-3.png b/graphics/icons/coke-3.png similarity index 100% rename from bzfoundry2/graphics/icons/coke-3.png rename to graphics/icons/coke-3.png diff --git a/sources/graphics/icons/coke-3.xcf b/graphics/icons/coke-3.xcf similarity index 100% rename from sources/graphics/icons/coke-3.xcf rename to graphics/icons/coke-3.xcf diff --git a/bzfoundry2/graphics/icons/coke-icon.png b/graphics/icons/coke-icon.png similarity index 100% rename from bzfoundry2/graphics/icons/coke-icon.png rename to graphics/icons/coke-icon.png diff --git a/sources/graphics/icons/coke-icon.xcf b/graphics/icons/coke-icon.xcf similarity index 100% rename from sources/graphics/icons/coke-icon.xcf rename to graphics/icons/coke-icon.xcf diff --git a/bzfoundry2/graphics/icons/coke-stacked.png b/graphics/icons/coke-stacked.png similarity index 100% rename from bzfoundry2/graphics/icons/coke-stacked.png rename to graphics/icons/coke-stacked.png diff --git a/bzfoundry2/graphics/icons/coke.png b/graphics/icons/coke.png similarity index 100% rename from bzfoundry2/graphics/icons/coke.png rename to graphics/icons/coke.png diff --git a/sources/graphics/icons/coke.xcf b/graphics/icons/coke.xcf similarity index 100% rename from sources/graphics/icons/coke.xcf rename to graphics/icons/coke.xcf diff --git a/graphics/icons/electric-foundry-tech.xcf b/graphics/icons/electric-foundry-tech.xcf new file mode 100644 index 0000000..19658d4 Binary files /dev/null and b/graphics/icons/electric-foundry-tech.xcf differ diff --git a/graphics/icons/electric-foundry.png b/graphics/icons/electric-foundry.png new file mode 100644 index 0000000..d08236d Binary files /dev/null and b/graphics/icons/electric-foundry.png differ diff --git a/graphics/icons/electric-foundry.xcf b/graphics/icons/electric-foundry.xcf new file mode 100644 index 0000000..d08b5bd Binary files /dev/null and b/graphics/icons/electric-foundry.xcf differ diff --git a/graphics/icons/foundry.png b/graphics/icons/foundry.png new file mode 100644 index 0000000..a743f2d Binary files /dev/null and b/graphics/icons/foundry.png differ diff --git a/graphics/icons/foundry.xcf b/graphics/icons/foundry.xcf new file mode 100644 index 0000000..5f5e755 Binary files /dev/null and b/graphics/icons/foundry.xcf differ diff --git a/graphics/icons/technology/electric-foundry.png b/graphics/icons/technology/electric-foundry.png new file mode 100644 index 0000000..604f0cb Binary files /dev/null and b/graphics/icons/technology/electric-foundry.png differ diff --git a/graphics/icons/technology/foundry.png b/graphics/icons/technology/foundry.png new file mode 100644 index 0000000..ddc8673 Binary files /dev/null and b/graphics/icons/technology/foundry.png differ diff --git a/graphics/icons/technology/foundry.xcf b/graphics/icons/technology/foundry.xcf new file mode 100644 index 0000000..3c2d594 Binary files /dev/null and b/graphics/icons/technology/foundry.xcf differ diff --git a/bzfoundry2/info.json b/info.json similarity index 51% rename from bzfoundry2/info.json rename to info.json index 68de52d..0764d9f 100644 --- a/bzfoundry2/info.json +++ b/info.json @@ -1,20 +1,19 @@ { "name": "bzfoundry", - "version": "2.0.0", - "factorio_version": "2.0", + "version": "0.2.10", + "factorio_version": "1.1", "title": "Foundry", "author": "Brevven", "contact": "", "homepage": "", "dependencies": [ - "base >= 2.0.0", - "rusty-locale >= 1.0.17", - "? space-exploration >= 0.7.34", - "(?) Krastorio2 >= 2.0.8", - "? bzsilicon >= 2.0.18", + "? space-exploration", + "(?) Krastorio2", + "? bzsilicon", "? bztungsten", - "? bzzirconium >= 2.1.13", - "! space-age" + "? bzzirconium", + "rusty-locale", + "base >= 1.1.0" ], "description": "Adds a foundry building for making alloys, etc.\n\nA standalone accessory from BZ Mods." } diff --git a/bzfoundry2/locale/cs/foundry.cfg b/locale/cs/foundry.cfg similarity index 100% rename from bzfoundry2/locale/cs/foundry.cfg rename to locale/cs/foundry.cfg diff --git a/bzfoundry2/locale/en/foundry.cfg b/locale/en/foundry.cfg similarity index 100% rename from bzfoundry2/locale/en/foundry.cfg rename to locale/en/foundry.cfg diff --git a/bzfoundry2/locale/ja/foundry.cfg b/locale/ja/foundry.cfg similarity index 87% rename from bzfoundry2/locale/ja/foundry.cfg rename to locale/ja/foundry.cfg index d04e086..c38d455 100644 --- a/bzfoundry2/locale/ja/foundry.cfg +++ b/locale/ja/foundry.cfg @@ -39,7 +39,6 @@ bzfoundry-smelt=鋳造所で製錬可能 bzfoundry-plates=耐熱レシピを追加 (実験的) bzfoundry-hydrocarbon=鋳造に使用する炭化水素類 bzfoundry-other-machines=鋳造所以外に鋳造を行える設備 -bzfoundry-woodcoke=木材を使用するコークスのレシピ bzfoundry-minimal=ミニマルモード (建造物を取り除く) [mod-setting-description] @@ -49,12 +48,3 @@ bzfoundry-hydrocarbon=鋳造に使用する炭化水素類。コークス化に bzfoundry-other-machines=鋳造所以外に "founding" レシピを実行できる "assembling-machine" エンティティの一覧。例: K2の "kr-advanced-furnace" や AAII の "industrial-furnace" (コンマ区切り) bzfoundry-plates=[color=orange]実験的[/color] 材料、生産物などあらゆる点が変更される可能性があります。\n一つ以上の耐熱素材を使うことで鋳造所における板材の生産量を向上することが出来ます。\n警告: 煩雑なレシピです。 bzfoundry-minimal=[color=yellow]注意して使用のこと![/color]\nFactorioのMOD依存関係システムの問題回避を意図した設定。鋳造所とそれに依存したレシピを無効化します。デフォルトのMOD設定でFoundry MODを依存関係に残したまま、Aluminium MODをFoundry MODを使わずにプレイすることが可能になります。 -bzfoundry-woodcoke=他の炭化水素類としては、固形燃料にも対応しますが石炭には対応しません。 - -[string-mod-setting] -bzfoundry-plates-yes=はい -bzfoundry-plates-no=いいえ -bzfoundry-hydrocarbon-coke=__ITEM__coke__ -bzfoundry-hydrocarbon-solid-fuel=__ITEM__solid-fuel__ -bzfoundry-hydrocarbon-coal=__ITEM__coal__ -bzfoundry-hydrocarbon-none=なし diff --git a/bzfoundry2/locale/ko/foundry.cfg b/locale/ko/foundry.cfg similarity index 100% rename from bzfoundry2/locale/ko/foundry.cfg rename to locale/ko/foundry.cfg diff --git a/bzfoundry2/locale/ru/foundry.cfg b/locale/ru/foundry.cfg similarity index 100% rename from bzfoundry2/locale/ru/foundry.cfg rename to locale/ru/foundry.cfg diff --git a/bzfoundry2/locale/zh-CN/bzfoundry.cfg b/locale/zh-CN/bzfoundry.cfg similarity index 100% rename from bzfoundry2/locale/zh-CN/bzfoundry.cfg rename to locale/zh-CN/bzfoundry.cfg diff --git a/bzfoundry2/me.lua b/me.lua similarity index 89% rename from bzfoundry2/me.lua rename to me.lua index 09fd319..bb06f1c 100644 --- a/bzfoundry2/me.lua +++ b/me.lua @@ -3,7 +3,7 @@ local me = {} me.name = "bzfoundry" function me.basic_founding() - return mods.bztin or mods.bzaluminum2 + return mods.bztin or mods.bzaluminum end function me.woodcoke() @@ -23,15 +23,14 @@ function me.enable() end function me.carbon() - if mods["Krastorio2"] then return "kr-coke" end if me.get_setting("bz-all-intermediates") then return "coke" end return me.get_setting("bzfoundry-hydrocarbon") end function me.carbonrecipe() local carbon = me.carbon() - if carbon == "coke" or carbon == "kr-coke" then - return me.carbon() + if carbon == "coke" then + return "coke" elseif carbon == "solid-fuel" then return "solid-fuel-from-coal" end diff --git a/bzfoundry2/prototypes/categories.lua b/prototypes/categories.lua similarity index 83% rename from bzfoundry2/prototypes/categories.lua rename to prototypes/categories.lua index 1bea4d5..16c53e5 100644 --- a/bzfoundry2/prototypes/categories.lua +++ b/prototypes/categories.lua @@ -2,9 +2,8 @@ local util = require("data-util") data:extend({ { type = "recipe-category", name = "founding"}, - { type = "item-subgroup", name = "founding-machines", group = "production", order = "d-f"}, - { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products", - order = util.se6() and "a-b-z" or "c-z"}, + { type = "item-subgroup", name = "founding-machines", group = "production"}, + { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"}, }) if util.me.basic_founding() then diff --git a/bzfoundry2/prototypes/coke.lua b/prototypes/coke.lua similarity index 77% rename from bzfoundry2/prototypes/coke.lua rename to prototypes/coke.lua index 98a70d8..fad2cfa 100644 --- a/bzfoundry2/prototypes/coke.lua +++ b/prototypes/coke.lua @@ -24,9 +24,9 @@ data:extend({ { type = "recipe", name = "coke", + result = "coke", category = "founding", - ingredients = {{type="item", name="coal", amount=2}}, - results = {{ type = "item", name = "coke", amount = 1 }}, + ingredients = {{"coal", 2}}, energy_required = 3.2, enabled=false, }, @@ -36,9 +36,9 @@ data:extend({ { type = "recipe", name = "woodcoke", + result = "coke", category = "founding", - ingredients = {{type="item", name="coal", amount=1}, {type="item", name="wood", amount=2}}, - results = {{ type = "item", name = "coke", amount = 1 }}, + ingredients = {{"coal", 1}, {"wood", 2}}, energy_required = 3.2, enabled=false, icons = { @@ -53,9 +53,9 @@ data:extend({ { type = "recipe", name = "solid-fuel-from-coal", + result = "solid-fuel", category = "founding", - ingredients = {{type="item", name="coal", amount=4}}, - results = {{ type = "item", name = "solid-fuel", amount = 1 }}, + ingredients = {{"coal", 4}}, energy_required = 3.2, enabled=false, }, @@ -65,9 +65,9 @@ data:extend({ { type = "recipe", name = "woodcoke", + result = "solid-fuel", category = "founding", - ingredients = {{type="item", name="coal", amount=3}, {type="item", name="wood", amount=2}}, - results = {{ type = "item", name = "solid-fuel", amount = 1 }}, + ingredients = {{"coal", 3}, {"wood", 2}}, energy_required = 3.2, enabled=false, icons = { diff --git a/prototypes/entity/electric-foundry.lua b/prototypes/entity/electric-foundry.lua new file mode 100644 index 0000000..e6b6570 --- /dev/null +++ b/prototypes/entity/electric-foundry.lua @@ -0,0 +1,162 @@ +require("util") +local futil = require("data-util") + +data:extend({ + { + type = "assembling-machine", + name = "electric-foundry", + fast_replaceable_group = "foundry", + icon = "__bzfoundry__/graphics/icons/foundry.png", + icon_size = 64, + flags = {"placeable-neutral", "placeable-player", "player-creation"}, + minable = {mining_time = 0.2, result = "electric-foundry"}, + max_health = 300, + corpse = "medium-small-remnants", + vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, + working_sound = + { + sound = { filename = "__base__/sound/electric-furnace.ogg" } + }, + resistances = + { + { + type = "fire", + percent = 100 + } + }, + collision_box = {{-1.7, -1.7}, {1.7, 1.7}}, + selection_box = {{-2, -2}, {2, 2}}, + crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil}, + energy_usage = "360kW", + drain = "12kW", + crafting_speed = 4, + energy_source = + { + type = "electric", + fuel_category = "chemical", + effectivity = 1, + emissions_per_minute = 2, + usage_priority = "secondary-input", + }, + module_specification = + { + module_slots = 3, + module_info_icon_shift = {0, 0.8} + }, + allowed_effects = {"consumption", "speed", "productivity", "pollution"}, + animation = + { + layers = + { + { + -- TODO make a non-hr version + filename = "__bzfoundry__/graphics/entity/hr-electric-foundry.png", + priority = "high", + width = 280, + height = 239, + frame_count = 1, + shift = util.by_pixel(8, 4), + scale = 0.5, + hr_version = + { + filename = "__bzfoundry__/graphics/entity/hr-electric-foundry.png", + priority = "high", + width = 280, + height = 239, + frame_count = 1, + shift = util.by_pixel(8, 4), + scale = 0.5, + } + }, + } + }, + working_visualisations = + { + { + north_position = {0.0, 0.0}, + east_position = {0.0, 0.0}, + south_position = {0.0, 0.0}, + west_position = {0.0, 0.0}, + animation = + { + filename = "__bzfoundry__/graphics/entity/hr-electric-foundry-animation.png", + priority = "extra-high", + animation_speed = 0.05, + line_length = 4, + width = 280, + height = 239, + frame_count = 4, + axially_symmetrical = false, + direction_count = 1, + shift = util.by_pixel(8, 4), + scale = 0.5, + hr_version = + { + filename = "__bzfoundry__/graphics/entity/hr-electric-foundry-animation.png", + priority = "extra-high", + animation_speed = 0.05, + line_length = 4, + width = 280, + height = 239, + frame_count = 4, + axially_symmetrical = false, + direction_count = 1, + shift = util.by_pixel(8, 4), + scale = 0.5, + } + }, + }, + { + fadeout = true, + draw_as_light = true, + effect = "flicker", + animation = + { + filename = "__bzfoundry__/graphics/entity/electric-foundry-glow.png", + priority = "extra-high", + width = 25, + height = 29, + frame_count = 1, + shift = util.by_pixel(0, 36), + } + }, + { + draw_as_light = true, + draw_as_sprite = false, + fadeout = true, + effect = "flicker", + animation = + { + filename = "__base__/graphics/entity/steel-furnace/steel-furnace-ground-light.png", + priority = "high", + line_length = 1, + draw_as_sprite = false, + width = 78, + height = 64, + frame_count = 1, + direction_count = 1, + shift = util.by_pixel(0, 72), + blend_mode = "additive", + hr_version = + { + filename = "__base__/graphics/entity/steel-furnace/hr-steel-furnace-ground-light.png", + priority = "high", + line_length = 1, + draw_as_sprite = false, + width = 152, + height = 126, + frame_count = 1, + direction_count = 1, + shift = util.by_pixel(1, 72), + blend_mode = "additive", + scale = 0.5, + } + }, + }, + }, + + }, + +}) + +futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding") diff --git a/prototypes/entity/foundry.lua b/prototypes/entity/foundry.lua new file mode 100644 index 0000000..54ddb32 --- /dev/null +++ b/prototypes/entity/foundry.lua @@ -0,0 +1,118 @@ +require("util") +local futil = require("data-util") + +local fuel = {"chemical"} +if mods.Krastorio2 then table.insert(fuel, "vehicle-fuel") end +if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end + +data:extend({ + { + type = "assembling-machine", + name = "foundry", + fast_replaceable_group = "foundry", + icon = "__bzfoundry__/graphics/icons/foundry.png", + icon_size = 64, + flags = {"placeable-neutral", "placeable-player", "player-creation"}, + minable = {mining_time = 0.2, result = "foundry"}, + max_health = 300, + corpse = "medium-small-remnants", + vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, + working_sound = + { + sound = { filename = "__base__/sound/furnace.ogg" } + }, + resistances = + { + { + type = "fire", + percent = 100 + } + }, + collision_box = {{-1.7, -1.7}, {1.7, 1.7}}, + selection_box = {{-2, -2}, {2, 2}}, + crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil}, + energy_usage = "180kW", + crafting_speed = 4, + energy_source = + { + type = "burner", + fuel_categories = fuel, + effectivity = 1, + emissions_per_minute = 8, + fuel_inventory_size = 1, + smoke = + { + { + name = "smoke", + frequency = 20, + position = {1, -1.7}, + starting_vertical_speed = 0.1, + starting_frame_deviation = 60 + } + } + }, + animation = + { + layers = + { + { + filename = "__bzfoundry__/graphics/entity/foundry.png", + priority = "high", + width = 140, + height = 120, + frame_count = 1, + shift = util.by_pixel(8, 4), + hr_version = + { + filename = "__bzfoundry__/graphics/entity/hr-foundry.png", + priority = "high", + width = 280, + height = 239, + frame_count = 1, + shift = util.by_pixel(8, 4), + scale = 0.5 + } + }, + } + }, + working_visualisations = + { + { + north_position = {0.0, 0.0}, + east_position = {0.0, 0.0}, + south_position = {0.0, 0.0}, + west_position = {0.0, 0.0}, + animation = + { + filename = "__base__/graphics/entity/stone-furnace/hr-stone-furnace-fire.png", + priority = "extra-high", + line_length = 8, + width = 41, + height = 100, + frame_count = 48, + axially_symmetrical = false, + direction_count = 1, + shift = util.by_pixel(-1, 9), + scale=1.1, + hr_version = + { + filename = "__base__/graphics/entity/stone-furnace/hr-stone-furnace-fire.png", + priority = "extra-high", + line_length = 8, + width = 41, + height = 100, + frame_count = 48, + axially_symmetrical = false, + direction_count = 1, + shift = util.by_pixel(-1, 9), + scale=1.1, + } + }, + } + }, + + }, + +}) + +futil.add_crafting_category("assembling-machine", "foundry", "basic-founding") diff --git a/bzfoundry2/prototypes/foundry.lua b/prototypes/foundry.lua similarity index 79% rename from bzfoundry2/prototypes/foundry.lua rename to prototypes/foundry.lua index 74ef89b..a5d3c06 100644 --- a/bzfoundry2/prototypes/foundry.lua +++ b/prototypes/foundry.lua @@ -1,13 +1,11 @@ local util = require("data-util") -local foundry_ingredients = {{type="item", name="stone-brick", amount=20}, {type="item", name="iron-plate", amount=10}, {type="item", name="copper-plate", amount=5}} -if mods.bzlead then table.insert(foundry_ingredients, {type="item", name="lead-plate", amount=8}) end -if mods.Krastorio2 then - table.insert(foundry_ingredients, {type="item", name="kr-sand", amount=10}) -elseif mods["aai-industry"] then - table.insert(foundry_ingredients, {type="item", name="sand", amount=10}) +local foundry_ingredients = {{"stone-brick", 20}, {"iron-plate", 10}, {"copper-plate", 5}} +if mods.bzlead then table.insert(foundry_ingredients, {"lead-plate", 8}) end +if mods.Krastorio2 or mods["aai-industry"] then + table.insert(foundry_ingredients, {"sand", 10}) elseif data.raw.item["silica"] and data.raw.technology["silica-processing"] then - table.insert(foundry_ingredients, {type="item", name="silica", amount=20}) + table.insert(foundry_ingredients, {"silica", 20}) end data:extend({ @@ -24,9 +22,9 @@ data:extend({ { type = "recipe", name = "foundry", + result = "foundry", enabled = false, ingredients = foundry_ingredients, - results = {{ type = "item", name = "foundry", amount = 1 }} }, { type = "technology", @@ -63,7 +61,7 @@ data:extend({ type = "item", name = "electric-foundry", icon = "__bzfoundry__/graphics/icons/electric-foundry.png", - icon_size = 64, + icon_size = 128, subgroup = "founding-machines", order = "z[foundryelectric]", place_result = "electric-foundry", @@ -78,16 +76,16 @@ data:extend({ }, type = "recipe", name = "electric-foundry", + result = "electric-foundry", enabled = false, ingredients = { - {type="item", name="foundry", amount=1}, - {type="item", name="steel-plate", amount=10}, - {type="item", name="processing-unit", amount=4}, - {type="item", name="concrete", amount=10}, - (data.raw.item["zirconia"] and {type="item", name="zirconia", amount=10} or {type="item", name="stone-brick", amount=10}), - (data.raw.item["tungsten-plate"] and {type="item", name="tungsten-plate", amount=5} or nil), + {"foundry", 1}, + {"steel-plate", 10}, + {"processing-unit", 4}, + {"concrete", 10}, + (data.raw.item["zirconia"] and {"zirconia", 10} or {"stone-brick", 10}), + (data.raw.item["tungsten-plate"] and {"tungsten-plate", 5} or nil), }, - results = {{ type = "item", name = "electric-foundry", amount = 1 }} }, { type = "technology", @@ -127,8 +125,8 @@ if util.me.founding_plates() then or (mods.bzzirconium and { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.5, shift={32, -32}}) - or (mods.bzaluminum2 and - { icon = "__bzaluminum2__/graphics/icons/alumina.png", + or (mods.bzaluminum and + { icon = "__bzaluminum__/graphics/icons/alumina.png", icon_size = 128, scale=0.5, shift={32, -32}}) or { icon = "__base__/graphics/icons/stone-brick.png", icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}} @@ -163,8 +161,8 @@ if util.me.founding_plates() then or (mods.bzzirconium and { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.5, shift={32, -32}}) - or (mods.bzaluminum2 and - { icon = "__bzaluminum2__/graphics/icons/alumina.png", + or (mods.bzaluminum and + { icon = "__bzaluminum__/graphics/icons/alumina.png", icon_size = 128, scale=0.5, shift={32, -32}}) or { icon = "__base__/graphics/icons/stone-brick.png", icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}} diff --git a/bzfoundry2/refractory-updates.lua b/refractory-updates.lua similarity index 59% rename from bzfoundry2/refractory-updates.lua rename to refractory-updates.lua index b053d8c..10c6eeb 100644 --- a/bzfoundry2/refractory-updates.lua +++ b/refractory-updates.lua @@ -1,8 +1,11 @@ local rusty_locale = require("__rusty-locale__.locale") local rusty_icons = require("__rusty-locale__.icons") +local rusty_recipes = require("__rusty-locale__.recipes") +local rusty_prototypes = require("__rusty-locale__.prototypes") local futil = require("util") local util = require("data-util") + function has_suffix(s, suffix) return string.sub(s, -string.len(suffix), -1) == suffix end @@ -20,34 +23,84 @@ function check_name(name) for i, suffix in pairs(suffixes) do if has_suffix(name, suffix) then return true end end - if name == "kr-rare-metals" then return true end + if name == "rare-metals" then return true end if name == "tungsten-carbide" then return true end return false end function make_recipe(recipe) local found_result = false + local has_normal = false + local has_exp = false + + local new_results = {} + local new_normal_results = {} + local new_exp_results = {} if recipe.results then -- standard recipes for i, result in pairs(recipe.results) do - if result.name and check_name(result.name) then - found_result = result.name + if (result.name and check_name(result.name)) or + (result[1] and check_name(result[1])) then + found_result = result.name and result.name or result[1] new_results = futil.table.deepcopy(recipe.results) break end end end + if recipe.result and check_name(recipe.result) then + found_result = recipe.result + new_results = {{recipe.result, recipe.result_count or 1}} + end + + if recipe.normal then + has_normal = true + if recipe.normal.results then + for i, result in pairs(recipe.normal.results) do + if (result.name and check_name(result.name)) or + (result[1] and check_name(result[1])) then + found_result = result.name and result.name or result[1] + new_normal_results = futil.table.deepcopy(recipe.normal.results) + break + end + end + end + + if recipe.normal.result and check_name(recipe.normal.result) then + found_result = recipe.normal.result + new_normal_results = {{recipe.normal.result, recipe.normal.result_count or 1}} + end + end + + if recipe.expensive then + has_exp = true + if recipe.expensive.results then + for i, result in pairs(recipe.expensive.results) do + if (result.name and check_name(result.name)) or + (result[1] and check_name(result[1])) then + found_result = result.name and result.name or result[1] + new_exp_results = futil.table.deepcopy(recipe.expensive.results) + break + end + end + end + + if recipe.expensive.result and check_name(recipe.expensive.result) then + found_result = recipe.expensive.result + new_exp_results = {{recipe.expensive.result, recipe.expensive.result_count or 1}} + end + end + if found_result then log("Attempting to make refractory recipe for " .. recipe.name) local r = futil.table.deepcopy(recipe) r.name = r.name .. "-refractory" - r.main_product = found_result - r.results = {} + r.result = nil + r.result_count = nil r.enabled = false r.category = recipe.category == "casting" and "casting" or "founding" - r.subgroup = data.raw.item[found_result] and data.raw.item[found_result].subgroup or "foundry-intermediate" + r.subgroup = data.raw.item[found_result].subgroup icons = rusty_icons.of(data.raw.recipe[recipe.name]) table.insert( icons, @@ -60,8 +113,8 @@ function make_recipe(recipe) or (mods.bzzirconium and { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.125, shift={8, -8}}) - or (mods.bzaluminum2 and - { icon = "__bzaluminum2__/graphics/icons/alumina.png", + or (mods.bzaluminum and + { icon = "__bzaluminum__/graphics/icons/alumina.png", icon_size = 128, scale=0.125, shift={8, -8}}) or { icon = "__base__/graphics/icons/stone-brick.png", icon_size = 64, scale=0.25, icon_mipmaps = 4, shift={8, -8}} @@ -69,9 +122,25 @@ function make_recipe(recipe) r.icons = icons locale = rusty_locale.of_recipe(data.raw.recipe[recipe.name]) r.localised_name = {"recipe-name.with-refractory", locale.name} - r.results = new_results - make_ingredients_and_products(r, r.name) - r.allow_productivity = true + + if not has_normal and not has_exp then + r.results = new_results + make_ingredients_and_products(r, r.name) + end + if has_normal then + r.normal.results = new_normal_results + r.normal.result = nil + r.normal.result_count = nil + r.normal.enabled = false + make_ingredients_and_products(r.normal, r.name) + end + if has_exp then + r.expensive.results = new_exp_results + r.expensive.result = nil + r.expensive.result_count = nil + r.expensive.enabled = false + make_ingredients_and_products(r.expensive, r.name) + end return r end return nil @@ -85,7 +154,7 @@ function get_refractories(recipe, name) if mods.bzcarbon then table.insert(refractories, "graphite") end if mods.bzsilicon then table.insert(refractories, "silica") end if #refractories < 2 and mods.bzzirconium and name ~= "zirconium-plate-refractory" then table.insert(refractories, "zirconia") end - if #refractories < 2 and mods.bzaluminum2 and name ~= "aluminum-plate-refractory" then table.insert(refractories, "alumina") end + if #refractories < 2 and mods.bzaluminum and name ~= "aluminum-plate-refractory" then table.insert(refractories, "alumina") end if #refractories < 2 then table.insert(refractories, "stone-brick") end return refractories end @@ -94,6 +163,9 @@ function make_ingredients_and_products(r, name) local refractories = get_refractories(r, name) local max_count = 1 for i, ingredient in pairs(r.ingredients) do + if ingredient[2] and ingredient[2] > max_count then + max_count = ingredient[2] + end if ingredient.amount and ingredient.amount > max_count then max_count = ingredient.amount end @@ -105,16 +177,20 @@ function make_ingredients_and_products(r, name) end for i, refractory in pairs(refractories) do for j, existing in pairs(r.ingredients) do - if existing.name == refractory then + if existing[1] == refractory or existing.name == refractory then log("Warning: "..name.." refractory recipe recipe unbalanced due to skipped ingredients") goto skip end end - table.insert(r.ingredients, {type = "item", name = refractory, amount = refractory_amount}) + table.insert(r.ingredients, {refractory, refractory_amount}) end ::skip:: for i, result in pairs(r.results) do + if result[1] and check_name(result[1]) then + result[2] = result[2]*2 + break + end if result.name and check_name(result.name) then if result.amount then result.amount = result.amount * 2 @@ -129,8 +205,8 @@ function make_ingredients_and_products(r, name) end end for i, refractory in pairs(refractories) do - table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, ignored_by_productivity=refractory_amount, - ignored_by_stats=refractory_amount, probability=get_probability(#refractories)}) + table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, catalyst_amount=refractory_amount, + probability=get_probability(#refractories)}) end end @@ -163,5 +239,16 @@ if util.me.founding_plates() then else util.add_effect("advanced-founding", {type="unlock-recipe", recipe=recipe.name}) end + + -- prod modules + for j, module in pairs(data.raw.module) do + if module.effect then + for effect_name, effect in pairs(module.effect) do + if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then + table.insert(module.limitation, recipe.name) + end + end + end + end end end diff --git a/bzfoundry2/settings-util.lua b/settings-util.lua similarity index 100% rename from bzfoundry2/settings-util.lua rename to settings-util.lua diff --git a/bzfoundry2/settings.lua b/settings.lua similarity index 84% rename from bzfoundry2/settings.lua rename to settings.lua index ee0bb8a..ac02318 100644 --- a/bzfoundry2/settings.lua +++ b/settings.lua @@ -11,8 +11,8 @@ data:extend({ type = "string-setting", name = "bzfoundry-hydrocarbon", setting_type = "startup", - allowed_values = {mods["Krastorio2"] and "kr-coke" or "coke", "solid-fuel", "coal", "none"}, - default_value = mods["Krastorio2"] and "kr-coke" or "coke", + allowed_values = {"coke", "solid-fuel", "coal", "none"}, + default_value = "coke", order = "aba", }, { @@ -42,7 +42,7 @@ data:extend({ name = "bzfoundry-minimal", setting_type = "startup", default_value = false, - hidden = not mods.bzaluminum2, + hidden = not mods.bzaluminum, order = "zza", }, }) diff --git a/sources/graphics/entity/foundry/foundry-main-1.afphoto b/sources/graphics/entity/foundry/foundry-main-1.afphoto deleted file mode 100644 index 4443bdf..0000000 Binary files a/sources/graphics/entity/foundry/foundry-main-1.afphoto and /dev/null differ diff --git a/sources/graphics/entity/foundry/foundry-main-2.afphoto b/sources/graphics/entity/foundry/foundry-main-2.afphoto deleted file mode 100644 index 373c24a..0000000 Binary files a/sources/graphics/entity/foundry/foundry-main-2.afphoto and /dev/null differ diff --git a/sources/graphics/entity/foundry/foundry-remnants.afphoto b/sources/graphics/entity/foundry/foundry-remnants.afphoto deleted file mode 100644 index 20ac4dd..0000000 Binary files a/sources/graphics/entity/foundry/foundry-remnants.afphoto and /dev/null differ diff --git a/sources/graphics/icons/foundry.afphoto b/sources/graphics/icons/foundry.afphoto deleted file mode 100644 index a42754a..0000000 Binary files a/sources/graphics/icons/foundry.afphoto and /dev/null differ diff --git a/sources/graphics/icons/technology/foundry.afphoto b/sources/graphics/icons/technology/foundry.afphoto deleted file mode 100644 index f0bf6ab..0000000 Binary files a/sources/graphics/icons/technology/foundry.afphoto and /dev/null differ diff --git a/bzfoundry2/thumbnail.png b/thumbnail.png similarity index 100% rename from bzfoundry2/thumbnail.png rename to thumbnail.png diff --git a/bzfoundry2/thumbnail.xcf b/thumbnail.xcf similarity index 100% rename from bzfoundry2/thumbnail.xcf rename to thumbnail.xcf