164
chess/board.lua
|
@ -1,164 +0,0 @@
|
|||
|
||||
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,3 +0,0 @@
|
|||
dofile(minetest.get_modpath("chess").."/pieces.lua")
|
||||
dofile(minetest.get_modpath("chess").."/board.lua")
|
||||
print("[Chess] Loaded!")
|
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 131 B |
|
@ -0,0 +1,165 @@
|
|||
|
||||
minetest.register_node("mycheckers:board", {
|
||||
description = "Checker Board",
|
||||
inventory_image = "mycheckers_board_inven.png",
|
||||
wield_image = "mycheckers_board_inven.png",
|
||||
light_source = 5,
|
||||
tiles = {"mycheckers_border_cbl.png","mycheckers_border.png","mycheckers_border_side.png","mycheckers_border_side.png","mycheckers_border_side.png","mycheckers_border_side.png"},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local schem = minetest.get_modpath("mycheckers").."/schems/mycheckersboard.mts"
|
||||
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
local board = {
|
||||
{"mycheckers:border" ,{"mycheckers_border.png"}},
|
||||
|
||||
{"mycheckers:borderb" ,{
|
||||
"mycheckers_border_bottom.png",
|
||||
"mycheckers_border.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png"}},
|
||||
|
||||
{"mycheckers:bordercbl" ,{
|
||||
"mycheckers_border_cornerbl.png",
|
||||
"mycheckers_border.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png"}},
|
||||
|
||||
{"mycheckers:borderocbr",{
|
||||
"mycheckers_border_cbr.png",
|
||||
"mycheckers_border.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png",
|
||||
"mycheckers_border_side.png"}}
|
||||
,
|
||||
|
||||
{"mycheckers:white" ,{"mycheckers_wboard.png"}},
|
||||
{"mycheckers:black" ,{"mycheckers_bboard.png"}},
|
||||
|
||||
}
|
||||
|
||||
for i in ipairs (board) do
|
||||
local item = board[i][1]
|
||||
local img = board[i][2]
|
||||
|
||||
minetest.register_node(item, {
|
||||
description = item,
|
||||
light_source = 5,
|
||||
tiles = img,
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 1, dig_immediate=3,not_in_creative_inventory=1},
|
||||
})
|
||||
end
|
||||
|
||||
local regp = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1875, -0.5, -0.3125, 0.1875, -0.3125, 0.3125},
|
||||
{-0.3125, -0.5, -0.1875, 0.3125, -0.3125, 0.1875},
|
||||
{-0.1875, -0.3125, -0.1875, 0.1875, -0.25, 0.1875},
|
||||
}
|
||||
}
|
||||
local crown = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1875, -0.5, -0.3125, 0.1875, -0.3125, 0.3125},
|
||||
{-0.3125, -0.5, -0.1875, 0.3125, -0.3125, 0.1875},
|
||||
{-0.3125, -0.25, -0.1875, 0.3125, -0.0625, 0.1875},
|
||||
{-0.1875, -0.25, -0.3125, 0.1875, -0.0625, 0.3125},
|
||||
{-0.1875, -0.3125, -0.1875, 0.1875, -0.25, 0.1875},
|
||||
{-0.1875, -0.0625, -0.1875, 0.1875, 0, 0.1875},
|
||||
}
|
||||
}
|
||||
|
||||
minetest.register_node("mycheckers:redp_c", {
|
||||
description = "Red Crown",
|
||||
light_source = 5,
|
||||
tiles = {"default_acacia_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
drop = "mycheckers:redp 2",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky = 1, dig_immediate=3,not_in_creative_inventory=1},
|
||||
node_box = crown,
|
||||
})
|
||||
minetest.register_node("mycheckers:blackp_c", {
|
||||
description = "Black Crown",
|
||||
light_source = 5,
|
||||
tiles = {"default_obsidian.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
drop = "mycheckers:blackp 2",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky = 1, dig_immediate=3,not_in_creative_inventory=1},
|
||||
node_box = crown,
|
||||
})
|
||||
minetest.register_node("mycheckers:blackp", {
|
||||
description = "Black Piece",
|
||||
light_source = 5,
|
||||
tiles = {"default_obsidian.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky = 1, dig_immediate=3,not_in_creative_inventory=1},
|
||||
node_box = regp,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if nodeu.name == "mycheckers:blackp" and
|
||||
node.name == "mycheckers:blackp" then
|
||||
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name = "mycheckers:blackp_c"})
|
||||
minetest.set_node(pos,{name = "air"})
|
||||
elseif nodeu ~= "mycheckers:blackp" then
|
||||
minetest.set_node(pos,{name="mycheckers:blackp"})
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
minetest.register_node("mycheckers:redp", {
|
||||
description = "Red Piece",
|
||||
light_source = 5,
|
||||
tiles = {"default_acacia_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky = 1, dig_immediate=3,not_in_creative_inventory=1},
|
||||
node_box = regp,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
|
||||
if nodeu.name == "mycheckers:redp" and
|
||||
node.name == "mycheckers:redp" then
|
||||
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name = "mycheckers:redp_c"})
|
||||
minetest.set_node(pos,{name = "air"})
|
||||
elseif nodeu ~= "mycheckers:redp" then
|
||||
minetest.set_node(pos,{name="mycheckers:redp"})
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
dofile(minetest.get_modpath("mycheckers").."/board.lua")
|
||||
print("[myCheckers] Loaded!")
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 113 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 83 B After Width: | Height: | Size: 83 B |
|
@ -0,0 +1,179 @@
|
|||
|
||||
minetest.register_node("mychess:board", {
|
||||
description = "Chess Board",
|
||||
inventory_image = "mychess_board_inven.png",
|
||||
wield_image = "mychess_board_inven.png",
|
||||
light_source = 5,
|
||||
tiles = {"mychess_border_cbl.png","mychess_border.png","mychess_border_side.png","mychess_border_side.png","mychess_border_side.png","mychess_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("mychess").."/schems/mychessboard.mts"
|
||||
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
|
||||
--Board Border
|
||||
|
||||
local board = {
|
||||
{"mychess:border" ,{"mychess_border.png"}},
|
||||
|
||||
{"mychess:borderb" ,{
|
||||
"mychess_border_bottom.png",
|
||||
"mychess_border.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png"}},
|
||||
|
||||
{"mychess:bordercbl" ,{
|
||||
"mychess_border_cornerbl.png",
|
||||
"mychess_border.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png"}},
|
||||
|
||||
{"mychess:borderocbr",{
|
||||
"mychess_border_cbr.png",
|
||||
"mychess_border.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png",
|
||||
"mychess_border_side.png"}}
|
||||
,
|
||||
|
||||
{"mychess:white" ,{"mychess_wboard.png"}},
|
||||
{"mychess:black" ,{"mychess_bboard.png"}},
|
||||
|
||||
{"mychess:whitet",{
|
||||
"mychess_white_t.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png"}},
|
||||
|
||||
{"mychess:whitebl" ,{
|
||||
"mychess_white_bl.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png",
|
||||
"mychess_wboard.png"},},
|
||||
|
||||
}
|
||||
|
||||
for i in ipairs (board) do
|
||||
local item = board[i][1]
|
||||
local img = board[i][2]
|
||||
|
||||
minetest.register_node(item, {
|
||||
description = item,
|
||||
light_source = 5,
|
||||
tiles = img,
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 3, dig_immediate=3,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("mychess_ding", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
tmp_node = {name="mychess:turnwhite", param1=me.param1, param2=me.param2}
|
||||
else
|
||||
state = 1
|
||||
minetest.sound_play("mychess_ding", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
tmp_node = {name="mychess:turnblack", param1=me.param1, param2=me.param2}
|
||||
end
|
||||
update_node(pos, tmp_node)
|
||||
meta:set_int("state", state)
|
||||
end
|
||||
|
||||
minetest.register_node("mychess:turnblack", {
|
||||
light_source = 5,
|
||||
tiles = {"mychess_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("mychess:turnwhite", {
|
||||
light_source = 5,
|
||||
tiles = {"mychess_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("mychess:stand", {
|
||||
tiles = {
|
||||
"mychess_beige.png",
|
||||
"mychess_beige.png",
|
||||
"mychess_beige.png",
|
||||
"mychess_beige.png",
|
||||
"mychess_beige.png",
|
||||
"mychess_beige.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 1, not_in_creative_inventory=0},
|
||||
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},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,3 @@
|
|||
dofile(minetest.get_modpath("mychess").."/pieces.lua")
|
||||
dofile(minetest.get_modpath("mychess").."/board.lua")
|
||||
print("[myChess] Loaded!")
|
|
@ -139,15 +139,15 @@ local rook = {
|
|||
|
||||
|
||||
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},
|
||||
{"mychess:king_white","White King","mychess_king_w_inven.png","default_pine_wood.png",king,kings},
|
||||
{"mychess:king_top_white","","","default_pine_wood.png",kingt,kingts},
|
||||
{"mychess:king_black","Black King","mychess_king_b_inven.png","default_junglewood.png",king,kings},
|
||||
{"mychess:king_top_black","","","default_junglewood.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},
|
||||
{"mychess:queen_white","White Queen","mychess_queen_w_inven.png","default_pine_wood.png",queen,queens},
|
||||
{"mychess:queen_top_white","","","default_pine_wood.png",queent,queents},
|
||||
{"mychess:queen_black","Black Queen","mychess_queen_b_inven.png","default_junglewood.png",queen,queens},
|
||||
{"mychess:queen_top_black","","","default_junglewood.png",queent,queents},
|
||||
}
|
||||
for i in ipairs (peices) do
|
||||
local item = peices[i][1]
|
||||
|
@ -172,14 +172,14 @@ minetest.register_node(item, {
|
|||
|
||||
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"})
|
||||
if node.name == "mychess:king_white" then
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "mychess:king_top_white"})
|
||||
elseif node.name == "mychess:king_black" then
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "mychess:king_top_black"})
|
||||
elseif node.name == "mychess:queen_white" then
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "mychess:queen_top_white"})
|
||||
elseif node.name == "mychess:queen_black" then
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "mychess:queen_top_black"})
|
||||
end
|
||||
|
||||
end,
|
||||
|
@ -187,21 +187,21 @@ minetest.register_node(item, {
|
|||
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
|
||||
if node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess: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
|
||||
elseif node.name == "mychess:queen_top_black" then
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end
|
||||
end,
|
||||
|
@ -218,17 +218,17 @@ minetest.register_node(item, {
|
|||
})
|
||||
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},
|
||||
{"mychess:knight_white","White Knight","myknight_w_inven.png","default_pine_wood.png^[transformR90",knight},
|
||||
{"mychess:knight_black","Black Knight","myknight_b_inven.png","default_junglewood.png^[transformR90",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},
|
||||
{"mychess:pon_white","White Pon","mypon_w_inven.png","default_pine_wood.png^[transformR90",pon},
|
||||
{"mychess:pon_black","Black Pon","mypon_b_inven.png","default_junglewood.png^[transformR90",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},
|
||||
{"mychess:bishop_white","White Bishop","mybishop_w_inven.png","default_pine_wood.png^[transformR90",bishop},
|
||||
{"mychess:bishop_black","Black Bishop","mybishop_b_inven.png","default_junglewood.png^[transformR90",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},
|
||||
{"mychess:rook_white","White Rook","myrook_w_inven.png","default_pine_wood.png^[transformR90",rook},
|
||||
{"mychess:rook_black","Black Rook","myrook_b_inven.png","default_junglewood.png^[transformR90",rook},
|
||||
}
|
||||
for i in ipairs (peices) do
|
||||
local item = peices[i][1]
|
||||
|
@ -241,7 +241,7 @@ minetest.register_node(item, {
|
|||
description = desc,
|
||||
-- inventory_image = inv,
|
||||
light_source = 7,
|
||||
tiles = {img.."^[transformR90"},
|
||||
tiles = {img},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -264,8 +264,8 @@ minetest.register_node(item, {
|
|||
elseif par2 == 5 then
|
||||
par2 = 1
|
||||
end
|
||||
if node.name == "chess:knight_black" then
|
||||
minetest.set_node({pos},{name = "chess:knight_black", param2 = par2})
|
||||
if node.name == "mychess:knight_black" then
|
||||
minetest.set_node({pos},{name = "mychess:knight_black", param2 = par2})
|
||||
end
|
||||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
After Width: | Height: | Size: 113 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 300 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 83 B |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
106
mydice/init.lua
|
@ -1,106 +0,0 @@
|
|||
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,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
local dice = {
|
||||
{"mylittle_bg:1",{"mylittle_bg_1.png","mylittle_bg_2.png","mylittle_bg_3.png","mylittle_bg_4.png","mylittle_bg_5.png","mylittle_bg_6.png"},"1"},
|
||||
{"mylittle_bg:2",{"mylittle_bg_2.png","mylittle_bg_3.png","mylittle_bg_4.png","mylittle_bg_5.png","mylittle_bg_6.png","mylittle_bg_1.png"},"2"},
|
||||
{"mylittle_bg:3",{"mylittle_bg_3.png","mylittle_bg_4.png","mylittle_bg_5.png","mylittle_bg_6.png","mylittle_bg_1.png","mylittle_bg_2.png"},"3"},
|
||||
{"mylittle_bg:4",{"mylittle_bg_4.png","mylittle_bg_5.png","mylittle_bg_6.png","mylittle_bg_1.png","mylittle_bg_2.png","mylittle_bg_3.png"},"4"},
|
||||
{"mylittle_bg:5",{"mylittle_bg_5.png","mylittle_bg_6.png","mylittle_bg_1.png","mylittle_bg_2.png","mylittle_bg_3.png","mylittle_bg_4.png"},"5"},
|
||||
{"mylittle_bg:6",{"mylittle_bg_6.png","mylittle_bg_1.png","mylittle_bg_2.png","mylittle_bg_3.png","mylittle_bg_4.png","mylittle_bg_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, not_in_creative_inventory=1},
|
||||
|
||||
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="mylittle_bg:roll"})
|
||||
timer:start(2)
|
||||
end,
|
||||
|
||||
})
|
||||
end
|
||||
minetest.register_node("mylittle_bg:roll",{
|
||||
description = d3,
|
||||
tiles = {
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
{name="mylittle_bg_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3, not_in_creative_inventory=1},
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local ran = math.random(1,6)
|
||||
minetest.set_node(pos,{name="mylittle_bg:"..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("mylittle_bg:"..item,{
|
||||
description = desc.." Player",
|
||||
tiles = {"default_gravel.png"..col},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
light_source = 11,
|
||||
groups = {cracky = 1, dig_immediate=3, not_in_creative_inventory=1},
|
||||
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("mylittle_bg:board",{
|
||||
description = "Little Board Game",
|
||||
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("mylittle_bg").."/schems/my_little_bg.mts"
|
||||
minetest.place_schematic({x=pos.x,y=pos.y-2,z=pos.z},schem,0, "air", true)
|
||||
end,
|
||||
})
|
||||
local signs = {
|
||||
{"1","red","^[colorize:red:120"},
|
||||
{"2","green","^[colorize:green:120"},
|
||||
{"3","yellow","^[colorize:yellow:120"},
|
||||
{"4","blue","^[colorize:blue:120"},
|
||||
}
|
||||
for i in ipairs (signs) do
|
||||
local desc = signs[i][1]
|
||||
local item = signs[i][2]
|
||||
local col = signs[i][3]
|
||||
|
||||
minetest.register_node("mylittle_bg:sign"..desc,{
|
||||
description = "sign"..desc,
|
||||
tiles = {"mylittle_bg_sign"..desc..".png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
light_source = 11,
|
||||
groups = {cracky = 1, not_in_creative_inventory=1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4375, -0.375, 0.4375, 0.4375, 0.3125, 0.5},
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |