Conflicts:
	shooter_rocket/init.lua
This commit is contained in:
philipmi 2021-07-21 22:13:52 +02:00
commit 4733f7e6c7
5 changed files with 9 additions and 9 deletions

View file

@ -217,7 +217,7 @@ for _, color in pairs(dye_basecolors) do
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user) on_use = function(itemstack, user)
minetest.sound_play("shooter_click", {object=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) itemstack:add_wear(65535 / config.crossbow_uses)
end end
itemstack = "shooter_crossbow:crossbow 1 "..itemstack:get_wear() 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+)") local color = string.match(stack:get_name(), "shooter_crossbow:arrow_(%a+)")
if color then if color then
minetest.sound_play("shooter_reload", {object=user}) 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") inv:remove_item("main", "shooter_crossbow:arrow_"..color.." 1")
end end
return "shooter_crossbow:crossbow_loaded_"..color.." 1 "..itemstack:get_wear() 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 for _, clr in pairs(dye_basecolors) do
if inv:contains_item("main", "shooter_crossbow:arrow_"..clr) then if inv:contains_item("main", "shooter_crossbow:arrow_"..clr) then
minetest.sound_play("shooter_reload", {object=user}) 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") inv:remove_item("main", "shooter_crossbow:arrow_"..clr.." 1")
end end
return "shooter_crossbow:crossbow_loaded_"..clr.." 1 "..itemstack:get_wear() return "shooter_crossbow:crossbow_loaded_"..clr.." 1 "..itemstack:get_wear()

View file

@ -85,7 +85,7 @@ minetest.register_entity("shooter_flaregun:flare_entity", {
if minetest.get_node(pos).name == "air" and if minetest.get_node(pos).name == "air" and
node.name ~= "default:water_source" and node.name ~= "default:water_source" and
node.name ~= "default:water_flowing" then node.name ~= "default:water_flowing" then
minetest.place_node(pos, {name="shooter_flaregun:flare_light"}) minetest.set_node(pos, {name="shooter_flaregun:flare_light"})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
pos.y = pos.y - 0.1 pos.y = pos.y - 0.1
local id = minetest.add_particlespawner({ local id = minetest.add_particlespawner({
@ -135,7 +135,7 @@ minetest.register_tool("shooter_flaregun:flaregun", {
minetest.sound_play("shooter_click", {object=user}) minetest.sound_play("shooter_click", {object=user})
return itemstack return itemstack
end 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") inv:remove_item("main", "shooter:flare 1")
itemstack:add_wear(65535 / 100) itemstack:add_wear(65535 / 100)
end end

View file

@ -63,7 +63,7 @@ minetest.register_tool("shooter_grenade:grenade", {
description = "Grenade", description = "Grenade",
inventory_image = "shooter_hand_grenade.png", inventory_image = "shooter_hand_grenade.png",
on_use = function(itemstack, user, pointed_thing) 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() itemstack:clear()
end end
if pointed_thing.type ~= "nothing" then 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 dir = user:get_look_dir()
local yaw = user:get_look_horizontal() local yaw = user:get_look_horizontal()
if pos and dir and yaw then 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() local before = itemstack:get_wear()
itemstack:add_wear(65535 / 100) itemstack:add_wear(65535 / 100)

View file

@ -84,7 +84,7 @@ minetest.register_tool("shooter_rocket:rocket_gun_loaded", {
value = "Your rocket has a cooldown!" value = "Your rocket has a cooldown!"
}) })
else else
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535 / 50) itemstack:add_wear(65535 / 50)
end end
itemstack = "shooter_rocket:rocket_gun 1 "..itemstack:get_wear() itemstack = "shooter_rocket:rocket_gun 1 "..itemstack:get_wear()
@ -131,7 +131,7 @@ minetest.register_tool("shooter_rocket:rocket_gun", {
local inv = user:get_inventory() local inv = user:get_inventory()
if inv:contains_item("main", "shooter_rocket:rocket") then if inv:contains_item("main", "shooter_rocket:rocket") then
minetest.sound_play("shooter_reload", {object=user}) 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") inv:remove_item("main", "shooter_rocket:rocket 1")
end end
itemstack = "shooter_rocket:rocket_gun_loaded 1 "..itemstack:get_wear() itemstack = "shooter_rocket:rocket_gun_loaded 1 "..itemstack:get_wear()