Exemple #1
0
def InitBodyQue(*qwp_extra):
    global bodyque_head
    bodyque_head = qc.spawn()
    bodyque_head.classname = "bodyque"
    bodyque_head.owner = qc.spawn()
    bodyque_head.owner.classname = "bodyque"
    bodyque_head.owner.owner = qc.spawn()
    bodyque_head.owner.owner.classname = "bodyque"
    bodyque_head.owner.owner.owner = qc.spawn()
    bodyque_head.owner.owner.owner.classname = "bodyque"
    bodyque_head.owner.owner.owner.owner = bodyque_head
Exemple #2
0
def InitBodyQue(*qwp_extra):
    global bodyque_head
    bodyque_head = qc.spawn()
    bodyque_head.classname = 'bodyque'
    bodyque_head.owner = qc.spawn()
    bodyque_head.owner.classname = 'bodyque'
    bodyque_head.owner.owner = qc.spawn()
    bodyque_head.owner.owner.classname = 'bodyque'
    bodyque_head.owner.owner.owner = qc.spawn()
    bodyque_head.owner.owner.owner.classname = 'bodyque'
    bodyque_head.owner.owner.owner.owner = bodyque_head
Exemple #3
0
def InitBodyQue(*qwp_extra):
    global bodyque_head
    e = engine.world
    bodyque_head = qc.spawn()
    bodyque_head.classname = 'bodyque'
    bodyque_head.owner = qc.spawn()
    bodyque_head.owner.classname = 'bodyque'
    bodyque_head.owner.owner = qc.spawn()
    bodyque_head.owner.owner.classname = 'bodyque'
    bodyque_head.owner.owner.owner = qc.spawn()
    bodyque_head.owner.owner.owner.classname = 'bodyque'
    bodyque_head.owner.owner.owner.owner = bodyque_head
Exemple #4
0
def plat_spawn_inside_trigger(*qwp_extra):
    trigger = engine.world
    tmin = Vector(0, 0, 0)
    tmax = Vector(0, 0, 0)
    # 
    #  middle trigger
    # 	
    trigger = qc.spawn()
    trigger.touch = plat_center_touch
    trigger.movetype = defs.MOVETYPE_NONE
    trigger.solid = defs.SOLID_TRIGGER
    trigger.enemy = qc.self
    tmin = qc.self.mins + Vector(25, 25, 0)
    tmax = qc.self.maxs - Vector(25, 25, -8)
    tmin %= Vector(None, None, tmax.z - (qc.self.pos1.z - qc.self.pos2.z + 8))
    if qc.self.spawnflags & PLAT_LOW_TRIGGER:
        tmax %= Vector(None, None, tmin.z + 8)
    if qc.self.size.x <= 50:
        tmin %= Vector((qc.self.mins.x + qc.self.maxs.x) / 2, None, None)
        tmax %= Vector(tmin.x + 1, None, None)
        
    if qc.self.size.y <= 50:
        tmin %= Vector(None, (qc.self.mins.y + qc.self.maxs.y) / 2, None)
        tmax %= Vector(None, tmin.y + 1, None)
        
    qc.setsize(trigger, tmin, tmax)
