commit b70afafde98bcc967f55f1d49baf461a849baa77 Author: DonBatman Date: Wed Sep 9 14:26:59 2015 -0600 First Upload diff --git a/chess/board.lua b/chess/board.lua new file mode 100644 index 0000000..47fea30 --- /dev/null +++ b/chess/board.lua @@ -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}, + } + } +}) + + + + + diff --git a/chess/depends.txt b/chess/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/chess/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/chess/init.lua b/chess/init.lua new file mode 100644 index 0000000..8d2dbea --- /dev/null +++ b/chess/init.lua @@ -0,0 +1,3 @@ +dofile(minetest.get_modpath("chess").."/pieces.lua") +dofile(minetest.get_modpath("chess").."/board.lua") +print("[Chess] Loaded!") diff --git a/chess/pieces.lua b/chess/pieces.lua new file mode 100644 index 0000000..8d76d46 --- /dev/null +++ b/chess/pieces.lua @@ -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 + + diff --git a/chess/schems/chess_board.mts b/chess/schems/chess_board.mts new file mode 100644 index 0000000..51b5a46 Binary files /dev/null and b/chess/schems/chess_board.mts differ diff --git a/chess/sounds/ding.mp3 b/chess/sounds/ding.mp3 new file mode 100644 index 0000000..f18ee79 Binary files /dev/null and b/chess/sounds/ding.mp3 differ diff --git a/chess/textures/board_inven.png b/chess/textures/board_inven.png new file mode 100644 index 0000000..c46f115 Binary files /dev/null and b/chess/textures/board_inven.png differ diff --git a/chess/textures/border.png b/chess/textures/border.png new file mode 100644 index 0000000..35ec3d9 Binary files /dev/null and b/chess/textures/border.png differ diff --git a/chess/textures/border_bottom.png b/chess/textures/border_bottom.png new file mode 100644 index 0000000..ca633f0 Binary files /dev/null and b/chess/textures/border_bottom.png differ diff --git a/chess/textures/border_cbl.png b/chess/textures/border_cbl.png new file mode 100644 index 0000000..e0a287c Binary files /dev/null and b/chess/textures/border_cbl.png differ diff --git a/chess/textures/border_cbr.png b/chess/textures/border_cbr.png new file mode 100644 index 0000000..495b746 Binary files /dev/null and b/chess/textures/border_cbr.png differ diff --git a/chess/textures/border_cornerbl.png b/chess/textures/border_cornerbl.png new file mode 100644 index 0000000..9bca522 Binary files /dev/null and b/chess/textures/border_cornerbl.png differ diff --git a/chess/textures/border_cornerbr.png b/chess/textures/border_cornerbr.png new file mode 100644 index 0000000..0a7ef89 Binary files /dev/null and b/chess/textures/border_cornerbr.png differ diff --git a/chess/textures/border_cornertl.png b/chess/textures/border_cornertl.png new file mode 100644 index 0000000..e7fe134 Binary files /dev/null and b/chess/textures/border_cornertl.png differ diff --git a/chess/textures/border_cornertr.png b/chess/textures/border_cornertr.png new file mode 100644 index 0000000..7f9bfb8 Binary files /dev/null and b/chess/textures/border_cornertr.png differ diff --git a/chess/textures/border_ctl.png b/chess/textures/border_ctl.png new file mode 100644 index 0000000..2b6189c Binary files /dev/null and b/chess/textures/border_ctl.png differ diff --git a/chess/textures/border_ctr.png b/chess/textures/border_ctr.png new file mode 100644 index 0000000..7e10e34 Binary files /dev/null and b/chess/textures/border_ctr.png differ diff --git a/chess/textures/border_left.png b/chess/textures/border_left.png new file mode 100644 index 0000000..b1070f7 Binary files /dev/null and b/chess/textures/border_left.png differ diff --git a/chess/textures/border_right.png b/chess/textures/border_right.png new file mode 100644 index 0000000..7971a15 Binary files /dev/null and b/chess/textures/border_right.png differ diff --git a/chess/textures/border_side.png b/chess/textures/border_side.png new file mode 100644 index 0000000..56c473c Binary files /dev/null and b/chess/textures/border_side.png differ diff --git a/chess/textures/border_top.png b/chess/textures/border_top.png new file mode 100644 index 0000000..aea3078 Binary files /dev/null and b/chess/textures/border_top.png differ diff --git a/chess/textures/chess_bboard.png b/chess/textures/chess_bboard.png new file mode 100644 index 0000000..985ecac Binary files /dev/null and b/chess/textures/chess_bboard.png differ diff --git a/chess/textures/chess_bbutton.png b/chess/textures/chess_bbutton.png new file mode 100644 index 0000000..de3ae56 Binary files /dev/null and b/chess/textures/chess_bbutton.png differ diff --git a/chess/textures/chess_beige.png b/chess/textures/chess_beige.png new file mode 100644 index 0000000..14c7dfe Binary files /dev/null and b/chess/textures/chess_beige.png differ diff --git a/chess/textures/chess_black.png b/chess/textures/chess_black.png new file mode 100644 index 0000000..d9be7b0 Binary files /dev/null and b/chess/textures/chess_black.png differ diff --git a/chess/textures/chess_wboard.png b/chess/textures/chess_wboard.png new file mode 100644 index 0000000..faf0ec1 Binary files /dev/null and b/chess/textures/chess_wboard.png differ diff --git a/chess/textures/chess_wbutton.png b/chess/textures/chess_wbutton.png new file mode 100644 index 0000000..b04afbc Binary files /dev/null and b/chess/textures/chess_wbutton.png differ diff --git a/chess/textures/chess_white.png b/chess/textures/chess_white.png new file mode 100644 index 0000000..98afacd Binary files /dev/null and b/chess/textures/chess_white.png differ diff --git a/chess/textures/chessblack.png b/chess/textures/chessblack.png new file mode 100644 index 0000000..67d9550 Binary files /dev/null and b/chess/textures/chessblack.png differ diff --git a/chess/textures/chesswhite.png b/chess/textures/chesswhite.png new file mode 100644 index 0000000..f23913d Binary files /dev/null and b/chess/textures/chesswhite.png differ diff --git a/chess/textures/king_b_inven.png b/chess/textures/king_b_inven.png new file mode 100644 index 0000000..d669567 Binary files /dev/null and b/chess/textures/king_b_inven.png differ diff --git a/chess/textures/king_w_inven.png b/chess/textures/king_w_inven.png new file mode 100644 index 0000000..9e43d81 Binary files /dev/null and b/chess/textures/king_w_inven.png differ diff --git a/chess/textures/queen_b_inven.png b/chess/textures/queen_b_inven.png new file mode 100644 index 0000000..7ab4793 Binary files /dev/null and b/chess/textures/queen_b_inven.png differ diff --git a/chess/textures/queen_w_inven.png b/chess/textures/queen_w_inven.png new file mode 100644 index 0000000..b850ced Binary files /dev/null and b/chess/textures/queen_w_inven.png differ diff --git a/chess/textures/white_b.png b/chess/textures/white_b.png new file mode 100644 index 0000000..30d2ee6 Binary files /dev/null and b/chess/textures/white_b.png differ diff --git a/chess/textures/white_bl.png b/chess/textures/white_bl.png new file mode 100644 index 0000000..69d58ee Binary files /dev/null and b/chess/textures/white_bl.png differ diff --git a/chess/textures/white_br.png b/chess/textures/white_br.png new file mode 100644 index 0000000..2f4520e Binary files /dev/null and b/chess/textures/white_br.png differ diff --git a/chess/textures/white_t.png b/chess/textures/white_t.png new file mode 100644 index 0000000..fe0a5ba Binary files /dev/null and b/chess/textures/white_t.png differ diff --git a/chess/textures/white_tl.png b/chess/textures/white_tl.png new file mode 100644 index 0000000..0ef7530 Binary files /dev/null and b/chess/textures/white_tl.png differ diff --git a/chess/textures/white_tr.png b/chess/textures/white_tr.png new file mode 100644 index 0000000..e2bc408 Binary files /dev/null and b/chess/textures/white_tr.png differ diff --git a/modpack.txt b/modpack.txt new file mode 100644 index 0000000..e69de29 diff --git a/mydice/init.lua b/mydice/init.lua new file mode 100644 index 0000000..63eda72 --- /dev/null +++ b/mydice/init.lua @@ -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, +}) + + + + + + + + + + + + + + + + + + diff --git a/mydice/schems/board1.mts b/mydice/schems/board1.mts new file mode 100644 index 0000000..55f7dbc Binary files /dev/null and b/mydice/schems/board1.mts differ diff --git a/mydice/textures/mydice_1.png b/mydice/textures/mydice_1.png new file mode 100644 index 0000000..48d8efb Binary files /dev/null and b/mydice/textures/mydice_1.png differ diff --git a/mydice/textures/mydice_1.xcf b/mydice/textures/mydice_1.xcf new file mode 100644 index 0000000..0224b55 Binary files /dev/null and b/mydice/textures/mydice_1.xcf differ diff --git a/mydice/textures/mydice_2.png b/mydice/textures/mydice_2.png new file mode 100644 index 0000000..a3acf7e Binary files /dev/null and b/mydice/textures/mydice_2.png differ diff --git a/mydice/textures/mydice_3.png b/mydice/textures/mydice_3.png new file mode 100644 index 0000000..534e635 Binary files /dev/null and b/mydice/textures/mydice_3.png differ diff --git a/mydice/textures/mydice_4.png b/mydice/textures/mydice_4.png new file mode 100644 index 0000000..5a5e2c2 Binary files /dev/null and b/mydice/textures/mydice_4.png differ diff --git a/mydice/textures/mydice_5.png b/mydice/textures/mydice_5.png new file mode 100644 index 0000000..7143d6c Binary files /dev/null and b/mydice/textures/mydice_5.png differ diff --git a/mydice/textures/mydice_6.png b/mydice/textures/mydice_6.png new file mode 100644 index 0000000..670f378 Binary files /dev/null and b/mydice/textures/mydice_6.png differ diff --git a/mydice/textures/mydice_ani.png b/mydice/textures/mydice_ani.png new file mode 100644 index 0000000..4805c7a Binary files /dev/null and b/mydice/textures/mydice_ani.png differ diff --git a/mydice/textures/mydice_ani.xcf b/mydice/textures/mydice_ani.xcf new file mode 100644 index 0000000..731baa3 Binary files /dev/null and b/mydice/textures/mydice_ani.xcf differ