From 8a5739486f52dd29f34374e0a1a3fbfeebe17037 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sun, 19 May 2019 09:48:01 +0100 Subject: [PATCH] added protector_show_interval setting to minetest.conf, code tidy --- README.md | 4 ++++ init.lua | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 132d54d..3f15f7a 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Change log: - 2.5 - Added HUD text to show when player is inside a protected area (updates every 5 seconds) - 2.6 - Add protection against CSM tampering, updated Intllib support (thanks codexp), tweaked block textures - 2.7 - Remove protection field entity when protector has been dug +- 2.8 - Added 'protector_show_interval' setting to minetest.conf, default is 5 Lucky Blocks: 10 @@ -114,6 +115,9 @@ protector_hurt = 2 protector_flip = true - When true players who dig inside a protected area will flipped around to stop them using lag to grief into someone else's build +protector_show_interval +- Number of seconds the protection field is visible, defaults to 5 seconds. + Protector Tool diff --git a/init.lua b/init.lua index c9dd9d2..50e434d 100644 --- a/init.lua +++ b/init.lua @@ -17,6 +17,7 @@ local protector_flip = minetest.settings:get_bool("protector_flip") or false local protector_hurt = tonumber(minetest.settings:get("protector_hurt")) or 0 local protector_spawn = tonumber(minetest.settings:get("protector_spawn") or minetest.settings:get("protector_pvp_spawn")) or 0 +local protector_show = tonumber(minetest.settings:get("protector_show_interval")) or 5 -- get static spawn position local statspawn = minetest.string_to_pos(minetest.settings:get("static_spawnpoint")) @@ -616,7 +617,7 @@ minetest.register_entity("protector:display", { collisionbox = {0, 0, 0, 0, 0, 0}, visual = "wielditem", -- wielditem seems to be scaled to 1.5 times original node size - visual_size = {x = 1.0 / 1.5, y = 1.0 / 1.5}, + visual_size = {x = 0.67, y = 0.67}, textures = {"protector:display_node"}, timer = 0, @@ -625,7 +626,7 @@ minetest.register_entity("protector:display", { self.timer = self.timer + dtime -- remove after 5 seconds - if self.timer > 5 then + if self.timer > protector_show then self.object:remove() end end,