Exemple #5
0
def W_FireGrenade(*qwp_extra):
    qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/grenade.wav', 1, defs.ATTN_NORM)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_BOUNCE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.classname = 'grenade'
    qc.newmis.cnt = 0
    #  set newmis speed	
    qc.makevectors(qc.self.v_angle)
    if qc.self.v_angle.x:
        qc.newmis.velocity = qc.v_forward * 600 + qc.v_up * 200 + crandom() * qc.v_right * 10 + crandom() * qc.v_up * 10
    else:
        qc.newmis.velocity = qc.self.aim(10000)
        qc.newmis.velocity *= 600
        qc.newmis.velocity %= Vector(None, None, 200)
        
    qc.newmis.avelocity = Vector(300, 300, 300)
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.touch = GrenadeTouch
    #  set newmis duration
    qc.newmis.nextthink = qc.time + 2.5
    qc.newmis.think = GrenadeExplode
    qc.newmis.setmodel('progs/grenade.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis, qc.self.origin)
Exemple #6
0
def W_FireGrenade(*qwp_extra):
    qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/grenade.wav', 1, defs.ATTN_NORM)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_BOUNCE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.classname = 'grenade'
    qc.newmis.cnt = 0
    #  set newmis speed
    qc.makevectors(qc.self.v_angle)
    if qc.self.v_angle.x:
        qc.newmis.velocity = qc.v_forward * 600 + qc.v_up * 200 + crandom(
        ) * qc.v_right * 10 + crandom() * qc.v_up * 10
    else:
        qc.newmis.velocity = qc.self.aim(10000)
        qc.newmis.velocity *= 600
        qc.newmis.velocity %= Vector(None, None, 200)

    qc.newmis.avelocity = Vector(300, 300, 300)
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.touch = GrenadeTouch
    #  set newmis duration
    qc.newmis.nextthink = qc.time + 2.5
    qc.newmis.think = GrenadeExplode
    qc.newmis.setmodel('progs/grenade.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis, qc.self.origin)
Exemple #7
0
def TossWeapon(*qwp_extra):
    if defs.deathmatch != 1:
        return  #  only in deathmatch 1
    if (qc.self.weapon == defs.IT_AXE) or (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon == defs.IT_GRAPPLE):
        return
    item = qc.spawn()
    item.owner = qc.self
    qc.makevectors(qc.self.v_angle)
    qc.setorigin(item, qc.self.origin + Vector(0, 0, 16))
    item.velocity = qc.self.aim(1000)
    item.velocity *= 500
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_BOUNCE

    if qc.self.weapon == defs.IT_SUPER_SHOTGUN:
        item.setmodel("progs/g_shot.mdl")
        item.weapon = defs.IT_SUPER_SHOTGUN
        item.netname = "Double-barrelled Shotgun"
        item.classname = "weapon_supershotgun"
        qc.self.items -= defs.IT_SUPER_SHOTGUN
    elif qc.self.weapon == defs.IT_NAILGUN:
        item.setmodel("progs/g_nail.mdl")
        item.weapon = defs.IT_NAILGUN
        item.netname = "nailgun"
        item.classname = "weapon_nailgun"
        qc.self.items -= defs.IT_NAILGUN
    elif qc.self.weapon == defs.IT_SUPER_NAILGUN:
        item.setmodel("progs/g_nail2.mdl")
        item.weapon = defs.IT_SUPER_NAILGUN
        item.netname = "Super Nailgun"
        item.classname = "weapon_supernailgun"
        qc.self.items -= defs.IT_SUPER_NAILGUN
    elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER:
        item.setmodel("progs/g_rock.mdl")
        item.weapon = 3
        item.netname = "Grenade Launcher"
        item.classname = "weapon_grenadelauncher"
        qc.self.items -= defs.IT_GRENADE_LAUNCHER
    elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER:
        item.setmodel("progs/g_rock2.mdl")
        item.weapon = 3
        item.netname = "Rocket Launcher"
        item.classname = "weapon_rocketlauncher"
        qc.self.items -= defs.IT_ROCKET_LAUNCHER
    elif qc.self.weapon == defs.IT_LIGHTNING:
        item.setmodel("progs/g_light.mdl")
        item.weapon = 3
        item.netname = "Thunderbolt"
        item.classname = "weapon_lightning"
        qc.self.items -= defs.IT_LIGHTNING

    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = Team_weapon_touch
    item.think = subs.SUB_Remove
    item.nextthink = qc.time + 120
    qc.self.weapon = weapons.W_BestWeapon()
    weapons.W_SetCurrentAmmo()
Exemple #8
0
def SUB_UseTargets(*qwp_extra):
    # 
    #  check for a delay
    # 
    if qc.self.delay:
        #  create a temp object to fire at a later time
        t = qc.spawn()
        t.classname = 'DelayedUse'
        t.nextthink = qc.time + qc.self.delay
        t.think = DelayThink
        t.enemy = defs.activator
        t.message = qc.self.message
        t.killtarget = qc.self.killtarget
        t.target = qc.self.target
        return 
        
    # 
    #  print the message
    # 
    if defs.activator.classname == 'player' and qc.self.message != None:
        qc.centerprint(defs.activator, qc.self.message)
        if not qc.self.noise:
            defs.activator.sound(defs.CHAN_VOICE, 'misc/talk.wav', 1, defs.ATTN_NORM)
        
    # 
    #  kill the killtagets
    # 
    if qc.self.killtarget:
        t = qc.world
        while 1:
            t = qc.find(t, 'targetname', qc.self.killtarget)
            if not t:
                return 
            t.remove()
                    
    # 
    #  fire targets
    # 
    if qc.self.target:
        act = defs.activator
        t = qc.world
        while 1:
            t = qc.find(t, 'targetname', qc.self.target)
            if not t:
                return 
                
            stemp = qc.self
            otemp = qc.other
            qc.self = t
            qc.other = stemp
            if qc.self.use != SUB_Null:
                if qc.self.use:
                    qc.self.use()
                
            qc.self = stemp
            qc.other = otemp
            defs.activator = act
Exemple #9
0
def DeathBubbles(num_bubbles, *qwp_extra):
    bubble_spawner = qc.spawn()
    qc.setorigin(bubble_spawner, qc.self.origin)
    bubble_spawner.movetype = defs.MOVETYPE_NONE
    bubble_spawner.solid = defs.SOLID_NOT
    bubble_spawner.nextthink = qc.time + 0.1
    bubble_spawner.think = DeathBubblesSpawn
    bubble_spawner.air_finished = 0
    bubble_spawner.owner = qc.self
    bubble_spawner.bubble_count = num_bubbles
Exemple #10
0
def DeathBubbles(num_bubbles, *qwp_extra):
    bubble_spawner = qc.spawn()
    qc.setorigin(bubble_spawner, qc.self.origin)
    bubble_spawner.movetype = defs.MOVETYPE_NONE
    bubble_spawner.solid = defs.SOLID_NOT
    bubble_spawner.nextthink = qc.time + 0.1
    bubble_spawner.think = DeathBubblesSpawn
    bubble_spawner.air_finished = 0
    bubble_spawner.owner = qc.self
    bubble_spawner.bubble_count = num_bubbles
Exemple #11
0
def MakeLink(*qwp_extra):
    qc.newmis = qc.spawn()
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_NOT
    qc.newmis.owner = qc.self  #  SELF is the hook!
    qc.newmis.avelocity = Vector(200, 200, 200)
    qc.newmis.setmodel('progs/bit.mdl')
    qc.setorigin(qc.newmis, qc.self.origin)
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    return qc.newmis
Exemple #12
0
def spawn_field(fmins, fmaxs, *qwp_extra):
    trigger = qc.spawn()
    trigger.movetype = defs.MOVETYPE_NONE
    trigger.solid = defs.SOLID_TRIGGER
    trigger.owner = qc.self
    trigger.touch = door_trigger_touch
    t1 = fmins
    t2 = fmaxs
    qc.setsize(trigger, t1 - Vector(60, 60, 8), t2 + Vector(60, 60, 8))
    return (trigger)
Exemple #13
0
def spawn_field(fmins, fmaxs, *qwp_extra):
    trigger = qc.spawn()
    trigger.movetype = defs.MOVETYPE_NONE
    trigger.solid = defs.SOLID_TRIGGER
    trigger.owner = qc.self
    trigger.touch = door_trigger_touch
    t1 = fmins
    t2 = fmaxs
    qc.setsize(trigger, t1 - Vector(60, 60, 8), t2 + Vector(60, 60, 8))
    return (trigger)
Exemple #14
0
def MakeLink(*qwp_extra):
    qc.newmis = qc.spawn()
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_NOT
    qc.newmis.owner = qc.self #  SELF is the hook!
    qc.newmis.avelocity = Vector(200, 200, 200)
    qc.newmis.setmodel('progs/bit.mdl')
    qc.setorigin(qc.newmis, qc.self.origin)
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    return qc.newmis
Exemple #15
0
def NextLevel(*qwp_extra):
    global nextmap
    o = engine.world
    newmap = None
    if nextmap != None:
        return  #  already done
    if qc.mapname == 'start':
        if not engine.cvar('registered'):
            qc.mapname = 'e1m1'
            
        elif not (qc.serverflags & 1):
            qc.mapname = 'e1m1'
            qc.serverflags |= 1
            
        elif not (qc.serverflags & 2):
            qc.mapname = 'e2m1'
            qc.serverflags |= 2
            
        elif not (qc.serverflags & 4):
            qc.mapname = 'e3m1'
            qc.serverflags |= 4
            
        elif not (qc.serverflags & 8):
            qc.mapname = 'e4m1'
            qc.serverflags -= 7
            
        o = qc.spawn()
        o.map = qc.mapname
        
    else:
        #  find a trigger changelevel
        o = qc.find(qc.world, 'classname', 'trigger_changelevel')
        if not o or qc.mapname == 'start':
            #  go back to same map if no trigger_changelevel
            o = qc.spawn()
            o.map = qc.mapname
            
        
    nextmap = o.map
    if o.nextthink < qc.time:
        o.think = execute_changelevel
        o.nextthink = qc.time + 0.1
Exemple #16
0
def NextLevel(*qwp_extra):
    global nextmap
    o = engine.world
    newmap = None
    if nextmap != None:
        return  #  already done
    if qc.mapname == 'start':
        if not engine.cvar('registered'):
            qc.mapname = 'e1m1'

        elif not (qc.serverflags & 1):
            qc.mapname = 'e1m1'
            qc.serverflags |= 1

        elif not (qc.serverflags & 2):
            qc.mapname = 'e2m1'
            qc.serverflags |= 2

        elif not (qc.serverflags & 4):
            qc.mapname = 'e3m1'
            qc.serverflags |= 4

        elif not (qc.serverflags & 8):
            qc.mapname = 'e4m1'
            qc.serverflags -= 7

        o = qc.spawn()
        o.map = qc.mapname

    else:
        #  find a trigger changelevel
        o = qc.find(qc.world, 'classname', 'trigger_changelevel')
        if not o or qc.mapname == 'start':
            #  go back to same map if no trigger_changelevel
            o = qc.spawn()
            o.map = qc.mapname

    nextmap = o.map
    if o.nextthink < qc.time:
        o.think = execute_changelevel
        o.nextthink = qc.time + 0.1
Exemple #17
0
def spawn_tfog(org, *qwp_extra):
    global s
    s = qc.spawn()
    s.origin = org
    s.nextthink = qc.time + 0.2
    s.think = play_teleport
    qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
    qc.WriteByte(defs.MSG_MULTICAST, defs.TE_TELEPORT)
    qc.WriteCoord(defs.MSG_MULTICAST, org.x)
    qc.WriteCoord(defs.MSG_MULTICAST, org.y)
    qc.WriteCoord(defs.MSG_MULTICAST, org.z)
    engine.multicast(org, defs.MULTICAST_PHS)
Exemple #18
0
def spawn_tfog(org, *qwp_extra):
    global s
    s = qc.spawn()
    s.origin = org
    s.nextthink = qc.time + 0.2
    s.think = play_teleport
    qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
    qc.WriteByte(defs.MSG_MULTICAST, defs.TE_TELEPORT)
    qc.WriteCoord(defs.MSG_MULTICAST, org.x)
    qc.WriteCoord(defs.MSG_MULTICAST, org.y)
    qc.WriteCoord(defs.MSG_MULTICAST, org.z)
    engine.multicast(org, defs.MULTICAST_PHS)
Exemple #19
0
def spawn_tdeath(org, death_owner, *qwp_extra):
    death = qc.spawn()
    death.classname = 'teledeath'
    death.movetype = defs.MOVETYPE_NONE
    death.solid = defs.SOLID_TRIGGER
    death.angles = Vector(0, 0, 0)
    qc.setsize(death, death_owner.mins - Vector(1, 1, 1), death_owner.maxs + Vector(1, 1, 1))
    qc.setorigin(death, org)
    death.touch = tdeath_touch
    death.nextthink = qc.time + 0.1
    death.think = subs.SUB_Remove
    death.owner = death_owner
    qc.force_retouch = 2 #  make sure even still objects get hit
Exemple #20
0
def spawn_tdeath(org, death_owner, *qwp_extra):
    death = qc.spawn()
    death.classname = 'teledeath'
    death.movetype = defs.MOVETYPE_NONE
    death.solid = defs.SOLID_TRIGGER
    death.angles = Vector(0, 0, 0)
    qc.setsize(death, death_owner.mins - Vector(1, 1, 1),
               death_owner.maxs + Vector(1, 1, 1))
    qc.setorigin(death, org)
    death.touch = tdeath_touch
    death.nextthink = qc.time + 0.1
    death.think = subs.SUB_Remove
    death.owner = death_owner
    qc.force_retouch = 2  #  make sure even still objects get hit
Exemple #21
0
def fire_fly(*qwp_extra):
    fireball = qc.spawn()
    fireball.solid = defs.SOLID_TRIGGER
    fireball.movetype = defs.MOVETYPE_TOSS
    fireball.velocity = Vector((random.random() * 100) - 50, (random.random() * 100) - 50, qc.self.speed + (random.random() * 200))
    fireball.classname = 'fireball'
    fireball.setmodel('progs/lavaball.mdl')
    qc.setsize(fireball, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(fireball, qc.self.origin)
    fireball.nextthink = qc.time + 5
    fireball.think = subs.SUB_Remove
    fireball.touch = fire_touch
    qc.self.nextthink = qc.time + (random.random() * 5) + 3
    qc.self.think = fire_fly
Exemple #22
0
def launch_spike(org, dir, *qwp_extra):
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.cnt = 0
    qc.newmis.angles = qc.vectoangles(dir)
    qc.newmis.touch = spike_touch
    qc.newmis.classname = 'spike'
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.nextthink = qc.time + 6
    qc.newmis.setmodel('progs/spike.mdl')
    qc.setsize(qc.newmis, defs.VEC_ORIGIN, defs.VEC_ORIGIN)
    qc.setorigin(qc.newmis, org)
    qc.newmis.velocity = dir * 1000
Exemple #23
0
def SpawnMeatSpray(org, vel, *qwp_extra):
    missile = qc.spawn()
    missile.owner = qc.self
    missile.movetype = defs.MOVETYPE_BOUNCE
    missile.solid = defs.SOLID_NOT
    qc.makevectors(qc.self.angles)
    missile.velocity = vel
    missile.velocity %= Vector(None, None, missile.velocity.z + 250 + 50 * random.random())
    missile.avelocity = Vector(3000, 1000, 2000)
    #  set missile duration
    missile.nextthink = qc.time + 1
    missile.think = subs.SUB_Remove
    missile.setmodel('progs/zom_gib.mdl')
    qc.setsize(missile, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(missile, org)
Exemple #24
0
def launch_spike(org, dir, *qwp_extra):
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.cnt = 0
    qc.newmis.angles = qc.vectoangles(dir)
    qc.newmis.touch = spike_touch
    qc.newmis.classname = 'spike'
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.nextthink = qc.time + 6
    qc.newmis.setmodel('progs/spike.mdl')
    qc.setsize(qc.newmis, defs.VEC_ORIGIN, defs.VEC_ORIGIN)
    qc.setorigin(qc.newmis, org)
    qc.newmis.velocity = dir * 1000
Exemple #25
0
def make_bubbles(*qwp_extra):
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.origin)
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = Vector(0, 0, 15)
    bubble.nextthink = qc.time + 0.5
    bubble.think = bubble_bob
    bubble.touch = bubble_remove
    bubble.classname = 'bubble'
    bubble.frame = 0
    bubble.cnt = 0
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.nextthink = qc.time + random.random() + 0.5
    qc.self.think = make_bubbles
Exemple #26
0
def make_bubbles(*qwp_extra):
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.origin)
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = Vector(0, 0, 15)
    bubble.nextthink = qc.time + 0.5
    bubble.think = bubble_bob
    bubble.touch = bubble_remove
    bubble.classname = 'bubble'
    bubble.frame = 0
    bubble.cnt = 0
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.nextthink = qc.time + random.random() + 0.5
    qc.self.think = make_bubbles
Exemple #27
0
def ThrowGib(gibname, dm, *qwp_extra):
    new = qc.spawn()
    new.origin = qc.self.origin
    new.setmodel(gibname)
    qc.setsize(new, Vector(0, 0, 0), Vector(0, 0, 0))
    new.velocity = VelocityForDamage(dm)
    new.movetype = defs.MOVETYPE_BOUNCE
    new.solid = defs.SOLID_NOT
    new.avelocity %= Vector(random.random() * 600, None, None)
    new.avelocity %= Vector(None, random.random() * 600, None)
    new.avelocity %= Vector(None, None, random.random() * 600)
    new.think = subs.SUB_Remove
    new.ltime = qc.time
    new.nextthink = qc.time + 10 + random.random() * 10
    new.frame = 0
    new.flags = 0
Exemple #28
0
def fire_fly(*qwp_extra):
    fireball = qc.spawn()
    fireball.solid = defs.SOLID_TRIGGER
    fireball.movetype = defs.MOVETYPE_TOSS
    fireball.velocity = Vector((random.random() * 100) - 50,
                               (random.random() * 100) - 50,
                               qc.self.speed + (random.random() * 200))
    fireball.classname = 'fireball'
    fireball.setmodel('progs/lavaball.mdl')
    qc.setsize(fireball, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(fireball, qc.self.origin)
    fireball.nextthink = qc.time + 5
    fireball.think = subs.SUB_Remove
    fireball.touch = fire_touch
    qc.self.nextthink = qc.time + (random.random() * 5) + 3
    qc.self.think = fire_fly
Exemple #29
0
def ThrowGib(gibname, dm, *qwp_extra):
    new = qc.spawn()
    new.origin = qc.self.origin
    new.setmodel(gibname)
    qc.setsize(new, Vector(0, 0, 0), Vector(0, 0, 0))
    new.velocity = VelocityForDamage(dm)
    new.movetype = defs.MOVETYPE_BOUNCE
    new.solid = defs.SOLID_NOT
    new.avelocity %= Vector(random.random() * 600, None, None)
    new.avelocity %= Vector(None, random.random() * 600, None)
    new.avelocity %= Vector(None, None, random.random() * 600)
    new.think = subs.SUB_Remove
    new.ltime = qc.time
    new.nextthink = qc.time + 10 + random.random() * 10
    new.frame = 0
    new.flags = 0
Exemple #30
0
def SpawnMeatSpray(org, vel, *qwp_extra):
    missile = qc.spawn()
    missile.owner = qc.self
    missile.movetype = defs.MOVETYPE_BOUNCE
    missile.solid = defs.SOLID_NOT
    qc.makevectors(qc.self.angles)
    missile.velocity = vel
    missile.velocity %= Vector(None, None,
                               missile.velocity.z + 250 + 50 * random.random())
    missile.avelocity = Vector(3000, 1000, 2000)
    #  set missile duration
    missile.nextthink = qc.time + 1
    missile.think = subs.SUB_Remove
    missile.setmodel('progs/zom_gib.mdl')
    qc.setsize(missile, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(missile, org)
Exemple #31
0
def LaunchLaser(org, vec, *qwp_extra):
    if qc.self.classname == 'monster_enforcer':
        qc.self.sound(defs.CHAN_WEAPON, 'enforcer/enfire.wav', 1, defs.ATTN_NORM)
    vec = vec.normalize()
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLY
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.effects = defs.EF_DIMLIGHT
    qc.newmis.setmodel('progs/laser.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis, org)
    qc.newmis.velocity = vec * 600
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.nextthink = qc.time + 5
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.touch = Laser_Touch
Exemple #32
0
def DropRing(timeleft, *qwp_extra):
    item = engine.world
    item = qc.spawn()
    item.origin = qc.self.origin
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.noise = 'items/inv1.wav'
    item.setmodel('progs/invisibl.mdl')
    qc.setsize(item, Vector(-16, -16, -24), Vector(16, 16, 32))
    item.cnt = qc.time + timeleft
    item.touch = r_touch
    item.nextthink = qc.time + timeleft  #  remove after 30 seconds
    item.think = subs.SUB_Remove
Exemple #33
0
def DropQuad(timeleft, *qwp_extra):
    item = engine.world
    item = qc.spawn()
    item.origin = qc.self.origin
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.noise = 'items/damage.wav'
    item.setmodel('progs/quaddama.mdl')
    qc.setsize(item, Vector(-16, -16, -24), Vector(16, 16, 32))
    item.cnt = qc.time + timeleft
    item.touch = q_touch
    item.nextthink = qc.time + timeleft  #  remove it with the time left on it
    item.think = subs.SUB_Remove
Exemple #34
0
def DropQuad(timeleft, *qwp_extra):
    item = engine.world
    item = qc.spawn()
    item.origin = qc.self.origin
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.noise = 'items/damage.wav'
    item.setmodel('progs/quaddama.mdl')
    qc.setsize(item, Vector(-16, -16, -24), Vector(16, 16, 32))
    item.cnt = qc.time + timeleft
    item.touch = q_touch
    item.nextthink = qc.time + timeleft #  remove it with the time left on it
    item.think = subs.SUB_Remove
Exemple #35
0
def DropRing(timeleft, *qwp_extra):
    item = engine.world
    item = qc.spawn()
    item.origin = qc.self.origin
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.noise = 'items/inv1.wav'
    item.setmodel('progs/invisibl.mdl')
    qc.setsize(item, Vector(-16, -16, -24), Vector(16, 16, 32))
    item.cnt = qc.time + timeleft
    item.touch = r_touch
    item.nextthink = qc.time + timeleft #  remove after 30 seconds
    item.think = subs.SUB_Remove
Exemple #36
0
def LaunchLaser(org, vec, *qwp_extra):
    if qc.self.classname == 'monster_enforcer':
        qc.self.sound(defs.CHAN_WEAPON, 'enforcer/enfire.wav', 1,
                      defs.ATTN_NORM)
    vec = vec.normalize()
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLY
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.effects = defs.EF_DIMLIGHT
    qc.newmis.setmodel('progs/laser.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis, org)
    qc.newmis.velocity = vec * 600
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.nextthink = qc.time + 5
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.touch = Laser_Touch
Exemple #37
0
def bubble_split(*qwp_extra):
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.origin)
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = qc.self.velocity
    bubble.nextthink = qc.time + 0.5
    bubble.think = bubble_bob
    bubble.touch = bubble_remove
    bubble.classname = 'bubble'
    bubble.frame = 1
    bubble.cnt = 10
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.frame = 1
    qc.self.cnt = 10
    if qc.self.waterlevel != 3:
        qc.self.remove()
Exemple #38
0
def bubble_split(*qwp_extra):
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.origin)
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = qc.self.velocity
    bubble.nextthink = qc.time + 0.5
    bubble.think = bubble_bob
    bubble.touch = bubble_remove
    bubble.classname = 'bubble'
    bubble.frame = 1
    bubble.cnt = 10
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.frame = 1
    qc.self.cnt = 10
    if qc.self.waterlevel != 3:
        qc.self.remove()
Exemple #39
0
def StartRuneSpawn(*qwp_extra):
    if defs.runespawned or defs.gamestart:
        return 
    defs.runespawned = 1
    engine.precache_model('progs/end1.mdl')
    engine.precache_model('progs/end2.mdl')
    engine.precache_model('progs/end3.mdl')
    engine.precache_model('progs/end4.mdl')
    engine.precache_model('progs/m_s_key.mdl')
    engine.precache_model('progs/m_g_key.mdl')
    engine.precache_sound('rune/rune1.wav')
    engine.precache_sound('rune/rune2.wav')
    engine.precache_sound('rune/rune22.wav') #  special rune and quad combo
    engine.precache_sound('rune/rune3.wav')
    engine.precache_sound('rune/rune4.wav')
    #  spawn the runes
    rspawn = qc.spawn()
    rspawn.nextthink = qc.time + 0.1
    rspawn.think = SpawnRunes
Exemple #40
0
def DeathBubblesSpawn(*qwp_extra):
    if qc.self.owner.waterlevel != 3:
        return 
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.owner.origin + Vector(0, 0, 24))
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = Vector(0, 0, 15)
    bubble.nextthink = qc.time + 0.5
    bubble.think = misc.bubble_bob
    bubble.classname = 'bubble'
    bubble.frame = 0
    bubble.cnt = 0
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.nextthink = qc.time + 0.1
    qc.self.think = DeathBubblesSpawn
    qc.self.air_finished += 1
    if qc.self.air_finished >= qc.self.bubble_count:
        qc.self.remove()
Exemple #41
0
def DeathBubblesSpawn(*qwp_extra):
    if qc.self.owner.waterlevel != 3:
        return
    bubble = qc.spawn()
    bubble.setmodel('progs/s_bubble.spr')
    qc.setorigin(bubble, qc.self.owner.origin + Vector(0, 0, 24))
    bubble.movetype = defs.MOVETYPE_NOCLIP
    bubble.solid = defs.SOLID_NOT
    bubble.velocity = Vector(0, 0, 15)
    bubble.nextthink = qc.time + 0.5
    bubble.think = misc.bubble_bob
    bubble.classname = 'bubble'
    bubble.frame = 0
    bubble.cnt = 0
    qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8))
    qc.self.nextthink = qc.time + 0.1
    qc.self.think = DeathBubblesSpawn
    qc.self.air_finished += 1
    if qc.self.air_finished >= qc.self.bubble_count:
        qc.self.remove()
Exemple #42
0
def DropBackpack(*qwp_extra):
    item = engine.world
    if not (qc.self.ammo_shells + qc.self.ammo_nails + qc.self.ammo_rockets +
            qc.self.ammo_cells):
        return  #  nothing in it
    item = qc.spawn()
    item.origin = qc.self.origin - Vector(0, 0, 24)
    item.items = qc.self.weapon
    if item.items == defs.IT_AXE:
        item.netname = 'Axe'
    elif item.items == defs.IT_SHOTGUN:
        item.netname = 'Shotgun'
    elif item.items == defs.IT_SUPER_SHOTGUN:
        item.netname = 'Double-barrelled Shotgun'
    elif item.items == defs.IT_NAILGUN:
        item.netname = 'Nailgun'
    elif item.items == defs.IT_SUPER_NAILGUN:
        item.netname = 'Super Nailgun'
    elif item.items == defs.IT_GRENADE_LAUNCHER:
        item.netname = 'Grenade Launcher'
    elif item.items == defs.IT_ROCKET_LAUNCHER:
        item.netname = 'Rocket Launcher'
    elif item.items == defs.IT_LIGHTNING:
        item.netname = 'Thunderbolt'
    else:
        item.netname = None
    item.ammo_shells = qc.self.ammo_shells
    item.ammo_nails = qc.self.ammo_nails
    item.ammo_rockets = qc.self.ammo_rockets
    item.ammo_cells = qc.self.ammo_cells
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.setmodel('progs/backpack.mdl')
    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = BackpackTouch
    item.nextthink = qc.time + 120  #  remove after 2 minutes
    item.think = subs.SUB_Remove
Exemple #43
0
def Do_DropRune(flag, *qwp_extra):
    item = qc.spawn()
    item.origin = qc.self.origin - Vector(0, 0, 24)
    item.player_flag = flag
    item.velocity = Vector((random.random() * 1000) - 500, (random.random() * 1000) - 500, 400)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    if flag & defs.ITEM_RUNE1_FLAG:
        item.setmodel('progs/end1.mdl')
    elif flag & defs.ITEM_RUNE2_FLAG:
        item.setmodel('progs/end2.mdl')
    elif flag & defs.ITEM_RUNE3_FLAG:
        item.setmodel('progs/end3.mdl')
    elif flag & defs.ITEM_RUNE4_FLAG:
        item.setmodel('progs/end4.mdl')
    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = RuneTouch
    item.nextthink = qc.time + 120 #  if no one touches it in two minutes,
    # 		respawn it somewhere else, so inaccessible ones will come 'back' 
    item.think = RuneRespawn
Exemple #44
0
def DropBackpack(*qwp_extra):
    item = engine.world
    if not (qc.self.ammo_shells + qc.self.ammo_nails + qc.self.ammo_rockets + qc.self.ammo_cells):
        return  #  nothing in it
    item = qc.spawn()
    item.origin = qc.self.origin - Vector(0, 0, 24)
    item.items = qc.self.weapon
    if item.items == defs.IT_AXE:
        item.netname = 'Axe'
    elif item.items == defs.IT_SHOTGUN:
        item.netname = 'Shotgun'
    elif item.items == defs.IT_SUPER_SHOTGUN:
        item.netname = 'Double-barrelled Shotgun'
    elif item.items == defs.IT_NAILGUN:
        item.netname = 'Nailgun'
    elif item.items == defs.IT_SUPER_NAILGUN:
        item.netname = 'Super Nailgun'
    elif item.items == defs.IT_GRENADE_LAUNCHER:
        item.netname = 'Grenade Launcher'
    elif item.items == defs.IT_ROCKET_LAUNCHER:
        item.netname = 'Rocket Launcher'
    elif item.items == defs.IT_LIGHTNING:
        item.netname = 'Thunderbolt'
    else:
        item.netname = None
    item.ammo_shells = qc.self.ammo_shells
    item.ammo_nails = qc.self.ammo_nails
    item.ammo_rockets = qc.self.ammo_rockets
    item.ammo_cells = qc.self.ammo_cells
    item.velocity %= Vector(None, None, 300)
    item.velocity %= Vector(-100 + (random.random() * 200), None, None)
    item.velocity %= Vector(None, -100 + (random.random() * 200), None)
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_TOSS
    item.setmodel('progs/backpack.mdl')
    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = BackpackTouch
    item.nextthink = qc.time + 120 #  remove after 2 minutes
    item.think = subs.SUB_Remove
Exemple #45
0
def W_FireRocket(*qwp_extra):
    qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/sgun1.wav', 1, defs.ATTN_NORM)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.classname = 'missile'
    qc.newmis.cnt = 0
    #  set newmis speed	
    qc.makevectors(qc.self.v_angle)
    qc.newmis.velocity = qc.self.aim(1000)
    qc.newmis.velocity *= 1000
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.touch = T_MissileTouch
    #  set newmis duration
    qc.newmis.nextthink = qc.time + 5
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.setmodel('progs/missile.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis, qc.self.origin + qc.v_forward * 8 + Vector(0, 0, 16))
Exemple #46
0
def Throw_Grapple(*qwp_extra):
    if qc.self.hook_out: #  reject subsequent calls from player.qc
        return 
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    #  chain out sound (loops)
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/chain1.wav', 1, defs.ATTN_NORM)
    qc.newmis = qc.spawn()
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.owner = qc.self #  newmis belongs to me
    qc.self.hook = qc.newmis #  This is my newmis
    qc.newmis.classname = 'hook'
    qc.makevectors(qc.self.v_angle)
    qc.newmis.velocity = qc.v_forward * 800
    qc.newmis.avelocity = Vector(0, 0, -500)
    qc.newmis.touch = Anchor_Grapple
    qc.newmis.think = Build_Chain
    qc.newmis.nextthink = qc.time + 0.1 #  don't jam newmis and links into same packet
    qc.newmis.setmodel('progs/star.mdl')
    qc.setorigin(qc.newmis, qc.self.origin + qc.v_forward * 16 + Vector(0, 0, 16))
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.self.hook_out = defs.TRUE
Exemple #47
0
def Throw_Grapple(*qwp_extra):
    if qc.self.hook_out:  #  reject subsequent calls from player.qc
        return
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    #  chain out sound (loops)
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/chain1.wav', 1, defs.ATTN_NORM)
    qc.newmis = qc.spawn()
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.owner = qc.self  #  newmis belongs to me
    qc.self.hook = qc.newmis  #  This is my newmis
    qc.newmis.classname = 'hook'
    qc.makevectors(qc.self.v_angle)
    qc.newmis.velocity = qc.v_forward * 800
    qc.newmis.avelocity = Vector(0, 0, -500)
    qc.newmis.touch = Anchor_Grapple
    qc.newmis.think = Build_Chain
    qc.newmis.nextthink = qc.time + 0.1  #  don't jam newmis and links into same packet
    qc.newmis.setmodel('progs/star.mdl')
    qc.setorigin(qc.newmis,
                 qc.self.origin + qc.v_forward * 16 + Vector(0, 0, 16))
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.self.hook_out = defs.TRUE
Exemple #48
0
def W_FireRocket(*qwp_extra):
    qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/sgun1.wav', 1, defs.ATTN_NORM)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
    qc.newmis = qc.spawn()
    qc.newmis.owner = qc.self
    qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE
    qc.newmis.solid = defs.SOLID_BBOX
    qc.newmis.classname = 'missile'
    qc.newmis.cnt = 0
    #  set newmis speed
    qc.makevectors(qc.self.v_angle)
    qc.newmis.velocity = qc.self.aim(1000)
    qc.newmis.velocity *= 1000
    qc.newmis.angles = qc.vectoangles(qc.newmis.velocity)
    qc.newmis.touch = T_MissileTouch
    #  set newmis duration
    qc.newmis.nextthink = qc.time + 5
    qc.newmis.think = subs.SUB_Remove
    qc.newmis.setmodel('progs/missile.mdl')
    qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0))
    qc.setorigin(qc.newmis,
                 qc.self.origin + qc.v_forward * 8 + Vector(0, 0, 16))
