forked from VoxeLibre/VoxeLibre
Update ignition, smothering, and campfire inventory drops
Bonus fix for grass path creation sound traveling across the entire server
This commit is contained in:
parent
177196a8d2
commit
d3095fea57
|
@ -1,6 +1,7 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
local mod_target = minetest.get_modpath("mcl_target")
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
local mod_campfire = minetest.get_modpath("mcl_campfires")
|
||||||
local enable_pvp = minetest.settings:get_bool("enable_pvp")
|
local enable_pvp = minetest.settings:get_bool("enable_pvp")
|
||||||
|
|
||||||
local math = math
|
local math = math
|
||||||
|
@ -395,6 +396,11 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
tnt.ignite(self._stuckin)
|
tnt.ignite(self._stuckin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Ignite Campfires
|
||||||
|
if mod_campfire and mcl_burning.is_burning(self.object) and minetest.get_item_group(snode.name, "campfire") ~= 0 then
|
||||||
|
mcl_campfires.light_campfire(self._stuckin)
|
||||||
|
end
|
||||||
|
|
||||||
-- Activate target
|
-- Activate target
|
||||||
if mod_target and snode.name == "mcl_target:target_off" then
|
if mod_target and snode.name == "mcl_target:target_off" then
|
||||||
mcl_target.hit(self._stuckin, 1) --10 redstone ticks
|
mcl_target.hit(self._stuckin, 1) --10 redstone ticks
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
mcl_campfires = {}
|
mcl_campfires = {}
|
||||||
|
|
||||||
local drop_items = mcl_util.drop_items_from_meta_container("main")
|
|
||||||
local food_entity = {nil, nil, nil, nil}
|
local food_entity = {nil, nil, nil, nil}
|
||||||
|
|
||||||
local function on_blast(pos)
|
local drop_inventory = mcl_util.drop_items_from_meta_container("main")
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
drop_items(pos, node)
|
local function drop_items(pos, node, oldmeta)
|
||||||
minetest.remove_node(pos)
|
drop_inventory(pos, node, oldmeta)
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
if food_entity[i] then
|
if food_entity[i] then
|
||||||
food_entity[i]:remove()
|
food_entity[i]:remove()
|
||||||
|
@ -15,6 +14,18 @@ local function on_blast(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function on_blast(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
drop_items(pos, node)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_campfires.light_campfire(pos)
|
||||||
|
local campfire = minetest.get_node(pos)
|
||||||
|
local name = campfire.name .. "_lit"
|
||||||
|
minetest.set_node(pos, {name = name, param2 = campfire.param2})
|
||||||
|
end
|
||||||
|
|
||||||
-- on_rightclick function to take items that are cookable in a campfire, and put them in the campfire inventory
|
-- on_rightclick function to take items that are cookable in a campfire, and put them in the campfire inventory
|
||||||
function mcl_campfires.take_item(pos, node, player, itemstack)
|
function mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
local campfire_spots = {
|
local campfire_spots = {
|
||||||
|
@ -96,15 +107,13 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
|
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
_on_ignite = function(player, node)
|
||||||
if player:get_wielded_item():get_name() == "mcl_fire:flint_and_steel" then
|
mcl_campfires.light_campfire(node.under)
|
||||||
node.name = name.."_lit"
|
return true
|
||||||
minetest.set_node(pos, node)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
drop = def.drops,
|
drop = def.drops,
|
||||||
_mcl_silk_touch_drop = {name},
|
_mcl_silk_touch_drop = {name},
|
||||||
mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = 'fixed',
|
type = 'fixed',
|
||||||
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
|
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
|
||||||
|
@ -143,7 +152,7 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
use_texture_alpha = "clip",
|
use_texture_alpha = "clip",
|
||||||
groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 },
|
groups = { handy=1, axey=1, material_wood=1, lit_campfire=1 },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
@ -152,10 +161,21 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
inv:set_size("main", 4)
|
inv:set_size("main", 4)
|
||||||
end,
|
end,
|
||||||
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
|
||||||
if player:get_wielded_item():get_name():find("shovel") then
|
if minetest.get_item_group(itemstack:get_name(), "shovel") ~= 0 then
|
||||||
node.name = name
|
local protected = mcl_util.check_position_protection(pos, player)
|
||||||
minetest.set_node(pos, node)
|
if not protected then
|
||||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
|
-- Add wear (as if digging a shovely node)
|
||||||
|
local toolname = itemstack:get_name()
|
||||||
|
local wear = mcl_autogroup.get_wear(toolname, "shovely")
|
||||||
|
if wear then
|
||||||
|
itemstack:add_wear(wear)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
node.name = name
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
mcl_campfires.take_item(pos, node, player, itemstack)
|
mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
end,
|
end,
|
||||||
|
@ -163,7 +183,7 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
drop = def.drops,
|
drop = def.drops,
|
||||||
_mcl_silk_touch_drop = {name.."_lit"},
|
_mcl_silk_touch_drop = {name.."_lit"},
|
||||||
light_source = def.lightlevel,
|
light_source = def.lightlevel,
|
||||||
mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
|
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
|
||||||
|
@ -176,7 +196,7 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
damage_per_second = def.damage,
|
damage_per_second = def.damage,
|
||||||
on_blast = on_blast,
|
on_blast = on_blast,
|
||||||
after_dig_node = on_blast,
|
after_dig_node = drop_items,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,12 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
||||||
if not minetest.is_creative_enabled("") then
|
if not minetest.is_creative_enabled("") then
|
||||||
stack:add_wear(65535/65) -- 65 uses
|
stack:add_wear(65535/65) -- 65 uses
|
||||||
end
|
end
|
||||||
|
-- Ignite Campfire
|
||||||
|
elseif minetest.get_item_group(dropnode.name, "campfire") ~= 0 then
|
||||||
|
add_node(droppos, {name=dropnode.name.."_lit"})
|
||||||
|
if not minetest.is_creative_enabled("") then
|
||||||
|
stack:add_wear(65535/65) -- 65 uses
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -187,7 +187,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
|
||||||
itemstack:add_wear(wear)
|
itemstack:add_wear(wear)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
|
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true)
|
||||||
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
|
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue