add arrow animations

This commit is contained in:
Juraj Vajda 2022-10-24 10:52:00 -04:00
parent 910491740a
commit b4dea2e88c
10 changed files with 60 additions and 650 deletions

88
api.lua
View File

@ -44,6 +44,7 @@ XBows = {
registered_arrows = {},
registered_quivers = {},
registered_particle_spawners = {},
registered_entities = {},
player_bow_sneak = {},
settings = {
x_bows_attach_arrows_to_entities = minetest.settings:get_bool('x_bows_attach_arrows_to_entities', false)
@ -292,8 +293,6 @@ function XBows.register_arrow(self, name, def)
def.custom.particle_effect = def.custom.particle_effect or 'arrow'
def.custom.particle_effect_crit = def.custom.particle_effect_crit or 'arrow_crit'
def.custom.particle_effect_fast = def.custom.particle_effect_fast or 'arrow_fast'
def.custom.projectile_textures = def.custom.projectile_textures or {'x_bows:arrow_node'}
def.custom.projectile_visual_size = def.custom.projectile_visual_size or {x = 1, y = 1, z = 1}
def.custom.projectile_entity = def.custom.projectile_entity or 'x_bows:arrow_entity'
def.custom.on_hit_node = def.custom.on_hit_node or nil
def.custom.on_hit_entity = def.custom.on_hit_entity or nil
@ -848,25 +847,34 @@ function XBowsEntityDef.on_activate(self, selfObj, staticdata, dtime_s)
selfObj._is_critical_hit = _staticdata.is_critical_hit
selfObj._faster_arrows_multiplier = _staticdata.faster_arrows_multiplier
selfObj._add_damage = _staticdata._add_damage
local x_bows_registered_arrow_def = self.registered_arrows[selfObj._arrow_name]
local x_bows_registered_bow_def = self.registered_bows[selfObj._bow_name]
selfObj._arrow_particle_effect = x_bows_registered_arrow_def.custom.particle_effect
selfObj._arrow_particle_effect_crit = x_bows_registered_arrow_def.custom.particle_effect_crit
selfObj._arrow_particle_effect_fast = x_bows_registered_arrow_def.custom.particle_effect_fast
selfObj._projectile_textures = x_bows_registered_arrow_def.custom.projectile_textures
selfObj._projectile_visual_size = x_bows_registered_arrow_def.custom.projectile_visual_size
selfObj._sound_hit = x_bows_registered_bow_def.custom.sound_hit
selfObj._caused_damage = 0
selfObj._caused_knockback = 0
local x_bows_registered_arrow_def = self.registered_arrows[selfObj._arrow_name]
selfObj._arrow_particle_effect = x_bows_registered_arrow_def.custom.particle_effect
selfObj._arrow_particle_effect_crit = x_bows_registered_arrow_def.custom.particle_effect_crit
selfObj._arrow_particle_effect_fast = x_bows_registered_arrow_def.custom.particle_effect_fast
local x_bows_registered_bow_def = self.registered_bows[selfObj._bow_name]
selfObj._sound_hit = x_bows_registered_bow_def.custom.sound_hit
local x_bows_registered_entity_def = self.registered_entities[selfObj.name]
selfObj._rotation_factor = x_bows_registered_entity_def._custom.rotation_factor
if type(selfObj._rotation_factor) == 'function' then
selfObj._rotation_factor = selfObj._rotation_factor()
end
selfObj.object:set_properties({
textures = selfObj._projectile_textures,
infotext = selfObj._arrow_name,
visual_size = selfObj._projectile_visual_size
})
if x_bows_registered_entity_def and x_bows_registered_entity_def._custom.animations.idle then
selfObj.object:set_animation(unpack(x_bows_registered_entity_def._custom.animations.idle))
end
---Callbacks
local on_after_activate_callback = x_bows_registered_arrow_def.custom.on_after_activate
if on_after_activate_callback then
@ -911,7 +919,7 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
selfObj.object:set_rotation({
x = pitch,
y = v_rotation.y,
z = v_rotation.z + math.pi / 2
z = v_rotation.z + (selfObj._rotation_factor or math.pi / 2)
})
end
@ -1261,36 +1269,9 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
end
---Wiggle
local rotation = selfObj.object:get_rotation()
if rotation then
local wiggle_timer_const = 0.05
local wiggle_timer = 0
for i = 1, 3 do
local rotx = rotation.x + math.random(10, 20) / 100
if i % 2 == 0 then
rotx = rotation.x - math.random(10, 20) / 100
end
local _rotation = {
x = rotx,
y = rotation.y,
z = rotation.z
}
if i == 3 then
_rotation = rotation
end
wiggle_timer = wiggle_timer + wiggle_timer_const
minetest.after(wiggle_timer, function(v_object)
selfObj.object:set_rotation(_rotation)
end, selfObj.object, wiggle_timer)
end
local x_bows_registered_entity_def = self.registered_entities[selfObj.name]
if x_bows_registered_entity_def and x_bows_registered_entity_def._custom.animations.on_hit_node then
selfObj.object:set_animation(unpack(x_bows_registered_entity_def._custom.animations.on_hit_node))
end
---API callbacks
@ -1340,20 +1321,21 @@ end
---@param name string
---@param def XBowsEntityDef
function XBows.register_entity(self, name, def)
if not def._custom then
def._custom = {}
end
def._custom = def._custom or {}
def._custom.animations = def._custom.animations or {}
local mod_name = def._custom.mod_name or 'x_bows'
def._custom.name = mod_name .. ':' .. name
def.initial_properties = {
def.initial_properties = mergeTables({
---defaults
visual = 'wielditem',
collisionbox = {0, 0, 0, 0, 0, 0},
selectionbox = {0, 0, 0, 0, 0, 0},
physical = false,
textures = {'air'},
hp_max = 1
}
hp_max = 1,
visual_size = {x = 1, y = 1, z = 1}
}, def.initial_properties or {})
def.on_death = function(selfObj, killer)
return XBowsEntityDef:on_death(selfObj, killer)
@ -1379,6 +1361,8 @@ function XBows.register_entity(self, name, def)
def.on_punch = def._custom.on_punch
end
self.registered_entities[def._custom.name] = def
minetest.register_entity(def._custom.name, {
initial_properties = def.initial_properties,
on_death = def.on_death,
@ -1656,7 +1640,7 @@ end
---@param quiver_id string
---@param player_name string
---@param quiver_items? string
---@return InvRef|unknown
---@return InvRef
function XBowsQuiver.get_or_create_detached_inv(self, quiver_id, player_name, quiver_items)
local detached_inv

View File

@ -1 +1,13 @@
XBows:register_entity('arrow_entity', {})
XBows:register_entity('arrow_entity', {
initial_properties = {
visual = 'mesh',
mesh = 'x_bows_arrow.b3d',
textures = {'x_bows_arrow_mesh.png'},
},
_custom = {
animations = {
idle = {{x = 41, y = 42}, 0, 0, false},
on_hit_node = {{x = 1, y = 40}, 40, 0, false}
}
}
})

View File

@ -50,7 +50,7 @@ function XBowsQuiver.udate_or_create_hud(self, player, inv_list, idx) end
-- @param quiver_id string
-- @param player_name string
-- @param quiver_items? string
-- @return InvRef|unknown
-- @return InvRef
function XBowsQuiver.get_or_create_detached_inv(self, quiver_id, player_name, quiver_items) end
---Create formspec

BIN
models/x_bows_arrow.b3d Normal file

Binary file not shown.

View File

@ -1,582 +0,0 @@
# Blender v3.3.0 OBJ File: 'arrow2.blend'
# www.blender.org
mtllib arrow2.mtl
o arrow2
v -0.007500 -0.037500 -0.112500
v -0.007500 -0.022500 -0.180000
v -0.007500 -0.022500 -0.157500
v -0.007500 0.007500 0.180000
v -0.007500 0.007500 0.090000
v -0.022500 -0.007500 -0.112500
v -0.037500 -0.007500 -0.112500
v -0.037500 0.007500 -0.180000
v -0.037500 -0.007500 -0.180000
v 0.022500 0.007500 -0.157500
v -0.007500 0.037500 -0.112500
v 0.007500 -0.022500 -0.157500
v 0.007500 -0.022500 0.090000
v 0.007500 -0.022500 -0.112500
v 0.007500 -0.007500 0.180000
v 0.007500 -0.007500 0.157500
v 0.022500 -0.007500 0.157500
v 0.022500 -0.007500 0.090000
v 0.022500 -0.007500 -0.090000
v 0.022500 0.007500 -0.090000
v 0.037500 -0.007500 -0.112500
v 0.037500 0.007500 -0.112500
v -0.022500 0.007500 -0.157500
v 0.007500 -0.007500 -0.180000
v 0.007500 0.007500 -0.180000
v 0.037500 0.007500 -0.180000
v 0.007500 0.022500 0.157500
v 0.007500 0.022500 -0.157500
v 0.007500 -0.037500 -0.112500
v -0.007500 -0.022500 0.157500
v 0.007500 -0.022500 0.157500
v -0.007500 -0.022500 -0.090000
v 0.007500 -0.022500 -0.090000
v -0.022500 0.007500 0.157500
v 0.022500 0.007500 0.157500
v -0.022500 -0.007500 -0.090000
v -0.007500 -0.007500 -0.090000
v 0.007500 -0.007500 -0.090000
v -0.037500 0.007500 -0.112500
v 0.022500 0.007500 -0.112500
v -0.007500 0.007500 0.157500
v -0.007500 0.022500 0.157500
v -0.007500 0.022500 -0.090000
v -0.007500 0.022500 -0.112500
v 0.007500 0.022500 -0.112500
v 0.007500 -0.022500 -0.180000
v -0.007500 -0.007500 -0.157500
v 0.007500 -0.007500 -0.157500
v 0.007500 -0.007500 0.090000
v 0.022500 0.007500 0.090000
v -0.022500 -0.007500 -0.180000
v 0.022500 -0.007500 -0.180000
v 0.022500 0.007500 -0.180000
v 0.007500 0.022500 0.090000
v 0.007500 0.007500 0.090000
v -0.007500 0.007500 -0.157500
v 0.007500 0.037500 -0.180000
v -0.007500 -0.037500 -0.180000
v 0.007500 -0.037500 -0.180000
v -0.007500 -0.022500 0.090000
v -0.007500 -0.022500 -0.112500
v -0.007500 -0.007500 0.180000
v -0.007500 -0.007500 0.157500
v -0.022500 -0.007500 0.157500
v -0.022500 -0.007500 0.090000
v -0.007500 -0.007500 0.090000
v 0.022500 -0.007500 -0.112500
v -0.022500 -0.007500 -0.157500
v -0.007500 -0.007500 -0.180000
v 0.022500 -0.007500 -0.157500
v 0.037500 -0.007500 -0.180000
v -0.007500 0.022500 -0.157500
v -0.007500 0.022500 -0.180000
v 0.007500 0.022500 -0.180000
v 0.007500 0.007500 0.180000
v 0.007500 0.007500 0.157500
v -0.022500 0.007500 0.090000
v 0.007500 0.007500 -0.090000
v -0.007500 0.007500 -0.090000
v -0.022500 0.007500 -0.090000
v -0.022500 0.007500 -0.112500
v -0.022500 0.007500 -0.180000
v 0.007500 0.007500 -0.157500
v -0.007500 0.007500 -0.180000
v -0.007500 0.022500 0.090000
v 0.007500 0.022500 -0.090000
v 0.007500 0.037500 -0.112500
v -0.007500 0.037500 -0.180000
vt 0.533333 0.533333
vt 0.000000 0.600000
vt 0.533333 0.600000
vt 0.466667 0.866667
vt 0.533333 0.800000
vt 0.466667 0.800000
vt 0.533333 0.866667
vt 0.600000 0.800000
vt 0.533333 0.800000
vt 0.733333 0.400000
vt 0.800000 0.200000
vt 0.733333 0.200000
vt 0.400000 0.733333
vt 0.200000 0.800000
vt 0.400000 0.800000
vt 0.466667 0.666667
vt 0.400000 0.733333
vt 0.400000 0.666667
vt 0.733333 0.866667
vt 0.800000 0.800000
vt 0.733333 0.800000
vt 0.866667 0.333333
vt 0.933333 0.266667
vt 0.866667 0.266667
vt 0.066667 0.533333
vt 0.133333 0.000000
vt 0.066667 0.000000
vt 0.200000 0.466667
vt 0.200000 0.533333
vt 0.133333 0.533333
vt 0.666667 0.866667
vt 0.600000 0.933333
vt 0.600000 0.866667
vt 0.800000 0.333333
vt 0.866667 0.266667
vt 0.800000 0.266667
vt 0.200000 0.866667
vt 0.000000 0.800000
vt 0.000000 0.866667
vt 0.866667 0.800000
vt 0.800000 0.866667
vt 0.800000 0.800000
vt 0.200000 0.733333
vt 0.000000 0.800000
vt 0.200000 0.800000
vt 0.600000 0.733333
vt 0.400000 0.800000
vt 0.400000 0.733333
vt 0.666667 0.866667
vt 0.733333 0.800000
vt 0.666667 0.800000
vt 0.733333 0.200000
vt 0.666667 0.266667
vt 0.666667 0.200000
vt 0.733333 0.200000
vt 0.666667 0.000000
vt 0.733333 0.000000
vt 0.733333 0.666667
vt 0.666667 0.733333
vt 0.666667 0.666667
vt 0.466667 0.333333
vt 0.466667 0.400000
vt 0.333333 0.333333
vt 0.733333 0.200000
vt 0.800000 0.000000
vt 0.800000 0.200000
vt 0.533333 0.733333
vt 0.600000 0.533333
vt 0.533333 0.533333
vt 0.466667 0.866667
vt 0.400000 0.933333
vt 0.400000 0.866667
vt 0.666667 0.266667
vt 0.600000 0.266667
vt 0.600000 0.200000
vt 0.333333 0.066667
vt 0.400000 0.066667
vt 0.400000 0.133333
vt 0.200000 0.866667
vt 0.133333 0.933333
vt 0.133333 0.866667
vt 0.000000 0.533333
vt 0.066667 0.000000
vt 0.066667 0.533333
vt 0.400000 0.866667
vt 0.466667 0.800000
vt 0.400000 0.800000
vt 0.466667 0.200000
vt 0.533333 0.200000
vt 0.466667 0.066667
vt 0.266667 0.866667
vt 0.200000 0.933333
vt 0.200000 0.866667
vt 0.866667 0.400000
vt 0.933333 0.333333
vt 0.866667 0.333333
vt 0.400000 0.866667
vt 0.200000 0.800000
vt 0.400000 0.800000
vt 0.333333 0.933333
vt 0.400000 0.866667
vt 0.333333 0.866667
vt 0.066667 0.866667
vt 0.000000 0.933333
vt 0.000000 0.866667
vt 0.800000 0.400000
vt 0.733333 0.466667
vt 0.733333 0.400000
vt 0.733333 0.466667
vt 0.666667 0.266667
vt 0.733333 0.266667
vt 0.200000 0.733333
vt 0.000000 0.666667
vt 0.200000 0.666667
vt 0.866667 0.333333
vt 0.800000 0.400000
vt 0.800000 0.333333
vt 0.333333 0.866667
vt 0.266667 0.933333
vt 0.266667 0.866667
vt 0.533333 0.600000
vt 0.000000 0.666667
vt 0.000000 0.600000
vt 0.866667 0.533333
vt 0.800000 0.600000
vt 0.800000 0.533333
vt 0.600000 0.466667
vt 0.600000 0.533333
vt 0.666667 0.533333
vt 0.466667 0.933333
vt 0.533333 0.866667
vt 0.466667 0.866667
vt 0.666667 0.666667
vt 0.733333 0.466667
vt 0.666667 0.466667
vt 0.866667 0.200000
vt 0.933333 0.133333
vt 0.866667 0.133333
vt 0.800000 0.666667
vt 0.733333 0.733333
vt 0.733333 0.666667
vt 0.733333 0.666667
vt 0.800000 0.466667
vt 0.800000 0.666667
vt 0.866667 0.000000
vt 0.800000 0.066667
vt 0.800000 0.000000
vt 0.800000 0.733333
vt 0.600000 0.800000
vt 0.800000 0.800000
vt 0.933333 0.000000
vt 0.866667 0.066667
vt 0.866667 0.000000
vt 0.866667 0.200000
vt 0.800000 0.200000
vt 0.400000 0.733333
vt 0.200000 0.666667
vt 0.400000 0.666667
vt 0.800000 0.200000
vt 0.866667 0.133333
vt 0.800000 0.133333
vt 0.133333 0.866667
vt 0.066667 0.933333
vt 0.066667 0.866667
vt 0.800000 0.133333
vt 0.866667 0.066667
vt 0.800000 0.066667
vt 0.800000 0.466667
vt 0.866667 0.400000
vt 0.800000 0.400000
vt 0.133333 0.133333
vt 0.133333 0.200000
vt 0.200000 0.200000
vt 0.466667 0.466667
vt 0.533333 0.466667
vt 0.533333 0.400000
vt 0.666667 0.733333
vt 0.600000 0.533333
vt 0.600000 0.733333
vt 0.800000 0.533333
vt 0.866667 0.466667
vt 0.800000 0.466667
vt 0.866667 0.733333
vt 0.800000 0.800000
vt 0.800000 0.733333
vt 0.933333 0.066667
vt 0.866667 0.133333
vt 0.866667 0.066667
vt 0.533333 0.933333
vt 0.600000 0.866667
vt 0.533333 0.866667
vt 0.800000 0.733333
vt 0.866667 0.666667
vt 0.800000 0.666667
vt 0.800000 0.666667
vt 0.866667 0.600000
vt 0.800000 0.600000
vt 0.600000 0.866667
vt 0.666667 0.800000
vt 0.600000 0.800000
vt 0.866667 0.266667
vt 0.933333 0.200000
vt 0.866667 0.200000
vt 0.933333 0.400000
vt 0.866667 0.466667
vt 0.866667 0.400000
vt 0.533333 0.666667
vt 0.466667 0.733333
vt 0.466667 0.666667
vt 0.000000 0.533333
vt 0.533333 0.866667
vt 0.600000 0.866667
vt 0.800000 0.400000
vt 0.200000 0.733333
vt 0.466667 0.733333
vt 0.800000 0.866667
vt 0.933333 0.333333
vt 0.133333 0.533333
vt 0.133333 0.333333
vt 0.200000 0.333333
vt 0.200000 0.266667
vt 0.266667 0.266667
vt 0.266667 0.466667
vt 0.666667 0.933333
vt 0.866667 0.333333
vt 0.200000 0.800000
vt 0.866667 0.866667
vt 0.000000 0.733333
vt 0.600000 0.800000
vt 0.733333 0.866667
vt 0.733333 0.266667
vt 0.666667 0.200000
vt 0.733333 0.733333
vt 0.266667 0.400000
vt 0.266667 0.333333
vt 0.333333 0.266667
vt 0.533333 0.266667
vt 0.533333 0.333333
vt 0.733333 0.000000
vt 0.600000 0.733333
vt 0.466667 0.933333
vt 0.533333 0.200000
vt 0.600000 0.066667
vt 0.533333 0.000000
vt 0.600000 0.000000
vt 0.666667 0.066667
vt 0.200000 0.133333
vt 0.200000 0.066667
vt 0.133333 0.066667
vt 0.133333 0.000000
vt 0.333333 0.000000
vt 0.200000 0.933333
vt 0.000000 0.000000
vt 0.466667 0.866667
vt 0.533333 0.000000
vt 0.466667 0.000000
vt 0.400000 0.066667
vt 0.400000 0.266667
vt 0.466667 0.266667
vt 0.266667 0.933333
vt 0.933333 0.400000
vt 0.200000 0.866667
vt 0.400000 0.933333
vt 0.066667 0.933333
vt 0.800000 0.466667
vt 0.666667 0.466667
vt 0.000000 0.733333
vt 0.866667 0.400000
vt 0.333333 0.933333
vt 0.533333 0.666667
vt 0.866667 0.600000
vt 0.666667 0.333333
vt 0.600000 0.333333
vt 0.600000 0.266667
vt 0.533333 0.266667
vt 0.533333 0.466667
vt 0.533333 0.933333
vt 0.733333 0.666667
vt 0.933333 0.200000
vt 0.800000 0.733333
vt 0.733333 0.466667
vt 0.866667 0.066667
vt 0.600000 0.733333
vt 0.933333 0.066667
vt 0.200000 0.733333
vt 0.866667 0.200000
vt 0.133333 0.933333
vt 0.866667 0.133333
vt 0.866667 0.466667
vt 0.200000 0.266667
vt 0.333333 0.200000
vt 0.400000 0.266667
vt 0.400000 0.200000
vt 0.333333 0.133333
vt 0.333333 0.400000
vt 0.333333 0.466667
vt 0.266667 0.466667
vt 0.266667 0.533333
vt 0.466667 0.533333
vt 0.666667 0.533333
vt 0.866667 0.533333
vt 0.866667 0.800000
vt 0.933333 0.133333
vt 0.600000 0.933333
vt 0.866667 0.733333
vt 0.866667 0.666667
vt 0.666667 0.866667
vt 0.933333 0.266667
vt 0.933333 0.466667
vt 0.533333 0.733333
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
vn 0.0000 0.0000 1.0000
vn 1.0000 0.0000 0.0000
usemtl arrow2_Material
s off
f 37/1/1 5/2/1 79/3/1
f 63/4/2 15/5/2 62/6/2
f 85/7/3 55/8/3 5/9/3
f 49/10/2 17/11/2 16/12/2
f 60/13/1 63/14/1 66/15/1
f 86/16/4 44/17/4 43/18/4
f 56/19/1 69/20/1 47/21/1
f 53/22/3 71/23/3 52/24/3
f 37/25/2 49/26/2 66/27/2
f 23/28/4 82/29/4 8/30/4
f 17/31/5 76/32/5 16/33/5
f 69/34/2 48/35/2 47/36/2
f 8/37/1 7/38/1 39/39/1
f 67/40/6 20/41/6 19/42/6
f 5/43/1 42/44/1 85/45/1
f 18/46/6 35/47/6 17/48/6
f 80/49/1 6/50/1 36/51/1
f 33/52/5 37/53/5 32/54/5
f 54/55/4 42/56/4 27/57/4
f 12/58/4 2/59/4 3/60/4
f 12/61/6 48/62/6 14/63/6
f 88/64/4 87/65/4 57/66/4
f 60/67/2 31/68/2 30/69/2
f 6/70/5 39/71/5 7/72/5
f 26/73/4 53/74/4 10/75/4
f 28/76/6 74/77/6 57/78/6
f 29/79/5 61/80/5 1/81/5
f 79/82/4 55/83/4 78/84/4
f 72/85/3 83/86/3 56/87/3
f 68/88/2 47/89/2 6/90/2
f 63/91/5 34/92/5 64/93/5
f 8/94/3 51/95/3 9/96/3
f 26/97/6 21/98/6 71/99/6
f 23/100/3 47/101/3 68/102/3
f 51/103/6 23/104/6 68/105/6
f 76/106/5 42/107/5 41/108/5
f 5/109/4 34/110/4 41/111/4
f 49/112/6 31/113/6 13/114/6
f 83/115/4 84/116/4 56/117/4
f 21/118/5 40/119/5 67/120/5
f 38/121/6 55/122/6 49/123/6
f 31/124/5 63/125/5 30/126/5
f 70/127/2 52/128/2 71/129/2
f 83/130/3 70/131/3 48/132/3
f 65/133/2 63/134/2 64/135/2
f 2/136/3 59/137/3 58/138/3
f 78/139/5 43/140/5 79/141/5
f 55/142/4 35/143/4 50/144/4
f 45/145/5 11/146/5 44/147/5
f 65/148/1 34/149/1 77/150/1
f 15/151/5 4/152/5 62/153/5
f 47/36/3 12/154/3 3/155/3
f 54/156/6 76/157/6 55/158/6
f 66/159/3 13/160/3 60/161/3
f 24/162/6 83/163/6 48/164/6
f 73/165/2 28/166/2 72/167/2
f 61/168/2 33/169/2 32/170/2
f 79/171/1 43/172/1 44/173/1
f 3/174/1 2/175/1 58/176/1
f 59/177/2 1/178/2 58/179/2
f 88/180/3 74/181/3 73/182/3
f 16/183/6 75/184/6 15/185/6
f 37/186/5 80/187/5 36/188/5
f 55/189/3 18/190/3 49/191/3
f 10/192/1 52/193/1 70/194/1
f 4/195/1 63/196/1 62/197/1
f 84/198/3 24/199/3 69/200/3
f 77/201/3 66/202/3 65/203/3
f 19/204/5 78/205/5 38/206/5
f 75/207/4 41/208/4 4/209/4
f 37/1/1 66/210/1 5/2/1
f 63/4/2 16/211/2 15/5/2
f 85/7/3 54/212/3 55/8/3
f 49/10/2 18/213/2 17/11/2
f 60/13/1 30/214/1 63/14/1
f 86/16/4 45/215/4 44/17/4
f 56/19/1 84/216/1 69/20/1
f 53/22/3 26/217/3 71/23/3
f 37/25/2 38/218/2 49/26/2
f 8/30/4 39/219/4 23/28/4
f 39/219/4 81/220/4 23/28/4
f 81/220/4 80/221/4 79/222/4
f 79/222/4 56/223/4 81/220/4
f 56/223/4 23/28/4 81/220/4
f 17/31/5 35/224/5 76/32/5
f 69/34/2 24/225/2 48/35/2
f 8/37/1 9/226/1 7/38/1
f 67/40/6 40/227/6 20/41/6
f 5/43/1 41/228/1 42/44/1
f 18/46/6 50/229/6 35/47/6
f 80/49/1 81/230/1 6/50/1
f 33/52/5 38/231/5 37/53/5
f 54/55/4 85/232/4 42/56/4
f 12/58/4 46/233/4 2/59/4
f 48/62/6 38/234/6 14/63/6
f 38/234/6 33/235/6 14/63/6
f 14/63/6 29/236/6 12/61/6
f 29/236/6 59/237/6 12/61/6
f 59/237/6 46/238/6 12/61/6
f 88/64/4 11/239/4 87/65/4
f 60/67/2 13/240/2 31/68/2
f 6/70/5 81/241/5 39/71/5
f 10/75/4 83/242/4 40/243/4
f 83/242/4 78/244/4 40/243/4
f 78/244/4 20/245/4 40/243/4
f 40/243/4 22/246/4 10/75/4
f 22/246/4 26/73/4 10/75/4
f 57/78/6 87/247/6 28/76/6
f 87/247/6 45/248/6 28/76/6
f 45/248/6 86/249/6 78/250/6
f 78/250/6 83/251/6 45/248/6
f 83/251/6 28/76/6 45/248/6
f 29/79/5 14/252/5 61/80/5
f 79/82/4 5/253/4 55/83/4
f 72/85/3 28/254/3 83/86/3
f 47/89/2 37/255/2 6/90/2
f 37/255/2 36/256/2 6/90/2
f 6/90/2 7/257/2 68/88/2
f 7/257/2 9/258/2 68/88/2
f 9/258/2 51/259/2 68/88/2
f 63/91/5 41/260/5 34/92/5
f 8/94/3 82/261/3 51/95/3
f 26/97/6 22/262/6 21/98/6
f 23/100/3 56/263/3 47/101/3
f 51/103/6 82/264/6 23/104/6
f 76/106/5 27/265/5 42/107/5
f 5/109/4 77/266/4 34/110/4
f 49/112/6 16/267/6 31/113/6
f 83/115/4 25/268/4 84/116/4
f 21/118/5 22/269/5 40/119/5
f 38/121/6 78/270/6 55/122/6
f 31/124/5 16/271/5 63/125/5
f 71/129/2 21/272/2 70/127/2
f 21/272/2 67/273/2 70/127/2
f 67/273/2 19/274/2 38/275/2
f 38/275/2 48/276/2 67/273/2
f 48/276/2 70/127/2 67/273/2
f 83/130/3 10/277/3 70/131/3
f 65/133/2 66/278/2 63/134/2
f 2/136/3 46/279/3 59/137/3
f 78/139/5 86/280/5 43/140/5
f 55/142/4 76/281/4 35/143/4
f 45/145/5 87/282/5 11/146/5
f 65/148/1 64/283/1 34/149/1
f 15/151/5 75/284/5 4/152/5
f 47/36/3 48/35/3 12/154/3
f 54/156/6 27/285/6 76/157/6
f 66/159/3 49/286/3 13/160/3
f 24/162/6 25/287/6 83/163/6
f 73/165/2 74/288/2 28/166/2
f 61/168/2 14/289/2 33/169/2
f 44/173/1 11/290/1 72/291/1
f 11/290/1 88/292/1 72/291/1
f 88/292/1 73/293/1 72/291/1
f 72/291/1 56/294/1 44/173/1
f 56/294/1 79/171/1 44/173/1
f 58/176/1 1/295/1 3/174/1
f 1/295/1 61/296/1 3/174/1
f 61/296/1 32/297/1 37/298/1
f 37/298/1 47/299/1 61/296/1
f 47/299/1 3/174/1 61/296/1
f 59/177/2 29/300/2 1/178/2
f 88/180/3 57/301/3 74/181/3
f 16/183/6 76/302/6 75/184/6
f 37/186/5 79/303/5 80/187/5
f 55/189/3 50/304/3 18/190/3
f 10/192/1 53/305/1 52/193/1
f 4/195/1 41/306/1 63/196/1
f 84/198/3 25/307/3 24/199/3
f 77/201/3 5/308/3 66/202/3
f 19/204/5 20/309/5 78/205/5
f 75/207/4 76/310/4 41/208/4

Binary file not shown.

View File

@ -1,14 +1,3 @@
minetest.register_node('x_bows:arrow_node', {
drawtype = 'mesh',
mesh = 'x_bows_arrow.obj',
tiles = {'x_bows_arrow_mesh.png'},
groups = {not_in_creative_inventory=1},
sunlight_propagates = true,
paramtype = 'light',
collision_box = {0, 0, 0, 0, 0, 0},
selection_box = {0, 0, 0, 0, 0, 0}
})
minetest.register_node('x_bows:target', {
description = 'Target',
tiles = {'x_bows_target.png'},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 236 B

View File

@ -30,6 +30,7 @@
---@field set_wielded_item fun(self: ObjectRef, item: ItemStack): boolean replaces the wielded item, returns `true` if successful.
---@field move_to fun(self: ObjectRef, pos: Vector, continuous?: boolean): nil Does an interpolated move for Lua entities for visually smooth transitions. If `continuous` is true, the Lua entity will not be moved to the current position before starting the interpolated move. For players this does the same as `set_pos`,`continuous` is ignored.
---@field set_hp fun(self: ObjectRef, hp: number, reason: table): nil set number of health points See reason in register_on_player_hpchange Is limited to the range of 0 ... 65535 (2^16 - 1) For players: HP are also limited by `hp_max` specified in object properties
---@field set_animation fun(self: ObjectRef, frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean): nil `frame_range`: table {x=num, y=num}, default: `{x=1, y=1}`, `frame_speed`: number, default: `15.0`, `frame_blend`: number, default: `0.0`, `frame_loop`: boolean, default: `true`
---Moving things in the game are generally these.
---This is basically a reference to a C++ `ServerActiveObject`.

View File

@ -9,6 +9,7 @@
---@field registered_arrows table<string, ItemDef|ArrowItemDefCustom>
---@field registered_quivers table<string, ItemDef|QuiverItemDefCustom>
---@field registered_particle_spawners table<string, ParticlespawnerDef|ParticlespawnerDefCustom>
---@field registered_entities table<string, XBowsEntityDef>
---@field player_bow_sneak table<string, table<string, boolean>>
---@field settings table
---@field quiver table Quiver class
@ -34,7 +35,7 @@
---@field hud_item_ids table
---@field after_job table<string, JobTable>
---@field udate_or_create_hud fun(self: XBowsQuiver, player: ObjectRef, inv_list: ItemStack[], idx?: number): nil Update or create quiver HUD
---@field get_or_create_detached_inv fun(self: XBowsQuiver, quiver_id: string, player_name: string, quiver_items?: string): InvRef|unknown Get existing detached inventory or create new one
---@field get_or_create_detached_inv fun(self: XBowsQuiver, quiver_id: string, player_name: string, quiver_items?: string): InvRef Get existing detached inventory or create new one
---@field save fun(self: XBowsQuiver, inv: InvRef, player: ObjectRef, quiver_is_closed?: boolean): nil Save quiver inventory to itemstack meta
---@field close_quiver fun(self: XBowsQuiver, player: ObjectRef, quiver_id?: string): nil Close one or all open quivers in players inventory
---@field get_replacement_item fun(self: XBowsQuiver, from_stack: ItemStack, to_item_name: string): ItemStack Swap item in player inventory indicating open quiver. Preserve all ItemStack definition and meta.
@ -101,8 +102,6 @@
---@field particle_effect string|nil
---@field particle_effect_crit string|nil
---@field particle_effect_fast string|nil
---@field projectile_textures table|nil
---@field projectile_visual_size table
---@field projectile_entity string
---@field on_hit_node fun(self: table, pointed_thing_ref: table)
---@field on_hit_entity fun(self: table, pointed_thing_ref: table)
@ -137,3 +136,10 @@
---@class EntityDefCustomAttrDef
---@field name string
---@field mod_name string
---@field animations EntityAnimationDef
---@field rotation_factor number|fun(): number
---Entity animation definition
---@class EntityAnimationDef
---@field idle {frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean}
---@field on_hit_node {frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean}