Ejemplo n.º 1
0
 def is_in_water(self, b_obj):
     is_in_water = False
     bb = b_obj.aabb.expand(-0.001, -0.4010000059604645, -0.001)
     top_y = utils.grid_shift(bb.max_y + 1)
     for blk in self.world.grid.blocks_in_aabb(bb):
         if isinstance(blk, blocks.BlockWater):
             if top_y >= (blk.y + 1 - blk.height_percent):
                 is_in_water = True
     return is_in_water
Ejemplo n.º 2
0
 def is_in_water(self, b_obj):
     is_in_water = False
     bb = b_obj.aabb.expand(-0.001, -0.4010000059604645, -0.001)
     top_y = utils.grid_shift(bb.max_y + 1)
     for blk in self.world.grid.blocks_in_aabb(bb):
         if isinstance(blk, blocks.BlockWater):
             if top_y >= (blk.y + 1 - blk.height_percent):
                 is_in_water = True
     return is_in_water
Ejemplo n.º 3
0
 def aabb_eyelevel_inside_water(self, bb, eye_height=config.PLAYER_EYELEVEL):
     eye_y = bb.min_y + eye_height
     ey = utils.grid_shift(eye_y)
     blk = self.get_block(bb.gridpos_x, ey, bb.gridpos_z)
     if blk.is_water:
         wh = blk.height_percent - 0.11111111
         return eye_y < (ey + 1 - wh)
     else:
         return False
Ejemplo n.º 4
0
 def head_inside_water(self, b_obj):
     bb = b_obj.aabb
     eye_y = bb.min_y + eye_height
     ey = utils.grid_shift(eye_y)
     blk = self.world.grid.get_block(bb.gridpos_x, ey, bb.gridpos_z)
     if blk.is_water:
         wh = blk.height_percent - 0.11111111
         return eye_y < (ey + 1 - wh)
     else:
         return False
Ejemplo n.º 5
0
 def head_inside_water(self, b_obj):
     bb = b_obj.aabb
     eye_y = bb.min_y + eye_height
     ey = utils.grid_shift(eye_y)
     blk = self.world.grid.get_block(bb.gridpos_x, ey, bb.gridpos_z)
     if blk.is_water:
         wh = blk.height_percent - 0.11111111
         return eye_y < (ey + 1 - wh)
     else:
         return False
Ejemplo n.º 6
0
 def handle_water_movement(self, b_obj):
     is_in_water = False
     water_current = utils.Vector(0, 0, 0)
     bb = b_obj.aabb.expand(-0.001, -0.401, -0.001)
     top_y = utils.grid_shift(bb.max_y + 1)
     for blk in self.world.grid.blocks_in_aabb(bb):
         if isinstance(blk, blocks.BlockWater):
             if top_y >= (blk.y + 1 - blk.height_percent):
                 is_in_water = True
                 water_current = blk.add_velocity_to(water_current)
     if water_current.size > 0:
         water_current.normalize()
         wconst = 0.014
         water_current = water_current * wconst
         b_obj.velocities = b_obj.velocities + water_current
     return is_in_water
Ejemplo n.º 7
0
 def handle_water_movement(self, b_obj):
     is_in_water = False
     water_current = utils.Vector(0, 0, 0)
     bb = b_obj.aabb.expand(-0.001, -0.401, -0.001)
     top_y = utils.grid_shift(bb.max_y + 1)
     for blk in self.world.grid.blocks_in_aabb(bb):
         if isinstance(blk, blocks.BlockWater):
             if top_y >= (blk.y + 1 - blk.height_percent):
                 is_in_water = True
                 water_current = blk.add_velocity_to(water_current)
     if water_current.size > 0:
         water_current.normalize()
         wconst = 0.014
         water_current = water_current * wconst
         b_obj.velocities = b_obj.velocities + water_current
     return is_in_water
Ejemplo n.º 8
0
 def gridpos_z(self):
     return utils.grid_shift(self.posz)
Ejemplo n.º 9
0
 def gridpos_y(self):
     return utils.grid_shift(self.posy)
Ejemplo n.º 10
0
 def gridpos_x(self):
     return utils.grid_shift(self.posx)
Ejemplo n.º 11
0
 def gridpos_y(self):
     return utils.grid_shift(self.posy)
Ejemplo n.º 12
0
 def grid_y(self):
     return utils.grid_shift(self.y)
Ejemplo n.º 13
0
 def grid_y(self):
     return utils.grid_shift(self.y)
Ejemplo n.º 14
0
 def grid_x(self):
     return utils.grid_shift(self.x)
Ejemplo n.º 15
0
 def gridpos_z(self):
     return utils.grid_shift(self.posz)
Ejemplo n.º 16
0
 def grid_x(self):
     return utils.grid_shift(self.x)
Ejemplo n.º 17
0
 def grid_z(self):
     return utils.grid_shift(self.z)
Ejemplo n.º 18
0
 def grid_z(self):
     return utils.grid_shift(self.z)
Ejemplo n.º 19
0
 def gridpos_x(self):
     return utils.grid_shift(self.posx)