Update balloon.lua

This commit is contained in:
Sumyjkl 2023-01-11 13:39:06 +11:00
parent 3a1e84e2ca
commit d5737a31da

View file

@ -153,12 +153,12 @@ end
function me.on_step(self, dtime, moveresult)
local exit = false
local ctrl = nil
local pi = nil
-- allow to exit
if self._driver and self._driver:is_player() then
local name = self._driver:get_player_name()
ctrl = player_info.p[name]
exit = ctrl.just_pressed.sneak
pi = player_info.p[name]
exit = pi.just_pressed.sneak
end
if exit then
me.detach(self)
@ -175,13 +175,13 @@ function me.on_step(self, dtime, moveresult)
local in_water = minetest.get_item_group(minetest.get_node(p).name, "liquid") ~= 0
local on_water = (minetest.get_item_group(minetest.get_node(vector.offset(p, 0, -0.2, 0)).name, "liquid") ~= 0 and not in_water)
if ctrl then
if ctrl.ctrl.up then forward = 1
elseif ctrl.ctrl.down then forward = -1 end
if ctrl.ctrl.jump then climb = 1
elseif ctrl.ctrl.aux1 then climb = -1 end
if ctrl.ctrl.right then right = 1
elseif ctrl.ctrl.left then right = -1 end
if pi then
if pi.ctrl.up then forward = 1
elseif pi.ctrl.down then forward = -1 end
if pi.ctrl.jump then climb = 1
elseif pi.ctrl.aux1 then climb = -1 end
if pi.ctrl.right then right = 1
elseif pi.ctrl.left then right = -1 end
local yaw = self.object:get_yaw()
local dir = minetest.yaw_to_dir(yaw)
self.object:set_yaw(yaw - right * dtime)