eye_height no longer hardcoded

This commit is contained in:
blut 2024-12-26 20:51:54 +01:00
parent ca0f11b586
commit d857dd136b

View File

@ -182,8 +182,9 @@ function bow2.shoot(itemstack, user, pointed_thing)
itemstack:set_name(bow_name) itemstack:set_name(bow_name)
local pos = user:get_pos() local pos = user:get_pos()
pos.y = pos.y + user:get_properties().eye_height
local dir = user:get_look_dir() local dir = user:get_look_dir()
local obj = core.add_entity({x = pos.x, y = pos.y + 1.5, z = pos.z}, 'bow2:arrow_entity', core.serialize(staticdata)) local obj = core.add_entity(pos, 'bow2:arrow_entity', core.serialize(staticdata))
if not obj then if not obj then
return itemstack return itemstack
@ -208,7 +209,7 @@ function bow2.shoot(itemstack, user, pointed_thing)
core.sound_play(sound_name, { core.sound_play(sound_name, {
gain = 0.3, gain = 0.3,
pos = user:get_pos(), pos = pos,
max_hear_distance = 10 max_hear_distance = 10
}) })