""" hop hop dotting """ from commands import add, admin from pyspades.common import coordinates @admin def sethop(connection, value = None): protocol = connection.protocol if value is None: protocol.rabbitzone = None protocol.send_chat('All areas are now RABBIT ZONE!', irc = True) else: if protocol.rabbitzone is None: protocol.rabbitzone = set() pos = coordinates(value) protocol.rabbitzone.symmetric_difference_update([pos]) message = 'The area at %s is now %s' % (value.upper(), 'rabbit zone' if pos in protocol.rabbitzone else 'normal state') protocol.send_chat(message, irc = True) add(sethop) def apply_script(protocol, connection, config): class DoublejumpConnection(connection): double_jumping = True def on_animation_update(self, jump, crouch, sneak, sprint): if jump: self.double_jumping = True if (self.fly or self.double_jumping) and self.protocol.is_rabbitzone(self) and crouch and self.world_object.velocity.z != 0.0: jump = True self.double_jumping = False return jump, crouch, sneak, sprint def on_spawn(self, pos): self.double_jumping = True return connection.on_spawn class DoublejumpProtocol(protocol): rabbitzone = None def on_map_change(self, map): self.rabbitzone = set(coordinates(s) for s in getattr(self.map_info.info, 'double_jumping', [])) protocol.on_map_change(self, map) def is_rabbitzone(self, player): x, y, z = player.world_object.position.get() if self.rabbitzone: for sx, sy in self.rabbitzone: if x >= sx and y >= sy and x < sx + 64 and y < sy + 64: return True else: return False else: return True return DoublejumpProtocol, DoublejumpConnection