Beispiel #1
0
def T_RadiusDamage(inflictor, attacker, damage, ignore, dtype, *qwp_extra):
    points = 0
    head = engine.world
    org = Vector(0, 0, 0)
    head = qc.findradius(inflictor.origin, damage + 40)
    while head:
        # bprint (PRINT_HIGH, head.classname);
        # bprint (PRINT_HIGH, " | ");
        # bprint (PRINT_HIGH, head.netname);
        # bprint (PRINT_HIGH, "\n");
        if head != ignore:
            if head.takedamage:
                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:
                    if CanDamage(head, inflictor):
                        head.deathtype = dtype
                        T_Damage(head, inflictor, attacker, points)
                        
                    
                
            
        head = head.chain
Beispiel #2
0
def SelectSpawnPoint(*qwp_extra):
    spot = engine.world
    newspot = engine.world
    thing = engine.world
    numspots = 0
    totalspots = 0
    rnum = 0
    pcount = 0
    rs = 0
    spots = engine.world
    numspots = 0
    totalspots = 0
    #  testinfo_player_start is only found in regioned levels
    spot = qc.find(qc.world, 'classname', 'testplayerstart')
    if spot:
        return spot
    #  choose a info_player_deathmatch point
    #  ok, find all spots that don't have players nearby
    spots = qc.world
    spot = qc.find(qc.world, 'classname', 'info_player_deathmatch')
    while spot:
        totalspots += 1
        thing = qc.findradius(spot.origin, 84)
        pcount = 0
        while thing:
            if thing.classname == 'player':
                pcount += 1
            thing = thing.chain
            
        if pcount == 0:
            spot.goalentity = spots
            spots = spot
            numspots += 1
            
        #  Get the next spot in the chain
        spot = qc.find(spot, 'classname', 'info_player_deathmatch')
        
    totalspots -= 1
    if not numspots:
        #  ack, they are all full, just pick one at random
        # 		bprint (PRINT_HIGH, "Ackk! All spots are full. Selecting random spawn spot\n");
        totalspots = round((random.random() * totalspots))
        spot = qc.find(qc.world, 'classname', 'info_player_deathmatch')
        while totalspots > 0:
            totalspots -= 1
            spot = qc.find(spot, 'classname', 'info_player_deathmatch')
            
        return spot
        
    #  We now have the number of spots available on the map in numspots
    #  Generate a random number between 1 and numspots
    numspots -= 1
    numspots = round((random.random() * numspots))
    spot = spots
    while numspots > 0:
        spot = spot.goalentity
        numspots -= 1
        
    return spot
Beispiel #3
0
def SelectSpawnPoint(*qwp_extra):
    spot = engine.world
    newspot = engine.world
    thing = engine.world
    numspots = 0
    totalspots = 0
    rnum = 0
    pcount = 0
    rs = 0
    spots = engine.world
    numspots = 0
    totalspots = 0
    #  testinfo_player_start is only found in regioned levels
    spot = qc.find(qc.world, 'classname', 'testplayerstart')
    if spot:
        return spot
    #  choose a info_player_deathmatch point
    #  ok, find all spots that don't have players nearby
    spots = qc.world
    spot = qc.find(qc.world, 'classname', 'info_player_deathmatch')
    while spot:
        totalspots += 1
        thing = qc.findradius(spot.origin, 84)
        pcount = 0
        while thing:
            if thing.classname == 'player':
                pcount += 1
            thing = thing.chain

        if pcount == 0:
            spot.goalentity = spots
            spots = spot
            numspots += 1

        #  Get the next spot in the chain
        spot = qc.find(spot, 'classname', 'info_player_deathmatch')

    totalspots -= 1
    if not numspots:
        #  ack, they are all full, just pick one at random
        # 		bprint (PRINT_HIGH, "Ackk! All spots are full. Selecting random spawn spot\n");
        totalspots = round((random.random() * totalspots))
        spot = qc.find(qc.world, 'classname', 'info_player_deathmatch')
        while totalspots > 0:
            totalspots -= 1
            spot = qc.find(spot, 'classname', 'info_player_deathmatch')

        return spot

    #  We now have the number of spots available on the map in numspots
    #  Generate a random number between 1 and numspots
    numspots -= 1
    numspots = round((random.random() * numspots))
    spot = spots
    while numspots > 0:
        spot = spot.goalentity
        numspots -= 1

    return spot
Beispiel #4
0
def T_BeamDamage(attacker, damage, *qwp_extra):
    points = 0
    head = engine.world
    head = qc.findradius(attacker.origin, damage + 40)
    while head:
        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:
                if CanDamage(head, attacker):
                    T_Damage(head, attacker, attacker, points)
                
            
        head = head.chain