Exemple #49
0
def TossBackpack(*qwp_extra):
    #  If we don't have any ammo, return (except AXE/GRAPPLE)
    if qc.self.currentammo <= 0:
        if qc.self.weapon != defs.IT_AXE and qc.self.weapon != defs.IT_GRAPPLE:
            return

    item = qc.spawn()
    #  See if you have the Shotgun or Super Shotgun on
    if (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon == defs.IT_SUPER_SHOTGUN):
        if qc.self.ammo_shells >= 20:
            item.ammo_shells = 20
            qc.self.ammo_shells -= 20
        else:
            item.ammo_shells = qc.self.ammo_shells
            qc.self.ammo_shells = 0

    #  See if you have neither the Shotgun or Super Shotgun
    if not (qc.self.items & defs.IT_SHOTGUN) and not (qc.self.items & defs.IT_SUPER_SHOTGUN):
        if qc.self.ammo_shells >= 20:
            item.ammo_shells = 20
            qc.self.ammo_shells -= 20
        else:
            item.ammo_shells = qc.self.ammo_shells
            qc.self.ammo_shells = 0

    #  See if we are using a nailgun
    if (qc.self.weapon == defs.IT_NAILGUN) or (qc.self.weapon == defs.IT_SUPER_NAILGUN):
        if qc.self.ammo_nails >= 20:
            item.ammo_nails = 20
            qc.self.ammo_nails -= 20
        else:
            item.ammo_nails = qc.self.ammo_nails
            qc.self.ammo_nails = 0

    #  Check to see if we have neither nailgun
    if not (qc.self.items & defs.IT_NAILGUN) and not (qc.self.items & defs.IT_SUPER_NAILGUN):
        if qc.self.ammo_nails >= 20:
            item.ammo_nails = 20
            qc.self.ammo_nails -= 20
        else:
            item.ammo_nails = qc.self.ammo_nails
            qc.self.ammo_nails = 0

    #  See if we are using a grenade or rocket launcher
    if (qc.self.weapon == defs.IT_GRENADE_LAUNCHER) or (qc.self.weapon == defs.IT_ROCKET_LAUNCHER):
        if qc.self.ammo_rockets >= 10:
            item.ammo_rockets = 10
            qc.self.ammo_rockets -= 10
        else:
            item.ammo_rockets = qc.self.ammo_rockets
            qc.self.ammo_rockets = 0

    #  See if we have neither the Grenade or rocket launcher
    if not (qc.self.items & defs.IT_GRENADE_LAUNCHER) and not (qc.self.items & defs.IT_ROCKET_LAUNCHER):
        if qc.self.ammo_rockets >= 10:
            item.ammo_rockets = 10
            qc.self.ammo_rockets -= 10
        else:
            item.ammo_rockets = qc.self.ammo_rockets
            qc.self.ammo_rockets = 0

    #  See if we're using the lightning gun
    if qc.self.weapon == defs.IT_LIGHTNING:
        if qc.self.ammo_cells >= 20:
            item.ammo_cells = 20
            qc.self.ammo_cells -= 20
        else:
            item.ammo_cells = qc.self.ammo_cells
            qc.self.ammo_cells = 0

    #  see if we don't have the lightning gun
    if not (qc.self.items & defs.IT_LIGHTNING):
        if qc.self.ammo_cells >= 20:
            item.ammo_cells = 20
            qc.self.ammo_cells -= 20
        else:
            item.ammo_cells = qc.self.ammo_cells
            qc.self.ammo_cells = 0

    if not item.ammo_shells and not item.ammo_nails and not item.ammo_rockets and not item.ammo_cells:
        #  we didn't put anything in
        item.remove()
        return

    item.owner = qc.self
    qc.makevectors(qc.self.v_angle)
    qc.setorigin(item, qc.self.origin + Vector(0, 0, 16))
    item.velocity = qc.self.aim(1000)
    item.velocity *= 500
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_BOUNCE
    item.setmodel("progs/backpack.mdl")
    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = items.BackpackTouch
    item.nextthink = qc.time + 120  #  remove after 2 minutes
    item.think = subs.SUB_Remove
    weapons.W_SetCurrentAmmo()
