Add Lava Furnace crafting guide; update README

This commit is contained in:
Zenon Seth 2023-11-14 11:27:55 +00:00
parent 37dcc552f3
commit 3084599300
14 changed files with 177 additions and 12 deletions

View File

@ -1,5 +1,4 @@
# Logistica
# WORK IN PROGRESS - PRE-ALPHA STATE
Logistica is an item transport, distribution and storage mod.
@ -7,10 +6,30 @@ The core principle behind this mod is that item transportation is demand-driven:
# Machines
All machines can connect to a network and can perform extra useful tasks when connected to an active network
All machines, except the Lava Furnace can connect to a network and can perform extra useful tasks when connected to an active network
Machines that have inputs or outputs can be sneak + punched to show their i/o.
# Getting Started
## Lava Furnace
The Lava Furnace is a lava-powered furnace that can cook regular items at an increased speed, but more importantly, can make Logistica specific items. The Lava Furnace has a built-in recipe guide about the Logistica-specific items it can make.
It is crafted in the regular crafting grid like this:
```
[Clay Block ] [Obsidian Brick] [Clay Block ]
[Steel Ingot] [ Empty Bucket ] [Steel Ingot]
[Steel Ingot] [ Empty Bucket ] [Steel Ingot]
```
The most useful item it can make, and the material required for all other machines is the `Silverin Crystal`
## Silverin Crystal
A crystal made from melting Silver Sand in the Lava Furnace and then rapidly cooling it with Ice (see Lava Furance in-game recipe guide). Silverin Crystals are the backbone of all Logistica machines due to their useful photonic properties.
Silverin Crystals can be broken into 8 `Silverin Slice`s by simply putting them on the crafting grid. The slices are used as basis for many other materials, many made in the Lava Furnace, which are then used to build the rest of the machines.
# Creating a Network
## Controller

View File

@ -50,6 +50,12 @@ end
minetest.register_on_player_receive_fields(on_controller_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
controllerForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -108,6 +108,12 @@ end
minetest.register_on_player_receive_fields(on_player_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
injectorForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -94,6 +94,12 @@ end
minetest.register_on_player_receive_fields(on_player_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
itemStorageForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -16,6 +16,8 @@ local INV_INPT = "src"
local INV_OUTP = "dst"
local INV_ADDI = "input"
local GUIDE_BTN = "guide"
local UPDATE_INTERVAL = 1.0
-- returns the lava cap in milibuckets
@ -148,9 +150,9 @@ local function common_formspec(pos, meta)
local currLava = meta:get_int(META_LAVA_IN_TANK)
local lavaCap = get_lava_capacity(pos) or 1
local lavaPercent = math.round(currLava / lavaCap * 100)
return "formspec_version[6]"..
return "formspec_version[4]"..
"size[10.5,11]"..
"background9[0,0;1,1;logistica_lava_furnace_bg.png;true;8]"..
logistica.ui.background_lava_furnace..
"list[current_player;main;0.4,5.9;8,4;0]"..
"list[context;fuel;0.4,4.5;1,1;0]"..
"list[context;src;2.2,2.3;1,1;0]"..
@ -164,6 +166,8 @@ local function common_formspec(pos, meta)
"listring[current_player;main]"..
"listring[context;fuel]"..
"listring[current_player;main]"..
"button[9.2,0.4;0.8,0.8;"..GUIDE_BTN..";?]"..
"tooltip["..GUIDE_BTN..";"..S("Recipes").."]"..
get_lava_img(currLava, lavaPercent)
end
@ -237,7 +241,7 @@ local function lava_furnace_node_timer(pos, elapsed)
-- cook is ready
inv:remove_item(INV_INPT, config.input)
inv:add_item(INV_OUTP, config.output)
if config.additive
if config.additive
and config.additive_use_chance
and logistica.random_chance(config.additive_use_chance) then
inv:remove_item(INV_ADDI, config.additive)
@ -317,13 +321,15 @@ local function lava_furnace_allow_metadata_inv_move(pos, from_list, from_index,
end
local function lava_furnace_on_inv_change(pos)
-- local timer = minetest.get_node_timer(pos)
-- if not timer:is_started() and lava_furnace_node_timer(pos, 0) then
-- timer:start(UPDATE_INTERVAL)
-- end
logistica.start_node_timer(pos, UPDATE_INTERVAL)
end
local function lava_furnace_receive_fields(pos, formname, fields, sender)
if fields[GUIDE_BTN] and sender and sender:is_player() then
logistica.lava_furnace_show_guide(sender:get_player_name())
end
end
--------------------------------
-- Public API
--------------------------------
@ -354,6 +360,7 @@ function logistica.register_lava_furnace(desc, name, lavaCapacity, combinedTiles
allow_metadata_inventory_put = lava_furnace_allow_metadata_inv_put,
allow_metadata_inventory_move = lava_furnace_allow_metadata_inv_move,
allow_metadata_inventory_take = lava_furnace_allow_metadata_inv_take,
on_receive_fields = lava_furnace_receive_fields,
logistica = {
lava_capacity = lavaCapacity
}

View File

@ -55,3 +55,8 @@ function logistica.get_lava_furnace_recipe_for(itemName)
-- nothing found
return nil
end
-- returns a copy_pointed_thing of internal the internal recipes - for reference
function logistica.get_lava_furnace_internal_recipes()
return table.copy(lava_furance_recipes)
end

View File

@ -325,6 +325,12 @@ end
minetest.register_on_player_receive_fields(on_receive_storage_formspec)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
storageForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -110,6 +110,12 @@ end
minetest.register_on_player_receive_fields(on_player_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
requesterForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -88,6 +88,12 @@ end
minetest.register_on_player_receive_fields(on_player_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
supplierForms[objRef:get_player_name()] = nil
end
end)
----------------------------------------------------------------
-- Public Registration API
----------------------------------------------------------------

View File

@ -16,8 +16,6 @@ items[L("silverin_slice")] = {
stack_max = 99,
}
items[L("silverin_circuit")] = {
description = S("Silverin Circuit"),
inventory_image = "logistica_silverin_circuit.png",

View File

@ -0,0 +1,99 @@
local S = logistica.TRANSLATOR
local T = minetest.get_translated_string
local FORMSPEC = "lavafunguide"
local NEXT_BTN = "nextbtn"
local PREV_BTN = "prevbtn"
local forms = {}
local internalRecipes = {}
local numInternalRecipes = 0
local function on_mods_loaded()
local rec = logistica.get_lava_furnace_internal_recipes()
local count = 0
for k, v in pairs(rec) do
count = count + 1
internalRecipes[count] = {name = k, recipe = v}
end
numInternalRecipes = count
end
local function get_guide_formspec(currPage, langCode)
currPage = logistica.clamp(currPage, 1, numInternalRecipes)
local recipe = internalRecipes[currPage]
local srcItem = ItemStack(recipe.name)
local addItem = ItemStack(recipe.recipe.additive or "")
local dstItem = ItemStack(recipe.recipe.output)
return "formspec_version[4]" ..
"size[10.5,7.5]" ..
logistica.ui.background_lava_furnace..
"item_image[0.4,4.5;1,1;bucket:bucket_lava]"..
"tooltip[0.4,0.8;1,5.1;"..S("Lava Furnace can only use Lava as fuel").."]"..
"item_image[2.2,2.3;1,1;"..recipe.name.."]"..--src
"tooltip[2.2,2.3;1,1;"..T(langCode, srcItem:get_short_description()).."]"..
"item_image[7.8,2.3;1,1;"..tostring(recipe.recipe.output).."]"..--dst
"tooltip[7.8,2.3;1,1;"..T(langCode, dstItem:get_short_description()).."]"..
"item_image[4.3,0.9;1,1;"..tostring(recipe.recipe.additive).."]"..--add
"tooltip[4.3,0.9;1,1;"..T(langCode, addItem:get_short_description()).."]"..
"image[4,2.3;3,1;logistica_lava_furnace_arrow_bg.png^[transformR270]"..
"image[0.4,1.4;1,3;logistica_lava_furnace_tank_bg.png]"..
"label[0.7,1.1;"..S("Lava").."]"..
"label[4.2,0.5;"..S("Additives").." : "..S("Use Chance: ")..tostring(recipe.recipe.additive_use_chance).."%]"..
"label[2.4,2.0;"..S("Input").."]"..
"label[8.0,2.0;"..S("Output").."]"..
"button[0.5,6.0;1,1;"..PREV_BTN..";<]"..
"button[9.0,6.0;1,1;"..NEXT_BTN..";>]"..
"label[4.4,5.5;"..S("Lava Furnace Recipes").."]"..
"label[4.8,6.5;"..S("Page: ")..tostring(currPage).." / "..tostring(numInternalRecipes).."]"
end
local function guide_receive_fields(player, formname, fields)
if not player or not player:is_player() then return false end
if formname ~= FORMSPEC then return false end
local playerName = player:get_player_name()
if not forms[playerName] then return true end
local page = forms[playerName].page
if not page then return true end
if fields.quit then
forms[playerName] = nil
elseif fields[PREV_BTN] then
forms[playerName].page = (forms[playerName].page or 1) - 1
if forms[playerName].page < 1 then forms[playerName].page = numInternalRecipes end
logistica.lava_furnace_show_guide(player:get_player_name())
elseif fields[NEXT_BTN] then
forms[playerName].page = (forms[playerName].page or 1) + 1
if forms[playerName].page > numInternalRecipes then forms[playerName].page = 1 end
logistica.lava_furnace_show_guide(player:get_player_name())
end
return true
end
----------------------------------------------------------------
-- registration stuff
----------------------------------------------------------------
minetest.register_on_player_receive_fields(guide_receive_fields)
minetest.register_on_leaveplayer(function(objRef, timed_out)
if objRef:is_player() then
forms[objRef:get_player_name()] = nil
end
end)
minetest.register_on_mods_loaded(on_mods_loaded)
----------------------------------------------------------------
-- public funcs
----------------------------------------------------------------
function logistica.lava_furnace_show_guide(playername)
local page = 1
if forms[playername] then page = forms[playername].page or 1
else forms[playername] = { page = 1 } end
local langCode = minetest.get_player_information(playername).lang_code or "en"
minetest.show_formspec(playername, FORMSPEC, get_guide_formspec(page, langCode))
end

View File

@ -13,3 +13,4 @@ dofile(path.."/injector.lua")
dofile(path.."/item_storage.lua")
dofile(path.."/access_point.lua")
dofile(path.."/access_point_formspec.lua")
dofile(path.."/lava_furnace_guide_formspec.lua")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -1,7 +1,7 @@
logistica.ui = {}
logistica.ui.background = "no_prepend[]bgcolor[#0000]background9[0,0;1,1;logistica_formspec_background.png;true;8]"
logistica.ui.background_lava_furnace = "background9[0,0;1,1;logistica_lava_furnace_bg.png;true;8]"
local function list_dropdown(name, itemTable, x, y, default, label)