a few new things

master
DonBatman 2016-03-28 05:44:36 -07:00
parent 308a2712d7
commit 2e45e67d54
6 changed files with 255 additions and 2 deletions

View File

@ -64,7 +64,33 @@ Extras are extra neat things that I would like to see on servers. Right now the
#Names Per IP
This is the names_per_ip mod from Krock. It limits the number of accounts that each ip address can have.
This is settable in the settings.txt.
#Guest
There is a setting to decide if you want to allow names with guest in them.
This is settable in settings.txt
#Password
A setting in the settingstxt to allow you to set whether or not you allow empty passwords.
This can be set in minetest.conf file as well.
#Underworld
This might not fit in this mod but I added it here anyway.
This is a teleporter that when set also places a teleporter below at what ever height you set it at.
Place a teleporter and a form opens. Name the teleporter and set the depth of the other. Click set.
When you step into the teleporter you will teleport down. After 10 seconds you can use the teleporter again.
You need the myadmin_levels_super priv to place and destroy the teleporters.

16
guest.lua Normal file
View File

@ -0,0 +1,16 @@
if myadmin.guest == true then
minetest.register_on_prejoinplayer(function(name, ip)
local n = string.find(string.lower(name),"guest")
if n ~= nil then
return "\nThe name Guest is not allowed\n\nPlease pick a Name."
end
end)
end
if minetest.setting_getbool("disallow_empty_password") == false or nil and
myadmin.require_password == true then
minetest.setting_setbool("disallow_empty_password", true)
elseif minetest.setting_getbool("disallow_empty_password") == true or nil and
myadmin.require_password == false then
minetest.setting_setbool("disallow_empty_password", false)
end

View File

@ -19,4 +19,12 @@ dofile(minetest.get_modpath("myadmin").."/privs.lua")
dofile(minetest.get_modpath("myadmin").."/curse.lua")
dofile(minetest.get_modpath("myadmin").."/extras.lua")
dofile(minetest.get_modpath("myadmin").."/start.lua")
dofile(minetest.get_modpath("myadmin").."/underworld.lua")
dofile(minetest.get_modpath("myadmin").."/guest.lua")
dofile(minetest.get_modpath("myadmin").."/npip.lua")
minetest.after(10,
function(params)
minetest.chat_send_all(myadmin.server_message)
end
)

4
npip.lua Executable file → Normal file
View File

@ -1,5 +1,5 @@
-- Created by Krock to stop mass-account-creators
-- License: WTFPL
-- License: DWYWPL
ipnames = {}
ipnames.data = {}
@ -9,7 +9,7 @@ ipnames.save_interval = 120
ipnames.save_time = 0
ipnames.file = minetest.get_worldpath().."/ipnames.txt"
ipnames.name_per_ip_limit = minetest.setting_get("max_names_per_ip") or 5
ipnames.name_per_ip_limit = myadmin.names_per_ip
-- Get accounts self:
minetest.register_chatcommand("whois", {

View File

@ -1,6 +1,13 @@
myadmin.server_name = "My Server"
myadmin.server_message = "Welcome to our server"
myadmin.guest = true
myadmin.names_per_ip = 5
-- spawn_name is the name you use in the chat commant
-- If you are not using the spawn_name then set it to false

196
underworld.lua Normal file
View File

@ -0,0 +1,196 @@
--[[
check for stone when placing underworld?
set underworld teleporter and set meta
make a schematic for underworld
make lvm for schematic placement
decide if this should be a seperate mod
--]]
local tp = {}
minetest.register_node("myadmin:underworld", {
description = "Underworld",
tiles = {
"default_sand.png^[colorize:#000000:255"
},
drawtype = "nodebox",
paramtype = "light",
groups = {oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5625, -0.5, 0.4375, -0.4375, 1.5, 0.5625},
{0.4375, -0.5, 0.4375, 0.5625, 1.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.5625, 1.5, -0.4375},
{-0.5625, -0.5, -0.5625, -0.4375, 1.5, -0.4375},
{-0.5625, -0.5, -0.5625, 0.5625, -0.4375, 0.5625},
{-0.5625, 1.4375, -0.5625, 0.5625, 1.5, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5625, -0.5, 0.4375, -0.4375, 1.5, 0.5625},
{0.4375, -0.5, 0.4375, 0.5625, 1.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.5625, 1.5, -0.4375},
{-0.5625, -0.5, -0.5625, -0.4375, 1.5, -0.4375},
{-0.5625, -0.5, -0.5625, 0.5625, -0.4375, 0.5625},
{-0.5625, 1.4375, -0.5625, 0.5625, 1.5, 0.5625},
}
},
on_place = function(itemstack, placer, pointed_thing)
if minetest.get_player_privs(placer:get_player_name()).myadmin_levels_super == true then
local pos = pointed_thing.above
local top = { x = pos.x, y = pos.y + 1, z = pos.z }
if top.name ~= air then
minetest.chat_send_player(placer, "Not enough room!")
return
end
minetest.set_node(pos, {name = "myadmin:underworld"})
minetest.set_node(top, {name = "myadmin:underworld_block"})
minetest.show_formspec(placer:get_player_name(),"fs",
"size[6,5;]"..
"field[1,1;4.5,1;name;Name;]"..
"field[2,2.5;2,1;depth;Depth;]"..
"button_exit[2,4;2,1;set;set]")
minetest.register_on_player_receive_fields(function(player, fs, fields)
local meta = minetest.get_meta(pos)
local n = fields["name"]
local d = fields["depth"]
if tonumber(d) + pos.y > 15000 then
d = 15000 + pos.y
end
if tonumber(d) + pos.y < 3000 then
d = 3000 + pos.y
end
if d == "" or
d == nil then
d = 5000
end
if fields["name"] or
fields["depth"] or
fields["set"] then
if fields["name"] ~= "" and
fields["depth"] ~= "" then
meta:set_string("name",n)
meta:set_string("infotext",n.." Top at "..d)
meta:set_string("depth",d)
meta:set_string("torb","top")
minetest.forceload_block({x = pos.x, y = pos.y - tonumber(d), z = pos.z})
minetest.set_node({x = pos.x, y = pos.y - tonumber(d), z = pos.z}, {name = "myadmin:underworld"})
minetest.set_node({x = pos.x, y = pos.y - tonumber(d) + 1, z = pos.z}, {name = "myadmin:underworld_block"})
local dmeta = minetest.get_meta({x = pos.x, y = pos.y - tonumber(d), z = pos.z})
dmeta:set_string("name",n.." Underworld")
dmeta:set_string("infotext",n.." Underworld at "..d)
dmeta:set_string("depth",d)
dmeta:set_string("torb","bottom")
end
end
end)
end
end,
on_dig = function(pos, node, player)
if minetest.get_player_privs(player:get_player_name()).myadmin_levels_super == true then
local meta = minetest.get_meta(pos)
local n = meta:get_string("torb")
local below = tonumber(meta:get_string("depth"))
--if below == nil then below = 1 end
local b = { x = pos.x, y = pos.y - below, z = pos.z }
local btop = { x = pos.x, y = pos.y - (below - 1), z = pos.z }
local t = { x = pos.x, y = pos.y + below, z = pos.z }
local ttop = { x = pos.x, y = pos.y + (below + 1), z = pos.z }
local top = { x = pos.x, y = pos.y + 1, z = pos.z }
if n == "top" then
minetest.remove_node(pos)
minetest.remove_node(top)
minetest.remove_node(b)
minetest.remove_node(btop)
elseif n == "bottom" then
minetest.remove_node(pos)
minetest.remove_node(top)
minetest.remove_node(t)
minetest.remove_node(ttop)
end
end
end,
})
minetest.register_node("myadmin:underworld_block", {
tiles = {
{name="myadmin_underworld_ani_blue.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.5}}
},
drawtype = "nodebox",
paramtype = "light",
walkable = false,
pointable = false,
light_source = 12,
node_box = {
type = "fixed",
fixed = {
{-0.4375, -1.4375, -0.4375, 0.4375, 0.4375, 0.4375},
}
}
})
minetest.register_abm({
nodenames = {"myadmin:underworld"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
local t = meta:get_string("name")
local depth = tonumber(meta:get_string("depth"))
if depth == nil then return end
local up = meta:get_string("torb")
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, player in pairs(objs) do
local p = player:get_player_name()
if tp[p] == false then
return
end
tp[p] = true
if up == "top" and p then
tp[p] = false
player:setpos({x = pos.x, y = pos.y - depth, z = pos.z})
minetest.after(10, function()
tp[p] = true
end)
else
tp[p] = false
player:setpos({x = pos.x, y = pos.y + depth, z = pos.z})
minetest.after(10, function()
tp[p] = true
end)
end
end
end
})