Restore tipped arrow entity registration as near copy of mcl_bows:arrow_entity

This commit is contained in:
teknomunk 2024-09-10 07:43:24 -05:00
parent 0b801a7a41
commit f467e43940
1 changed files with 10 additions and 1 deletions

View File

@ -27,7 +27,8 @@ function mcl_potions.register_arrow(name, desc, color, def)
local tt = def._tt or "" local tt = def._tt or ""
local groups = {ammo=1, ammo_bow=1, brewitem=1, _mcl_potion=1} local groups = {ammo=1, ammo_bow=1, brewitem=1, _mcl_potion=1}
if def.nocreative then groups.not_in_creative_inventory = 1 end if def.nocreative then groups.not_in_creative_inventory = 1 end
minetest.register_craftitem("mcl_potions:"..name.."_arrow", { local arrow_item = "mcl_potions:"..name.."_arrow"
minetest.register_craftitem(arrow_item, {
description = desc, description = desc,
_tt_help = arrow_tt .. "\n" .. tt, _tt_help = arrow_tt .. "\n" .. tt,
_dynamic_tt = def._dynamic_tt, _dynamic_tt = def._dynamic_tt,
@ -80,6 +81,14 @@ function mcl_potions.register_arrow(name, desc, color, def)
end, end,
}) })
-- Entity for older-style arrows
local arrow_entity = table.copy(mcl_bows.arrow_entity)
arrow_entity.on_activate = function(self, staticdata, dtime_s)
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)
if minetest.get_modpath("mcl_bows") then if minetest.get_modpath("mcl_bows") then
minetest.register_craft({ minetest.register_craft({
output = "mcl_potions:"..name.."_arrow 8", output = "mcl_potions:"..name.."_arrow 8",