0
0
Fork 0
This commit is contained in:
AFCMS 2021-03-13 11:13:36 +01:00
commit 68df2c447a
6 changed files with 103 additions and 48 deletions

View File

@ -35,53 +35,12 @@ S("Arrows might get stuck on solid blocks and can be retrieved again. They are a
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={
physical = true,
visual = "wielditem",
visual_size = {x=0.4, y=0.4},
textures = {"mcl_bows:arrow_box"},
visual = "mesh",
mesh = "mcl_bows_arrow.obj",
visual_size = {x=-1, y=1},
textures = {"mcl_bows_arrow.png"},
collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19},
collide_with_objects = false,
_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)
else
if 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 = 0.5,
maxexptime = 0.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.
-- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often.

View File

@ -0,0 +1,56 @@
# Blender v2.91.0 OBJ File: ''
# www.blender.org
mtllib mcl_bows_arrow.mtl
o Plane
v -3.782006 -1.443249 0.000500
v -3.782006 1.444249 0.000500
v 3.782006 1.444249 0.000500
v 3.782006 -1.443249 0.000500
v 3.331104 1.069925 1.085017
v 3.331104 -1.100076 1.085017
v 3.331104 1.069925 -1.064830
v 3.331104 -1.100076 -1.064829
v 3.782006 0.001000 1.443749
v 3.782006 0.001000 -1.443750
v -3.782006 0.001000 -1.443749
v -3.782006 0.001000 1.443750
v 3.782006 0.000000 -1.443750
v 3.782006 0.000000 1.443749
v -3.782006 0.000000 1.443750
v -3.782006 0.000000 -1.443749
v 3.782006 1.444249 -0.000500
v 3.782006 -1.443249 -0.000500
v -3.782006 -1.443249 -0.000500
v -3.782006 1.444249 -0.000500
vt 0.000000 0.300000
vt 0.000000 0.700000
vt 1.000000 0.700000
vt 1.000000 0.300000
vt -0.007553 -0.000373
vt 0.296712 -0.000373
vt 0.296712 0.298611
vt -0.007553 0.298611
vt 0.000000 0.300000
vt 1.000000 0.300000
vt 1.000000 0.700000
vt 0.000000 0.700000
vt 0.000000 0.300000
vt 1.000000 0.300000
vt 1.000000 0.700000
vt 0.000000 0.700000
vt 0.000000 0.300000
vt 0.000000 0.700000
vt 1.000000 0.700000
vt 1.000000 0.300000
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
usemtl Material.002
s off
f 17/1/1 18/2/1 19/3/1 20/4/1
f 8/5/2 7/6/2 5/7/2 6/8/2
f 10/9/3 11/10/3 12/11/3 9/12/3
f 3/13/4 2/14/4 1/15/4 4/16/4
f 13/17/5 14/18/5 15/19/5 16/20/5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 260 B

View File

@ -100,9 +100,10 @@ function mcl_potions.register_arrow(name, desc, color, def)
local ARROW_ENTITY={
physical = true,
visual = "wielditem",
visual_size = {x=0.4, y=0.4},
textures = {"mcl_potions:"..name.."_arrow_box"},
visual = "mesh",
mesh = "mcl_bows_arrow.obj",
visual_size = {x=1, y=1},
textures = arrow_image(color, 100),
collisionbox = {-0.19, -0.125, -0.19, 0.19, 0.125, 0.19},
collide_with_objects = false,
@ -177,6 +178,26 @@ function mcl_potions.register_arrow(name, desc, color, def)
-- Check for object "collision". Done every tick (hopefully this is not too stressing)
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 = 0.5,
maxexptime = 0.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.
-- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often.