Exemple #50
0
def TossBackpack(*qwp_extra):
    #  If we don't have any ammo, return (except AXE/GRAPPLE)
    if qc.self.currentammo <= 0:
        if qc.self.weapon != defs.IT_AXE and qc.self.weapon != defs.IT_GRAPPLE:
            return

    item = qc.spawn()
    #  See if you have the Shotgun or Super Shotgun on
    if (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon
                                               == defs.IT_SUPER_SHOTGUN):
        if qc.self.ammo_shells >= 20:
            item.ammo_shells = 20
            qc.self.ammo_shells -= 20
        else:
            item.ammo_shells = qc.self.ammo_shells
            qc.self.ammo_shells = 0

    #  See if you have neither the Shotgun or Super Shotgun
    if not (qc.self.items & defs.IT_SHOTGUN) and not (qc.self.items
                                                      & defs.IT_SUPER_SHOTGUN):
        if qc.self.ammo_shells >= 20:
            item.ammo_shells = 20
            qc.self.ammo_shells -= 20
        else:
            item.ammo_shells = qc.self.ammo_shells
            qc.self.ammo_shells = 0

    #  See if we are using a nailgun
    if (qc.self.weapon == defs.IT_NAILGUN) or (qc.self.weapon
                                               == defs.IT_SUPER_NAILGUN):
        if qc.self.ammo_nails >= 20:
            item.ammo_nails = 20
            qc.self.ammo_nails -= 20
        else:
            item.ammo_nails = qc.self.ammo_nails
            qc.self.ammo_nails = 0

    #  Check to see if we have neither nailgun
    if not (qc.self.items & defs.IT_NAILGUN) and not (qc.self.items
                                                      & defs.IT_SUPER_NAILGUN):
        if qc.self.ammo_nails >= 20:
            item.ammo_nails = 20
            qc.self.ammo_nails -= 20
        else:
            item.ammo_nails = qc.self.ammo_nails
            qc.self.ammo_nails = 0

    #  See if we are using a grenade or rocket launcher
    if (qc.self.weapon
            == defs.IT_GRENADE_LAUNCHER) or (qc.self.weapon
                                             == defs.IT_ROCKET_LAUNCHER):
        if qc.self.ammo_rockets >= 10:
            item.ammo_rockets = 10
            qc.self.ammo_rockets -= 10
        else:
            item.ammo_rockets = qc.self.ammo_rockets
            qc.self.ammo_rockets = 0

    #  See if we have neither the Grenade or rocket launcher
    if not (qc.self.items & defs.IT_GRENADE_LAUNCHER) and not (
            qc.self.items & defs.IT_ROCKET_LAUNCHER):
        if qc.self.ammo_rockets >= 10:
            item.ammo_rockets = 10
            qc.self.ammo_rockets -= 10
        else:
            item.ammo_rockets = qc.self.ammo_rockets
            qc.self.ammo_rockets = 0

    #  See if we're using the lightning gun
    if qc.self.weapon == defs.IT_LIGHTNING:
        if qc.self.ammo_cells >= 20:
            item.ammo_cells = 20
            qc.self.ammo_cells -= 20
        else:
            item.ammo_cells = qc.self.ammo_cells
            qc.self.ammo_cells = 0

    #  see if we don't have the lightning gun
    if not (qc.self.items & defs.IT_LIGHTNING):
        if qc.self.ammo_cells >= 20:
            item.ammo_cells = 20
            qc.self.ammo_cells -= 20
        else:
            item.ammo_cells = qc.self.ammo_cells
            qc.self.ammo_cells = 0

    if not item.ammo_shells and not item.ammo_nails and not item.ammo_rockets and not item.ammo_cells:
        #  we didn't put anything in
        item.remove()
        return

    item.owner = qc.self
    qc.makevectors(qc.self.v_angle)
    qc.setorigin(item, qc.self.origin + Vector(0, 0, 16))
    item.velocity = qc.self.aim(1000)
    item.velocity *= 500
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_BOUNCE
    item.setmodel('progs/backpack.mdl')
    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = items.BackpackTouch
    item.nextthink = qc.time + 120  #  remove after 2 minutes
    item.think = subs.SUB_Remove
    weapons.W_SetCurrentAmmo()
