mirror of
https://asciireactor.com/factorio/adamo-chemical.git
synced 2024-11-21 13:15:07 +00:00
Added a place-holder informatron control script.
This commit is contained in:
parent
7c9fcbc6d4
commit
bd87efb05e
@ -1,3 +1,11 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.3.1
|
||||
Date: 2020-11-15
|
||||
|
||||
Recipes:
|
||||
- Further-tweaked some flow rates.
|
||||
- Added informatron interface with place-holder text.
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.3.0
|
||||
Date: 2020-09-29
|
||||
|
203
control.lua
Normal file
203
control.lua
Normal file
@ -0,0 +1,203 @@
|
||||
remote.add_interface("adamo-chemical", {
|
||||
informatron_menu = function(data)
|
||||
return mymod_menu(data.player_index)
|
||||
end,
|
||||
informatron_page_content = function(data)
|
||||
return mymod_page_content(data.page_name, data.player_index, data.element)
|
||||
end
|
||||
})
|
||||
|
||||
--[[
|
||||
If you implement the informatron_menu interface at all then you will have a page in Informatron even if you don't add additional sub-pages to the menu.
|
||||
The deafult page has a menu caption of adamo-chemical.menu_adamo-chemical and a page title of adamo-chemical.title_adamo-chemical.
|
||||
If you also add text to the page with the caption "adamo-chemical.page_adamo-chemical_text_1" then your mod should add the following to your local .cfg file:
|
||||
[adamo-chemical]
|
||||
menu_adamo-chemical=My Mod Name
|
||||
title_adamo-chemical=My Mod Name
|
||||
page_adamo-chemical_text_1=My descriptive text
|
||||
]]--
|
||||
|
||||
function mymod_menu(player_index)
|
||||
return {
|
||||
minerals=1,
|
||||
smelting=1,
|
||||
processes=1
|
||||
}
|
||||
end
|
||||
--[[
|
||||
For the above menu items you should add to your local .cfg file (under [adamo-chemical]):
|
||||
menu_minerals=minerals
|
||||
title_minerals=minerals
|
||||
page_minerals_text_1=Text about mineralss.
|
||||
menu_smelting=smelting
|
||||
title_smelting=smelting
|
||||
page_smelting_text_1=Text about smeltings.
|
||||
menu_processes=processes
|
||||
title_processes=processes
|
||||
page_processes_text_1=Text about processes.
|
||||
menu_penguin=Pengiun
|
||||
title_penguin=Pengiun
|
||||
page_penguin_text_1=Text about pengiuns.
|
||||
etc...
|
||||
]]
|
||||
|
||||
function mymod_page_content(page_name, player_index, element)
|
||||
-- main page
|
||||
|
||||
if page_name == "adamo-chemical" then
|
||||
element.add {
|
||||
type="label",
|
||||
name="text_1",
|
||||
caption={"adamo-chemical.page_adamo-chemical_text_1"}
|
||||
}
|
||||
-- Says dude's name in __1__
|
||||
--element.add{
|
||||
-- type="label",
|
||||
-- name="text_1",
|
||||
-- caption={
|
||||
-- "adamo-chemical.page_text_1",
|
||||
-- player.name or {"informatron.player_name", player_index}
|
||||
-- },
|
||||
-- style="heading_1_label"
|
||||
--}
|
||||
--local image_container = element.add{
|
||||
-- type="frame",
|
||||
-- name="image_1",
|
||||
-- style="informatron_image_container",
|
||||
-- direction="vertical"
|
||||
--}
|
||||
--image_container.style.horizontally_stretchable = true
|
||||
--image_container.style.horizontal_align = "center"
|
||||
--image_container.add{
|
||||
-- type="button",
|
||||
-- name="image_1",
|
||||
-- style="adamo-chemical-image",
|
||||
-- caption=
|
||||
--} -- image is the background
|
||||
element.add{
|
||||
type="button",
|
||||
name="image_1",
|
||||
style="adamo-chemical-image"
|
||||
}
|
||||
|
||||
element.add{
|
||||
type="label",
|
||||
name="text_3",
|
||||
caption={"adamo-chemical.page_adamo-chemical_text_3"}
|
||||
}
|
||||
|
||||
-- if #Informatron.get_menu_pane(player_index).children == 1 then
|
||||
-- local conditional = element.add{
|
||||
-- type="label",
|
||||
-- name="text_3_c",
|
||||
-- caption={"adamo-chemical.page_adamo-chemical_text_3_conditional"}
|
||||
-- }
|
||||
-- conditional.style.font_color = {255/255,230/255,192/255}
|
||||
-- end
|
||||
|
||||
element.add{
|
||||
type="label",
|
||||
name="text_4",
|
||||
caption={"adamo-chemical.page_adamo-chemical_text_4"}, style="heading_1_label"
|
||||
}
|
||||
element.add{
|
||||
type="label",
|
||||
name="text_5",
|
||||
caption={"adamo-chemical.page_adamo-chemical_text_5"}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
if page_name == "minerals" then
|
||||
element.add {
|
||||
type="label",
|
||||
name="text_1",
|
||||
caption={"adamo-chemical.page_minerals_text_1"}
|
||||
}
|
||||
end
|
||||
|
||||
if page_name == "smelting" then
|
||||
element.add {
|
||||
type="label",
|
||||
name="text_1",
|
||||
caption={"adamo-chemical.page_smelting_text_1"}
|
||||
}
|
||||
end
|
||||
|
||||
if page_name == "processes" then
|
||||
element.add {
|
||||
type="label",
|
||||
name="text_1",
|
||||
caption={"adamo-chemical.page_processes_text_1"}
|
||||
}
|
||||
--[[
|
||||
To make an image you need to require the Informatron mod (so it loads first) then have some code like this in data.lua
|
||||
informatron_make_image("mymod_penguin_image_1", "__adamo-chemical__/graphics/informatron/pengiun.png", 200, 200)
|
||||
"mymod_penguin_image_1" must be unique per image.
|
||||
"__adamo-chemical__/graphics/informatron/page_1_image.png" is the path to your image.
|
||||
200, 200 is the width, height of the image
|
||||
]]--
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- if page_name == "editor" then
|
||||
-- element.add{type="label", name="text_1", caption={"informatron.page_editor_text_1"}}
|
||||
-- end
|
||||
--
|
||||
-- if page_name == "console" then
|
||||
-- element.add{type="label", name="text_1", caption={"informatron.page_console_text_1"}}
|
||||
-- element.add{type="label", name="text_2", caption={"informatron.page_console_text_2"}, style="heading_1_label"}
|
||||
-- element.add{type="label", name="text_3", caption={"informatron.page_console_text_3"}}
|
||||
-- element.add{type="label", name="text_4", caption={"informatron.page_console_text_4"}, style="heading_1_label"}
|
||||
--
|
||||
-- element.add{type="label", name="text_scripting_intro", caption={"informatron.page_console_text_scripting_intro"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_editor", text="/editor"}
|
||||
--
|
||||
-- element.add{type="label", name="label_editor", caption={"informatron.page_console_text_command_editor"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_indestructible", text="/c game.player.character.destructible=false"}
|
||||
-- element.add{type="label", name="label_indestructible", caption={"informatron.page_console_text_command_indestructible"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_cheat", text="/c game.player.cheat_mode=true"}
|
||||
-- element.add{type="label", name="label_cheat", caption={"informatron.page_console_text_command_cheat"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_item", text="/c game.player.insert{name=\"infinity-chest\",count=1}"}
|
||||
-- element.add{type="label", name="label_item", caption={"informatron.page_console_text_command_item"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_teleport", text="/c game.player.teleport({0,0})"}
|
||||
-- element.add{type="label", name="label_teleport", caption={"informatron.page_console_text_command_teleport"}}
|
||||
--
|
||||
-- local code_chart = element.add{type="text-box", name="code_chart", text="/c local radius=300 game.player.force.chart(game.player.surface, {{game.player.position.x-radius, game.player.position.y-radius}, {game.player.position.x+radius, game.player.position.y+radius}})"}
|
||||
-- code_chart.word_wrap = true
|
||||
-- code_chart.style.height = 50
|
||||
-- element.add{type="label", name="label_chart", caption={"informatron.page_console_text_command_chart"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_speed", text="/c game.speed=10"}
|
||||
-- element.add{type="label", name="label_speed", caption={"informatron.page_console_text_command_speed"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_set_evolution", text="/c game.forces[\"enemy\"].evolution_factor=0.5"}
|
||||
-- element.add{type="label", name="label_set_evolution", caption={"informatron.page_console_text_command_set_evolution"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_recipes", text="/c for name, recipe in pairs(game.player.force.recipes) do recipe.enabled = true end"}
|
||||
-- element.add{type="label", name="label_recipes", caption={"informatron.page_console_text_command_recipes"}}
|
||||
--
|
||||
-- element.add{type="text-box", name="code_research", text="/c game.player.force.research_all_technologies()"}
|
||||
-- element.add{type="label", name="label_research", caption={"informatron.page_console_text_command_research"}}
|
||||
--
|
||||
-- element.add{type="label", name="text_scripting_outro", caption={"informatron.page_console_text_scripting_outro"}}
|
||||
--
|
||||
-- for _, child in pairs(element.children) do
|
||||
-- if child.type == "text-box" then
|
||||
-- child.read_only = true
|
||||
-- child.style.horizontally_stretchable = true
|
||||
-- child.style.vertically_stretchable = true
|
||||
-- child.style.top_margin = 15
|
||||
-- end
|
||||
-- end
|
@ -244,9 +244,6 @@ local calcinate_recipe = function(recipe,mult)
|
||||
if not recipe then return nil end
|
||||
if type(mult) ~= "number"
|
||||
or mult <= 0 then mult = ore_mult end
|
||||
local count_minerals = function(ore_count)
|
||||
return math.ceil(ore_count * adamo.geo.ore.impurity_ratio)
|
||||
end
|
||||
local flux_recipe = util.table.deepcopy(recipe)
|
||||
flux_recipe.name = flux_recipe.name.."-calcined"
|
||||
mult_recipe_energy(flux_recipe,time_mult/ore_mult*mult)
|
||||
@ -261,13 +258,14 @@ local calcinate_recipe = function(recipe,mult)
|
||||
local x,this_ore_count,x =
|
||||
get_ingredient(flux_recipe,ore)
|
||||
ore_count = ore_count + (this_ore_count or 0)
|
||||
if this_ore_count > 0 then
|
||||
add_ingredient(
|
||||
flux_recipe,
|
||||
ore,
|
||||
ore_count/ore_mult
|
||||
)
|
||||
end
|
||||
-- Adds extra ore to account for impurities.
|
||||
--if this_ore_count > 0 then
|
||||
-- add_ingredient(
|
||||
-- flux_recipe,
|
||||
-- ore,
|
||||
-- ore_count/ore_mult
|
||||
-- )
|
||||
--end
|
||||
end
|
||||
if ore_count == 0 then
|
||||
if uses_ingredient(flux_recipe,"stone") then
|
||||
|
@ -5,7 +5,8 @@
|
||||
"author": "adamo",
|
||||
"dependencies": [
|
||||
"base",
|
||||
"SimpleSilicon"
|
||||
"SimpleSilicon",
|
||||
"informatron"
|
||||
],
|
||||
"description": "Chemical reverse engineering.",
|
||||
"factorio_version": "1.0"
|
||||
|
@ -46,4 +46,17 @@ sulfur=Sulfur
|
||||
|
||||
[adamo-chemical]
|
||||
title_adamo-chemical=Adamo Chemical
|
||||
page_adamo-chemical_text_1=Adamo chemical provides alternatve production chains for most chemical recipes made available by the vanilla game and your installed mods. Separate stone to access reatants for these processes. Smelt plates in blast furnaces for more reactants.
|
||||
title_minerals=Minerals
|
||||
title_smelting=Smelting
|
||||
title_processes=Processes
|
||||
menu_adamo-chemical=Adamo Chemical
|
||||
menu_minerals=Minerals
|
||||
menu_smelting=Smelting
|
||||
menu_processes=Processes
|
||||
page_adamo-chemical_text_1=Adamo chemical provides alternatve production chains for most chemical recipes made available by the vanilla game and your installed mods. Separate stone to gather minerals for these processes. Smelt plates in blast furnaces for more reactants.
|
||||
page_adamo-chemical_text_3=
|
||||
page_adamo-chemical_text_4=
|
||||
page_adamo-chemical_text_5=
|
||||
page_minerals_text_1=Gathered from processing stone and smelting ore.
|
||||
page_smelting_text_1=Efficient way to smelt plates while gathering minerals.
|
||||
page_processes_text_1=Recipes found in the game are split up into various process classes that can be produced using the chemical plants provided in this mod. Classes: manufacturing, vaporworks, disassociation, recovery, activation, deposition, and mixing.
|
Loading…
Reference in New Issue
Block a user