Add function for faking blocks while pathing
This commit is contained in:
@@ -141,6 +141,26 @@ class World:
|
||||
except path.AStarTimeout:
|
||||
return None
|
||||
|
||||
def path_to_place_faked(self, start, place):
|
||||
# same as above, but adds a fake block below and air before pathfinding
|
||||
# so that the pathfinder can actually make it to the block
|
||||
c = self.g.chunks
|
||||
above = utils.padd(place, path.BLOCK_ABOVE)
|
||||
below = utils.padd(place, path.BLOCK_BELOW)
|
||||
|
||||
tmp = c.get_block_at(*place)
|
||||
tmp2 = c.get_block_at(*above)
|
||||
tmp3 = c.get_block_at(*below)
|
||||
c.set_block_at(*place, blocks.AIR)
|
||||
c.set_block_at(*above, blocks.AIR)
|
||||
c.set_block_at(*below, blocks.STONE)
|
||||
navpath = self.path_to_place(start, place)
|
||||
c.set_block_at(*place, tmp)
|
||||
c.set_block_at(*above, tmp2)
|
||||
c.set_block_at(*below, tmp3)
|
||||
|
||||
return navpath
|
||||
|
||||
def find_bed_areas(self, center, distance):
|
||||
bed_clearance = 9 # 5x5 area
|
||||
clear_distance = 2
|
||||
|
||||
Reference in New Issue
Block a user