Implement very basic flopping

This commit is contained in:
Wuzzy 2020-12-05 14:14:16 +01:00
parent cb08062926
commit a9b59816c4
2 changed files with 14 additions and 3 deletions

View File

@ -11,6 +11,8 @@ local HORNY_AGAIN_TIME = 300
local CHILD_GROW_TIME = 60*20 local CHILD_GROW_TIME = 60*20
local DEATH_DELAY = 0.5 local DEATH_DELAY = 0.5
local DEFAULT_FALL_SPEED = -10 local DEFAULT_FALL_SPEED = -10
local FLOP_HEIGHT = 5.0
local FLOP_HOR_SPEED = 1.5
local MOB_CAP = {} local MOB_CAP = {}
MOB_CAP.hostile = 70 MOB_CAP.hostile = 70
@ -2147,13 +2149,23 @@ local follow_flop = function(self)
if not flight_check(self, s) then if not flight_check(self, s) then
self.state = "flop" self.state = "flop"
self.object:set_velocity({x = 0, y = -5, z = 0}) self.object:set_acceleration({x = 0, y = DEFAULT_FALL_SPEED, z = 0})
set_animation(self, "stand") local sdef = minetest.registered_nodes[self.standing_on]
if sdef and sdef.walkable then
self.object:set_velocity({
x = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED),
y = FLOP_HEIGHT,
z = math.random(-FLOP_HOR_SPEED, FLOP_HOR_SPEED),
})
end
set_animation(self, "stand", true)
return return
elseif self.state == "flop" then elseif self.state == "flop" then
self.state = "stand" self.state = "stand"
self.object:set_acceleration({x = 0, y = 0, z = 0})
end end
end end
end end

View File

@ -47,7 +47,6 @@ mobs:register_mob("mobs_mc:squid", {
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
breathes_in_water = true, breathes_in_water = true,
jump = false, jump = false,
fall_speed = 0.5,
view_range = 16, view_range = 16,
runaway = true, runaway = true,
fear_height = 4, fear_height = 4,