code tidy, make protection field glow in dark

This commit is contained in:
TenPlus1 2019-05-20 16:46:22 +01:00
commit 08a07a76a9
2 changed files with 8 additions and 6 deletions

View file

@ -55,7 +55,7 @@ Change log:
- 2.5 - Added HUD text to show when player is inside a protected area (updates every 5 seconds) - 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.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.7 - Remove protection field entity when protector has been dug
- 2.8 - Added 'protector_show_interval' setting to minetest.conf, default is 5 - 2.8 - Added 'protector_show_interval' setting to minetest.conf [default is 5], make protection field glow in dark.
Lucky Blocks: 10 Lucky Blocks: 10

View file

@ -5,10 +5,11 @@ local S = dofile(MP .. "/intllib.lua")
local F = minetest.formspec_escape local F = minetest.formspec_escape
protector = {} protector = {
protector.mod = "redo" mod = "redo",
protector.modpath = MP modpath = MP,
protector.intllib = S intllib = S
}
local protector_max_share_count = 12 local protector_max_share_count = 12
-- get minetest.conf settings -- get minetest.conf settings
@ -620,12 +621,13 @@ minetest.register_entity("protector:display", {
visual_size = {x = 0.67, y = 0.67}, visual_size = {x = 0.67, y = 0.67},
textures = {"protector:display_node"}, textures = {"protector:display_node"},
timer = 0, timer = 0,
glow = 10,
on_step = function(self, dtime) on_step = function(self, dtime)
self.timer = self.timer + dtime self.timer = self.timer + dtime
-- remove after 5 seconds -- remove after set number of seconds
if self.timer > protector_show then if self.timer > protector_show then
self.object:remove() self.object:remove()
end end