Exemplo n.º 1
0
def Grapple_Track(*qwp_extra):
    #  Release dead targets
    if qc.self.enemy.classname == 'player' and qc.self.enemy.health <= 0:
        qc.self.owner.on_hook = defs.FALSE
        qc.self.owner.attack_finished = qc.time + 0.75

    #  drop the hook if owner is dead or has released the button
    if not qc.self.owner.on_hook or qc.self.owner.health <= 0:
        Reset_Grapple(qc.self)
        return

    #  bring the pAiN!
    if qc.self.enemy.classname == 'player':
        #  4.1, if we can't see our enemy, unlock
        if not combat.CanDamage(qc.self.enemy, qc.self.owner):
            Reset_Grapple(qc.self)
            return

        #  move the hook along with the player.  It's invisible, but
        #  we need this to make the sound come from the right spot
        qc.setorigin(qc.self, qc.self.enemy.origin)
        qc.self.sound(defs.CHAN_WEAPON, 'blob/land1.wav', 1, defs.ATTN_NORM)
        combat.T_Damage(qc.self.enemy, qc.self, qc.self.owner, 1)
        qc.makevectors(qc.self.v_angle)
        weapons.SpawnBlood(qc.self.enemy.origin, 1)

    #  If the hook is not attached to the player, constantly copy
    #  copy the target's velocity. Velocity copying DOES NOT work properly
    #  for a hooked client.
    if qc.self.enemy.classname != 'player':
        qc.self.velocity = qc.self.enemy.velocity
    qc.self.nextthink = qc.time + 0.1
Exemplo n.º 2
0
def W_FireAxe(*qwp_extra):
    source = Vector(0, 0, 0)
    org = Vector(0, 0, 0)
    qc.makevectors(qc.self.v_angle)
    source = qc.self.origin + Vector(0, 0, 16)
    qc.traceline(source, source + qc.v_forward * 64, defs.FALSE, qc.self)
    if qc.trace_fraction == 1.0:
        return 
    org = qc.trace_endpos - qc.v_forward * 4
    if qc.trace_ent.takedamage:
        qc.trace_ent.axhitme = 1
        SpawnBlood(org, 20)
        if defs.deathmatch > 3:
            combat.T_Damage(qc.trace_ent, qc.self, qc.self, 75)
        else:
            combat.T_Damage(qc.trace_ent, qc.self, qc.self, 20)
        
    else:
        #  hit wall
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit2.wav', 1, defs.ATTN_NORM)
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_GUNSHOT)
        qc.WriteByte(defs.MSG_MULTICAST, 3)
        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_PVS)
Exemplo n.º 3
0
def fd_secret_use(*qwp_extra):
    qc.self.health = 10000
    #  exit if still moving around...
    if qc.self.origin != qc.self.oldorigin:
        return 
    qc.self.message = defs.string_null #  no more message
    subs.SUB_UseTargets() #  fire all targets / killtargets
    if qc.self.spawnflags & SECRET_NEVER:
        return  #  it never opens
    if not (qc.self.spawnflags & SECRET_NO_SHOOT):
        qc.self.th_pain = subs.SUB_Null
        qc.self.takedamage = defs.DAMAGE_NO
        
    qc.self.velocity = Vector(0, 0, 0)
    #  Make a sound, wait a little...
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise1, 1, defs.ATTN_NORM)
    qc.self.nextthink = qc.self.ltime + 0.1
    temp = 1 - (qc.self.spawnflags & SECRET_1ST_LEFT) #  1 or -1
    qc.makevectors(qc.self.mangle)
    if not qc.self.t_width:
        if qc.self.spawnflags & SECRET_1ST_DOWN:
            qc.self.t_width = math.fabs(qc.v_up * qc.self.size)
        else:
            qc.self.t_width = math.fabs(qc.v_right * qc.self.size)
        
    if not qc.self.t_length:
        qc.self.t_length = math.fabs(qc.v_forward * qc.self.size)
    if qc.self.spawnflags & SECRET_1ST_DOWN:
        qc.self.dest1 = qc.self.origin - qc.v_up * qc.self.t_width
    else:
        qc.self.dest1 = qc.self.origin + qc.v_right * (qc.self.t_width * temp)
    qc.self.dest2 = qc.self.dest1 + qc.v_forward * qc.self.t_length
    subs.SUB_CalcMove(qc.self.dest1, qc.self.speed, fd_secret_move1)
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise2, 1, defs.ATTN_NORM)
Exemplo n.º 4
0
def Grapple_Track(*qwp_extra):
    #  Release dead targets
    if qc.self.enemy.classname == 'player' and qc.self.enemy.health <= 0:
        qc.self.owner.on_hook = defs.FALSE
        qc.self.owner.attack_finished = qc.time + 0.75
        
    #  drop the hook if owner is dead or has released the button
    if not qc.self.owner.on_hook or qc.self.owner.health <= 0:
        Reset_Grapple(qc.self)
        return 
        
    #  bring the pAiN!
    if qc.self.enemy.classname == 'player':
        #  4.1, if we can't see our enemy, unlock
        if not combat.CanDamage(qc.self.enemy, qc.self.owner):
            Reset_Grapple(qc.self)
            return 
            
        #  move the hook along with the player.  It's invisible, but
        #  we need this to make the sound come from the right spot
        qc.setorigin(qc.self, qc.self.enemy.origin)
        qc.self.sound(defs.CHAN_WEAPON, 'blob/land1.wav', 1, defs.ATTN_NORM)
        combat.T_Damage(qc.self.enemy, qc.self, qc.self.owner, 1)
        qc.makevectors(qc.self.v_angle)
        weapons.SpawnBlood(qc.self.enemy.origin, 1)
        
    #  If the hook is not attached to the player, constantly copy
    #  copy the target's velocity. Velocity copying DOES NOT work properly
    #  for a hooked client. 
    if qc.self.enemy.classname != 'player':
        qc.self.velocity = qc.self.enemy.velocity
    qc.self.nextthink = qc.time + 0.1
