def __init__(self, ploader, settings): super(PathfindingPlugin, self).__init__(ploader, settings) self.bounding_box = BoundingBox(w=0.6, h=1.8) self.path_job = None self.col = MTVTest( self.world, BoundingBox(const.PLAYER_WIDTH, const.PLAYER_HEIGHT) ) ploader.provides('Pathfinding', PathfindingCore(self.start_path))
def _trapdoor_ext(block): block.direction = block.metadata & 0x03 block.open = (block.metadata >> 2) & 0x01 == const.BLOCK_TRAPDOOR_OPEN block.orientation = (block.metadata >> 3) & 0x1 if block.open == const.BLOCK_TRAPDOOR_OPEN: block.bounding_box = None elif block.orientation == const.BLOCK_TRAPDOOR_UPPER: block.bounding_box = BoundingBox(1, 1) elif block.orientation == const.BLOCK_TRAPDOOR_LOWER: block.bounding_box = BoundingBox(1, 0.4)
def start_path(self, pos, target, scb, fcb=None): pos = center_position(pos.floor(), BoundingBox(1, 1)) target = center_position(target.floor(), BoundingBox(1, 1)) new_job = Path(PathNode(pos), PathNode(target)), scb, fcb if self.path_job: self.path_job = new_job return self.path_job = new_job if not self.do_job(): self.event.reg_event_handler('event_tick', self.do_job)
def _gate_ext(block): block.direction = block.metadata & 0x03 block.open = (block.metadata >> 2) & 0x01 == const.BLOCK_GATE_OPEN block.powered = block.metadata >> 3 == const.BLOCK_GATE_POWERED if block.open: block.bounding_box = None else: block.bounding_box = BoundingBox(1, 1.5)
def __init__(self, ploader, settings): super(PhysicsPlugin, self).__init__(ploader, settings) self.vec = Vector3(0.0, 0.0, 0.0) self.col = collision.MTVTest( self.world, BoundingBox(const.PLAYER_WIDTH, const.PLAYER_HEIGHT)) self.pos = self.clientinfo.position self.skip_tick = False self.pc = PhysicsCore(self.pos, self.vec, self.clientinfo.abilities) ploader.provides('Physics', self.pc)
def __init__(self, ploader, settings): self.vec = Vector3(0.0, 0.0, 0.0) self.playerbb = BoundingBox(0.8, 1.8) self.world = ploader.requires('World') self.event = ploader.requires('Event') clinfo = ploader.requires('ClientInfo') self.pos = clinfo.position ploader.reg_event_handler('physics_tick', self.tick) self.pycore = NewPhysicsCore(self.vec, self.pos) ploader.provides('NewPhysics', self.pycore)
def _door_ext(block): block.section = (block.metadata >> 3) & 0x1 if block.section == const.BLOCK_DOOR_LOWER: block.open = (block.metadata >> 2) & 0x01 == const.BLOCK_DOOR_OPEN block.direction = block.metadata & 0x03 if not block.open: block.bounding_box = BoundingBox(1, 2) else: block.bounding_box = None elif block.section == const.BLOCK_DOOR_UPPER: block.hinge = block.metadata & 0x01 block.bounding_box = None
def _convert_boundingbox(bb): if bb == 'block': return BoundingBox(1, 1) else: # empty or unknown return None
def _lillypad_ext(block): block.bounding_box = BoundingBox(1, 0.0, 1)
def _fence_ext(block): block.bounding_box = BoundingBox(1, 1.5)