remove unecessary globals
This commit is contained in:
parent
fa12398332
commit
a7ee92feff
4 changed files with 40 additions and 35 deletions
24
pvp.lua
24
pvp.lua
|
|
@ -5,14 +5,16 @@ local S = protector.intllib
|
|||
local statspawn = minetest.string_to_pos(minetest.settings:get("static_spawnpoint"))
|
||||
or {x = 0, y = 2, z = 0}
|
||||
|
||||
-- is pvp protection enabled
|
||||
protector.pvp = minetest.settings:get_bool("protector_pvp")
|
||||
-- is spawn protected
|
||||
local protector_spawn = tonumber(minetest.settings:get("protector_spawn")
|
||||
or minetest.settings:get("protector_pvp_spawn")) or 0
|
||||
|
||||
-- is night-only pvp enabled
|
||||
protector.night_pvp = minetest.settings:get_bool("protector_night_pvp")
|
||||
local protector_night_pvp = minetest.settings:get_bool("protector_night_pvp")
|
||||
|
||||
-- disables PVP in your own protected areas
|
||||
if minetest.settings:get_bool("enable_pvp") and protector.pvp then
|
||||
if minetest.settings:get_bool("enable_pvp")
|
||||
and minetest.settings:get_bool("protector_pvp") then
|
||||
|
||||
if minetest.register_on_punchplayer then
|
||||
|
||||
|
|
@ -31,17 +33,17 @@ if minetest.settings:get_bool("enable_pvp") and protector.pvp then
|
|||
-- no pvp at spawn area
|
||||
local pos = player:get_pos()
|
||||
|
||||
if pos.x < statspawn.x + protector.spawn
|
||||
and pos.x > statspawn.x - protector.spawn
|
||||
and pos.y < statspawn.y + protector.spawn
|
||||
and pos.y > statspawn.y - protector.spawn
|
||||
and pos.z < statspawn.z + protector.spawn
|
||||
and pos.z > statspawn.z - protector.spawn then
|
||||
if pos.x < statspawn.x + protector_spawn
|
||||
and pos.x > statspawn.x - protector_spawn
|
||||
and pos.y < statspawn.y + protector_spawn
|
||||
and pos.y > statspawn.y - protector_spawn
|
||||
and pos.z < statspawn.z + protector_spawn
|
||||
and pos.z > statspawn.z - protector_spawn then
|
||||
return true
|
||||
end
|
||||
|
||||
-- do we enable pvp at night time only ?
|
||||
if protector.night_pvp then
|
||||
if protector_night_pvp then
|
||||
|
||||
-- get time of day
|
||||
local tod = minetest.get_timeofday() or 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue