Example #1
0
 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]                   
Example #2
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)
Example #3
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)
Example #4
0
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)
Example #5
0
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)                                                                        
Example #6
0
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
Example #7
0
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