From 59e8ba64f28b293b716854eeee9550cd9f97cfb9 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 22 Feb 2017 12:57:02 +0000 Subject: Tidied code, added fly arrow check --- mount.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'mount.lua') diff --git a/mount.lua b/mount.lua index b3b527f..0b08613 100644 --- a/mount.lua +++ b/mount.lua @@ -340,9 +340,6 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) else v = v * 0.25 end --- elseif ni == "walkable" then --- v = 0 --- new_acce.y = 1 end new_velo = get_velocity(v, entity.object:getyaw() - rot_view, velo.y) @@ -415,11 +412,16 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) y = pos.y + 1.5 + dir.y, z = pos.z + 0 + dir.z * 2.5}, arrow) - local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} - local yaw = entity.driver:get_look_yaw() - - obj:setyaw(yaw + math.pi / 2) - obj:setvelocity(vec) + local ent = obj:get_luaentity() + if ent then + ent.switch = 1 -- for mob specific arrows + local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} + local yaw = entity.driver:get_look_yaw() + obj:setyaw(yaw + math.pi / 2) + obj:setvelocity(vec) + else + obj:remove() + end end -- change animation if stopped -- cgit v1.2.3