mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-25 02:10:30 +01:00
make "half"/"full" buttons work
This commit is contained in:
parent
d40946fa38
commit
4ecb3d4334
@ -143,30 +143,32 @@ local cnc_formspec =
|
|||||||
"listring[current_name;src]"..
|
"listring[current_name;src]"..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
|
|
||||||
local size = 1;
|
|
||||||
|
|
||||||
-- The form handler is declared here because we need it in both the inactive and active modes
|
-- The form handler is declared here because we need it in both the inactive and active modes
|
||||||
-- in order to be able to change programs wile it is running.
|
-- in order to be able to change programs wile it is running.
|
||||||
local function form_handler(pos, formname, fields, sender)
|
local function form_handler(pos, formname, fields, sender)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
-- REGISTER MILLING PROGRAMS AND OUTPUTS:
|
-- REGISTER MILLING PROGRAMS AND OUTPUTS:
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
-- Program for half/full size
|
-- Program for half/full size
|
||||||
if fields["full"] then
|
if fields["full"] then
|
||||||
size = 1
|
meta:set_int("size", 1)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["half"] then
|
if fields["half"] then
|
||||||
size = 2
|
meta:set_int("size", 2)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Resolve the node name and the number of items to make
|
-- Resolve the node name and the number of items to make
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local inputstack = inv:get_stack("src", 1)
|
local inputstack = inv:get_stack("src", 1)
|
||||||
local inputname = inputstack:get_name()
|
local inputname = inputstack:get_name()
|
||||||
local multiplier = 0
|
local multiplier = 0
|
||||||
|
local size = meta:get_int("size")
|
||||||
|
if size < 1 then size = 1 end
|
||||||
|
|
||||||
for k, _ in pairs(fields) do
|
for k, _ in pairs(fields) do
|
||||||
-- Set a multipier for the half/full size capable blocks
|
-- Set a multipier for the half/full size capable blocks
|
||||||
if twosize_products[k] ~= nil then
|
if twosize_products[k] ~= nil then
|
||||||
|
Loading…
Reference in New Issue
Block a user