mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-03-15 04:11:24 +00:00
Add Context Based Steering, ABM Spawning fixes 2
This commit is contained in:
parent
64de7d9ed5
commit
3dbca468d3
3 changed files with 6 additions and 6 deletions
4
api.lua
4
api.lua
|
@ -143,14 +143,14 @@ function creatura.get_ground_level(pos, range)
|
|||
local under = {x = above.x, y = above.y - 1, z = above.z}
|
||||
if not get_node_def(above).walkable and get_node_def(under).walkable then return above end
|
||||
if get_node_def(above).walkable then
|
||||
for i = 1, range do
|
||||
for _ = 1, range do
|
||||
under = above
|
||||
above = {x = above.x, y = above.y + 1, z = above.z}
|
||||
if not get_node_def(above).walkable and get_node_def(under).walkable then return above end
|
||||
end
|
||||
end
|
||||
if not get_node_def(under).walkable then
|
||||
for i = 1, range do
|
||||
for _ = 1, range do
|
||||
above = under
|
||||
under = {x = under.x, y = under.y - 1, z = under.z}
|
||||
if not get_node_def(above).walkable and get_node_def(under).walkable then return above end
|
||||
|
|
|
@ -34,7 +34,7 @@ local vec_sub = vector.subtract
|
|||
local yaw2dir = minetest.yaw_to_dir
|
||||
local dir2yaw = minetest.dir_to_yaw
|
||||
|
||||
local function debugpart(pos, time, tex)
|
||||
--[[local function debugpart(pos, time, tex)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
texture = tex or "creatura_particle_red.png",
|
||||
|
@ -42,7 +42,7 @@ local function debugpart(pos, time, tex)
|
|||
glow = 16,
|
||||
size = 16
|
||||
})
|
||||
end
|
||||
end]]
|
||||
|
||||
---------------------
|
||||
-- Local Utilities --
|
||||
|
@ -122,7 +122,7 @@ function creatura.get_collision_ranged(self, dir, range)
|
|||
local dir_x, dir_y, dir_z = dir.x, dir.y, dir.z
|
||||
local dist
|
||||
local collision
|
||||
for i = 0, range or 4 do
|
||||
for _ = 0, range or 4 do
|
||||
pos_x = pos_x + dir_x
|
||||
pos_y = pos_y + dir_y
|
||||
pos_z = pos_z + dir_z
|
||||
|
|
|
@ -580,7 +580,7 @@ function creatura.register_abm_spawn(mob, def)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.log("action",
|
||||
"[Creatura] [ABM Spawning] Spawned " .. group_size .. " " .. mob .. " at " .. minetest.pos_to_string(pos))
|
||||
|
|
Loading…
Add table
Reference in a new issue