fix: bats don't fly
parent
cca7a718f6
commit
4688047f69
|
@ -69,7 +69,8 @@ petz.put_saddle = function(self, clicker, wielded_item, wielded_item_name)
|
||||||
another_saddle = "^petz_"..self.type.."_saddle.png"
|
another_saddle = "^petz_"..self.type.."_saddle.png"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local texture = "petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png" .. "^petz_"..self.type.."_"..saddle_type..".png"..another_saddle
|
local texture = "petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png"
|
||||||
|
.. "^petz_"..self.type.."_"..saddle_type..".png"..another_saddle
|
||||||
petz.set_properties(self, {textures = {texture}})
|
petz.set_properties(self, {textures = {texture}})
|
||||||
wielded_item:take_item()
|
wielded_item:take_item()
|
||||||
clicker:set_wielded_item(wielded_item)
|
clicker:set_wielded_item(wielded_item)
|
||||||
|
|
|
@ -32,7 +32,7 @@ function petz.bh_climb(self, pos, prty)
|
||||||
mobkit.animate(self, 'climb')
|
mobkit.animate(self, 'climb')
|
||||||
return true
|
return true
|
||||||
else --search for a tree
|
else --search for a tree
|
||||||
if mobkit.timer(self, 10) then
|
if mobkit.timer(self, 60) then
|
||||||
local view_range = self.view_range
|
local view_range = self.view_range
|
||||||
local nearby_wood = minetest.find_nodes_in_area(
|
local nearby_wood = minetest.find_nodes_in_area(
|
||||||
{x = pos.x - view_range, y = pos.y - view_range, z = pos.z - view_range},
|
{x = pos.x - view_range, y = pos.y - view_range, z = pos.z - view_range},
|
||||||
|
|
|
@ -48,7 +48,8 @@ end
|
||||||
local function get_velocity(v, yaw, y)
|
local function get_velocity(v, yaw, y)
|
||||||
local x = -math.sin(yaw) * v
|
local x = -math.sin(yaw) * v
|
||||||
local z = math.cos(yaw) * v
|
local z = math.cos(yaw) * v
|
||||||
return {x = x, y = y, z = z}
|
local vel = vector.new(x, y, z)
|
||||||
|
return vel
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_v(v)
|
local function get_v(v)
|
||||||
|
@ -77,11 +78,11 @@ function petz.lq_mountdriver(self)
|
||||||
rot_view = math.pi/2
|
rot_view = math.pi/2
|
||||||
end
|
end
|
||||||
local acce_y = 0
|
local acce_y = 0
|
||||||
local velo= {
|
local velo = vector.new(
|
||||||
x= self.max_speed_forward/3,
|
self.max_speed_forward/3,
|
||||||
y= 0,
|
0,
|
||||||
z= self.max_speed_forward/3,
|
self.max_speed_forward/3
|
||||||
}
|
)
|
||||||
local velocity = get_v(velo)
|
local velocity = get_v(velo)
|
||||||
--minetest.chat_send_player("singleplayer", tostring(velocity))
|
--minetest.chat_send_player("singleplayer", tostring(velocity))
|
||||||
-- process controls
|
-- process controls
|
||||||
|
@ -139,7 +140,7 @@ function petz.lq_mountdriver(self)
|
||||||
end
|
end
|
||||||
-- Set position, velocity and acceleration
|
-- Set position, velocity and acceleration
|
||||||
local new_velo = get_velocity(velocity, self.object:get_yaw() - rot_view, velo.y)
|
local new_velo = get_velocity(velocity, self.object:get_yaw() - rot_view, velo.y)
|
||||||
local new_acce = {x = 0, y = mobkit.gravity, z = 0}
|
local new_acce = vector.new(0, mobkit.gravity, 0)
|
||||||
self.object:set_velocity(new_velo)
|
self.object:set_velocity(new_velo)
|
||||||
if not(self.gallop) then
|
if not(self.gallop) then
|
||||||
mobkit.animate(self, "walk") -- set animation
|
mobkit.animate(self, "walk") -- set animation
|
||||||
|
|
|
@ -37,7 +37,7 @@ minetest.register_entity("petz:"..pet_name,{
|
||||||
-- api props
|
-- api props
|
||||||
springiness= 0,
|
springiness= 0,
|
||||||
buoyancy = 0.5, -- portion of hitbox submerged
|
buoyancy = 0.5, -- portion of hitbox submerged
|
||||||
max_speed = 2.5,
|
max_speed = 3.5,
|
||||||
jump_height = 2.0,
|
jump_height = 2.0,
|
||||||
view_range = 10,
|
view_range = 10,
|
||||||
lung_capacity = 10, -- seconds
|
lung_capacity = 10, -- seconds
|
||||||
|
@ -61,7 +61,7 @@ minetest.register_entity("petz:"..pet_name,{
|
||||||
moaning = "petz_bat_moaning",
|
moaning = "petz_bat_moaning",
|
||||||
},
|
},
|
||||||
|
|
||||||
logic = petz.herbivore_brain,
|
logic = petz.flying_brain,
|
||||||
|
|
||||||
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
||||||
mobkit.actfunc(self, staticdata, dtime_s)
|
mobkit.actfunc(self, staticdata, dtime_s)
|
||||||
|
|
Loading…
Reference in New Issue