Diesel generator


Diesel generator

Content
4 months ago
2.0 - 2.1
914

g does not reflect the essence

12 days ago

Тема не моя. Результат разговоров с ИИ.
Что было изменено в соответствии с API Factorio 2.1

• Свойство pictures: В Factorio 2.1 официальная документация GeneratorPrototype заменила horizontal_animation / vertical_animation на структуру pictures с четырьмя направлениями (north, east, south, west), в каждом из которых передается animation.
• Расположение smoke: Массив дыма возвращен на корневой уровень прототипа.
Вставьте этот код, сохраните файл и перезапустите игру — спрайты генератора появятся во всех четырех поворотах. prototypes/entity.lua local vertical_anim = {
layers = {
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-vertical-base.png",
width = 256, height = 448, frame_count = 1, repeat_count = 8, animation_speed = 0.5, scale = 0.5,
},
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-vertical-base-shadow.png",
width = 256, height = 448, frame_count = 1, repeat_count = 8,
shift = util.by_pixel(25, 0), animation_speed = 0.5, scale = 0.5, draw_as_shadow = true,
},
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-vertical-anim.png",
width = 256, height = 448, frame_count = 8, line_length = 4, animation_speed = 0.5, scale = 0.5, draw_as_glow = true
},
},
}

local horizontal_anim = {
layers = {
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-horizontal-base.png",
width = 548, height = 256, frame_count = 1, repeat_count = 14,
shift = util.by_pixel(0, -13), animation_speed = 0.5, scale = 0.5,
},
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-horizontal-base-shadow.png",
width = 548, height = 256, frame_count = 1, repeat_count = 14,
shift = {0.5, -0.4}, animation_speed = 0.5, scale = 0.5, draw_as_shadow = true,
},
{
filename = "KS12/graphics/entity/petroleum-generator/hr-petroleum-generator-horizontal-anim.png",
width = 448, height = 256, frame_count = 8, line_length = 4,
shift = util.by_pixel(0, -13), animation_speed = 0.5, scale = 0.5,
run_mode = "forward-then-backward", draw_as_glow = true,
},
}
}

data:extend({
{
type = "generator",
name = "petroleum-generator",
icon = "KS12/graphics/icons/diesel-fuel-icon.png",
icon_size = 64,
flags = {"placeable-neutral", "player-creation"},
minable = {mining_time = 2, result = "petroleum-generator"},
max_power_output = "1MW",
max_health = 1000,
corpse = "big-remnants",
effectivity = 1,
fluid_usage_per_tick = 2 / 60,
burns_fluid = true,
scale_fluid_usage = true,
maximum_temperature = 1000,
resistances = {
{ type = "fire", percent = 70 }
},
collision_box = {{-0.7, -2.7}, {0.7, 2.7}},
selection_box = {{-1, -3}, {1, 3}},
fluid_box = {
volume = 100,
pipe_covers = pipecoverspictures(),
production_type = "input-output",
pipe_connections = {
{position = {-0.5, -2.5}, flow_direction = "input-output", direction = defines.direction.north},
{position = {0.5, -2.5}, flow_direction = "input-output", direction = defines.direction.north},
{position = {-0.5, 2.5}, flow_direction = "input-output", direction = defines.direction.south},
{position = {0.5, 2.5}, flow_direction = "input-output", direction = defines.direction.south},
{position = {-0.5, 0.5}, flow_direction = "input-output", direction = defines.direction.west},
{position = {-0.5, -0.5}, flow_direction = "input-output", direction = defines.direction.west},
{position = {0.5, 0.5}, flow_direction = "input-output", direction = defines.direction.east},
{position = {0.5, -0.5}, flow_direction = "input-output", direction = defines.direction.east}
},
},
energy_source = {
type = "electric",
usage_priority = "secondary-output",
emissions_per_minute = {pollution = 50},
},
vehicle_impact_sound = {filename = "base/sound/car-metal-impact.ogg", volume = 0.65},
pictures = {
north = { animation = vertical_anim },
south = { animation = vertical_anim },
east = { animation = horizontal_anim },
west = { animation = horizontal_anim },
},
smoke = {
{
name = "tank-smoke", north_position = util.by_pixel(-14.5, -27), south_position = util.by_pixel(-14.5, -27),
east_position = util.by_pixel(-46, -66), west_position = util.by_pixel(-46, -66),
frequency = 10 / 32, starting_vertical_speed = 0.06, starting_vertical_speed_deviation = 0.1,
slow_down_factor = 1, starting_frame_deviation = 60, starting_frame = 5,
},
{
name = "tank-smoke", north_position = util.by_pixel(14.5, -27), south_position = util.by_pixel(14.5, -27),
east_position = util.by_pixel(-46, -82), west_position = util.by_pixel(-46, -82),
frequency = 10 / 32, starting_vertical_speed = 0.06, starting_vertical_speed_deviation = 0.1,
slow_down_factor = 1, starting_frame_deviation = 10, starting_frame = 5,
starting_frame_speed = 1, starting_frame_speed_deviation = 0.5
}
},
working_sound = {
sound = {
{ filename = "KS12/sounds/diesel-loop-1.ogg", volume = 0.5 },
{ filename = "KS12/sounds/diesel-loop-2.ogg", volume = 0.5 },
{ filename = "KS12/sounds/diesel-loop-3.ogg", volume = 0.5 }
},
match_speed_to_activity = true, max_sounds_per_type = 2
},
min_perceived_performance = 0.4,
performance_to_sound_speedup = 0.2
},
})

12 days ago

Please accept my apologies if this post happens to offend anyone. I don’t write code, and I don’t know English. I like this fork, and I simply wanted to share something good. There are no obligations involved.

New response