Compare commits

..

8 Commits

3 changed files with 14 additions and 35 deletions

View File

@ -81,7 +81,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
mcl_bows.arrow_entity.on_activate(self, staticdata, dtime_s) mcl_bows.arrow_entity.on_activate(self, staticdata, dtime_s)
self._arrow_item = arrow_item self._arrow_item = arrow_item
end end
vl_projectile.register("mcl_potions:"..name.."_arrow_entity", arrow_entity) minetest.register_entity("mcl_potions:"..name.."_arrow_entity", arrow_entity)
if minetest.get_modpath("mcl_bows") then if minetest.get_modpath("mcl_bows") then
minetest.register_craft({ minetest.register_craft({

View File

@ -308,6 +308,7 @@ local function stuck_on_step(self, dtime, entity_def, projectile_def)
if not minetest.is_creative_enabled(player_name) then if not minetest.is_creative_enabled(player_name) then
local arrow_item = self._itemstring or self._arrow_item local arrow_item = self._itemstring or self._arrow_item
if arrow_item and minetest.registered_items[arrow_item] and obj:get_inventory():room_for_item("main", arrow_item) then if arrow_item and minetest.registered_items[arrow_item] and obj:get_inventory():room_for_item("main", arrow_item) then
minetest.log("inventory add: "..dump(arrow_item))
obj:get_inventory():add_item("main", arrow_item) obj:get_inventory():add_item("main", arrow_item)
self._picked_up = true self._picked_up = true
@ -458,6 +459,17 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
allow_punching = allow_punching(self, entity_def, projectile_def, object) allow_punching = allow_punching(self, entity_def, projectile_def, object)
end end
if DEBUG then
minetest.log("handle_entity_collision("..dump({
self = self,
allow_punching = allow_punching,
entity_def = entity_def,
object = object,
object_id = mcl_util.get_entity_id(object),
luaentity = object:get_luaentity(),
})..")")
end
if not allow_punching then return end if not allow_punching then return end
local object_lua = object:get_luaentity() local object_lua = object:get_luaentity()

View File

@ -82,10 +82,6 @@ local spear_on_place = function(wear_divisor)
return itemstack return itemstack
end end
if not minetest.is_creative_enabled(user:get_player_name()) then
mcl_util.use_item_durability(itemstack, 1)
end
local pos = user:get_pos() local pos = user:get_pos()
pos.y = pos.y + 1.5 pos.y = pos.y + 1.5
local dir = user:get_look_dir() local dir = user:get_look_dir()
@ -104,7 +100,7 @@ local spear_on_place = function(wear_divisor)
le._is_critical = false le._is_critical = false
le._startpos = pos le._startpos = pos
le._collectable = true le._collectable = true
le._arrow_item = itemstack:to_string() le._arrow_item = itemstack:get_name()
minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true) minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true)
if user and user:is_player() then if user and user:is_player() then
if obj:get_luaentity().player == "" then if obj:get_luaentity().player == "" then
@ -125,13 +121,6 @@ local uses = {
diamond = 1562, diamond = 1562,
netherite = 2031, netherite = 2031,
} }
local materials = {
wood = "group:wood",
stone = "group:cobble",
iron = "mcl_core:iron_ingot",
gold = "mcl_core:gold_ingot",
diamond = "mcl_core:diamond",
}
local SPEAR_RANGE = 4.5 local SPEAR_RANGE = 4.5
@ -432,25 +421,3 @@ minetest.register_tool("vl_weaponry:spear_netherite", {
}, },
_mcl_spear_thrown_damage = 12, _mcl_spear_thrown_damage = 12,
}) })
-- Crafting recipes
local s = "mcl_core:stick"
local b = ""
for t,m in pairs(materials) do
minetest.register_craft({
output = "vl_weaponry:hammer_"..t,
recipe = {
{ m, b, m },
{ m, s, m },
{ b, s, b },
}
})
minetest.register_craft({
output = "vl_weaponry:spear_"..t,
recipe = {
{ m, b, b },
{ b, s, b },
{ b, b, s },
}
})
end