mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-12 20:53:16 +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
5668dae194
commit
899bb2d3e3
@ -1044,8 +1044,8 @@ function mob_class:do_states_attack(dtime)
|
|||||||
owner = self,
|
owner = self,
|
||||||
})
|
})
|
||||||
ent = arrow:get_luaentity()
|
ent = arrow:get_luaentity()
|
||||||
ent.switch = 1
|
|
||||||
v = ent.velocity or v
|
v = ent.velocity or v
|
||||||
|
ent.switch = 1
|
||||||
|
|
||||||
-- important for mcl_shields
|
-- important for mcl_shields
|
||||||
ent._shooter = self.object
|
ent._shooter = self.object
|
||||||
@ -1056,7 +1056,7 @@ function mob_class:do_states_attack(dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- offset makes shoot aim accurate
|
-- offset makes shoot aim accurate
|
||||||
vec.y = vec.y + self.shoot_offset -- TODO: check if this is breaking the new projectile refactor
|
vec.y = vec.y + self.shoot_offset
|
||||||
vec.x, vec.y, vec.z = vec.x * (v / dist), vec.y * (v / dist), vec.z * (v / dist)
|
vec.x, vec.y, vec.z = vec.x * (v / dist), vec.y * (v / dist), vec.z * (v / dist)
|
||||||
if self.shoot_arrow then
|
if self.shoot_arrow then
|
||||||
vec = vector.normalize(vec)
|
vec = vector.normalize(vec)
|
||||||
|
@ -21,7 +21,7 @@ function mod.projectile_physics(obj, entity_def, v, a)
|
|||||||
v = v or obj:get_velocity()
|
v = v or obj:get_velocity()
|
||||||
a = a or vector.zero()
|
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)
|
a = a + vector.new(0,-GRAVITY,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -372,6 +372,7 @@ function mod.create(entity_id, options)
|
|||||||
a = vector.zero()
|
a = vector.zero()
|
||||||
v = a
|
v = a
|
||||||
end
|
end
|
||||||
|
local entity_def = minetest.registered_entities[entity_id]
|
||||||
mod.projectile_physics(obj, entity_def, v, a)
|
mod.projectile_physics(obj, entity_def, v, a)
|
||||||
|
|
||||||
-- Update projectile parameters
|
-- Update projectile parameters
|
||||||
|
Loading…
Reference in New Issue
Block a user