[simple_protection] Update to Git commit 69b2dee:
https://github.com/SmallJoker/simple_protection/tree/69b2dee
This commit is contained in:
parent
f367d17c17
commit
56b14a4181
@ -85,7 +85,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||
* [wardrobe][] ([WTFPL][lic.wtfpl]) -- version: [1.1-2-c48b011 Git][ver.wardrobe] *2015-05-21*
|
||||
* protection/
|
||||
* [areas][] ([LGPL][lic.lgpl2.1]) -- version [289d0e6 Git][ver.areas] *2017-06-09*
|
||||
* [simple_protection][] ([WTFPL][lic.wtfpl]) -- version [2cdb431 Git][ver.simple_protection] *2017-07-03* ([patched][patch.simple_protection])
|
||||
* [simple_protection][] ([WTFPL][lic.wtfpl]) -- version [69b2dee Git][ver.simple_protection] *2017-07-09*
|
||||
* signs/
|
||||
* [signs_lib][] ([BSD][lic.signs_lib] / [WTFPL][lic.wtfpl]) -- version: [3e00159 Git][ver.signs_lib] *2017-05-20* ([patched][patch.signs_lib])
|
||||
* sound/
|
||||
@ -496,7 +496,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||
[ver.quartz]: https://github.com/minetest-mods/quartz/tree/00ca4eb
|
||||
[ver.rainbow_ore]: https://github.com/FsxShader2012/rainbow_ore/tree/6e77693
|
||||
[ver.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/3e00159
|
||||
[ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/2cdb431
|
||||
[ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/69b2dee
|
||||
[ver.slingshot]: https://github.com/AntumMT/mod-slingshot/tree/ef698e8
|
||||
[ver.sneeker]: https://github.com/AntumMT/mod-sneeker/tree/a56b9c2
|
||||
[ver.snowdrift]: https://github.com/paramat/snowdrift/tree/fcb0537
|
||||
@ -579,7 +579,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||
[patch.quartz]: https://github.com/AntumMT/mod-quartz/tree/d23dabd
|
||||
[patch.rainbow_ore]: https://github.com/AntumMT/mod-rainbow_ore/tree/0227a86
|
||||
[patch.signs_lib]: https://github.com/AntumMT/mod-signs_lib/tree/47d3dd0
|
||||
[patch.simple_protection]: https://github.com/AntumMT/mod-simple_protection/tree/1b924d0
|
||||
[patch.snowdrift]: https://github.com/AntumMT/mod-snowdrift/tree/1b9da4f
|
||||
[patch.spawneggs]: https://github.com/AntumMT/mod-spawneggs/tree/f2cc4cc
|
||||
[patch.technic]: https://github.com/AntumMT/mp-technic/tree/bb388d5
|
||||
|
@ -40,8 +40,10 @@ s_protect.can_access = function(pos, player_name)
|
||||
if player_name == ":pipeworks" then
|
||||
return true
|
||||
end
|
||||
-- Admin power
|
||||
if minetest.check_player_privs(player_name, {simple_protection=true}) then
|
||||
|
||||
-- Admin power, handle privileges
|
||||
local privs = minetest.get_player_privs(player_name)
|
||||
if privs.simple_protection or privs.protection_bypass then
|
||||
return true
|
||||
end
|
||||
|
||||
@ -82,24 +84,39 @@ s_protect.can_access = function(pos, player_name)
|
||||
return false
|
||||
end
|
||||
|
||||
local function get_location(pos_)
|
||||
local pos = vector.round(pos_)
|
||||
return vector.floor({
|
||||
x = pos.x / s_protect.claim_size,
|
||||
y = (pos.y + s_protect.start_underground) / s_protect.claim_height,
|
||||
z = pos.z / s_protect.claim_size
|
||||
})
|
||||
end
|
||||
|
||||
s_protect.get_data = function(pos)
|
||||
local str = s_protect.get_location(vector.round(pos))
|
||||
return s_protect.claims[str]
|
||||
local pos = get_location(pos)
|
||||
local str = pos.x..","..pos.y..","..pos.z
|
||||
return s_protect.claims[str], str
|
||||
end
|
||||
|
||||
s_protect.get_y_axis = function(y)
|
||||
y = (y + s_protect.start_underground) / s_protect.claim_height
|
||||
return math.floor(y) * s_protect.claim_height - s_protect.start_underground
|
||||
end
|
||||
s_protect.get_area_bounds = function(pos_)
|
||||
local cs = s_protect.claim_size
|
||||
local cy = s_protect.claim_height
|
||||
|
||||
s_protect.get_location = function(pos1)
|
||||
local pos = {
|
||||
x = pos1.x / s_protect.claim_size,
|
||||
y = (pos1.y + s_protect.start_underground) / s_protect.claim_height,
|
||||
z = pos1.z / s_protect.claim_size
|
||||
local p = get_location(pos_)
|
||||
|
||||
local minp = {
|
||||
x = p.x * cs,
|
||||
y = p.y * cy - s_protect.start_underground,
|
||||
z = p.z * cs
|
||||
}
|
||||
pos = vector.floor(pos)
|
||||
return pos.x..","..pos.y..","..pos.z
|
||||
local maxp = {
|
||||
x = minp.x + cs - 1,
|
||||
y = minp.y + cy - 1,
|
||||
z = minp.z + cs - 1
|
||||
}
|
||||
|
||||
return minp, maxp
|
||||
end
|
||||
|
||||
s_protect.get_center = function(pos1)
|
||||
@ -224,4 +241,4 @@ s_protect.load_config = function()
|
||||
end
|
||||
file:write(block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,6 +10,7 @@ s_protect.mod_path = minetest.get_modpath("simple_protection")
|
||||
s_protect.conf = world_path.."/s_protect.conf"
|
||||
s_protect.file = world_path.."/s_protect.data"
|
||||
s_protect.sharefile = world_path.."/s_protect_share.data"
|
||||
s_protect.store = false -- AreaStore support
|
||||
|
||||
-- INTTLIB SUPPORT START
|
||||
s_protect.gettext = function(rawtext, replacements, ...)
|
||||
@ -79,10 +80,9 @@ s_protect.command_show = function(name)
|
||||
local data = s_protect.get_data(player_pos)
|
||||
|
||||
minetest.add_entity(s_protect.get_center(player_pos), "simple_protection:marker")
|
||||
local axis = s_protect.get_y_axis(player_pos.y)
|
||||
local y_end = axis + s_protect.claim_height
|
||||
local minp, maxp = s_protect.get_area_bounds(player_pos)
|
||||
minetest.chat_send_player(name, S("Vertical area limit from Y @1 to @2",
|
||||
tostring(axis), tostring(y_end)))
|
||||
tostring(minp.y), tostring(maxp.y)))
|
||||
|
||||
if not data then
|
||||
if axis < s_protect.underground_limit then
|
||||
@ -222,9 +222,7 @@ end
|
||||
|
||||
s_protect.command_unclaim = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player_pos = vector.round(player:getpos())
|
||||
local pos = s_protect.get_location(player_pos)
|
||||
local data = s_protect.claims[pos]
|
||||
local data, pos = s_protect.get_data(player:getpos())
|
||||
if not data then
|
||||
return false, S("You do not own this area.")
|
||||
end
|
||||
@ -232,7 +230,7 @@ s_protect.command_unclaim = function(name)
|
||||
if name ~= data.owner and not priv then
|
||||
return false, S("You do not own this area.")
|
||||
end
|
||||
if not priv and s_protect.claim_return then
|
||||
if s_protect.claim_return and name == data.owner then
|
||||
local inv = player:get_inventory()
|
||||
if inv:room_for_item("main", "simple_protection:claim") then
|
||||
inv:add_item("main", "simple_protection:claim")
|
||||
|
@ -28,15 +28,6 @@ end
|
||||
local old_item_place = minetest.item_place
|
||||
minetest.item_place = function(itemstack, placer, pointed_thing)
|
||||
local player_name = placer:get_player_name()
|
||||
--local under_node = minetest.get_node(pointed_thing.under)
|
||||
|
||||
-- if rightclick on special nodes
|
||||
--[[if not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[under_node.name] and minetest.registered_nodes[under_node.name].on_rightclick then
|
||||
minetest.registered_nodes[under_node.name].on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
end]]
|
||||
|
||||
if s_protect.can_access(pointed_thing.above, player_name)
|
||||
or not minetest.registered_nodes[itemstack:get_name()] then
|
||||
@ -133,15 +124,14 @@ minetest.register_craftitem("simple_protection:claim", {
|
||||
return
|
||||
end
|
||||
if not s_protect.underground_claim then
|
||||
local y = s_protect.get_y_axis(pos.y)
|
||||
if y < s_protect.underground_limit then
|
||||
local minp, maxp = s_protect.get_area_bounds(pos)
|
||||
if minp.y < s_protect.underground_limit then
|
||||
minetest.chat_send_player(player_name, S("You can not claim areas below @1.",
|
||||
s_protect.underground_limit.."m"))
|
||||
return
|
||||
end
|
||||
end
|
||||
local area_pos = s_protect.get_location(pos)
|
||||
local data = s_protect.claims[area_pos]
|
||||
local data, area_pos = s_protect.get_data(pos)
|
||||
if data then
|
||||
minetest.chat_send_player(player_name,
|
||||
S("This area is already owned by: @1", data.owner))
|
||||
@ -220,4 +210,4 @@ minetest.register_node("simple_protection:mark", {
|
||||
{-size-.5, -size-.5, -size-.5, size-.5, size+.5, -size-.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user