First Upload

master
DonBatman 2015-09-09 14:26:59 -06:00
commit b70afafde9
52 changed files with 550 additions and 0 deletions

164
chess/board.lua Normal file
View File

@ -0,0 +1,164 @@
minetest.register_node("chess:board", {
description = "Chess Board",
inventory_image = "board_inven.png",
wield_image = "board_inven.png",
light_source = 5,
tiles = {"border_cbl.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"},
drawtype = "normal",
paramtype = "light",
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("chess").."/schems/chess_board.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end,
})
--Board Border
local board = {
{"chess:border" ,{"border.png"}},
{"chess:borderl" ,{"border_left.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderr" ,{"border_right.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:bordert" ,{"border_top.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderb" ,{"border_bottom.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:bordercbr" ,{"border_cornerbr.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:bordercbl" ,{"border_cornerbl.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderctr" ,{"border_cornertr.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderctl" ,{"border_cornertl.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderoctl",{"border_ctl.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderoctr",{"border_ctr.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderocbl",{"border_cbl.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:borderocbr",{"border_cbr.png","border.png","border_side.png","border_side.png","border_side.png","border_side.png"}},
{"chess:white" ,{"chess_wboard.png"}},
{"chess:black" ,{"chess_bboard.png"}},
{"chess:whitet" ,{"white_t.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"}},
{"chess:whiteb" ,{"white_b.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"}},
{"chess:whitebl" ,{"white_bl.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"},},
{"chess:whitebr" ,{"white_br.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"}},
{"chess:whitetl" ,{"white_tl.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"}},
{"chess:whitetr" ,{"white_tr.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png","chess_wboard.png"}},
}
for i in ipairs (board) do
local item = board[i][1]
local img = board[i][2]
minetest.register_node(item, {
light_source = 5,
tiles = img,
drawtype = "normal",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory=1},
})
end
-- Punch on Turn------------------------------------------
local function update_node(pos, node)
minetest.set_node(pos, node)
end
local function punch(pos)
local meta = minetest.get_meta(pos)
local state = meta:get_int("state")
local me = minetest.get_node(pos)
local tmp_node
local tmp_node2
oben = {x=pos.x, y=pos.y, z=pos.z}
if state == 1 then
state = 0
minetest.sound_play("chess_ding", {pos = pos, gain = 0.3, max_hear_distance = 10})
tmp_node = {name="chess:turnwhite", param1=me.param1, param2=me.param2}
else
state = 1
minetest.sound_play("chess_ding", {pos = pos, gain = 0.3, max_hear_distance = 10})
tmp_node = {name="chess:turnblack", param1=me.param1, param2=me.param2}
end
update_node(pos, tmp_node)
meta:set_int("state", state)
end
minetest.register_node("chess:turnblack", {
light_source = 5,
tiles = {"chess_bbutton.png"},
drawtype = "normal",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory=1},
on_punch = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_node("chess:turnwhite", {
light_source = 5,
tiles = {"chess_wbutton.png"},
drawtype = "normal",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory=1},
on_punch = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_node("chess:beige", {
light_source = 5,
tiles = {"chess_beige.png"},
drawtype = "normal",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory=1},
})
minetest.register_node("chess:stand", {
tiles = {
"chess_beige.png",
"chess_beige.png",
"chess_beige.png",
"chess_beige.png",
"chess_beige.png",
"chess_beige.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory=1},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.375, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.3125, 0.25},
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375},
{-0.1875, 0.3125, -0.1875, 0.1875, 0.5, 0.1875},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.375, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.3125, 0.25},
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375},
{-0.1875, 0.3125, -0.1875, 0.1875, 0.5, 0.1875},
}
}
})

1
chess/depends.txt Normal file
View File

@ -0,0 +1 @@
default

3
chess/init.lua Normal file
View File

@ -0,0 +1,3 @@
dofile(minetest.get_modpath("chess").."/pieces.lua")
dofile(minetest.get_modpath("chess").."/board.lua")
print("[Chess] Loaded!")

276
chess/pieces.lua Normal file
View File

@ -0,0 +1,276 @@
local king = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, -0.375, 0.375},
{-0.3125, -0.5, -0.3125, 0.3125, -0.3125, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
}
}
local kings = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, -0.375, 0.375},
{-0.3125, -0.5, -0.3125, 0.3125, -0.3125, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
{-0.3125, -1.5, -0.3125, 0.3125, -1.4375, 0.3125},
{-0.375, -1.4375, -0.375, 0.375, -1.3125, 0.375},
{-0.3125, -1.3125, -0.3125, 0.3125, -1.25, 0.3125},
{-0.0625, -1.5, -0.0625, 0.0625, 1.5, 0.0625},
{-0.25, 1.1875, -0.0625, 0.25, 1.3125, 0.0625},
{-0.1875, -1.5, -0.1875, 0.1875, 1, 0.1875},
{-0.0625, 1.1875, -0.25, 0.0625, 1.3125, 0.25},
}
}
local kingt = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.4375, 0.3125},
{-0.375, -0.4375, -0.375, 0.375, -0.3125, 0.375},
{-0.3125, -0.3125, -0.3125, 0.3125, -0.25, 0.3125},
{-0.1875, -0.5, -0.1875, 0.1875, 0, 0.1875},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{-0.0625, 0.1875, -0.25, 0.0625, 0.3125, 0.25},
{-0.25, 0.1875, -0.0625, 0.25, 0.3125, 0.0625},
}
}
local kingts = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
}
local queen = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, -0.375, 0.375},
{-0.3125, -0.5, -0.3125, 0.3125, -0.3125, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
}
}
local queens = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, -0.375, 0.375},
{-0.3125, -0.5, -0.3125, 0.3125, -0.3125, 0.3125},
{-0.25, -0.5, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
{-0.3125, -1.5, -0.3125, 0.3125, -1.4375, 0.3125},
{-0.375, -1.4375, -0.375, 0.375, -1.3125, 0.375},
{-0.3125, -1.3125, -0.3125, 0.3125, -1.25, 0.3125},
{-0.1875, -1.5, -0.1875, 0.1875, 1.0625, 0.1875},
{-0.0625, 1.0625, -0.0625, 0.0625, 1.25, 0.0625},
}
}
local queent = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.4375, 0.3125},
{-0.375, -0.4375, -0.375, 0.375, -0.3125, 0.375},
{-0.3125, -0.3125, -0.3125, 0.3125, -0.25, 0.3125},
{-0.1875, -0.5, -0.1875, 0.1875, 0.0625, 0.1875},
{-0.0625, 0.0625, -0.0625, 0.0625, 0.25, 0.0625},
}
}
local queents = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
}
local knight = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.4375, 0.3125},
{-0.25, -0.4375, -0.25, 0.25, -0.375, 0.25},
{-0.1875, -0.375, -0.1875, 0.1875, -0.3125, 0.1875},
{-0.25, -0.3125, -0.1875, 0.25, -0.25, 0.25},
{-0.1875, -0.25, -0.125, 0.1875, -0.1875, 0.1875},
{-0.1875, -0.1875, -0.0625, 0.1875, -0.125, 0.25},
{-0.1875, -0.125, 0, 0.1875, -0.0625, 0.3125},
{-0.1875, -0.0625, 0.0625, 0.1875, 0.0625, 0.4375},
{-0.1875, 0.0625, 0.125, 0.1875, 0.5, 0.5},
{-0.125, 0.125, -0.125, 0.125, 0.4375, 0.125},
{-0.125, 0.125, -0.25, 0.125, 0.375, -0.125},
{-0.125, 0.0625, -0.1875, 0.125, 0.125, 0},
}
}
local pon = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.4375, 0.3125},
{-0.25, -0.4375, -0.25, 0.25, -0.375, 0.25},
{-0.1875, -0.375, -0.1875, 0.1875, -0.3125, 0.1875},
{-0.125, -0.3125, -0.125, 0.125, 0.0625, 0.125},
{-0.1875, 0.0625, -0.1875, 0.1875, 0.375, 0.1875},
}
}
local bishop = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.375, 0.3125},
{-0.25, -0.375, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.25, -0.1875, 0.1875, -0.125, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0.1875, 0.125},
{-0.1875, 0.1875, -0.1875, 0.1875, 0.375, 0.1875},
{-0.125, 0.5625, -0.125, 0.125, 0.625, 0.125},
{-0.1875, 0.375, -0.0625, 0.1875, 0.4375, 0.1875},
{-0.1875, 0.4375, -0.1875, 0.1875, 0.5625, 0.1875},
}
}
local rook = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.375, 0.3125},
{-0.25, -0.375, -0.25, 0.25, -0.25, 0.25},
{-0.1875, -0.25, -0.1875, 0.1875, -0.125, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
{-0.1875, 0.125, -0.1875, 0.1875, 0.3125, 0.1875},
{-0.1875, 0.3125, -0.1875, -0.125, 0.4375, -0.125},
{0.125, 0.3125, -0.1875, 0.1875, 0.4375, -0.125},
{0.125, 0.3125, 0.125, 0.1875, 0.4375, 0.1875},
{-0.1875, 0.3125, 0.125, -0.125, 0.4375, 0.1875},
}
}
local peices = { --item,desc,inv,img,nodebox
{"chess:king_white","White King","king_w_inven.png","chess_white.png",king,kings},
{"chess:king_top_white","","","chess_white.png",kingt,kingts},
{"chess:king_black","Black King","king_b_inven.png","chess_black.png",king,kings},
{"chess:king_top_black","","","chess_black.png",kingt,kingts},
{"chess:queen_white","White Queen","queen_w_inven.png","chess_white.png",queen,queens},
{"chess:queen_top_white","","","chess_white.png",queent,queents},
{"chess:queen_black","Black Queen","queen_b_inven.png","chess_black.png",queen,queens},
{"chess:queen_top_black","","","chess_black.png",queent,queents},
}
for i in ipairs (peices) do
local item = peices[i][1]
local desc = peices[i][2]
local inv = peices[i][3]
local img = peices[i][4]
local nbox = peices[i][5]
local sbox = peices[i][6]
minetest.register_node(item, {
description = desc,
inventory_image = inv,
light_source = 7,
tiles = {img.."^[transformR90"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {dig_immediate = 3, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
node_box = nbox,
selection_box = sbox,
after_place_node = function(pos)
local node = minetest.get_node(pos)
if node.name == "chess:king_white" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "chess:king_top_white"})
elseif node.name == "chess:king_black" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "chess:king_top_black"})
elseif node.name == "chess:queen_white" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "chess:queen_top_white"})
elseif node.name == "chess:queen_black" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "chess:queen_top_black"})
end
end,
on_destruct = function(pos)
local pos2 = {x=pos.x,y=pos.y+1,z=pos.z}
local node = minetest.get_node(pos)
local node2 = minetest.get_node(pos2)
if node.name == "chess:king_white" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:king_black" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:queen_white" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:queen_black" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:king_top_white" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:king_top_black" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:queen_top_white" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
elseif node.name == "chess:queen_top_black" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end
end,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place it here!" )
return
end
return minetest.item_place(itemstack, placer, pointed_thing)
end
})
end
local peices = { --item,desc,inv,img,nodebox
{"chess:knight_white","White Knight","knight_w_inven.png","chess_white.png",knight},
{"chess:knight_black","Black Knight","knight_b_inven.png","chess_black.png",knight},
{"chess:pon_white","White Pon","pon_w_inven.png","chess_white.png",pon},
{"chess:pon_black","Black Pon","pon_b_inven.png","chess_black.png",pon},
{"chess:bishop_white","White Bishop","bishop_w_inven.png","chess_white.png",bishop},
{"chess:bishop_black","Black Bishop","bishop_b_inven.png","chess_black.png",bishop},
{"chess:rook_white","White Rook","rook_w_inven.png","chess_white.png",rook},
{"chess:rook_black","Black Rook","rook_b_inven.png","chess_black.png",rook},
}
for i in ipairs (peices) do
local item = peices[i][1]
local desc = peices[i][2]
local inv = peices[i][3]
local img = peices[i][4]
local nbox = peices[i][5]
minetest.register_node(item, {
description = desc,
-- inventory_image = inv,
light_source = 7,
tiles = {img.."^[transformR90"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {dig_immediate = 3, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
node_box = nbox,
selection_box = nbox,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place it here!" )
return
end
local node = minetest.get_node(pos)
local par1 = node.param2
par2 = par1 + 2
if par2 == 4 then
par2 = 0
elseif par2 == 5 then
par2 = 1
end
if node.name == "chess:knight_black" then
minetest.set_node({pos},{name = "chess:knight_black", param2 = par2})
end
return minetest.item_place(itemstack, placer, pointed_thing)
end
})
end

Binary file not shown.

BIN
chess/sounds/ding.mp3 Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
chess/textures/border.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
chess/textures/white_b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
chess/textures/white_bl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

BIN
chess/textures/white_br.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

BIN
chess/textures/white_t.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

BIN
chess/textures/white_tl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

BIN
chess/textures/white_tr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

0
modpack.txt Normal file
View File

106
mydice/init.lua Normal file
View File

@ -0,0 +1,106 @@
local dice = {
{"mydice:1",{"mydice_1.png","mydice_2.png","mydice_3.png","mydice_4.png","mydice_5.png","mydice_6.png"},"1"},
{"mydice:2",{"mydice_2.png","mydice_3.png","mydice_4.png","mydice_5.png","mydice_6.png","mydice_1.png"},"2"},
{"mydice:3",{"mydice_3.png","mydice_4.png","mydice_5.png","mydice_6.png","mydice_1.png","mydice_2.png"},"3"},
{"mydice:4",{"mydice_4.png","mydice_5.png","mydice_6.png","mydice_1.png","mydice_2.png","mydice_3.png"},"4"},
{"mydice:5",{"mydice_5.png","mydice_6.png","mydice_1.png","mydice_2.png","mydice_3.png","mydice_4.png"},"5"},
{"mydice:6",{"mydice_6.png","mydice_1.png","mydice_2.png","mydice_3.png","mydice_4.png","mydice_5.png"},"6"},
}
for i in ipairs (dice) do
local d1 = dice [i][1]
local d2 = dice [i][2]
local d3 = dice [i][3]
minetest.register_node(d1,{
description = d3,
tiles = d2,
drawtype = "normal",
paramtype = "light",
groups = {cracky = 3},
on_punch = function(pos, node, puncher, pointed_thing)
local timer = minetest.get_node_timer(pos)
local ran = math.random(1,6)
minetest.set_node(pos,{name="mydice:roll"})
timer:start(2)
end,
})
end
minetest.register_node("mydice:roll",{
description = d3,
tiles = {
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mydice_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
},
drawtype = "normal",
paramtype = "light",
groups = {cracky = 3},
on_timer = function(pos, elapsed)
local ran = math.random(1,6)
minetest.set_node(pos,{name="mydice:"..ran})
end
})
local pieces = {
{"Red","red","^[colorize:red:120"},
{"Green","green","^[colorize:green:120"},
{"Yellow","yellow","^[colorize:yellow:120"},
{"Blue","blue","^[colorize:blue:120"},
}
for i in ipairs (pieces) do
local desc = pieces[i][1]
local item = pieces[i][2]
local col = pieces[i][3]
minetest.register_node("mydice:"..item,{
description = desc.." Player",
tiles = {"default_gravel.png"..col},
drawtype = "nodebox",
paramtype = "light",
light_source = 11,
groups = {cracky = 1, dig_immediate=3},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, -0.3125, 0.3125},
{-0.125, -0.3125, -0.125, 0.125, 0.125, 0.125},
{-0.1875, 0.125, -0.1875, 0.1875, 0.3125, 0.1875},
}
}
})
end
minetest.register_node("mydice:reset",{
description = "reset",
tiles = {"default_coal_block.png^default_snowball.png"},
drawtype = "normal",
paramtype = "light",
light_source = 8,
groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mydice").."/schems/board1.mts"
minetest.place_schematic({x=pos.x,y=pos.y-2,z=pos.z},schem,0, "air", true)
end,
})

BIN
mydice/schems/board1.mts Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.