Use new Minetest settings API syntax for most mods

This commit is contained in:
Wuzzy 2017-08-09 16:17:00 +02:00
parent 6fa426741e
commit e5a34367c9
41 changed files with 86 additions and 86 deletions

View file

@ -117,7 +117,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self._lastpos.x~=nil then
local def = minetest.registered_nodes[node.name]
if (def and def.walkable) or not def then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(self._lastpos, 'mcl_throwing:arrow')
end
self.object:remove()

View file

@ -53,7 +53,7 @@ end
local player_shoot_arrow = function(itemstack, player, power, damage)
local arrow_stack, arrow_stack_id = get_arrow(player)
local arrow_itemstring
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
if not arrow_stack then
return false
end
@ -86,7 +86,7 @@ local powerup_function = function(nextbow)
end
-- Check for arrow or Creative Mode
if minetest.setting_getbool("creative_mode") or get_arrow(placer) ~= nil then
if minetest.settings:get_bool("creative_mode") or get_arrow(placer) ~= nil then
local wear = itemstack:get_wear()
itemstack:replace(nextbow)
itemstack:set_wear(wear)
@ -131,7 +131,7 @@ minetest.register_tool("mcl_throwing:bow_0", {
itemstack:replace("mcl_throwing:bow")
itemstack:set_wear(wear)
if player_shoot_arrow(itemstack, user, 4, 1) then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability)
end
end
@ -153,7 +153,7 @@ minetest.register_tool("mcl_throwing:bow_1", {
itemstack:replace("mcl_throwing:bow")
itemstack:set_wear(wear)
if player_shoot_arrow(itemstack, user, 16, 2) then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability)
end
end
@ -183,7 +183,7 @@ minetest.register_tool("mcl_throwing:bow_2", {
damage = 4
end
if player_shoot_arrow(itemstack, user, 26, damage) then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability)
end
end

View file

@ -2,7 +2,7 @@
-- Snowballs and other throwable items
--
local GRAVITY = tonumber(minetest.setting_get("movement_gravity"))
local GRAVITY = tonumber(minetest.settings:get("movement_gravity"))
local entity_mapping = {
["mcl_throwing:snowball"] = "mcl_throwing:snowball_entity",
@ -38,7 +38,7 @@ local throw_function = function(entity_name, velocity)
local dir = player:get_look_dir()
local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity)
obj:get_luaentity()._thrower = player:get_player_name()
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
item:take_item()
end
return item