code cleanup
creative won't take items
This commit is contained in:
parent
4cee33a979
commit
7c5ab717f9
95
machine.lua
95
machine.lua
@ -20,55 +20,55 @@ minetest.register_node("mysheetmetal:machine", {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.0625, -0.3125, 0.5, 0.0625, 0.1875}, -- NodeBox6
|
||||
{-0.5, 0.125, -0.3125, 0.5, 0.1875, 0.125}, -- NodeBox7
|
||||
{-0.5, 0.1875, -0.25, 0.5, 0.25, 0.125}, -- NodeBox8
|
||||
{-0.5, -0.0625, -0.4375, 0.5, 0.0625, -0.3125}, -- NodeBox9
|
||||
{0, -0.25, -0.4375, 0.0625, -0.0625, -0.375}, -- NodeBox10
|
||||
{0, -0.3125, -0.4375, 0.5, -0.25, -0.375}, -- NodeBox11
|
||||
{-0.5, -0.5, 0.0625, -0.375, -0.0625, 0.1875}, -- NodeBox12
|
||||
{0, 0.25, 0, 0.0625, 0.5, 0.0625}, -- NodeBox13
|
||||
{0.0625, 0.4375, 0, 0.5, 0.5, 0.0625}, -- NodeBox14
|
||||
{-0.5, 0.0625, 0.125, 0.5, 0.1875, 0.1875}, -- NodeBox15
|
||||
{-0.5, -0.5, -0.3125, -0.375, -0.0625, -0.1875}, -- NodeBox16
|
||||
{-0.5, -0.0625, -0.3125, 0.5, 0.0625, 0.1875},
|
||||
{-0.5, 0.125, -0.3125, 0.5, 0.1875, 0.125},
|
||||
{-0.5, 0.1875, -0.25, 0.5, 0.25, 0.125},
|
||||
{-0.5, -0.0625, -0.4375, 0.5, 0.0625, -0.3125},
|
||||
{0, -0.25, -0.4375, 0.0625, -0.0625, -0.375},
|
||||
{0, -0.3125, -0.4375, 0.5, -0.25, -0.375},
|
||||
{-0.5, -0.5, 0.0625, -0.375, -0.0625, 0.1875},
|
||||
{0, 0.25, 0, 0.0625, 0.5, 0.0625},
|
||||
{0.0625, 0.4375, 0, 0.5, 0.5, 0.0625},
|
||||
{-0.5, 0.0625, 0.125, 0.5, 0.1875, 0.1875},
|
||||
{-0.5, -0.5, -0.3125, -0.375, -0.0625, -0.1875},
|
||||
|
||||
|
||||
{0.5, -0.0625, -0.3125, 1.5, 0.0625, 0.1875}, -- NodeBox6
|
||||
{0.5, 0.125, -0.3125, 1.5, 0.1875, 0.125}, -- NodeBox7
|
||||
{0.5, 0.1875, -0.25, 1.5, 0.25, 0.125}, -- NodeBox8
|
||||
{0.5, -0.0625, -0.4375, 1.5, 0.0625, -0.3125}, -- NodeBox9
|
||||
{1, -0.25, -0.4375, 1.0625, -0.0625, -0.375}, -- NodeBox10
|
||||
{0.5, -0.3125, -0.4375, 1.0625, -0.25, -0.375}, -- NodeBox11
|
||||
{0.5, -0.0625, -0.3125, 1.5, 0.0625, 0.1875},
|
||||
{0.5, 0.125, -0.3125, 1.5, 0.1875, 0.125},
|
||||
{0.5, 0.1875, -0.25, 1.5, 0.25, 0.125},
|
||||
{0.5, -0.0625, -0.4375, 1.5, 0.0625, -0.3125},
|
||||
{1, -0.25, -0.4375, 1.0625, -0.0625, -0.375},
|
||||
{0.5, -0.3125, -0.4375, 1.0625, -0.25, -0.375},
|
||||
|
||||
{1.375, -0.5, 0.0625, 1.5, -0.0625, 0.1875}, -- NodeBox12
|
||||
{1, 0.25, 0, 1.0625, 0.5, 0.0625}, -- NodeBox13
|
||||
{0.5, 0.4375, 0, 1.0625, 0.5, 0.0625}, -- NodeBox14
|
||||
{0.5, 0.0625, 0.125, 1.5, 0.1875, 0.1875}, -- NodeBox15
|
||||
{1.375, -0.5, -0.3125, 1.5, -0.0625, -0.1875}, -- NodeBox16
|
||||
{1.375, -0.5, 0.0625, 1.5, -0.0625, 0.1875},
|
||||
{1, 0.25, 0, 1.0625, 0.5, 0.0625},
|
||||
{0.5, 0.4375, 0, 1.0625, 0.5, 0.0625},
|
||||
{0.5, 0.0625, 0.125, 1.5, 0.1875, 0.1875},
|
||||
{1.375, -0.5, -0.3125, 1.5, -0.0625, -0.1875},
|
||||
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.0625, -0.3125, 1.5, 0.0625, 0.1875}, -- NodeBox6
|
||||
{-0.5, 0.125, -0.3125, 1.5, 0.1875, 0.125}, -- NodeBox7
|
||||
{-0.5, 0.1875, -0.25, 1.5, 0.25, 0.125}, -- NodeBox8
|
||||
{-0.5, -0.0625, -0.4375, 1.5, 0.0625, -0.3125}, -- NodeBox9
|
||||
{0, -0.25, -0.4375, 0.0625, -0.0625, -0.375}, -- NodeBox10
|
||||
{0, -0.3125, -0.4375, 1.0625, -0.25, -0.375}, -- NodeBox11
|
||||
{-0.5, -0.5, 0.0625, -0.375, -0.0625, 0.1875}, -- NodeBox12
|
||||
{0, 0.25, 0, 0.0625, 0.4375, 0.0625}, -- NodeBox13
|
||||
{0, 0.4375, 0, 1.0625, 0.5, 0.0625}, -- NodeBox14
|
||||
{-0.5, 0.0625, 0.125, 1.5, 0.1875, 0.1875}, -- NodeBox15
|
||||
{-0.5, -0.5, -0.3125, -0.375, -0.0625, -0.1875}, -- NodeBox16
|
||||
{-0.5, -0.0625, -0.3125, 1.5, 0.0625, 0.1875},
|
||||
{-0.5, 0.125, -0.3125, 1.5, 0.1875, 0.125},
|
||||
{-0.5, 0.1875, -0.25, 1.5, 0.25, 0.125},
|
||||
{-0.5, -0.0625, -0.4375, 1.5, 0.0625, -0.3125},
|
||||
{0, -0.25, -0.4375, 0.0625, -0.0625, -0.375},
|
||||
{0, -0.3125, -0.4375, 1.0625, -0.25, -0.375},
|
||||
{-0.5, -0.5, 0.0625, -0.375, -0.0625, 0.1875},
|
||||
{0, 0.25, 0, 0.0625, 0.4375, 0.0625},
|
||||
{0, 0.4375, 0, 1.0625, 0.5, 0.0625},
|
||||
{-0.5, 0.0625, 0.125, 1.5, 0.1875, 0.1875},
|
||||
{-0.5, -0.5, -0.3125, -0.375, -0.0625, -0.1875},
|
||||
|
||||
|
||||
{1, -0.25, -0.4375, 1.0625, -0.0625, -0.375}, -- NodeBox10
|
||||
{1, -0.25, -0.4375, 1.0625, -0.0625, -0.375},
|
||||
|
||||
{1.375, -0.5, 0.0625, 1.5, -0.0625, 0.1875}, -- NodeBox12
|
||||
{1, 0.25, 0, 1.0625, 0.4375, 0.0625}, -- NodeBox13
|
||||
{1.375, -0.5, -0.3125, 1.5, -0.0625, -0.1875}, -- NodeBox16
|
||||
{1.375, -0.5, 0.0625, 1.5, -0.0625, 0.1875},
|
||||
{1, 0.25, 0, 1.0625, 0.4375, 0.0625},
|
||||
{1.375, -0.5, -0.3125, 1.5, -0.0625, -0.1875},
|
||||
}
|
||||
},
|
||||
|
||||
@ -81,11 +81,9 @@ minetest.register_node("mysheetmetal:machine", {
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("ingot") then
|
||||
return false
|
||||
elseif not inv:is_empty("ingot2") then
|
||||
return false
|
||||
elseif not inv:is_empty("res") then
|
||||
if not inv:is_empty("ingot") or
|
||||
not inv:is_empty("ingot2") or
|
||||
not inv:is_empty("res") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@ -130,7 +128,7 @@ end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
--eaves trough
|
||||
|
||||
if fields["et"]
|
||||
or fields["etocorner"]
|
||||
or fields["eticorner"]
|
||||
@ -268,23 +266,22 @@ then
|
||||
local ingotstack = inv:get_stack("ingot", 1)
|
||||
local ingotstack2 = inv:get_stack("ingot2", 1)
|
||||
local resstack = inv:get_stack("res", 1)
|
||||
----------------------------------------------------------------------------------
|
||||
--register nodes
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
if ingotstack:get_name()=="default:steel_ingot" and
|
||||
ingotstack2:get_name()=="dye:white" then
|
||||
make_ok = "1"
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------
|
||||
if make_ok == "1" then
|
||||
local give = {}
|
||||
for i = 0, anzahl-1 do
|
||||
give[i+1]=inv:add_item("res",shape)
|
||||
end
|
||||
ingotstack:take_item()
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
ingotstack:take_item()
|
||||
ingotstack2:take_item()
|
||||
end
|
||||
inv:set_stack("ingot",1,ingotstack)
|
||||
ingotstack2:take_item()
|
||||
inv:set_stack("ingot2",1,ingotstack2)
|
||||
end
|
||||
end
|
||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 236 KiB |
Loading…
x
Reference in New Issue
Block a user