1
0
Fork 0

Fixes for arrows

This commit is contained in:
epCode 2021-03-12 14:45:22 -08:00
parent a84b70bde6
commit 40471399cb
3 changed files with 45091 additions and 45 deletions

View File

@ -35,53 +35,12 @@ S("Arrows might get stuck on solid blocks and can be retrieved again. They are a
end, end,
}) })
-- This is a fake node, used as model for the arrow entity.
-- It's not supposed to be usable as item or real node.
-- TODO: Use a proper mesh for the arrow entity
minetest.register_node("mcl_bows:arrow_box", {
drawtype = "nodebox",
is_ground_content = false,
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, -4.5/17, 1.5/17, 1.5/17},
{-4.5/17, -0.5/17, -0.5/17, 5.5/17, 0.5/17, 0.5/17},
{5.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Tip
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Fletching
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"mcl_bows_arrow.png^[transformFX", "mcl_bows_arrow.png^[transformFX", "mcl_bows_arrow_back.png", "mcl_bows_arrow_front.png", "mcl_bows_arrow.png", "mcl_bows_arrow.png^[transformFX"},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {not_in_creative_inventory=1, dig_immediate=3},
drop = "",
node_placement_prediction = "",
on_construct = function(pos)
minetest.log("error", "[mcl_bows] Trying to construct mcl_bows:arrow_box at "..minetest.pos_to_string(pos))
minetest.remove_node(pos)
end,
})
local ARROW_ENTITY={ local ARROW_ENTITY={
physical = true, physical = true,
visual = "wielditem", visual = "mesh",
visual_size = {x=0.4, y=0.4}, mesh = "mcl_bows_arrow.obj",
textures = {"mcl_bows:arrow_box"}, visual_size = {x=1, y=1},
textures = {"mcl_bows_arrow.png"},
collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19}, collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19},
collide_with_objects = false, collide_with_objects = false,
_fire_damage_resistant = true, _fire_damage_resistant = true,
@ -185,6 +144,25 @@ ARROW_ENTITY.on_step = function(self, dtime)
-- Check for object "collision". Done every tick (hopefully this is not too stressing) -- Check for object "collision". Done every tick (hopefully this is not too stressing)
else else
if self._damage == 10 or self._damage == 9 then
minetest.add_particlespawner({
amount = 1,
time = .001,
minpos = pos,
maxpos = pos,
minvel = vector.new(-0.1,-0.1,-0.1),
maxvel = vector.new(0.1,0.1,0.1),
minexptime = 1.5,
maxexptime = 1.5,
minsize = 2,
maxsize = 2,
collisiondetection = false,
vertical = false,
texture = "mobs_mc_arrow_particle.png",
glow = 1,
})
end
-- We just check for any hurtable objects nearby. -- We just check for any hurtable objects nearby.
-- The radius of 3 is fairly liberal, but anything lower than than will cause -- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often. -- arrow to hilariously go through mobs often.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 203 B