Skip to content

Commit

Permalink
Update minetest.setting_getbool to minetest.settings:get_bool (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksandronline committed Jul 12, 2021
1 parent ee6aacb commit d4a450c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions shooter_crossbow/init.lua
Expand Up @@ -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()
Expand Down Expand Up @@ -265,15 +265,15 @@ 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()
end
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()
Expand Down
2 changes: 1 addition & 1 deletion shooter_flaregun/init.lua
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion shooter_grenade/init.lua
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion shooter_hook/init.lua
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions shooter_rocket/init.lua
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit d4a450c

Please sign in to comment.