mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 23:33:44 +01:00
Merge pull request #10 from realmicu/master
Added new button image for BLOCKED state.
This commit is contained in:
commit
f2876b191f
@ -30,7 +30,7 @@ tubelib.StatesImg = {
|
|||||||
"tubelib_inv_button_on.png",
|
"tubelib_inv_button_on.png",
|
||||||
"tubelib_inv_button_standby.png",
|
"tubelib_inv_button_standby.png",
|
||||||
"tubelib_inv_button_error.png",
|
"tubelib_inv_button_error.png",
|
||||||
"tubelib_inv_button_error.png",
|
"tubelib_inv_button_warning.png",
|
||||||
"tubelib_inv_button_off.png",
|
"tubelib_inv_button_off.png",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
tubelib/textures/tubelib_inv_button_warning.png
Normal file
BIN
tubelib/textures/tubelib_inv_button_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 B |
@ -116,11 +116,13 @@ local function convert_leaves_to_biogas(pos, meta)
|
|||||||
|
|
||||||
-- take NUM_LEAVES items
|
-- take NUM_LEAVES items
|
||||||
local items = {}
|
local items = {}
|
||||||
local fault = false
|
|
||||||
for i = 1, NUM_LEAVES do
|
for i = 1, NUM_LEAVES do
|
||||||
items[i] = tubelib.get_num_items(meta, "src", 1)
|
items[i] = tubelib.get_num_items(meta, "src", 1)
|
||||||
if items[i] then -- input available?
|
if items[i] then -- input available?
|
||||||
if not is_leaves(items[i]:get_name()) then
|
if not is_leaves(items[i]:get_name()) then
|
||||||
|
for j = 1, #items do
|
||||||
|
inv:add_item("src", items[j])
|
||||||
|
end
|
||||||
State:fault(pos, meta)
|
State:fault(pos, meta)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -23,6 +23,7 @@ local M = minetest.get_meta
|
|||||||
local STANDBY_TICKS = 4
|
local STANDBY_TICKS = 4
|
||||||
local COUNTDOWN_TICKS = 4
|
local COUNTDOWN_TICKS = 4
|
||||||
local CYCLE_TIME = 2
|
local CYCLE_TIME = 2
|
||||||
|
local NUM_BIOGAS = 4 -- to produce on biofuel
|
||||||
|
|
||||||
local function formspec(self, pos, meta)
|
local function formspec(self, pos, meta)
|
||||||
return "size[8,8]"..
|
return "size[8,8]"..
|
||||||
@ -100,26 +101,40 @@ end
|
|||||||
local function convert_biogas_to_biofuel(pos, meta)
|
local function convert_biogas_to_biofuel(pos, meta)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local biofuel = ItemStack("tubelib_addons1:biofuel")
|
local biofuel = ItemStack("tubelib_addons1:biofuel")
|
||||||
if inv:room_for_item("dst", biofuel) then -- enough output space?
|
|
||||||
local items = tubelib.get_num_items(meta, "src", 4)
|
-- Not enough output space?
|
||||||
if items then -- input available?
|
if not inv:room_for_item("dst", biofuel) then
|
||||||
if items:get_name() == "tubelib_addons1:biogas" then -- valid input?
|
|
||||||
inv:add_item("dst", biofuel)
|
|
||||||
State:keep_running(pos, meta, COUNTDOWN_TICKS)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
inv:add_item("src", items)
|
|
||||||
State:fault(pos, meta)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
else
|
|
||||||
State:idle(pos, meta)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
else
|
|
||||||
State:blocked(pos, meta)
|
State:blocked(pos, meta)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- take NUM_BIOGAS items
|
||||||
|
local items = {}
|
||||||
|
for i = 1, NUM_BIOGAS do
|
||||||
|
items[i] = tubelib.get_num_items(meta, "src", 1)
|
||||||
|
if items[i] then -- input available?
|
||||||
|
if items[i]:get_name() ~= "tubelib_addons1:biogas" then
|
||||||
|
for j = 1, #items do
|
||||||
|
inv:add_item("src", items[j])
|
||||||
|
end
|
||||||
|
State:fault(pos, meta)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- put result into dst inventory
|
||||||
|
if #items == NUM_BIOGAS then
|
||||||
|
inv:add_item("dst", biofuel)
|
||||||
|
State:keep_running(pos, meta, COUNTDOWN_TICKS)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- put biogas back to src inventory
|
||||||
|
for i = 1, #items do
|
||||||
|
inv:add_item("src", items[i])
|
||||||
|
end
|
||||||
|
State:idle(pos, meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user