Replace deprecated settings_* API methods
This commit is contained in:
parent
f2c864ac04
commit
904c47dea2
15 changed files with 29 additions and 33 deletions
|
@ -179,7 +179,7 @@ for _, color in pairs(dye_basecolors) do
|
|||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
minetest.sound_play("shooter_click", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:add_wear(65535/SHOOTER_CROSSBOW_USES)
|
||||
end
|
||||
itemstack = "shooter:crossbow 1 "..itemstack:get_wear()
|
||||
|
@ -244,7 +244,7 @@ minetest.register_tool("shooter:crossbow", {
|
|||
local color = string.match(stack:get_name(), "shooter:arrow_(%a+)")
|
||||
if color then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||
end
|
||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
|
@ -252,7 +252,7 @@ minetest.register_tool("shooter:crossbow", {
|
|||
for _, color in pairs(dye_basecolors) do
|
||||
if inv:contains_item("main", "shooter:arrow_"..color) then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||
end
|
||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
|
|
|
@ -104,7 +104,7 @@ minetest.register_tool("shooter:flaregun", {
|
|||
minetest.sound_play("shooter_click", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:flare 1")
|
||||
itemstack:add_wear(65535/100)
|
||||
end
|
||||
|
@ -144,4 +144,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ local function throw_hook(itemstack, user, vel)
|
|||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:add_wear(65535/100)
|
||||
end
|
||||
pos.y = pos.y + 1.5
|
||||
|
@ -84,7 +84,7 @@ minetest.register_tool("shooter:grapple_gun", {
|
|||
inventory_image = "shooter_hook_gun.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local inv = user:get_inventory()
|
||||
if inv:contains_item("main", "shooter:grapple_hook") and
|
||||
if inv:contains_item("main", "shooter:grapple_hook") and
|
||||
inv:contains_item("main", "tnt:gunpowder") then
|
||||
inv:remove_item("main", "tnt:gunpowder")
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
|
@ -129,4 +129,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ minetest.register_tool("shooter:grenade", {
|
|||
description = "Grenade",
|
||||
inventory_image = "shooter_hand_grenade.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack = ""
|
||||
end
|
||||
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)
|
||||
|
|
|
@ -46,7 +46,7 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
|
|||
inventory_image = "shooter_rocket_gun_loaded.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:add_wear(65535/50)
|
||||
end
|
||||
itemstack = "shooter:rocket_gun 1 "..itemstack:get_wear()
|
||||
|
@ -85,7 +85,7 @@ minetest.register_tool("shooter:rocket_gun", {
|
|||
local inv = user:get_inventory()
|
||||
if inv:contains_item("main", "shooter:rocket") then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:rocket 1")
|
||||
end
|
||||
itemstack = "shooter:rocket_gun_loaded 1 "..itemstack:get_wear()
|
||||
|
@ -111,4 +111,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ minetest.register_entity("shooter:tnt_entity", {
|
|||
end,
|
||||
get_staticdata = function(self)
|
||||
return "expired"
|
||||
end,
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("shooter:turret_entity", {
|
||||
|
@ -92,7 +92,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
self.timer = self.timer + dtime
|
||||
if self.timer < 0.1 then
|
||||
return
|
||||
end
|
||||
end
|
||||
if self.player then
|
||||
local pitch = self.pitch
|
||||
local yaw = self.object:getyaw()
|
||||
|
@ -122,7 +122,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
end
|
||||
if pitch < 0 then
|
||||
pitch = 0
|
||||
elseif pitch > 90 then
|
||||
elseif pitch > 90 then
|
||||
pitch = 90
|
||||
end
|
||||
if self.pitch ~= pitch then
|
||||
|
@ -148,7 +148,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
return
|
||||
end
|
||||
minetest.sound_play("shooter_shotgun", {object=self.object})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
inv:remove_item("main", "tnt:tnt")
|
||||
end
|
||||
local pitch = math.rad(self.pitch - 40)
|
||||
|
@ -263,4 +263,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue