- First thing, is there an entity 'type', (example: { type = "assembling-machine", type = "boiler", type = "generator", }), that produces selected crafting products of either fluids or solids, that can generate electricity, while also consuming for example solid or fluid fuels or even electricity (requires electricity to generate electricity)? If not then ok.
- The idea is that we can have an entity 'type' that resembles exact parameters and mechanics of an 'assembling-machine', but additionally can have another string or array that you can define its electricity production of a 'generator'. I figured this would have to be seperate 'energy_source ='s so that consuming energy source doesn't interfere with the mechanics of generating energy source.
- Example of potential machine I wanted to make for modding but couldn't figure out or use other entity types, which would otherwise have me to do custom code just like, for example, Space Exploration's condensor turbine, a turbine taking in steam to generate electricity while also producing water as it "condenses'.
- The example (I use this machine idea because it utilizes multiple parts and mechanics from a entity type(s)):
I wanted to make a simple generator where it takes in "air" and some fuel (either solid or constant consumption fluid). The higher the temperature of air (which you can correlate to pressure psi) the more electricity it generates up to whatever max watts based off of 'steam-generator' or 'steam-turbine' (their max watts is based on steam temperature). The byproduct of this generator is exhaust gas, which you can guess can either be expelled to atmosphere as pollution through a "exhaust pipe machine" or into a compressor (turbo) which you would only need a simple 'assembling-machine' to take in exhaust gas and turn it into "air" again and produce pollution. - Technically, this aims to allow a player to build a factory with generators as individuals parts all working together rather than a single unit.
- Example of what the code might look like, but this can be inaccurate, the idea is there.
Code: Select all
{
{
type = "assembling-machine-generator", -- example string type
name = "six-piston-combustion-generator",
icon = "some-art.png",
icon_size = 64,
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 0.2, result = "six-piston-combustion-generator"},
max_health = 400,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
resistances =
{
{
type = "fire",
percent = 70
}
},
fluid_boxes = -- unrelating fluid boxes and pictures overlays;
{
{
production_type = "input",
pipe_picture = assembler3pipepictures(),
pipe_covers = pipecoverspictures(),
base_area = 10,
base_level = -1,
pipe_connections = {{ type="input", position = {0, -2} }},
secondary_draw_orders = { north = -1 }
},
{
production_type = "output",
pipe_picture = assembler3pipepictures(),
pipe_covers = pipecoverspictures(),
base_area = 10,
base_level = 1,
pipe_connections = {{ type="output", position = {0, 2} }},
secondary_draw_orders = { north = -1 }
},
off_when_no_fluid_recipe = true
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
fast_replaceable_group = "assembling-machine",
light_flicker =
{
minimum_light_size = 1,
light_intensity_to_size_coefficient = 0.2,
color = {1,0.6,0},
minimum_intensity = 0.05,
maximum_intensity = 0.2
},
smoke =
{
{
name = "light-smoke",
deviation = {0.1, 0.1},
position = {0.5, -1.5},
frequency = 9
}
},
animation =
{
layers =
{
{
filename = "some-art.png",
priority="high",
width = 107,
height = 113,
frame_count = 32,
line_length = 8,
shift = util.by_pixel(0, 2),
hr_version =
{
filename = "some-art.png",
priority="high",
width = 214,
height = 226,
frame_count = 32,
line_length = 8,
shift = util.by_pixel(0, 2),
scale = 0.5
}
},
{
filename = "some-art.png",
priority = "high",
width = 214,
height = 226,
repeat_count = 32,
shift = util.by_pixel(0, 2),
tint = {r = 1, g = 1, b = 1},
scale = 0.5
},
{
filename = "some-art.png",
priority="high",
width = 95,
height = 83,
frame_count = 1,
line_length = 1,
repeat_count = 32,
draw_as_shadow = true,
shift = util.by_pixel(8.5, 5.5),
hr_version =
{
filename = "some-art.png",
priority="high",
width = 190,
height = 165,
frame_count = 1,
line_length = 1,
repeat_count = 32,
draw_as_shadow = true,
shift = util.by_pixel(8.5, 5),
scale = 0.5
}
}
}
},
working_visualisations =
{
{
draw_as_glow = true,
fadeout = true,
animation =
{
filename = "some-art.png",
priority = "high",
width = 214/2,
height = 226/2,
frame_count = 1,
animation_speed = 1,
shift = util.by_pixel(0, 2),
draw_as_glow = true,
blend_mode = "additive",
hr_version = {
filename = "some-art.png",
priority = "high",
width = 214,
height = 226,
frame_count = 1,
animation_speed = 1,
shift = util.by_pixel(0, 2),
scale = 0.5,
draw_as_glow = true,
blend_mode = "additive",
}
}
},
--{
-- effect = "uranium-glow", -- changes alpha based on energy source light intensity
-- light = {intensity = 0.1, size = 18, shift = {0.0, 1}, color = {r = 1, g = 0.4, b = 0.1}}
--},
},
open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
working_sound =
{
sound =
{
{
filename = "__base__/sound/assembling-machine-t2-1.ogg",
volume = 0.45
}
},
audible_distance_modifier = 0.5,
fade_in_ticks = 4,
fade_out_ticks = 20
}, -- I have some comments (---) from my other assembling-machine, let me know if they are accurate and the ones I don't know
how they work (if u have a wiki, reply to me it). Regarding about 'energy_source', it would allow multiple different
types of sources, either consuming and/or generating;
crafting_speed = 50, --- Matches when maximum fuel (air) temp is reached;
fluid_usage_per_tick = 1, -- Here, outside of 'energy-source(s)', the 'assembling-machine-generator' uses fluid fuel
('petroleum-gas' for example), which I don't know if this interferes with the mechanics of the
'energy-source' "air", and with how it helps scale up with the machine's electricity production.
The fuel here doesn't scale anything, it just consistently consumes 1 fluid fuel per tick;
burns_fluid = true, -- Assuming that the machine recognized fluid fuel value to burn this fluid, and below it scales based on
the density;
scale_fluid_usage = true,
energy_sources = {
{
type = "fluid",
effectivity = 1, --- effeciency of fuel consumption to complete a product; example, if .5, then it takes 4000KJ instead of
2000KJ to do something;
emissions_per_minute = 0, --- fairly sure this scales, so it would be 1 at level 1 speed. No work needed here;
fluid_box =
{
base_area = 1,
height = 2,
base_level = -1,
pipe_connections =
{
{type = "input-output", position = { 2, 0}},
{type = "input-output", position = {-2, 0}}
},
pipe_covers = pipecoverspictures(),
pipe_picture = assembler3pipepictures(),
production_type = "input-output",
filter = "air"
},
burns_fluid = false, --- ! DK. Assumingly, this is so it recognizes fuel Joule value and correlates to fuel fluid usage
(scale_fluid_usage);
scale_fluid_usage = false, --- ! DK. Maybe has something to do with above 'burns_fluid' thing with fuel value;
fluid_usage_per_tick = (4/60), --- fluid consumption. Game tick is 60 per second;
maximum_temperature = 5000, --- air temp is output amount for like speed or power;
},
{
type = "electric",
usage_priority = "secondary-output"
}
},
energy_usage = "2000kW", --- controls how much it needs to output max speed (50), determines behavior of fuel temp to speed.
Lower air temp is relative to lower speed and lower energy_usage, but the higher temp it is,
the speed exponentially climbs to meet its max speed (50); mental VisGraph will look like
bottom-right 1/4-circle; Past a certain energy_usage point, it will start to VisGraph a
top-left 1/4-circle;
allowed_effects = {"consumption", "speed", "pollution"}
}
}
Overall, the goal is to have such a entity machine that can perform those mechanics so that modding would be easier for new and existing, no new code or additional entity or entities needs to be created just so they work as intended, which improves performs, and in general cooler ideas can sprout from this.
I know this might get complicated with how to code this for such entity to perform as intended. If this is something too much at all or too much at the moment (I can wait whatever amount of time it takes for this idea to be an actual thing), it's understandable. I also don't want you guys to slow down on the new updates, maybe this could be a after-all-the-high-intensity-and-bug-fixing-era activity later in the future.
Your efforts are appreciated.