Exemplo n.º 5
0
def Check_Overhead(*qwp_extra):
    qc.makevectors(qc.self.owner.angles)
    #  The following comparisons could be optimized by doing away with
    #  SRC and END, and plugging the values directly into the traceline
    #  function calls. Using SRC and END made debugging easier. You
    #  decide if it's worth it.
    #  quick check right above head
    src = qc.self.owner.origin - Vector(0, 0, 24)
    end = qc.self.owner.origin - Vector(0, 0, 24)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_forward * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_forward * 16 + Vector(0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_forward * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_forward * 16 + Vector(0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_right * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_right * 16 + Vector(0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_right * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_right * 16 + Vector(0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    return defs.TRUE
Exemplo n.º 6
0
def PlayerPreThink(*qwp_extra):
    mspeed = 0
    aspeed = 0
    r = 0
    if intermission_running:
        IntermissionThink()  #  otherwise a button could be missed between
        return  #  the think tics

    if qc.self.view_ofs == Vector(0, 0, 0):
        return  #  intermission or finale
    qc.makevectors(qc.self.v_angle)  #  is this still used
    qc.self.deathtype = None
    CheckRules()
    WaterMove()
    #
    # 	if (self.waterlevel == 2)
    # 		CheckWaterJump ();
    #
    if qc.self.deadflag >= defs.DEAD_DEAD:
        PlayerDeathThink()
        return

    if qc.self.deadflag == defs.DEAD_DYING:
        return  #  dying, so do nothing
    if qc.self.button2:
        PlayerJump()

    else:
        qc.self.flags |= defs.FL_JUMPRELEASED
    #  teleporters can force a non-moving pause time
    if qc.time < qc.self.pausetime:
        qc.self.velocity = Vector(0, 0, 0)
    if qc.time > qc.self.attack_finished and qc.self.currentammo == 0 and qc.self.weapon != defs.IT_AXE:
        qc.self.weapon = weapons.W_BestWeapon()
        weapons.W_SetCurrentAmmo()
Exemplo n.º 7
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)
Exemplo n.º 8
0
def fd_secret_use(*qwp_extra):
    qc.self.health = 10000
    #  exit if still moving around...
    if qc.self.origin != qc.self.oldorigin:
        return
    qc.self.message = defs.string_null  #  no more message
    subs.SUB_UseTargets()  #  fire all targets / killtargets
    if qc.self.spawnflags & SECRET_NEVER:
        return  #  it never opens
    if not (qc.self.spawnflags & SECRET_NO_SHOOT):
        qc.self.th_pain = subs.SUB_Null
        qc.self.takedamage = defs.DAMAGE_NO

    qc.self.velocity = Vector(0, 0, 0)
    #  Make a sound, wait a little...
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise1, 1, defs.ATTN_NORM)
    qc.self.nextthink = qc.self.ltime + 0.1
    temp = 1 - (qc.self.spawnflags & SECRET_1ST_LEFT)  #  1 or -1
    qc.makevectors(qc.self.mangle)
    if not qc.self.t_width:
        if qc.self.spawnflags & SECRET_1ST_DOWN:
            qc.self.t_width = math.fabs(qc.v_up * qc.self.size)
        else:
            qc.self.t_width = math.fabs(qc.v_right * qc.self.size)

    if not qc.self.t_length:
        qc.self.t_length = math.fabs(qc.v_forward * qc.self.size)
    if qc.self.spawnflags & SECRET_1ST_DOWN:
        qc.self.dest1 = qc.self.origin - qc.v_up * qc.self.t_width
    else:
        qc.self.dest1 = qc.self.origin + qc.v_right * (qc.self.t_width * temp)
    qc.self.dest2 = qc.self.dest1 + qc.v_forward * qc.self.t_length
    subs.SUB_CalcMove(qc.self.dest1, qc.self.speed, fd_secret_move1)
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise2, 1, defs.ATTN_NORM)
Exemplo n.º 9
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)
Exemplo n.º 10
0
def PlayerPreThink(*qwp_extra):
    mspeed = 0
    aspeed = 0
    r = 0
    if intermission_running:
        IntermissionThink() #  otherwise a button could be missed between
        return  #  the think tics
        
    if qc.self.view_ofs == Vector(0, 0, 0):
        return  #  intermission or finale
    qc.makevectors(qc.self.v_angle) #  is this still used
    qc.self.deathtype = None
    CheckRules()
    WaterMove()
    # 
    # 	if (self.waterlevel == 2)
    # 		CheckWaterJump ();
    # 
    if qc.self.deadflag >= defs.DEAD_DEAD:
        PlayerDeathThink()
        return 
        
    if qc.self.deadflag == defs.DEAD_DYING:
        return  #  dying, so do nothing
    if qc.self.button2:
        PlayerJump()
        
    else:
        qc.self.flags |= defs.FL_JUMPRELEASED
    #  teleporters can force a non-moving pause time        
    if qc.time < qc.self.pausetime:
        qc.self.velocity = Vector(0, 0, 0)
    if qc.time > qc.self.attack_finished and qc.self.currentammo == 0 and qc.self.weapon != defs.IT_AXE:
        qc.self.weapon = weapons.W_BestWeapon()
        weapons.W_SetCurrentAmmo()
