split up files, got checkbox working!
parent
c2bff82734
commit
d2be4b5034
|
@ -0,0 +1,9 @@
|
|||
colbox_0_0 ={
|
||||
type = 'fixed',
|
||||
fixed = {{-.375, -.5, -.125, .375, .4375, .125}}
|
||||
}
|
||||
|
||||
colbox_0_1 ={
|
||||
type = 'fixed',
|
||||
fixed = {{-.375, -.5, .125, .375, .4375, .375}}
|
||||
}
|
14
formspec.lua
14
formspec.lua
|
@ -1,3 +1,11 @@
|
|||
formspec =
|
||||
'size[8,6]'..
|
||||
'list[current_player;main;1,6;8,4;]'
|
||||
machine_formspec =
|
||||
'size[8,7.5]'..
|
||||
'list[context;tool;0,0;1,1]'..
|
||||
'label[1,0;Tool/Bones]'..
|
||||
'list[context;input;0,1;1,1]'..
|
||||
'label[1,1;Material]'..
|
||||
'list[context;output;0,2;1,1]'..
|
||||
'label[1,2;Output]'..
|
||||
'item_image_button[4,0;1,1;tombs:cobble_0_0;0;]'..
|
||||
'checkbox[6,2.5;offset;Offset Node?;]'..
|
||||
'list[current_player;main;0,3.5;8,4]'
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
--[[
|
||||
minetest.register_node('tombs:cobble_0_0', {
|
||||
description = material..' grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = texture_image,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = col_box_0_0,
|
||||
collision_box = col_box_0_0,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:cobble_0_1', {
|
||||
description = 'offset '..material..'' grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = texture_image,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = col_box_0_1,
|
||||
collision_box = col_box_0_1,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
|
||||
})
|
||||
--]]
|
||||
|
||||
minetest.register_node('tombs:cobble_0_0', {
|
||||
description = 'cobblestone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = {'default_cobble.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = colbox_0_0,
|
||||
collision_box = colbox_0_0,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:cobble_0_1', {
|
||||
description = 'offset cobblestone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_1.obj',
|
||||
tiles = {'default_cobble.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = colbox_0_1,
|
||||
collision_box = colbox_0_1,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:stone_0_0', {
|
||||
description = 'stone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = {'default_stone.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = colbox_0_0,
|
||||
collision_box = colbox_0_0,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:stone_0_1', {
|
||||
description = 'offset stone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_1.obj',
|
||||
tiles = {'default_stone.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
selection_box = colbox_0_1,
|
||||
collision_box = colbox_0_1,
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
111
init.lua
111
init.lua
|
@ -1,107 +1,6 @@
|
|||
tombs = {}
|
||||
|
||||
|
||||
minetest.register_node('tombs:machine', {
|
||||
description = 'Gravestone Engraver',
|
||||
tiles = {
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_front.png',
|
||||
},
|
||||
groups = {oddly_breakable_by_hand=3},
|
||||
paramtype2 = 'facedir',
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string('infotext', 'Gravestone Creator')
|
||||
meta:set_string('formspec', 'size[8,7.5]'..
|
||||
'list[context;tool;0,0;1,1]'..
|
||||
'label[1,0;Tool/Bones]'..
|
||||
'list[context;input;0,1;1,1]'..
|
||||
'label[1,1;Material]'..
|
||||
'list[context;output;0,2;1,1]'..
|
||||
'label[1,2;Output]'..
|
||||
'item_image_button[4,0;1,1;tombs:cobble_0_0;0;]'..
|
||||
'checkbox[6,2.5;offset;Offset Node?;]'..
|
||||
'list[current_player;main;0,3.5;8,4]')
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('tool', 1)
|
||||
inv:set_size('input', 1)
|
||||
inv:set_size('output', 1)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
--[[ if fields['offset'] == 'true' then --mesh should be offset version
|
||||
minetest.chat_send_all('hello world')
|
||||
return offset = '1'
|
||||
end
|
||||
if fields['offset'] == 'false' then
|
||||
minetest.chat_send_all('goodbye world')
|
||||
return offset = '0'
|
||||
--]]
|
||||
if fields['0'] then
|
||||
local itemstack = inv:get_stack('input', 1)
|
||||
local material = itemstack:get_name()
|
||||
local tool = inv:get_stack('tool', 1)
|
||||
local tool_name = tool:get_name()
|
||||
if tool_name == 'bones:bones' then
|
||||
if material == 'default:cobble' then
|
||||
inv:add_item('output', 'tombs:cobble_0_0')
|
||||
elseif material == 'default:stone' then
|
||||
inv:add_item('output', 'tombs:stone_0_0')
|
||||
else
|
||||
return
|
||||
end
|
||||
itemstack:take_item(1)
|
||||
inv:set_stack('input',1,itemstack)
|
||||
tool:take_item(1)
|
||||
inv:set_stack('tool',1,tool)
|
||||
end
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty('tool') and
|
||||
inv:is_empty('input') and
|
||||
inv:is_empty('output') then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node('tombs:cobble_0_0', {
|
||||
description = 'cobblestone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = {'default_cobble.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:cobble_0_1', {
|
||||
description = 'cobblestone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_1.obj',
|
||||
tiles = {'default_cobble.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
|
||||
minetest.register_node('tombs:stone_0_0', {
|
||||
description = 'stone grave marker',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tombs_0_0.obj',
|
||||
tiles = {'default_stone.png'},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1,},
|
||||
})
|
||||
--break the file up to make it easier to maintain.
|
||||
dofile(minetest.get_modpath('tombs')..'/machine.lua')
|
||||
dofile(minetest.get_modpath('tombs')..'/collision_boxes.lua')
|
||||
dofile(minetest.get_modpath('tombs')..'/gravestones.lua')
|
||||
dofile(minetest.get_modpath('tombs')..'/formspec.lua')
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
local center = '0'
|
||||
|
||||
minetest.register_node('tombs:machine', {
|
||||
description = 'Gravestone Engraver',
|
||||
tiles = {
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_side.png',
|
||||
'tombs_machine_front.png',
|
||||
},
|
||||
groups = {oddly_breakable_by_hand=3},
|
||||
paramtype2 = 'facedir',
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string('infotext', 'Gravestone Creator')
|
||||
meta:set_string('formspec', machine_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('tool', 1)
|
||||
inv:set_size('input', 1)
|
||||
inv:set_size('output', 1)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if fields['offset'] == 'true' then --mesh should be offset version
|
||||
center = '1'
|
||||
elseif fields['offset'] == 'false' then
|
||||
center = '0'
|
||||
end
|
||||
if fields['0'] then
|
||||
local input = inv:get_stack('input', 1)
|
||||
local tool = inv:get_stack('tool', 1)
|
||||
if tool:get_name() == 'bones:bones' then
|
||||
if input:get_name() == 'default:cobble' then
|
||||
inv:add_item('output', 'tombs:cobble_0_'..center)
|
||||
elseif input:get_name() == 'default:stone' then
|
||||
inv:add_item('output', 'tombs:stone_0_'..center)
|
||||
else
|
||||
return
|
||||
end
|
||||
input:take_item(1)
|
||||
inv:set_stack('input',1,input)
|
||||
tool:take_item(1)
|
||||
inv:set_stack('tool',1,tool)
|
||||
end
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty('tool') and
|
||||
inv:is_empty('input') and
|
||||
inv:is_empty('output') then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -1,14 +1,14 @@
|
|||
# Blender v2.79 (sub 6) OBJ File: ''
|
||||
# www.blender.org
|
||||
o Cube.001
|
||||
v -0.375000 -0.500000 -0.125000
|
||||
v -0.375000 0.437500 -0.125000
|
||||
v -0.375000 -0.500000 -0.375000
|
||||
v -0.375000 0.437500 -0.375000
|
||||
v 0.375000 -0.500000 -0.125000
|
||||
v 0.375000 0.437500 -0.125000
|
||||
v 0.375000 -0.500000 -0.375000
|
||||
v 0.375000 0.437500 -0.375000
|
||||
v -0.375000 -0.500000 0.375000
|
||||
v -0.375000 0.437500 0.375000
|
||||
v -0.375000 -0.500000 0.125000
|
||||
v -0.375000 0.437500 0.125000
|
||||
v 0.375000 -0.500000 0.375000
|
||||
v 0.375000 0.437500 0.375000
|
||||
v 0.375000 -0.500000 0.125000
|
||||
v 0.375000 0.437500 0.125000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 0.937500
|
||||
vt 0.625000 0.937500
|
||||
|
|
Loading…
Reference in New Issue