Compare commits
4 Commits
950115d69e
...
a8f447a346
Author | SHA1 | Date | |
---|---|---|---|
a8f447a346 | |||
49a5d903d4 | |||
93e4bc2268 | |||
|
af7eafc22c |
23
api.lua
23
api.lua
@ -27,7 +27,7 @@ local use_cmi = minetest.global_exists("cmi")
|
||||
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20230726",
|
||||
version = "20230805",
|
||||
intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||
node_ice = "default:ice",
|
||||
@ -268,7 +268,7 @@ end
|
||||
-- are we a real player ?
|
||||
local function is_player(player)
|
||||
|
||||
if player and type(player) == "userdata" and minetest.is_player(player) then
|
||||
if player and type(player) == "userdata" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -279,7 +279,6 @@ function mob_class:collision()
|
||||
|
||||
local pos = self.object:get_pos() ; if not pos then return {0, 0} end
|
||||
local x, z = 0, 0
|
||||
local vel = self.object:get_velocity()
|
||||
local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5
|
||||
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||
@ -372,7 +371,7 @@ function mob_class:set_velocity(v)
|
||||
end
|
||||
|
||||
-- set velocity
|
||||
local vel = self.object:get_velocity() or 0
|
||||
local vel = self.object:get_velocity() or {x = 0, y = 0, z = 0}
|
||||
|
||||
local new_vel = {
|
||||
x = (sin(yaw) * -v) + c_x,
|
||||
@ -1323,26 +1322,24 @@ function mob_class:do_jump()
|
||||
and not self.facing_fence
|
||||
and self.looking_at ~= mobs.node_snow then
|
||||
|
||||
local v = self.object:get_velocity()
|
||||
|
||||
v.y = self.jump_height
|
||||
vel.y = self.jump_height
|
||||
|
||||
self:set_animation("jump") -- only if defined
|
||||
|
||||
self.object:set_velocity(v)
|
||||
self.object:set_velocity(vel)
|
||||
|
||||
-- when in air move forward
|
||||
minetest.after(0.3, function(self, v)
|
||||
minetest.after(0.3, function(self, vel)
|
||||
|
||||
if self.object:get_luaentity() then
|
||||
|
||||
self.object:set_acceleration({
|
||||
x = v.x * 2,
|
||||
x = vel.x * 2,
|
||||
y = 0,
|
||||
z = v.z * 2
|
||||
z = vel.z * 2
|
||||
})
|
||||
end
|
||||
end, self, v)
|
||||
end, self, vel)
|
||||
|
||||
if self:get_velocity() > 0 then
|
||||
self:mob_sound(self.sounds.jump)
|
||||
@ -2355,7 +2352,7 @@ function mob_class:do_states(dtime)
|
||||
lp = minetest.find_nodes_in_area_under_air(
|
||||
{x = s.x - 5, y = s.y , z = s.z - 5},
|
||||
{x = s.x + 5, y = s.y + 2, z = s.z + 5},
|
||||
{"group:cracky", "group:crumbly", "group:choppy", "group:solid", "group:stone", "group:sand", node_ice, node_snowblock})
|
||||
{"group:cracky", "group:crumbly", "group:choppy", "group:solid", "group:stone", "group:sand", mobs.node_ice, mobs.node_snow})
|
||||
|
||||
-- did we find land?
|
||||
if lp and #lp > 0 then
|
||||
|
Loading…
x
Reference in New Issue
Block a user