summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.lua9
-rw-r--r--depends.txt2
-rw-r--r--functions.lua9
-rw-r--r--protection.lua8
4 files changed, 23 insertions, 5 deletions
diff --git a/config.lua b/config.lua
index 4c34102..0eb4847 100644
--- a/config.lua
+++ b/config.lua
@@ -15,7 +15,9 @@ local defaults = {
offenseReset = "1440",
adminUser = nil,
chunkSize = "16",
- enableHud = "true"
+ enableHud = "true",
+ noBanTime = 240,
+ noDamageTime = 600
}
for k, v in pairs(defaults) do
@@ -30,3 +32,8 @@ landrush.config:write()
-- These are items that can be dug in unclaimed areas when landrush.config:get_bool("requireClaim") is true
landrush.global_dig_list = {["default:ladder"]=true,["default:leaves"]=true,["default:tree"]=true,["default:grass"]=true,["default:grass_1"]=true,["default:grass_2"]=true,["default:grass_3"]=true,["default:grass_4"]=true}
+if minetest.get_modpath("whoison") then
+ landrush.whoison=true
+else
+ landrush.whoison=false
+end
diff --git a/depends.txt b/depends.txt
index 4cfb8a9..1017fca 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1,2 +1,2 @@
-default
+whoison?
doors \ No newline at end of file
diff --git a/functions.lua b/functions.lua
index 92cad80..839c814 100644
--- a/functions.lua
+++ b/functions.lua
@@ -44,11 +44,18 @@ function landrush.get_owner(pos)
end
function landrush.get_distance(pos1,pos2)
-
if ( pos1 ~= nil and pos2 ~= nil ) then
return math.abs(math.floor(math.sqrt( (pos1.x - pos2.x)^2 + (pos1.z - pos2.z)^2 )))
else
return 0
end
+end
+function landrush.get_timeonline(name)
+ -- a wrapper for whoison.getTimeOnline since whoison is an optional dependancy
+ if ( landrush.whoison == true ) then
+ return (whoison.getTimeOnline(name) / 60)
+ else
+ return -1
+ end
end
diff --git a/protection.lua b/protection.lua
index c5b8f9f..7fbb3bf 100644
--- a/protection.lua
+++ b/protection.lua
@@ -126,10 +126,14 @@ function landrush.protection_violation(pos,name)
end
minetest.chat_send_player(name, "Area owned by "..tostring(owner).." stop trying to dig here!")
- player:set_hp( player:get_hp() - landrush.config:get("offenseDamage") )
+ if ( tonumber(landrush.config:get("noDamageTime")) > landrush.get_timeonline(name) ) then
+ player:set_hp( player:get_hp() - landrush.config:get("offenseDamage") )
+ end
if ( landrush.config:get_bool("autoBan") == true ) then
- landrush.do_autoban(pos,name)
+ if ( tonumber(landrush.config:get("noBanTime")) > landrush.get_timeonline(name) ) then
+ landrush.do_autoban(pos,name)
+ end
end
end