def get_look_dir(self): yaw = math.radians(self.body_yaw + 90) pitch = math.radians(self.body_pitch) x = math.cos(yaw) * math.cos(pitch) y = math.sin(yaw) * math.cos(pitch) z = math.sin(pitch) return vec3(x, y, z)
def create_teleport_packet(pos, chunk_pos, user_id): packet = static.StaticEntityPacket() header = static.StaticEntityHeader() packet.header = header packet.chunk_x = chunk_pos[0] packet.chunk_y = chunk_pos[1] packet.entity_id = 0 header.set_type('Bench') header.size = vec3(0, 0, 0) header.closed = True header.orientation = static.ORIENT_SOUTH header.pos = pos header.time_offset = 0 header.something8 = 0 header.user_id = user_id return packet
def run_particles(self): while True: for entities in (self.flags, self.bases): for entity in entities: particle = packets.ParticleData() particle.pos = entity.pos particle.accel = vec3(0.0, 0.0, 8) particle.color = make_int_color(250, 40, 99, 255) particle.scale = 0.5 particle.count = 2 particle.particle_type = constants.NO_GRAVITY_PARTICLE particle.spreading = 3 particle.something18 = 0 self.server.update_packet.particles.append(particle) yield from asyncio.sleep(0.2)
def damage(self, damage=0, stun_duration=0): packet = packets.HitPacket() packet.entity_id = self.entity_id packet.target_id = self.entity_id packet.hit_type = packets.HIT_NORMAL packet.damage = damage packet.critical = 1 packet.stun_duration = stun_duration packet.something8 = 0 packet.pos = self.pos packet.hit_dir = vec3() packet.skill_hit = 0 packet.show_light = 0 self.world.server.update_packet.player_hits.append(packet) if self.hp <= 0: return self.hp -= damage if self.connection and self.hp <= 0: self.connection.scripts.call('on_die', killer=None)
APPEARANCES = dict({ 2: { 'scale': 0.96, 'radius': 0.96, 'height': 2.16, 'scale_head': 1.01, 'scale_feet': 0.98, 'scale_hand': 1.00, 'scale_body': 1.00, 'scale_back': 0.80, 'scale_shoulder': 1.00, 'scale_weapon': 0.98, 'scale_wing': 1.00, 'scale_unknown': 1.00, 'offset_body': vec3(0, 0, -5), 'offset_head': vec3(0, 0.5, 5), 'offset_hand': vec3(6, 0, 0), 'offset_foot': vec3(3, 1, -10.5), 'offset_back': vec3(0, -8, 2), 'offset_wing': vec3(0, 0, 0), 'model_head': list(range(1246, 1251 + 1)), 'model_hair': list(range(1252, 1266 + 1)), 'model_feet': (432, ), 'model_hand': (430, 431), 'model_body': (1, ), 'model_back': (-1, ), 'model_shoulder': (-1, ), 'model_wing': (-1, ) }, 3: {
}) APPEARANCES = dict({ 2: {'scale': 0.96, 'radius': 0.96, 'height': 2.16, 'scale_head': 1.01, 'scale_feet': 0.98, 'scale_hand': 1.00, 'scale_body': 1.00, 'scale_back': 0.80, 'scale_shoulder': 1.00, 'scale_weapon': 0.98, 'scale_wing': 1.00, 'scale_unknown': 1.00, 'offset_body': vec3(0, 0, -5), 'offset_head': vec3(0, 0.5, 5), 'offset_hand': vec3(6, 0, 0), 'offset_foot': vec3(3, 1, -10.5), 'offset_back': vec3(0, -8, 2), 'offset_wing': vec3(0, 0, 0), 'model_head': list(range(1246, 1251 + 1)), 'model_hair': list(range(1252, 1266 + 1)), 'model_feet': (432, ), 'model_hand': (430, 431), 'model_body': (1, ), 'model_back': (-1, ), 'model_shoulder': (-1, ), 'model_wing': (-1, )}, 3: {'scale': 0.96,