Exemplo n.º 11
0
def voteexit_teleport(*qwp_extra):
    global lastvotespawn
    
    #  put a tfog where the player was
    triggers.spawn_tfog(qc.other.origin)
    #  if we aren't in custom mode, just find a deathmatch target
    #  find the destination 
    if not qc.self.target:
        lastvotespawn = qc.find(lastvotespawn, 'classname', 'info_player_deathmatch')
        if lastvotespawn == qc.world:
            lastvotespawn = qc.find(lastvotespawn, 'classname', 'info_player_deathmatch')
        t = lastvotespawn        
    else:
        t = qc.find(qc.world, 'targetname', qc.self.target)
    if not t:
        qc.objerror("couldn't find target")
    #  spawn a tfog flash in front of the destination
    qc.makevectors(t.mangle)
    org = t.origin + 32 * qc.v_forward
    triggers.spawn_tfog(org)
    triggers.spawn_tdeath(t.origin, qc.other)
    #  move the player and lock him down for a little while
    if not qc.other.health:
        qc.other.origin = t.origin
        qc.other.velocity = (qc.v_forward * qc.other.velocity.x) + (qc.v_forward * qc.other.velocity.y)
        return 
        
    qc.setorigin(qc.other, t.origin)
    qc.other.angles = t.mangle
    qc.other.fixangle = 1 #  turn this way immediately
    qc.other.teleport_time = qc.time + 0.7
    if qc.other.flags & defs.FL_ONGROUND:
        qc.other.flags -= defs.FL_ONGROUND
    qc.other.velocity = qc.v_forward * 300
Exemplo n.º 12
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()
Exemplo n.º 13
0
def SetMovedir(*qwp_extra):
    if qc.self.angles == Vector(0, -1, 0):
        qc.self.movedir = Vector(0, 0, 1)
    elif qc.self.angles == Vector(0, -2, 0):
        qc.self.movedir = Vector(0, 0, -1)
    else:
        qc.makevectors(qc.self.angles)
        qc.self.movedir = qc.v_forward
        
    qc.self.angles = Vector(0, 0, 0)
Exemplo n.º 14
0
def multi_touch(*qwp_extra):
    if qc.other.classname != 'player':
        return
    #  if the trigger has an angles field, check player's facing direction
    if qc.self.movedir != Vector(0, 0, 0):
        qc.makevectors(qc.other.angles)
        if qc.v_forward * qc.self.movedir < 0:
            return  #  not facing the right way

    qc.self.enemy = qc.other
    multi_trigger()
Exemplo n.º 15
0
def multi_touch(*qwp_extra):
    if qc.other.classname != 'player':
        return 
    #  if the trigger has an angles field, check player's facing direction
    if qc.self.movedir != Vector(0, 0, 0):
        qc.makevectors(qc.other.angles)
        if qc.v_forward * qc.self.movedir < 0:
            return  #  not facing the right way
        
    qc.self.enemy = qc.other
    multi_trigger()
Exemplo n.º 16
0
def teleport_touch(*qwp_extra):
    if qc.self.targetname:
        if qc.self.nextthink < qc.time:
            return  #  not fired yet

    if qc.self.spawnflags & PLAYER_ONLY:
        if qc.other.classname != 'player':
            return

    #  only teleport living creatures
    if qc.other.health <= 0 or qc.other.solid != defs.SOLID_SLIDEBOX:
        return

    subs.SUB_UseTargets()

    #  put a tfog where the player was
    spawn_tfog(qc.other.origin)
    t = qc.find(qc.world, 'targetname', qc.self.target)
    if not t:
        qc.objerror("couldn't find target")

    #  spawn a tfog flash in front of the destination
    qc.makevectors(t.mangle)
    org = t.origin + 32 * qc.v_forward
    spawn_tfog(org)
    spawn_tdeath(t.origin, qc.other)

    #  move the player and lock him down for a little while
    if not qc.other.health:
        qc.other.origin = t.origin
        qc.other.velocity = (qc.v_forward * qc.other.velocity.x) + (
            qc.v_forward * qc.other.velocity.y)
        return

    qc.setorigin(qc.other, t.origin)
    qc.other.angles = t.mangle
    if qc.other.classname == 'player':
        #  Teleporting - detach hook (wedge)
        if qc.other.weapon == defs.IT_GRAPPLE and qc.other.hook_out:
            qc.other.sound(defs.CHAN_WEAPON, 'weapons/bounce2.wav', 1,
                           defs.ATTN_NORM)
            qc.other.on_hook = defs.FALSE
            qc.other.hook_out = defs.FALSE
            qc.other.weaponframe = 0
            qc.other.attack_finished = qc.time + 0.75  #  avoid instant rehook

        qc.other.fixangle = 1  #  turn this way immediately
        qc.other.teleport_time = qc.time + 0.7
        if qc.other.flags & defs.FL_ONGROUND:
            qc.other.flags -= defs.FL_ONGROUND
        qc.other.velocity = qc.v_forward * 300

    qc.other.flags -= qc.other.flags & defs.FL_ONGROUND
