INITIAL COMMIT

Some code from bob's for the gasification plant. Planning to remove it
This commit is contained in:
Peter 2019-03-07 00:57:42 +08:00
parent 3fa5d2b6bd
commit 22c3e93def
21 changed files with 472 additions and 1 deletions

View File

@ -0,0 +1,7 @@
--prototype crap
require("prototypes.entities")
require("prototypes.items")
require("prototypes.fluids")
require("prototypes.automatic_recipes")
require("prototypes.entity_overrides")
--require("prototypes.technologies")

View File

@ -0,0 +1,42 @@
--table of common metric prefixes
metric_suffix = {
--above 1 --name
E = 10^18, --exa
P = 10^15, --peta
T = 10^12, --tera
G = 10^9, --giga
M = 10^6, --mega
k = 10^3, --kilo
h = 10^2, --hecto
da = 10^1, --deca
--below 1
d = 10^-1, --deci
c = 10^-2, --centi
m = 10^-3 --mili
}
function string_to_num(str)
num = ""
for i = 1, #str do
local a = str:sub(i,i)
if tonumber(a) ~= nil then
num = num .. a
elseif tonumber(a) == nil and metric_suffix[a] ~= nil then
suffix = a
end
end
if suffix ~= nil then
return tonumber(num) * metric_suffix[suffix]
else
return tonumber(num)
end
end
--print(string_to_num("5G43j")) --debug crap
--Takes a list and recognises the existence of the elements in the list,
--allowing it to be used in statements
function Set (list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

View File

@ -0,0 +1,10 @@
{
"name": "Liquid_Fueled",
"version": "0.1.0",
"factorio_version": "0.17",
"title": "Liquid Fueled",
"author": "npc_strider(morley376)",
"contact": "",
"homepage": "http://steamcommunity.com/id/morley376",
"description": "Template Description"
}

View File

@ -0,0 +1,55 @@
require("functions")
fuel_blacklist = Set {
"fuel-gas",
"nuclear-fuel",
"rocket-fuel",
"solid-fuel"
}
--hidden category
data:extend(
{{
type = "recipe-category",
name = "gasification-recipes"
}})
for _, item in pairs(data.raw.item) do
if item.fuel_value ~= nil and item.fuel_category == "chemical" and fuel_blacklist[item.name] == nil then
local fuel_value = string_to_num(item.fuel_value)
local output_amount = math.ceil(fuel_value/10000)
local water_amount = math.ceil(fuel_value/100000)
--local energy = (output_amount^1.5)/(output_amount^1.1)
local energy = 0.25
--[[
Coal example:
4MJ = 4,000,000J
4,000,000/10,000 = 400 fuel-gas
400*0.01MJ = 4MJ
Fuel-Gas == Coal
]]
local recipe = {
type = "recipe",
name = "gasification-of-" .. item.name,
category = "gasification-recipes",
energy_required = energy,
enabled = true, --change this to false on release
ingredients =
{
{type="fluid", name="water", amount=water_amount},
{type="item", name=item.name, amount=1}
},
results=
{
{type="fluid", name="fuel-gas", amount=output_amount, temperature = 25}
},
crafting_machine_tint =
{
primary = {r = 0.498, g = 0.498, b = 0.498, a = 0.000}, -- #7f7f7f00
secondary = {r = 0.400, g = 0.400, b = 0.400, a = 0.000}, -- #66666600
tertiary = {r = 0.305, g = 0.305, b = 0.305, a = 0.000}, -- #4d4d4d00
}
}
data:extend({recipe})
end
end

View File

@ -0,0 +1,249 @@
mod_scale = 2/3
data:extend(
{
{
type = "assembling-machine",
name = "gasification-plant",
icon = "__base__/graphics/icons/chemical-plant.png",
icon_size = 32,
flags = {"placeable-neutral","placeable-player", "player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "gasification-plant"},
max_health = 300,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
collision_box = {{-0.8, -0.8}, {0.8, 0.8}},
selection_box = {{-0.9, -0.9}, {0.9, 0.9}},
--[[module_specification =
{
module_slots = 3
},
allowed_effects = {"consumption", "speed", "productivity", "pollution"},]]
animation = make_4way_animation_from_spritesheet({ layers =
{
{
filename = "__base__/graphics/entity/chemical-plant/chemical-plant.png",
width = 122,
height = 134,
frame_count = 1,
shift = util.by_pixel(-5, -4.5),
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-chemical-plant.png",
width = 244,
height = 268,
frame_count = 1,
shift = util.by_pixel(-5, -4.5),
scale = 0.5 * mod_scale
}
},
{
filename = "__base__/graphics/entity/chemical-plant/chemical-plant-shadow.png",
width = 175,
height = 110,
frame_count = 1,
shift = util.by_pixel(31.5, 11),
scale = mod_scale,
draw_as_shadow = true,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-chemical-plant-shadow.png",
width = 350,
height = 219,
frame_count = 1,
shift = util.by_pixel(31.5, 10.75),
draw_as_shadow = true,
scale = 0.5 * mod_scale
}
},
}}),
working_visualisations =
{
{
north_position = util.by_pixel(30, -24),
west_position = util.by_pixel(1, -49.5),
south_position = util.by_pixel(-30, -48),
east_position = util.by_pixel(-11, -1),
apply_recipe_tint = "primary",
animation =
{
filename = "__base__/graphics/entity/chemical-plant/boiling-green-patch.png",
frame_count = 32,
width = 15,
height = 10,
animation_speed = 0.5,
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-boiling-green-patch.png",
frame_count = 32,
width = 30,
height = 20,
animation_speed = 0.5,
scale = 0.5 * mod_scale
}
}
},
{
north_position = util.by_pixel(30, -24),
west_position = util.by_pixel(1, -49.5),
south_position = util.by_pixel(-30, -48),
east_position = util.by_pixel(-11, -1),
apply_recipe_tint = "secondary",
animation =
{
filename = "__base__/graphics/entity/chemical-plant/boiling-green-patch-mask.png",
frame_count = 32,
width = 15,
height = 10,
animation_speed = 0.5,
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-boiling-green-patch-mask.png",
frame_count = 32,
width = 30,
height = 20,
animation_speed = 0.5,
scale = 0.5 * mod_scale
}
}
},
{
apply_recipe_tint = "tertiary",
north_position = {0, 0},
west_position = {0, 0},
south_position = {0, 0},
east_position = {0, 0},
north_animation =
{
filename = "__base__/graphics/entity/chemical-plant/boiling-window-green-patch.png",
frame_count = 1,
width = 87,
height = 60,
shift = util.by_pixel(0, -5),
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-boiling-window-green-patch.png",
x = 0,
frame_count = 1,
width = 174,
height = 119,
shift = util.by_pixel(0, -5.25),
scale = 0.5 * mod_scale
}
},
east_animation =
{
filename = "__base__/graphics/entity/chemical-plant/boiling-window-green-patch.png",
x = 87,
frame_count = 1,
width = 87,
height = 60,
shift = util.by_pixel(0, -5),
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-boiling-window-green-patch.png",
x = 174,
frame_count = 1,
width = 174,
height = 119,
shift = util.by_pixel(0, -5.25),
scale = 0.5 * mod_scale
}
},
south_animation =
{
filename = "__base__/graphics/entity/chemical-plant/boiling-window-green-patch.png",
x = 174,
frame_count = 1,
width = 87,
height = 60,
shift = util.by_pixel(0, -5),
scale = mod_scale,
hr_version = {
filename = "__base__/graphics/entity/chemical-plant/hr-boiling-window-green-patch.png",
x = 348,
frame_count = 1,
width = 174,
height = 119,
shift = util.by_pixel(0, -5.25),
scale = 0.5 * mod_scale
}
}
}
},
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
{
filename = "__base__/sound/boiler.ogg",
volume = 0.8
}
},
idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
apparent_volume = 1.5,
},
crafting_speed = 1.25,
energy_source =
{
type = "burner",
fuel_category = "chemical",
effectivity = 0.9,
emissions = 0.03 / 3.5,
fuel_inventory_size = 1,
--[[smoke =
{
{
name = "smoke",
frequency = 10,
position = {0.7, -1.2},
starting_vertical_speed = 0.08,
starting_frame_deviation = 60
}
}]]
},
--[[energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0.03 / 3.5
},]]
energy_usage = "210kW",
ingredient_count = 4,
crafting_categories = {"gasification-recipes"},
fluid_boxes =
{
{
production_type = "input",
pipe_covers = pipecoverspictures(),
base_area = 10,
base_level = -1,
pipe_connections = {{ type="input", position = {-0.5, -1.5} }}
},
--[[
{
production_type = "input",
pipe_covers = pipecoverspictures(),
base_area = 10,
base_level = -1,
pipe_connections = {{ type="input", position = {1, -2} }}
},]]
{
production_type = "output",
pipe_covers = pipecoverspictures(),
base_level = 1,
pipe_connections = {{ position = {-0.5, 1.5} }}
}
--[[
{
production_type = "output",
pipe_covers = pipecoverspictures(),
base_level = 1,
pipe_connections = {{ position = {1, 2} }}
}]]
}
}
}
)

