Added privs for use on a server.

master
NathanSalapat 2016-02-14 18:27:20 -06:00
parent 7ed435e9c2
commit 61e3371403
16 changed files with 179 additions and 64 deletions

View File

@ -28,3 +28,5 @@ There is no craft for these. Use /giveme or creative to get the placer block.
Place the block and right click it. The schematic places to the north east.(+x,+z) Place the block and right click it. The schematic places to the north east.(+x,+z)
For more information please view the topic on the forum. https://forum.minetest.net/viewtopic.php?f=9&t=13209 For more information please view the topic on the forum. https://forum.minetest.net/viewtopic.php?f=9&t=13209
This version of the mod has been modified for server use, basically you need to have the myboardgames privilege to place the boards, by default this isn't granted to singleplayer. ~Nathan.S

View File

@ -1,3 +1,8 @@
minetest.register_privilege("myboardgames", {
description = "Place board games",
give_to_singleplayer = false
})
minetest.register_node("mycanadiancheckers:board", { minetest.register_node("mycanadiancheckers:board", {
description = "Canadian Checkers", description = "Canadian Checkers",
@ -10,11 +15,17 @@ minetest.register_node("mycanadiancheckers:board", {
groups = {cracky = 1}, groups = {cracky = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mycanadiancheckers").."/schems/mycanadiancheckers.mts" local schem = minetest.get_modpath("mycanadiancheckers").."/schems/mycanadiancheckers.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local board = { local board = {

View File

@ -10,11 +10,17 @@ minetest.register_node("mycheckers:board", {
groups = {cracky = 1}, groups = {cracky = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mycheckers").."/schems/mycheckersboard.mts" 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) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local board = { local board = {

View File

@ -10,11 +10,17 @@ minetest.register_node("mychess:board", {
groups = {cracky = 3}, groups = {cracky = 3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mychess").."/schems/mychessboard.mts" 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) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })

View File

@ -124,8 +124,15 @@ minetest.register_node("myconnect4:reset",{
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1}, groups = {cracky=1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("myconnect4").."/schems/myconnect4.mts" local schem = minetest.get_modpath("myconnect4").."/schems/myconnect4.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })

View File

@ -7,10 +7,17 @@ minetest.register_node("mydiamondblock:block",{
paramtype = "light", paramtype = "light",
light_source = 8, light_source = 8,
groups = {cracky = 1}, groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mydiamondblock").."/schems/mydiamondblock.mts" local schem = minetest.get_modpath("mydiamondblock").."/schems/mydiamondblock.mts"
minetest.place_schematic(pos,schem,0, "air", true) minetest.place_schematic(pos,schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
for blues = 1,6 do for blues = 1,6 do
local blue = blues local blue = blues

View File

@ -10,11 +10,17 @@ minetest.register_node("mydraughts:board", {
groups = {cracky = 1}, groups = {cracky = 1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mydraughts").."/schems/mydraughts.mts" local schem = minetest.get_modpath("mydraughts").."/schems/mydraughts.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local board = { local board = {

View File

@ -41,9 +41,16 @@ minetest.register_node("mygomoku:placer",{
groups = {cracky=3}, groups = {cracky=3},
light_source = 5, light_source = 5,
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mygomoku").."/schems/mygomoku.mts" local schem = minetest.get_modpath("mygomoku").."/schems/mygomoku.mts"
minetest.place_schematic(pos,schem,0, "air", true) minetest.place_schematic(pos,schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
minetest.register_alias("mygomoku:stone_brown","mygomoku:stone_black") minetest.register_alias("mygomoku:stone_brown","mygomoku:stone_black")

View File

@ -83,10 +83,17 @@ minetest.register_node("mylittle_bg:board",{
paramtype = "light", paramtype = "light",
light_source = 8, light_source = 8,
groups = {cracky = 1}, groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mylittle_bg").."/schems/my_little_bg.mts" 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) minetest.place_schematic({x=pos.x,y=pos.y-2,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local signs = { local signs = {
{"1","red","^[colorize:red:120"}, {"1","red","^[colorize:red:120"},

View File

@ -7,10 +7,17 @@ minetest.register_node("mymazes:block1",{
paramtype = "light", paramtype = "light",
light_source = 8, light_source = 8,
groups = {cracky = 1}, groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mymazes").."/schems/mymaze1.mts" local schem = minetest.get_modpath("mymazes").."/schems/mymaze1.mts"
minetest.place_schematic(pos,schem,0, "air", true) minetest.place_schematic(pos,schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
minetest.register_node("mymazes:block2",{ minetest.register_node("mymazes:block2",{
description = "Maze 2", description = "Maze 2",
@ -21,8 +28,15 @@ minetest.register_node("mymazes:block2",{
paramtype = "light", paramtype = "light",
light_source = 8, light_source = 8,
groups = {cracky = 1}, groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mymazes").."/schems/mymaze2.mts" local schem = minetest.get_modpath("mymazes").."/schems/mymaze2.mts"
minetest.place_schematic(pos,schem,0, "air", true) minetest.place_schematic(pos,schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })

View File

@ -68,8 +68,15 @@ minetest.register_node("mypachisi:placer",{
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3}, groups = {cracky=3},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mypachisi").."/schems/mypachisi.mts" local schem = minetest.get_modpath("mypachisi").."/schems/mypachisi.mts"
minetest.place_schematic(pos,schem,0, "air", true) minetest.place_schematic(pos,schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
dofile(minetest.get_modpath("mypachisi").."/dice.lua") dofile(minetest.get_modpath("mypachisi").."/dice.lua")

View File

@ -7,10 +7,17 @@ minetest.register_node("mypitfall:block",{
paramtype = "light", paramtype = "light",
light_source = 8, light_source = 8,
groups = {cracky = 1}, groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mypitfall").."/schems/mypitfall1.mts" local schem = minetest.get_modpath("mypitfall").."/schems/mypitfall1.mts"
minetest.place_schematic({x=pos.x,y=pos.y-9,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y-9,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
minetest.register_node("mypitfall:swamp_water", { minetest.register_node("mypitfall:swamp_water", {
description = "Swamp Water", description = "Swamp Water",

View File

@ -135,9 +135,16 @@ minetest.register_node("mys_n_l:placer",{
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3}, groups = {cracky=3},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mys_n_l").."/schems/mys_n_l.mts" local schem = minetest.get_modpath("mys_n_l").."/schems/mys_n_l.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local pieces = { local pieces = {
{"Red","red","^[colorize:red:120"}, {"Red","red","^[colorize:red:120"},

View File

@ -71,9 +71,16 @@ minetest.register_node("mys_n_l_mini:placer",{
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3}, groups = {cracky=3},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mys_n_l_mini").."/schems/mys_n_l_mini.mts" local schem = minetest.get_modpath("mys_n_l_mini").."/schems/mys_n_l_mini.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
local pieces = { local pieces = {
{"Red","red","^[colorize:red:120"}, {"Red","red","^[colorize:red:120"},

View File

@ -72,8 +72,15 @@ minetest.register_node("mytrouble:placer",{
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3}, groups = {cracky=3},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("mytrouble").."/schems/mytrouble.mts" local schem = minetest.get_modpath("mytrouble").."/schems/mytrouble.mts"
minetest.place_schematic({x=pos.x-1,y=pos.y,z=pos.z-1},schem,0, "air", true) minetest.place_schematic({x=pos.x-1,y=pos.y,z=pos.z-1},schem,0, "air", true)
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
dofile(minetest.get_modpath("mytrouble").."/dice.lua") dofile(minetest.get_modpath("mytrouble").."/dice.lua")

View File

@ -229,11 +229,18 @@ end,
drawtype = "normal", drawtype = "normal",
paramtype = "light", paramtype = "light",
groups = {oddly_breakable_by_hand = 1}, groups = {oddly_breakable_by_hand = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing) on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("myuno").."/schems/myuno.mts" local schem = minetest.get_modpath("myuno").."/schems/myuno.mts"
minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true) minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
count = 0 count = 0
end, end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
else
minetest.remove_node(pos)
return true
end
end,
}) })
minetest.register_node("myuno:placer",{ minetest.register_node("myuno:placer",{