Exemplo n.º 17
0
def teleport_touch(*qwp_extra):
    if qc.self.targetname:
        if qc.self.nextthink < qc.time:
            return  #  not fired yet
                    
    if qc.self.spawnflags & PLAYER_ONLY:
        if qc.other.classname != 'player':
            return 
        
    #  only teleport living creatures
    if qc.other.health <= 0 or qc.other.solid != defs.SOLID_SLIDEBOX:
        return 
        
    subs.SUB_UseTargets()
    
    #  put a tfog where the player was
    spawn_tfog(qc.other.origin)
    t = qc.find(qc.world, 'targetname', qc.self.target)
    if not t:
        qc.objerror("couldn't find target")
        
    #  spawn a tfog flash in front of the destination
    qc.makevectors(t.mangle)
    org = t.origin + 32 * qc.v_forward
    spawn_tfog(org)
    spawn_tdeath(t.origin, qc.other)
    
    #  move the player and lock him down for a little while
    if not qc.other.health:
        qc.other.origin = t.origin
        qc.other.velocity = (qc.v_forward * qc.other.velocity.x) + (qc.v_forward * qc.other.velocity.y)
        return 
        
    qc.setorigin(qc.other, t.origin)
    qc.other.angles = t.mangle
    if qc.other.classname == 'player':
        #  Teleporting - detach hook (wedge)
        if qc.other.weapon == defs.IT_GRAPPLE and qc.other.hook_out:
            qc.other.sound(defs.CHAN_WEAPON, 'weapons/bounce2.wav', 1, defs.ATTN_NORM)
            qc.other.on_hook = defs.FALSE
            qc.other.hook_out = defs.FALSE
            qc.other.weaponframe = 0
            qc.other.attack_finished = qc.time + 0.75 #  avoid instant rehook
            
        qc.other.fixangle = 1 #  turn this way immediately
        qc.other.teleport_time = qc.time + 0.7
        if qc.other.flags & defs.FL_ONGROUND:
            qc.other.flags -= defs.FL_ONGROUND
        qc.other.velocity = qc.v_forward * 300
        
    qc.other.flags -= qc.other.flags & defs.FL_ONGROUND
Exemplo n.º 18
0
def W_Attack(*qwp_extra):
    r = 0
    if not W_CheckNoAmmo():
        return 
    qc.makevectors(qc.self.v_angle) #  calculate forward angle for velocity
    qc.self.show_hostile = qc.time + 1 #  wake monsters up
    if qc.self.weapon == defs.IT_AXE:
        qc.self.attack_finished = qc.time + 0.5
        qc.self.sound(defs.CHAN_WEAPON, 'weapons/ax1.wav', 1, defs.ATTN_NORM)
        r = random.random()
        if r < 0.25:
            player.player_axe1()
        elif r < 0.5:
            player.player_axeb1()
        elif r < 0.75:
            player.player_axec1()
        else:
            player.player_axed1()
        
    elif qc.self.weapon == defs.IT_SHOTGUN:
        player.player_shot1()
        qc.self.attack_finished = qc.time + 0.5
        W_FireShotgun()
        
    elif qc.self.weapon == defs.IT_SUPER_SHOTGUN:
        player.player_shot1()
        qc.self.attack_finished = qc.time + 0.7
        W_FireSuperShotgun()
        
    elif qc.self.weapon == defs.IT_NAILGUN:
        player.player_nail1()
        
    elif qc.self.weapon == defs.IT_SUPER_NAILGUN:
        player.player_nail1()
        
    elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER:
        player.player_rocket1()
        qc.self.attack_finished = qc.time + 0.6
        W_FireGrenade()
        
    elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER:
        player.player_rocket1()
        qc.self.attack_finished = qc.time + 0.8
        W_FireRocket()
        
    elif qc.self.weapon == defs.IT_LIGHTNING:
        qc.self.attack_finished = qc.time + 0.1
        qc.self.sound(defs.CHAN_AUTO, 'weapons/lstart.wav', 1, defs.ATTN_NORM)
        player.player_light1()
Exemplo n.º 19
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)
Exemplo n.º 20
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)
Exemplo n.º 21
0
def FireBullets(shotcount, dir, spread, *qwp_extra):
    global puff_org
    
    qc.makevectors(qc.self.v_angle)
    src = qc.self.origin + qc.v_forward * 10
    src %= Vector(None, None, qc.self.absmin.z + qc.self.size.z * 0.7)
    ClearMultiDamage()
    qc.traceline(src, src + dir * 2048, defs.FALSE, qc.self)
    puff_org = qc.trace_endpos - dir * 4
    while shotcount > 0:
        direction = dir + crandom() * spread.x * qc.v_right + crandom() * spread.y * qc.v_up
        qc.traceline(src, src + direction * 2048, defs.FALSE, qc.self)
        if qc.trace_fraction != 1.0:
            TraceAttack(4, direction)
        shotcount -= 1
        
    ApplyMultiDamage()
    Multi_Finish()
Exemplo n.º 22
0
def W_FireSpikes(ox, *qwp_extra):
    qc.makevectors(qc.self.v_angle)
    if qc.self.ammo_nails >= 2 and qc.self.weapon == defs.IT_SUPER_NAILGUN:
        W_FireSuperSpikes()
        return

    if qc.self.ammo_nails < 1:
        qc.self.weapon = W_BestWeapon()
        W_SetCurrentAmmo()
        return

    qc.self.sound(defs.CHAN_WEAPON, 'weapons/rocket1i.wav', 1, defs.ATTN_NORM)
    qc.self.attack_finished = qc.time + 0.2
    qc.self.currentammo = qc.self.ammo_nails = qc.self.ammo_nails - 1
    dir = qc.self.aim(1000)
    launch_spike(qc.self.origin + Vector(0, 0, 16) + qc.v_right * ox, dir)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
