def findradius(self, origin, radius): ents = engine.findradius(origin, radius) if not ents: return None for i in range(len(ents)-1): ents[i].chain = ents[i+1] ents[-1].chain = None return ents[0]
def T_BeamDamage(attacker, damage, *qwp_extra): for head in engine.findradius(attacker.origin, damage + 40): if head.takedamage: points = 0.5 * qc.length(attacker.origin - head.origin) if points < 0: points = 0 points = damage - points if head == attacker: points *= 0.5 if (points > 0) and CanDamage(head, attacker): T_Damage(head, attacker, attacker, points)
def T_RadiusDamage(inflictor, attacker, damage, ignore, *qwp_extra): for head in engine.findradius(inflictor.origin, damage + 40): if head.takedamage and (head != ignore): org = head.origin + (head.mins + head.maxs) * 0.5 points = 0.5 * qc.length(inflictor.origin - org) if points < 0: points = 0 points = damage - points if head == attacker: points *= 0.5 if (points > 0) and CanDamage(head, inflictor): T_Damage(head, inflictor, attacker, points)
def TelefragSelectSpawnPoint(spot, *qwp_extra): search_spot = 25 firstspot = spot while search_spot: ents = engine.findradius(spot.origin, 50) if not ents: search_spot = 0 else: occupied = 0 for e in ents: if e.classname == 'player' and e.deadflag == defs.DEAD_NO: occupied = 1 break if occupied: spot = client.SelectSpawnPoint() search_spot -= 1 if spot == firstspot: search_spot = 0 else: search_spot = 0 return spot