summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-10-09 13:58:19 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2017-10-09 13:58:19 +0100
commitc81191df2ab8b0f6f79692278ca3035779d7913b (patch)
treeb4c2b4fa011e07fd87e57283d72e85a37cba9e92
parent1c37c2b695e61c19147923aa89736f8cd654a325 (diff)
update to newer 0.4.16 functions
-rw-r--r--README.md1
-rw-r--r--init.lua13
-rw-r--r--pvp.lua9
3 files changed, 13 insertions, 10 deletions
diff --git a/README.md b/README.md
index 53505d8..888330d 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,7 @@ Change log:
- 2.2 - Updated protector tool so that player only needs to stand nearby (2 block radius)
It can also place vertically (up and down) as well. New protector recipe added.
- 2.3 - Localise many of the protector functions and tidy code.
+- 2.4 - Update to newer functions, Minetest 0.4.16 needed to run now.
Lucky Blocks: 10
diff --git a/init.lua b/init.lua
index 4534eed..048d3bc 100644
--- a/init.lua
+++ b/init.lua
@@ -2,15 +2,16 @@
-- get minetest.conf settings
protector = {}
protector.mod = "redo"
-protector.radius = tonumber(minetest.setting_get("protector_radius")) or 5
-protector.flip = minetest.setting_getbool("protector_flip") or false
-protector.hurt = tonumber(minetest.setting_get("protector_hurt")) or 0
-protector.spawn = tonumber(minetest.setting_get("protector_spawn")
- or minetest.setting_get("protector_pvp_spawn")) or 0
+protector.radius = tonumber(minetest.settings:get("protector_radius")) or 5
+protector.flip = minetest.settings:get_bool("protector_flip") or false
+protector.hurt = tonumber(minetest.settings:get("protector_hurt")) or 0
+protector.spawn = tonumber(minetest.settings:get("protector_spawn")
+ or minetest.settings:get("protector_pvp_spawn")) or 0
-- get static spawn position
-local statspawn = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 2, z = 0}
+local statspawn = minetest.string_to_pos(minetest.settings:get("static_spawnpoint"))
+ or {x = 0, y = 2, z = 0}
-- Intllib
diff --git a/pvp.lua b/pvp.lua
index 90a8d3f..ef380bc 100644
--- a/pvp.lua
+++ b/pvp.lua
@@ -2,16 +2,17 @@
local S = protector.intllib
-- get static spawn position
-local statspawn = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 2, z = 0}
+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.setting_getbool("protector_pvp")
+protector.pvp = minetest.settings:get_bool("protector_pvp")
-- is night-only pvp enabled
-protector.night_pvp = minetest.setting_getbool("protector_night_pvp")
+protector.night_pvp = minetest.settings:get_bool("protector_night_pvp")
-- disables PVP in your own protected areas
-if minetest.setting_getbool("enable_pvp") and protector.pvp then
+if minetest.settings:get_bool("enable_pvp") and protector.pvp then
if minetest.register_on_punchplayer then