Added Sussy Imposter (he's very sussy and he wants to kill you) and improved jumping of every entity

This commit is contained in:
2023-02-05 23:47:35 +01:00
parent 27d36b0e8b
commit f62082d9c6
11 changed files with 607 additions and 23 deletions

View File

@@ -120,14 +120,20 @@ local entity = {
pos.z = pos.z + dir_sin
local bnode = minetest.get_node(pos)
if bnode.name == "air" or bnode.name == "amogus_blocks:water_source" or bnode.name == "amogus_blocks:water_flowing" then
--if bnode.name == "air" or bnode.name == "amogus_blocks:water_source" or bnode.name == "amogus_blocks:water_flowing" then
-- if node is not solid OR is a liquid
if minetest.registered_nodes[bnode.name].walkable == false or minetest.registered_nodes[bnode.name].liquidtype ~= "none" then
self.block_lastly_in_front = false
-- if node next to the entity is a solid block
else
if self.block_lastly_in_front == false then
self.block_lastly_in_front = true
local vel = self.object:get_velocity()
vel.y = vel.y + (math.random() * self.min_max_jump_force_diff + self.min_jump_force)
self.object:set_velocity(vel)
-- randomly jump in the next iteration even if theres still a block in front
elseif math.random(10) == 1 then
self.block_lastly_in_front = false
end
end