mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-04 16:53:46 +01:00
Correct behavior when ignore_gravity flag is true, fix mob projectile velocity calculation, add missing entity_def lookup
This commit is contained in:
parent
cd11f1c588
commit
f7c20748e7
@ -1242,8 +1242,8 @@ function mob_class:do_states_attack (dtime)
|
||||
owner = self,
|
||||
})
|
||||
ent = arrow:get_luaentity()
|
||||
v = ent.velocity or v
|
||||
ent.switch = 1
|
||||
v = ent.velocity or 1
|
||||
|
||||
-- important for mcl_shields
|
||||
ent._shooter = self.object
|
||||
@ -1255,7 +1255,8 @@ function mob_class:do_states_attack (dtime)
|
||||
|
||||
-- offset makes shoot aim accurate
|
||||
local amount = vector.length(vec)
|
||||
vec = vector.multiply(vec, v / vector.length(vec))
|
||||
vec.y = vec.y + self.shoot_offset
|
||||
vec = vector.multiply(vec, v / amount)
|
||||
|
||||
if self.shoot_arrow then
|
||||
vec = vector.normalize(vec)
|
||||
|
@ -21,7 +21,7 @@ function mod.projectile_physics(obj, entity_def, v, a)
|
||||
v = v or obj:get_velocity()
|
||||
a = a or vector.zero()
|
||||
|
||||
if not entity_def.ignore_gravity then
|
||||
if not entity_def._vl_projectile.ignore_gravity then
|
||||
a = a + vector.new(0,-GRAVITY,0)
|
||||
end
|
||||
|
||||
@ -372,6 +372,7 @@ function mod.create(entity_id, options)
|
||||
a = vector.zero()
|
||||
v = a
|
||||
end
|
||||
local entity_def = minetest.registered_entities[entity_id]
|
||||
mod.projectile_physics(obj, entity_def, v, a)
|
||||
|
||||
-- Update projectile parameters
|
||||
|
Loading…
Reference in New Issue
Block a user