Exemplo n.º 23
0
def W_FireSpikes(ox, *qwp_extra):
    qc.makevectors(qc.self.v_angle)
    if qc.self.ammo_nails >= 2 and qc.self.weapon == defs.IT_SUPER_NAILGUN:
        W_FireSuperSpikes()
        return 
        
    if qc.self.ammo_nails < 1:
        qc.self.weapon = W_BestWeapon()
        W_SetCurrentAmmo()
        return 
        
    qc.self.sound(defs.CHAN_WEAPON, 'weapons/rocket1i.wav', 1, defs.ATTN_NORM)
    qc.self.attack_finished = qc.time + 0.2
    qc.self.currentammo = qc.self.ammo_nails = qc.self.ammo_nails - 1
    dir = qc.self.aim(1000)
    launch_spike(qc.self.origin + Vector(0, 0, 16) + qc.v_right * ox, dir)
    qc.msg_entity = qc.self
    qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
Exemplo n.º 24
0
def FireBullets(shotcount, dir, spread, *qwp_extra):
    global puff_org

    qc.makevectors(qc.self.v_angle)
    src = qc.self.origin + qc.v_forward * 10
    src %= Vector(None, None, qc.self.absmin.z + qc.self.size.z * 0.7)
    ClearMultiDamage()
    qc.traceline(src, src + dir * 2048, defs.FALSE, qc.self)
    puff_org = qc.trace_endpos - dir * 4
    while shotcount > 0:
        direction = dir + crandom() * spread.x * qc.v_right + crandom(
        ) * spread.y * qc.v_up
        qc.traceline(src, src + direction * 2048, defs.FALSE, qc.self)
        if qc.trace_fraction != 1.0:
            TraceAttack(4, direction)
        shotcount -= 1

    ApplyMultiDamage()
    Multi_Finish()
Exemplo n.º 25
0
def teleport_touch(*qwp_extra):
    t = engine.world
    org = Vector(0, 0, 0)
    if qc.self.targetname:
        if qc.self.nextthink < qc.time:
            return  #  not fired yet
            
        
    if qc.self.spawnflags & PLAYER_ONLY:
        if qc.other.classname != 'player':
            return 
        
    #  only teleport living creatures
    if qc.other.health <= 0 or qc.other.solid != defs.SOLID_SLIDEBOX:
        return 
    subs.SUB_UseTargets()
    #  put a tfog where the player was
    spawn_tfog(qc.other.origin)
    t = qc.find(qc.world, 'targetname', qc.self.target)
    if not t:
        qc.objerror("couldn't find target")
    #  spawn a tfog flash in front of the destination
    qc.makevectors(t.mangle)
    org = t.origin + 32 * qc.v_forward
    spawn_tfog(org)
    spawn_tdeath(t.origin, qc.other)
    #  move the player and lock him down for a little while
    if not qc.other.health:
        qc.other.origin = t.origin
        qc.other.velocity = (qc.v_forward * qc.other.velocity.x) + (qc.v_forward * qc.other.velocity.y)
        return 
        
    qc.setorigin(qc.other, t.origin)
    qc.other.angles = t.mangle
    if qc.other.classname == 'player':
        qc.other.fixangle = 1 #  turn this way immediately
        qc.other.teleport_time = qc.time + 0.7
        if qc.other.flags & defs.FL_ONGROUND:
            qc.other.flags -= defs.FL_ONGROUND
        qc.other.velocity = qc.v_forward * 300
        
    qc.other.flags -= qc.other.flags & defs.FL_ONGROUND
Exemplo n.º 26
0
def teleport_touch(*qwp_extra):
    t = engine.world
    org = Vector(0, 0, 0)
    if qc.self.targetname:
        if qc.self.nextthink < qc.time:
            return  #  not fired yet

    if qc.self.spawnflags & PLAYER_ONLY:
        if qc.other.classname != 'player':
            return

    #  only teleport living creatures
    if qc.other.health <= 0 or qc.other.solid != defs.SOLID_SLIDEBOX:
        return
    subs.SUB_UseTargets()
    #  put a tfog where the player was
    spawn_tfog(qc.other.origin)
    t = qc.find(qc.world, 'targetname', qc.self.target)
    if not t:
        qc.objerror("couldn't find target")
    #  spawn a tfog flash in front of the destination
    qc.makevectors(t.mangle)
    org = t.origin + 32 * qc.v_forward
    spawn_tfog(org)
    spawn_tdeath(t.origin, qc.other)
    #  move the player and lock him down for a little while
    if not qc.other.health:
        qc.other.origin = t.origin
        qc.other.velocity = (qc.v_forward * qc.other.velocity.x) + (
            qc.v_forward * qc.other.velocity.y)
        return

    qc.setorigin(qc.other, t.origin)
    qc.other.angles = t.mangle
    if qc.other.classname == 'player':
        qc.other.fixangle = 1  #  turn this way immediately
        qc.other.teleport_time = qc.time + 0.7
        if qc.other.flags & defs.FL_ONGROUND:
            qc.other.flags -= defs.FL_ONGROUND
        qc.other.velocity = qc.v_forward * 300

    qc.other.flags -= qc.other.flags & defs.FL_ONGROUND
Exemplo n.º 27
0
def W_FireAxe(*qwp_extra):
    qc.makevectors(qc.self.v_angle)
    source = qc.self.origin + Vector(0, 0, 16)
    qc.traceline(source, source + qc.v_forward * 64, defs.FALSE, qc.self)
    if qc.trace_fraction == 1.0:
        return
    org = qc.trace_endpos - qc.v_forward * 4
    if qc.trace_ent.takedamage:
        qc.trace_ent.axhitme = 1
        SpawnBlood(org, 20)
        combat.T_Damage(qc.trace_ent, qc.self, qc.self, 20)
    else:
        #  hit wall
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit2.wav', 1, defs.ATTN_NORM)
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_GUNSHOT)
        qc.WriteByte(defs.MSG_MULTICAST, 3)
        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_PVS)
