forked from VoxeLibre/VoxeLibre
Merge pull request 'Fix crash when using flint and steel on creeper' (#2598) from fix_flint_and_creeper into master
Reviewed-on: MineClone2/MineClone2#2598 Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
commit
1f2b70cb85
|
@ -213,11 +213,11 @@ end
|
||||||
local collision = function(self)
|
local collision = function(self)
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
if not pos then return {0,0} end
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity()
|
||||||
local x = 0
|
local x = 0
|
||||||
local z = 0
|
local z = 0
|
||||||
local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5
|
local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5
|
||||||
|
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
|
@ -254,13 +254,15 @@ local set_velocity = function(self, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
local yaw = (self.object:get_yaw() or 0) + self.rotate
|
local yaw = (self.object:get_yaw() or 0) + self.rotate
|
||||||
|
local vv = self.object:get_velocity()
|
||||||
|
if vv then
|
||||||
self.object:set_velocity({
|
self.object:set_velocity({
|
||||||
x = (sin(yaw) * -v) + c_x,
|
x = (sin(yaw) * -v) + c_x,
|
||||||
y = self.object:get_velocity().y,
|
y = vv.y,
|
||||||
z = (cos(yaw) * v) + c_y,
|
z = (cos(yaw) * v) + c_y,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3002,6 +3004,7 @@ end
|
||||||
|
|
||||||
local function check_entity_cramming(self)
|
local function check_entity_cramming(self)
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
|
if not p then return end
|
||||||
local oo = minetest.get_objects_inside_radius(p,1)
|
local oo = minetest.get_objects_inside_radius(p,1)
|
||||||
local mobs = {}
|
local mobs = {}
|
||||||
for _,o in pairs(oo) do
|
for _,o in pairs(oo) do
|
||||||
|
|
Loading…
Reference in New Issue