Add simple_protection support
This commit is contained in:
parent
c8757c94a0
commit
8ab2107d37
@ -19,7 +19,7 @@ Settings documented in [reference][].
|
||||
### Requirements:
|
||||
|
||||
- Depends: default, tnt
|
||||
- Optional depends: nether, sounds
|
||||
- Optional depends: nether, sounds, simple_protection
|
||||
|
||||
### Links:
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
|
||||
v1.1
|
||||
v1.0-1
|
||||
----
|
||||
- added sound when hit
|
||||
- fixed entity vertical positioning
|
||||
- fixed tnt:boom node left after explosion
|
||||
- added setting to customize spawn nodes
|
||||
- added simple_protection support
|
||||
|
||||
v1.0
|
||||
----
|
||||
|
2
mod.conf
2
mod.conf
@ -4,4 +4,4 @@ description = An explosive nuisance.
|
||||
version = 1.0
|
||||
author = Rui
|
||||
depends = default, tnt
|
||||
optional_depends = nether, sounds
|
||||
optional_depends = nether, sounds, simple_protection
|
||||
|
@ -164,8 +164,21 @@ local function add_drop(drops, item)
|
||||
end
|
||||
end
|
||||
|
||||
local function is_protected(pos, name) return core.is_protected(pos, name) end
|
||||
if core.global_exists("s_protect") then
|
||||
is_protected = function(pos, name)
|
||||
local s_protect_name = name
|
||||
-- simple_protection ignores names with empty strings
|
||||
if s_protect_name == "" then
|
||||
s_protect_name = " "
|
||||
end
|
||||
|
||||
return core.is_protected(pos, name) or not s_protect.can_access(pos, s_protect_name)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy(drops, pos, cid)
|
||||
if core.is_protected(pos, "") then
|
||||
if is_protected(pos, "") then
|
||||
return
|
||||
end
|
||||
local def = cid_data[cid]
|
||||
|
Loading…
Reference in New Issue
Block a user