Compare commits

..

11 Commits

3 changed files with 35 additions and 14 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)
self._arrow_item = arrow_item
end
minetest.register_entity("mcl_potions:"..name.."_arrow_entity", arrow_entity)
vl_projectile.register("mcl_potions:"..name.."_arrow_entity", arrow_entity)
if minetest.get_modpath("mcl_bows") then
minetest.register_craft({

View File

@ -308,7 +308,6 @@ local function stuck_on_step(self, dtime, entity_def, projectile_def)
if not minetest.is_creative_enabled(player_name) then
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
minetest.log("inventory add: "..dump(arrow_item))
obj:get_inventory():add_item("main", arrow_item)
self._picked_up = true
@ -459,17 +458,6 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
allow_punching = allow_punching(self, entity_def, projectile_def, object)
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
local object_lua = object:get_luaentity()

View File

@ -82,6 +82,10 @@ local spear_on_place = function(wear_divisor)
return itemstack
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()
pos.y = pos.y + 1.5
local dir = user:get_look_dir()
@ -100,7 +104,7 @@ local spear_on_place = function(wear_divisor)
le._is_critical = false
le._startpos = pos
le._collectable = true
le._arrow_item = itemstack:get_name()
le._arrow_item = itemstack:to_string()
minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true)
if user and user:is_player() then
if obj:get_luaentity().player == "" then
@ -121,6 +125,13 @@ local uses = {
diamond = 1562,
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
@ -421,3 +432,25 @@ minetest.register_tool("vl_weaponry:spear_netherite", {
},
_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