Exemplo n.º 28
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))
Exemplo n.º 29
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
Exemplo n.º 30
0
def Check_Overhead(*qwp_extra):
    qc.makevectors(qc.self.owner.angles)
    #  The following comparisons could be optimized by doing away with
    #  SRC and END, and plugging the values directly into the traceline
    #  function calls. Using SRC and END made debugging easier. You
    #  decide if it's worth it.
    #  quick check right above head
    src = qc.self.owner.origin - Vector(0, 0, 24)
    end = qc.self.owner.origin - Vector(0, 0, 24)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_forward * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_forward * 16 + Vector(
        0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_forward * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_forward * 16 + Vector(
        0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_right * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) - qc.v_right * 16 + Vector(
        0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    src = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_right * 16
    end = qc.self.owner.origin - Vector(0, 0, 24) + qc.v_right * 16 + Vector(
        0, 0, 58)
    qc.traceline(src, end, defs.FALSE, qc.self.owner)
    if qc.trace_fraction != 1.0:
        return defs.FALSE
    return defs.TRUE
Exemplo n.º 31
0
def CheckWaterJump(*qwp_extra):
    start = Vector(0, 0, 0)
    end = Vector(0, 0, 0)
    #  check for a jump-out-of-water
    qc.makevectors(qc.self.angles)
    start = qc.self.origin
    start %= Vector(None, None, start.z + 8)
    qc.v_forward %= Vector(None, None, 0)
    qc.v_forward.normalize()
    end = start + qc.v_forward * 24
    qc.traceline(start, end, defs.TRUE, qc.self)
    if qc.trace_fraction < 1:
        #  solid at waist
        start %= Vector(None, None, start.z + qc.self.maxs.z - 8)
        end = start + qc.v_forward * 24
        qc.self.movedir = qc.trace_plane_normal * -50
        qc.traceline(start, end, defs.TRUE, qc.self)
        if qc.trace_fraction == 1:
            #  open at eye level
            qc.self.flags |= defs.FL_WATERJUMP
            qc.self.velocity %= Vector(None, None, 225)
            qc.self.flags -= qc.self.flags & defs.FL_JUMPRELEASED
            qc.self.teleport_time = qc.time + 2 #  safety net
            return 
Exemplo n.º 32
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
Exemplo n.º 33
0
def CheckWaterJump(*qwp_extra):
    start = Vector(0, 0, 0)
    end = Vector(0, 0, 0)
    #  check for a jump-out-of-water
    qc.makevectors(qc.self.angles)
    start = qc.self.origin
    start %= Vector(None, None, start.z + 8)
    qc.v_forward %= Vector(None, None, 0)
    qc.v_forward.normalize()
    end = start + qc.v_forward * 24
    qc.traceline(start, end, defs.TRUE, qc.self)
    if qc.trace_fraction < 1:
        #  solid at waist
        start %= Vector(None, None, start.z + qc.self.maxs.z - 8)
        end = start + qc.v_forward * 24
        qc.self.movedir = qc.trace_plane_normal * -50
        qc.traceline(start, end, defs.TRUE, qc.self)
        if qc.trace_fraction == 1:
            #  open at eye level
            qc.self.flags |= defs.FL_WATERJUMP
            qc.self.velocity %= Vector(None, None, 225)
            qc.self.flags -= qc.self.flags & defs.FL_JUMPRELEASED
            qc.self.teleport_time = qc.time + 2  #  safety net
            return
Exemplo n.º 34
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))
Exemplo n.º 35
0
def PutClientInServer(*qwp_extra):
    global modelindex_eyes
    global modelindex_player
    spot = engine.world
    s = None
    qc.self.classname = 'player'
    qc.self.health = 100
    qc.self.takedamage = defs.DAMAGE_AIM
    qc.self.solid = defs.SOLID_SLIDEBOX
    qc.self.movetype = defs.MOVETYPE_WALK
    qc.self.show_hostile = 0
    qc.self.max_health = 100
    qc.self.flags = defs.FL_CLIENT
    qc.self.air_finished = qc.time + 12
    qc.self.dmg = 2 #  initial water damage
    qc.self.super_damage_finished = 0
    qc.self.radsuit_finished = 0
    qc.self.invisible_finished = 0
    qc.self.invincible_finished = 0
    qc.self.effects = 0
    qc.self.invincible_time = 0
    DecodeLevelParms()
    weapons.W_SetCurrentAmmo()
    qc.self.attack_finished = qc.time
    qc.self.th_pain = player.player_pain
    qc.self.th_die = player.PlayerDie
    qc.self.deadflag = defs.DEAD_NO
    #  paustime is set by teleporters to keep the player from moving a while
    qc.self.pausetime = 0
    spot = SelectSpawnPoint()
    qc.self.origin = spot.origin + Vector(0, 0, 1)
    qc.self.angles = spot.angles
    qc.self.fixangle = defs.TRUE #  turn this way immediately
    #  oh, this is a hack!
    qc.self.setmodel('progs/eyes.mdl')
    modelindex_eyes = qc.self.modelindex
    qc.self.setmodel('progs/player.mdl')
    modelindex_player = qc.self.modelindex
    qc.setsize(qc.self, defs.VEC_HULL_MIN, defs.VEC_HULL_MAX)
    qc.self.view_ofs = Vector(0, 0, 22)
    #  Mod - Xian (May.20.97)
    #  Bug where player would have velocity from their last kill
    qc.self.velocity = Vector(0, 0, 0)
    player.player_stand1()
    qc.makevectors(qc.self.angles)
    triggers.spawn_tfog(qc.self.origin + qc.v_forward * 20)
    triggers.spawn_tdeath(qc.self.origin, qc.self)
    #  Set Rocket Jump Modifiers
    if qc.stof(qc.world.infokey('rj')) != 0:
        defs.rj = qc.stof(qc.world.infokey('rj'))
        
    if defs.deathmatch == 4:
        qc.self.ammo_shells = 0
        if qc.stof(qc.world.infokey('axe')) == 0:
            qc.self.ammo_nails = 255
            qc.self.ammo_shells = 255
            qc.self.ammo_rockets = 255
            qc.self.ammo_cells = 255
            qc.self.items |= defs.IT_NAILGUN
            qc.self.items |= defs.IT_SUPER_NAILGUN
            qc.self.items |= defs.IT_SUPER_SHOTGUN
            qc.self.items |= defs.IT_ROCKET_LAUNCHER
            # 		self.items = self.items | IT_GRENADE_LAUNCHER;
            qc.self.items |= defs.IT_LIGHTNING
            
        qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3
        qc.self.armorvalue = 200
        qc.self.armortype = 0.8
        qc.self.health = 250
        qc.self.items |= defs.IT_INVULNERABILITY
        qc.self.invincible_time = 1
        qc.self.invincible_finished = qc.time + 3
        
    if defs.deathmatch == 5:
        qc.self.ammo_nails = 80
        qc.self.ammo_shells = 30
        qc.self.ammo_rockets = 10
        qc.self.ammo_cells = 30
        qc.self.items |= defs.IT_NAILGUN
        qc.self.items |= defs.IT_SUPER_NAILGUN
        qc.self.items |= defs.IT_SUPER_SHOTGUN
        qc.self.items |= defs.IT_ROCKET_LAUNCHER
        qc.self.items |= defs.IT_GRENADE_LAUNCHER
        qc.self.items |= defs.IT_LIGHTNING
        qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3
        qc.self.armorvalue = 200
        qc.self.armortype = 0.8
        qc.self.health = 200
        qc.self.items |= defs.IT_INVULNERABILITY
        qc.self.invincible_time = 1
        qc.self.invincible_finished = qc.time + 3
Exemplo n.º 36
0
def PutClientInServer(*qwp_extra):
    global modelindex_eyes
    global modelindex_player
    spot = engine.world
    s = None
    qc.self.classname = 'player'
    qc.self.health = 100
    qc.self.takedamage = defs.DAMAGE_AIM
    qc.self.solid = defs.SOLID_SLIDEBOX
    qc.self.movetype = defs.MOVETYPE_WALK
    qc.self.show_hostile = 0
    qc.self.max_health = 100
    qc.self.flags = defs.FL_CLIENT
    qc.self.air_finished = qc.time + 12
    qc.self.dmg = 2  #  initial water damage
    qc.self.super_damage_finished = 0
    qc.self.radsuit_finished = 0
    qc.self.invisible_finished = 0
    qc.self.invincible_finished = 0
    qc.self.effects = 0
    qc.self.invincible_time = 0
    DecodeLevelParms()
    weapons.W_SetCurrentAmmo()
    qc.self.attack_finished = qc.time
    qc.self.th_pain = player.player_pain
    qc.self.th_die = player.PlayerDie
    qc.self.deadflag = defs.DEAD_NO
    #  paustime is set by teleporters to keep the player from moving a while
    qc.self.pausetime = 0
    spot = SelectSpawnPoint()
    qc.self.origin = spot.origin + Vector(0, 0, 1)
    qc.self.angles = spot.angles
    qc.self.fixangle = defs.TRUE  #  turn this way immediately
    #  oh, this is a hack!
    qc.self.setmodel('progs/eyes.mdl')
    modelindex_eyes = qc.self.modelindex
    qc.self.setmodel('progs/player.mdl')
    modelindex_player = qc.self.modelindex
    qc.setsize(qc.self, defs.VEC_HULL_MIN, defs.VEC_HULL_MAX)
    qc.self.view_ofs = Vector(0, 0, 22)
    #  Mod - Xian (May.20.97)
    #  Bug where player would have velocity from their last kill
    qc.self.velocity = Vector(0, 0, 0)
    player.player_stand1()
    qc.makevectors(qc.self.angles)
    triggers.spawn_tfog(qc.self.origin + qc.v_forward * 20)
    triggers.spawn_tdeath(qc.self.origin, qc.self)
    #  Set Rocket Jump Modifiers
    if qc.stof(qc.world.infokey('rj')) != 0:
        defs.rj = qc.stof(qc.world.infokey('rj'))

    if defs.deathmatch == 4:
        qc.self.ammo_shells = 0
        if qc.stof(qc.world.infokey('axe')) == 0:
            qc.self.ammo_nails = 255
            qc.self.ammo_shells = 255
            qc.self.ammo_rockets = 255
            qc.self.ammo_cells = 255
            qc.self.items |= defs.IT_NAILGUN
            qc.self.items |= defs.IT_SUPER_NAILGUN
            qc.self.items |= defs.IT_SUPER_SHOTGUN
            qc.self.items |= defs.IT_ROCKET_LAUNCHER
            # 		self.items = self.items | IT_GRENADE_LAUNCHER;
            qc.self.items |= defs.IT_LIGHTNING

        qc.self.items = qc.self.items - (qc.self.items &
                                         (defs.IT_ARMOR1 | defs.IT_ARMOR2
                                          | defs.IT_ARMOR3)) + defs.IT_ARMOR3
        qc.self.armorvalue = 200
        qc.self.armortype = 0.8
        qc.self.health = 250
        qc.self.items |= defs.IT_INVULNERABILITY
        qc.self.invincible_time = 1
        qc.self.invincible_finished = qc.time + 3

    if defs.deathmatch == 5:
        qc.self.ammo_nails = 80
        qc.self.ammo_shells = 30
        qc.self.ammo_rockets = 10
        qc.self.ammo_cells = 30
        qc.self.items |= defs.IT_NAILGUN
        qc.self.items |= defs.IT_SUPER_NAILGUN
        qc.self.items |= defs.IT_SUPER_SHOTGUN
        qc.self.items |= defs.IT_ROCKET_LAUNCHER
        qc.self.items |= defs.IT_GRENADE_LAUNCHER
        qc.self.items |= defs.IT_LIGHTNING
        qc.self.items = qc.self.items - (qc.self.items &
                                         (defs.IT_ARMOR1 | defs.IT_ARMOR2
                                          | defs.IT_ARMOR3)) + defs.IT_ARMOR3
        qc.self.armorvalue = 200
        qc.self.armortype = 0.8
        qc.self.health = 200
        qc.self.items |= defs.IT_INVULNERABILITY
        qc.self.invincible_time = 1
        qc.self.invincible_finished = qc.time + 3
