fix Voxel usage
This commit is contained in:
parent
8a44b7384c
commit
32aaf650cf
@ -45,6 +45,7 @@ License: LGPLv2
|
||||
- plan_obj:do_add_chunk_voxel(plan_pos) - Place all nodes for chunk in real world using voxelmanip (TODO)
|
||||
- plan_obj:get_status() - get the plan status. Returns values are "new", "build" and "finished"
|
||||
- plan_obj:set_status(status) - set the plan status. Created plan is new, allowed new stati are "build" and "finished"
|
||||
- plan_obj:load_region(min_world_pos[, max_world_pos]) - Load a Voxel-Manip for faster lookups to the real world
|
||||
|
||||
### Hooks
|
||||
- plan_obj:on_status() - if defined, is called from get_plan_status() to get custom updates
|
||||
@ -59,7 +60,6 @@ License: LGPLv2
|
||||
- plan_obj.data.groundnode_count - count of nodes found for ground_y determination (internal)
|
||||
- plan_obj.data.min_pos - minimal {x,y,z} vector
|
||||
- plan_obj.data.max_pos - maximal {x,y,z} vector
|
||||
- plan_obj:load_region(min_world_pos, max_world_pos) - Load a Voxel-Manip for faster lookups to the real world
|
||||
|
||||
## Node object
|
||||
### class-methods
|
||||
|
16
npc_ai.lua
16
npc_ai.lua
@ -48,18 +48,12 @@ function npc_ai_class:get_if_buildable(node)
|
||||
local node_index
|
||||
local world_content_id
|
||||
|
||||
if self.plan.vm_area then
|
||||
node_index = self.plan.vm_area:indexp(world_pos)
|
||||
world_content_id = self.plan.vm_data[node_index]
|
||||
end
|
||||
if not world_content_id then
|
||||
self.plan:load_region(world_pos, world_pos)
|
||||
node_index = self.plan.vm_area:indexp(world_pos)
|
||||
world_content_id = self.plan.vm_data[node_index]
|
||||
end
|
||||
if not world_content_id then
|
||||
return nil --something wrong
|
||||
if not self.plan.vm_area or not self.plan.vm_area:contains(world_pos.x, world_pos.y, world_pos.z) then
|
||||
self.plan:load_region(world_pos)
|
||||
end
|
||||
node_index = self.plan.vm_area:indexp(world_pos)
|
||||
world_content_id = self.plan.vm_data[node_index]
|
||||
|
||||
node.world_node_name = minetest.get_name_from_content_id(world_content_id)
|
||||
if world_content_id == mapped.content_id then
|
||||
-- right node is at the place. there are no costs to touch them. Check if a touch needed
|
||||
|
Loading…
x
Reference in New Issue
Block a user