namespacing
41
mods/pn/.gitignore
vendored
@ -1,41 +0,0 @@
|
||||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.def
|
||||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Emojigit
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,9 +0,0 @@
|
||||
This mod add `setblock` and `place` command
|
||||
|
||||
## Commands
|
||||
|
||||
### /setblock x y z modname:foobar_node & /place x y z modname:foobar_node
|
||||
Place a block at x,y,z (setblock call `minetest.set_node`, and place call `minetest.place_node`)
|
||||
|
||||
### /setblock_heremodname:foobar_node & /place_here modname:foobar_node
|
||||
Place a block at your pos (setblock call `minetest.set_node`, and place call `minetest.place_node`)
|
103
mods/pn/init.lua
@ -1,103 +0,0 @@
|
||||
minetest.register_privilege("setblock", {
|
||||
description = "Player can use place and setblock command.",
|
||||
give_to_singleplayer= false,
|
||||
})
|
||||
|
||||
local function split (inputstr, sep)
|
||||
if sep == nil then
|
||||
sep = "%s"
|
||||
end
|
||||
local t={}
|
||||
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("place", {
|
||||
params = "<x> <y> <x> <nodename>",
|
||||
description = "Place block",
|
||||
privs = {setblock = true},
|
||||
func = function(name, param)
|
||||
splited = split(param," ")
|
||||
if not(tonumber(splited[1]) and tonumber(splited[2]) and tonumber(splited[3])) then
|
||||
return false, "Pos error: please give int!"
|
||||
end
|
||||
x,y,z,node = tonumber(splited[1]),tonumber(splited[2]),tonumber(splited[3]),splited[4]
|
||||
if node == "ignore" then
|
||||
return false, "You can't place \"ignore\"!"
|
||||
end
|
||||
if minetest.registered_nodes[node] then
|
||||
minetest.place_node({x=x, y=y, z=z}, {name=node})
|
||||
return true, "Setted node "..node.." at "..tostring(x)..tostring(y)..tostring(z)
|
||||
else
|
||||
return false, "Cannot place a unknown node."
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("place_here", {
|
||||
params = "<node>",
|
||||
privs = {setblock = true},
|
||||
description = "Place block at player's pos",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "Player is not online."
|
||||
end
|
||||
if param == "ignore" then
|
||||
return false, "You can't place \"ignore\"!"
|
||||
end
|
||||
if minetest.registered_nodes[param] then
|
||||
minetest.place_node(player:get_pos(), {name=param})
|
||||
return true, "Placed node "..param.." at "..tostring(math.floor(player:get_pos().x))..","..tostring(math.floor(player:get_pos().y))..","..tostring(math.floor(player:get_pos().z))
|
||||
else
|
||||
return false, "Cannot place a unknown node."
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- minetest.set_node
|
||||
|
||||
minetest.register_chatcommand("setblock", {
|
||||
params = "<x> <y> <x> <nodename>",
|
||||
privs = {setblock = true},
|
||||
description = "Set a block",
|
||||
func = function(name, param)
|
||||
splited = split(param," ")
|
||||
if not(tonumber(splited[1]) and tonumber(splited[2]) and tonumber(splited[3])) then
|
||||
return false, "Pos error: please give int!"
|
||||
end
|
||||
x,y,z,node = tonumber(splited[1]),tonumber(splited[2]),tonumber(splited[3]),splited[4]
|
||||
if node == "ignore" then
|
||||
return false, "You can't set \"ignore\"!"
|
||||
end
|
||||
if minetest.registered_nodes[node] then
|
||||
minetest.set_node({x=x, y=y, z=z}, {name=node})
|
||||
return true, "Setted node "..node.." at "..tostring(x)..tostring(y)..tostring(z)
|
||||
else
|
||||
return false, "Cannot set a unknown node."
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("setblock_here", {
|
||||
params = "<node>",
|
||||
privs = {setblock = true},
|
||||
description = "Set a block at player's pos",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "Player is not online."
|
||||
end
|
||||
if param == "ignore" then
|
||||
return false, "You can't set \"ignore\"!"
|
||||
end
|
||||
if minetest.registered_nodes[param] then
|
||||
minetest.set_node(player:get_pos(), {name=param})
|
||||
return true, "Setted node "..param.." at "..tostring(math.floor(player:get_pos().x))..","..tostring(math.floor(player:get_pos().y))..","..tostring(math.floor(player:get_pos().z))
|
||||
else
|
||||
return false, "Cannot set a unknown node."
|
||||
end
|
||||
end,
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
name = place_node
|
||||
description = Add `setblock` and `place` command to the game
|
Before Width: | Height: | Size: 2.8 MiB |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 1015 B After Width: | Height: | Size: 1015 B |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 753 B After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |