ratelimit and syntax bugfix
parent
920849eb33
commit
a88101fef2
14
init.lua
14
init.lua
|
@ -1,7 +1,10 @@
|
|||
local aS = minetest.get_translator("areas")
|
||||
local S = minetest.get_translator("protect_block_area")
|
||||
|
||||
local protector_radius = tonumber(minetest.settings:get("protector_radius")) or 5
|
||||
local protector_radius = tonumber(minetest.settings:get("area_protector_radius")) or tonumber(minetest.settings:get("protector_radius")) or 5
|
||||
local protector_placing_delay = tonumber(minetest.settings:get("area_protector_delay")) or 2
|
||||
|
||||
local in_delay = {}
|
||||
|
||||
local function get_node_place_position(pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return false end
|
||||
|
@ -37,6 +40,10 @@ minetest.register_node("protect_block_area:protect", {
|
|||
return itemstack
|
||||
end
|
||||
local pname = placer:get_player_name()
|
||||
if in_delay[pname] then
|
||||
minetest.chat_send_player(pname,S("You cannot place more than 1 protector blocks within @1 seconds!",protector_placing_delay))
|
||||
return itemstack
|
||||
end
|
||||
local privs = minetest.get_player_privs(pname)
|
||||
if not privs[areas.config.self_protection_privilege] then
|
||||
minetest.chat_send_player(pname,S("You are not allowed to protect!"))
|
||||
|
@ -70,6 +77,10 @@ minetest.register_node("protect_block_area:protect", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("AreaID",id)
|
||||
meta:set_string("infotext",S("Area protection block, ID: @1",id))
|
||||
in_delay[pname] = true
|
||||
minetest.after(protector_placing_delay,function()
|
||||
in_delay[pname] = false
|
||||
end)
|
||||
return itemstack
|
||||
end,
|
||||
on_dig = function(pos,node,digger)
|
||||
|
@ -120,4 +131,5 @@ if not minetest.global_exists("protector") then
|
|||
{"default:stone", "default:stone", "default:stone"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# textdomain: protect_block_area
|
||||
Protection Block=保護區方塊
|
||||
Create areas quickly=快速保護區域
|
||||
You cannot place more than 1 protector blocks within @1 seconds!=在@1秒之內只可放置一個保護區方塊!
|
||||
You are not allowed to protect!=你無權保護區域!
|
||||
Area protection block, ID: @1=保護區方塊,區域ID:@1
|
||||
Failed.=失敗。
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# textdomain: protect_block_area
|
||||
Protection Block=保護區方塊
|
||||
Create areas quickly=快速保護區域
|
||||
You are not allowed to protect!=你無權保護區域!
|
||||
Area protection block, ID: @1=保護區方塊,區域ID:@1
|
||||
Failed.=失敗。
|
|
@ -1,6 +1,7 @@
|
|||
# textdomain: protect_block_area
|
||||
Protection Block=
|
||||
Create areas quickly=
|
||||
You cannot place more than 1 protector blocks within @1 seconds!=
|
||||
You are not allowed to protect!=
|
||||
Area protection block, ID: @1=
|
||||
Failed.=
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Area protector radius (fallback: protector_radius)
|
||||
area_protector_radius (Area protector radius) int 5
|
||||
|
||||
# Area protector placing delay
|
||||
area_protector_delay (Area protector placing delay) int 2
|
Loading…
Reference in New Issue