Update minetest.setting_getbool to minetest.settings:get_bool (#6)

This commit is contained in:
ksandr 2021-07-12 17:24:30 +03:00 committed by GitHub
parent ee6aacbb51
commit d4a450cd5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View file

@ -217,7 +217,7 @@ for _, color in pairs(dye_basecolors) do
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user)
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 / config.crossbow_uses)
end
itemstack = "shooter_crossbow:crossbow 1 "..itemstack:get_wear()
@ -265,7 +265,7 @@ minetest.register_tool("shooter_crossbow:crossbow", {
local color = string.match(stack:get_name(), "shooter_crossbow: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_crossbow:arrow_"..color.." 1")
end
return "shooter_crossbow:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
@ -273,7 +273,7 @@ minetest.register_tool("shooter_crossbow:crossbow", {
for _, clr in pairs(dye_basecolors) do
if inv:contains_item("main", "shooter_crossbow:arrow_"..clr) 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_crossbow:arrow_"..clr.." 1")
end
return "shooter_crossbow:crossbow_loaded_"..clr.." 1 "..itemstack:get_wear()

View file

@ -135,7 +135,7 @@ minetest.register_tool("shooter_flaregun: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

View file

@ -63,7 +63,7 @@ minetest.register_tool("shooter_grenade: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:clear()
end
if pointed_thing.type ~= "nothing" then

View file

@ -22,7 +22,7 @@ local function throw_hook(itemstack, user, vel)
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
if pos and dir and yaw then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
local before = itemstack:get_wear()
itemstack:add_wear(65535 / 100)

View file

@ -70,7 +70,7 @@ minetest.register_tool("shooter_rocket: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:rocket_gun 1 "..itemstack:get_wear()
@ -109,7 +109,7 @@ minetest.register_tool("shooter_rocket:rocket_gun", {
local inv = user:get_inventory()
if inv:contains_item("main", "shooter_rocket: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:rocket 1")
end
itemstack = "shooter_rocket:rocket_gun_loaded 1 "..itemstack:get_wear()