Exemple #51
0
def TossWeapon(*qwp_extra):
    if defs.deathmatch != 1:
        return  #  only in deathmatch 1
    if (qc.self.weapon
            == defs.IT_AXE) or (qc.self.weapon
                                == defs.IT_SHOTGUN) or (qc.self.weapon
                                                        == defs.IT_GRAPPLE):
        return
    item = qc.spawn()
    item.owner = qc.self
    qc.makevectors(qc.self.v_angle)
    qc.setorigin(item, qc.self.origin + Vector(0, 0, 16))
    item.velocity = qc.self.aim(1000)
    item.velocity *= 500
    item.flags = defs.FL_ITEM
    item.solid = defs.SOLID_TRIGGER
    item.movetype = defs.MOVETYPE_BOUNCE

    if qc.self.weapon == defs.IT_SUPER_SHOTGUN:
        item.setmodel('progs/g_shot.mdl')
        item.weapon = defs.IT_SUPER_SHOTGUN
        item.netname = 'Double-barrelled Shotgun'
        item.classname = 'weapon_supershotgun'
        qc.self.items -= defs.IT_SUPER_SHOTGUN
    elif qc.self.weapon == defs.IT_NAILGUN:
        item.setmodel('progs/g_nail.mdl')
        item.weapon = defs.IT_NAILGUN
        item.netname = 'nailgun'
        item.classname = 'weapon_nailgun'
        qc.self.items -= defs.IT_NAILGUN
    elif qc.self.weapon == defs.IT_SUPER_NAILGUN:
        item.setmodel('progs/g_nail2.mdl')
        item.weapon = defs.IT_SUPER_NAILGUN
        item.netname = 'Super Nailgun'
        item.classname = 'weapon_supernailgun'
        qc.self.items -= defs.IT_SUPER_NAILGUN
    elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER:
        item.setmodel('progs/g_rock.mdl')
        item.weapon = 3
        item.netname = 'Grenade Launcher'
        item.classname = 'weapon_grenadelauncher'
        qc.self.items -= defs.IT_GRENADE_LAUNCHER
    elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER:
        item.setmodel('progs/g_rock2.mdl')
        item.weapon = 3
        item.netname = 'Rocket Launcher'
        item.classname = 'weapon_rocketlauncher'
        qc.self.items -= defs.IT_ROCKET_LAUNCHER
    elif qc.self.weapon == defs.IT_LIGHTNING:
        item.setmodel('progs/g_light.mdl')
        item.weapon = 3
        item.netname = 'Thunderbolt'
        item.classname = 'weapon_lightning'
        qc.self.items -= defs.IT_LIGHTNING

    qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56))
    item.touch = Team_weapon_touch
    item.think = subs.SUB_Remove
    item.nextthink = qc.time + 120
    qc.self.weapon = weapons.W_BestWeapon()
    weapons.W_SetCurrentAmmo()