View File

@ -0,0 +1,51 @@
local entities = {
{type="furnace", name="steel-furnace"},
{type="assembling-machine", name="assembling-machine-1"},
{type="assembling-machine", name="assembling-machine-2"},
}
for _, entities in pairs(entities) do
local entity = util.table.deepcopy(data.raw[entities.type][entities.name])
local smoke = entity.energy_source.smoke
local item = util.table.deepcopy(data.raw["item"][entities.name])
item.name = "liquid-" .. entity.name
item.place_result = "liquid-" .. entity.name
data:extend({item})
entity.name = "liquid-" .. entity.name
entity.minable.result = entity.name
entity.energy_source = {
type = "fluid",
fuel_category = "basic-fuel",
effectivity = 1,
emissions = 0.02,
fuel_inventory_size = 1,
maximum_temperature = 40.0,
scale_fluid_usage = true,
smoke = smoke,
fluid_box =
{
production_type = "input",
pipe_picture = assembler2pipepictures(),
pipe_covers = pipecoverspictures(),
base_area = 5,
base_level = -1,
filter = "fuel-gas",
pipe_connections = {{ type="input", position = {-0.5, -1.5}}}
}
}
if entity.fluid_boxes == nil then
entity.fluid_boxes = {}
end
entity.fluid_boxes[#entity.fluid_boxes+1] =
{
production_type = "output",
-- pipe_covers = pipecoverspictures(), --TODO: ADD NULL PIPE COVER PICTURES
base_area = 10^-5,
base_level = 0,
-- filter = "water", --TODO: ADD NULL FILTER WITH NULL IMAGE. try the filter = "none" first
pipe_connections = {{ type="output", position = {0, entity.selection_box[2][2]}}}
}
entity.fluid_boxes.off_when_no_fluid_recipe = false
data:extend({entity})
end

View File

@ -0,0 +1,26 @@
data:extend(
{
{
type = "fuel-category",
name = "basic-fuel"
},
{
type = "fluid",
name = "fuel-gas",
default_temperature = 24,
base_color = {r=0, g=0, b=0},
flow_color = {r=0.5, g=0.5, b=0.5},
max_temperature = 1000,
icon = "__base__/graphics/icons/fluid/crude-oil.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
heat_capacity = "0.01MJ",
fuel_value = "0.01MJ",
fuel_category = "basic-fuel",
order = "a[fluid]-b[crude-oil]"
}
}
)

View File

@ -0,0 +1,24 @@
data:extend(
{
{
type = "item",
name = "gasification-plant",
icon = "__base__/graphics/icons/chemical-plant.png",
icon_size = 32,
subgroup = "production-machine",
order = "e[gasification-plant]",
place_result = "gasification-plant",
stack_size = 50
},
{
type = "item",
name = "liquid-steel-furnace",
icon = "__base__/graphics/icons/steel-furnace.png",
icon_size = 32,
subgroup = "smelting-machine",
order = "b[liquid-steel-furnace]",
place_result = "liquid-steel-furnace",
stack_size = 50
},
}
)

View File

@ -0,0 +1,6 @@
data:extend(
{
{
}
}
)

View File

@ -1,2 +1,3 @@
# Factorio-Dieselpunk
Test mod test mod
Mod aims to remove power from the game and replace it with fuel-powered machines and inserters, which should pose a hard logistical challenge for seasoned players.
Reskins of electronic components planned as well.