add settings, define table for namespace

This commit is contained in:
Gundul 2023-11-15 12:47:40 +01:00
parent 64e672a1c7
commit c2bab6fd07
3 changed files with 23 additions and 7 deletions

View File

@ -1,8 +1,7 @@
-- Minetest 5.4.1 : airutils
airutils = {}
airutils = {
storage = minetest.get_mod_storage()
}
airutils.storage = minetest.get_mod_storage()
local storage = airutils.storage
@ -36,13 +35,15 @@ airutils.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1,
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10,
['airutils:biofuel'] = 1,}
if not minetest.settings:get_bool('airutils.disable_papi') then
airutils.protect_in_areas = minetest.settings:get_bool('airutils_protect_in_areas')
if not minetest.settings:get_bool('airutils_disable_papi') then
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "airutils_papi.lua")
end
if not minetest.settings:get_bool('airutils.disable_tug') then
if not minetest.settings:get_bool('airutils_disable_tug') then
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "airutils_tug.lua")
end
if not minetest.settings:get_bool('airutils.disable_repair') then
if not minetest.settings:get_bool('airutils_disable_repair') then
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "airutils_repair.lua")
end

View File

@ -641,7 +641,8 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
if (puncher:is_player()) then
name = puncher:get_player_name()
ppos = puncher:get_pos()
if (minetest.is_protected(ppos, name)) then
if (minetest.is_protected(ppos, name) and
airutils.protect_in_areas) then
return
end
end

14
settingtypes.txt Normal file
View File

@ -0,0 +1,14 @@
# all settings for client menu or in minetest.conf on servers
# protect airplanes from player damage in protected areas
airutils_protect_in_areas (protect in area) bool true
# disable PAPI (Precision Approach Path Indicator)
airutils_disable_papi (disable PAPI) bool false
# disable tug tool (reposition of not owning planes)
airutils_disable_tug (disable tug tool) bool false
# disable repair tool for planes
airutils_disable_repair (planes cannot be repaired) bool false