Esempio n. 1
0
    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))
Esempio n. 2
0
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)
Esempio n. 3
0
 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)
Esempio n. 4
0
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)
Esempio n. 5
0
 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)
Esempio n. 7
0
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
Esempio n. 8
0
def _convert_boundingbox(bb):
    if bb == 'block':
        return BoundingBox(1, 1)
    else:  # empty or unknown
        return None
Esempio n. 9
0
def _lillypad_ext(block):
    block.bounding_box = BoundingBox(1, 0.0, 1)
Esempio n. 10
0
def _fence_ext(block):
    block.bounding_box = BoundingBox(1, 1.5)