Exemplo n.º 37
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()
Exemplo n.º 38
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()
Exemplo n.º 39
0
def W_Attack(*qwp_extra):
    if not W_CheckNoAmmo():
        return
    qc.makevectors(qc.self.v_angle)  #  calculate forward angle for velocity
    qc.self.show_hostile = qc.time + 1  #  wake monsters up
    if qc.self.weapon == defs.IT_GRAPPLE:
        if qc.self.hook_out:
            player.player_chain3()
        else:
            player.player_chain1()
        qc.self.attack_finished = qc.time + 0.1

    if qc.self.weapon == defs.IT_AXE:
        qc.self.sound(defs.CHAN_WEAPON, 'weapons/ax1.wav', 1, defs.ATTN_NORM)
        r = random.random()
        if r < 0.25:
            player.player_axe1()
        elif r < 0.5:
            player.player_axeb1()
        elif r < 0.75:
            player.player_axec1()
        else:
            player.player_axed1()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()

        else:
            qc.self.attack_finished = qc.time + 0.5

    elif qc.self.weapon == defs.IT_SHOTGUN:
        player.player_shot1()
        W_FireShotgun()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()
        else:
            qc.self.attack_finished = qc.time + 0.5

    elif qc.self.weapon == defs.IT_SUPER_SHOTGUN:
        player.player_shot1()
        W_FireSuperShotgun()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.4
            HasteSound()
        else:
            qc.self.attack_finished = qc.time + 0.7

    elif qc.self.weapon == defs.IT_NAILGUN:
        player.player_nail1()

    elif qc.self.weapon == defs.IT_SUPER_NAILGUN:
        player.player_nail1()

    elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER:
        player.player_rocket1()
        W_FireGrenade()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()
        else:
            qc.self.attack_finished = qc.time + 0.6

    elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER:
        player.player_rocket1()
        W_FireRocket()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.4
            HasteSound()
        else:
            qc.self.attack_finished = qc.time + 0.8

    elif qc.self.weapon == defs.IT_LIGHTNING:
        qc.self.attack_finished = qc.time + 0.1
        qc.self.sound(defs.CHAN_AUTO, 'weapons/lstart.wav', 1, defs.ATTN_NORM)
        player.player_light1()
Exemplo n.º 40
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()
Exemplo n.º 41
0
def W_Attack(*qwp_extra):
    if not W_CheckNoAmmo():
        return 
    qc.makevectors(qc.self.v_angle) #  calculate forward angle for velocity
    qc.self.show_hostile = qc.time + 1 #  wake monsters up
    if qc.self.weapon == defs.IT_GRAPPLE:
        if qc.self.hook_out:
            player.player_chain3()
        else:
            player.player_chain1()
        qc.self.attack_finished = qc.time + 0.1
        
    if qc.self.weapon == defs.IT_AXE:
        qc.self.sound(defs.CHAN_WEAPON, 'weapons/ax1.wav', 1, defs.ATTN_NORM)
        r = random.random()
        if r < 0.25:
            player.player_axe1()
        elif r < 0.5:
            player.player_axeb1()
        elif r < 0.75:
            player.player_axec1()
        else:
            player.player_axed1()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()
            
        else:
            qc.self.attack_finished = qc.time + 0.5
        
    elif qc.self.weapon == defs.IT_SHOTGUN:
        player.player_shot1()
        W_FireShotgun()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()            
        else:
            qc.self.attack_finished = qc.time + 0.5
        
    elif qc.self.weapon == defs.IT_SUPER_SHOTGUN:
        player.player_shot1()
        W_FireSuperShotgun()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.4
            HasteSound()            
        else:
            qc.self.attack_finished = qc.time + 0.7
        
    elif qc.self.weapon == defs.IT_NAILGUN:
        player.player_nail1()
        
    elif qc.self.weapon == defs.IT_SUPER_NAILGUN:
        player.player_nail1()
        
    elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER:
        player.player_rocket1()
        W_FireGrenade()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.3
            HasteSound()            
        else:
            qc.self.attack_finished = qc.time + 0.6
        
    elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER:
        player.player_rocket1()
        W_FireRocket()
        #  RUNE: rune of hell magic
        if qc.self.player_flag & defs.ITEM_RUNE3_FLAG:
            qc.self.attack_finished = qc.time + 0.4
            HasteSound()            
        else:
            qc.self.attack_finished = qc.time + 0.8
        
    elif qc.self.weapon == defs.IT_LIGHTNING:
        qc.self.attack_finished = qc.time + 0.1
        qc.self.sound(defs.CHAN_AUTO, 'weapons/lstart.wav', 1, defs.ATTN_NORM)
        player.player_light1()