1
0
Fork 0

Fix mobs colliding with objects

This commit is contained in:
jordan4ibanez 2021-04-07 23:07:04 -04:00
parent ec6eb51726
commit 6bd249547a
1 changed files with 11 additions and 3 deletions

View File

@ -866,10 +866,12 @@ local check_for_death = function(self, cause, cmi_cause)
remove_texture_mod(self, "^[colorize:#FF000040") remove_texture_mod(self, "^[colorize:#FF000040")
remove_texture_mod(self, "^[brighten") remove_texture_mod(self, "^[brighten")
self.passive = true self.passive = true
self.object:set_properties({ self.object:set_properties({
pointable = false, pointable = false,
collide_with_objects = false, collide_with_objects = false,
}) })
set_velocity(self, 0) set_velocity(self, 0)
local acc = self.object:get_acceleration() local acc = self.object:get_acceleration()
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0 acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
@ -3418,7 +3420,6 @@ local mob_activate = function(self, staticdata, def, dtime)
self.timer = 0 self.timer = 0
self.blinktimer = 0 self.blinktimer = 0
self.blinkstatus = false self.blinkstatus = false
self.collide_with_objects = false
-- check existing nametag -- check existing nametag
if not self.nametag then if not self.nametag then
@ -3907,6 +3908,12 @@ minetest.register_entity(name, {
on_detach_child = mob_detach_child, on_detach_child = mob_detach_child,
on_activate = function(self, staticdata, dtime) on_activate = function(self, staticdata, dtime)
--this is a temporary hack so mobs stop
--glitching and acting really weird with the
--default built in engine collision detection
self.object:set_properties({
collide_with_objects = false,
})
return mob_activate(self, staticdata, def, dtime) return mob_activate(self, staticdata, def, dtime)
end, end,
@ -4341,11 +4348,11 @@ end
--todo mob limiting --todo mob limiting
--MAIN LOOP --MAIN LOOP
local timer = 0 local timer = 15 --0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
timer = timer + dtime timer = timer + dtime
if timer >= 15 then if timer >= 15 then
timer = 0 timer = 15--0
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
for i = 1,math.random(5) do for i = 1,math.random(5) do
local player_pos = player:get_pos() local player_pos = player:get_pos()
@ -4354,6 +4361,7 @@ minetest.register_globalstep(function(dtime)
local goal_pos = position_calculation(player_pos) local goal_pos = position_calculation(player_pos)
print(dump(minetest.get_biome_data(goal_pos)))
local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])] local mob_def = spawn_dictionary[dimension][math.random(1,#spawn_dictionary[dimension])]