Esempio n. 1
0
def superspike_touch(*qwp_extra):
    if qc.other == qc.self.owner:
        return
    if qc.self.cnt:
        return
    if qc.other.solid == defs.SOLID_TRIGGER:
        return  #  trigger field, do nothing
    qc.self.cnt = 1
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return

    #  hit something that bleeds
    if qc.other.takedamage:
        spawn_touchblood(18)
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 18)
    else:
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_SUPERSPIKE)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
        engine.multicast(qc.self.origin, defs.MULTICAST_PHS)

    qc.self.remove()
Esempio n. 2
0
def Anchor_Grapple(*qwp_extra):
    if qc.other == qc.self.owner:
        return 
    #  DO NOT allow the grapple to hook to any projectiles, no matter WHAT!
    #  if you create new types of projectiles, make sure you use one of the
    #  classnames below or write code to exclude your new classname so
    #  grapples will not stick to them.
    if qc.other.classname == 'missile' or qc.other.classname == 'grenade' or qc.other.classname == 'spike' or qc.other.classname == 'hook':
        return 
    #  Don't stick the the sky.
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        Reset_Grapple(qc.self)
        return 
        
    if qc.other.classname == 'player':
        #  glance off of teammates
        if qc.other.steam == qc.self.owner.steam:
            return 
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit1.wav', 1, defs.ATTN_NORM)
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 10)
        #  make hook invisible since we will be pulling directly
        #  towards the player the hook hit. Quakeworld makes it
        #  too quirky to try to match hook's velocity with that of
        #  the client that it hit. 
        qc.self.setmodel(None)
        
    elif qc.other.classname != 'player':
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit2.wav', 1, defs.ATTN_NORM)
        #  One point of damage inflicted upon impact. Subsequent
        #  damage will only be done to PLAYERS... this way secret
        #  doors and triggers will only be damaged once.
        if qc.other.takedamage:
            combat.T_Damage(qc.other, qc.self, qc.self.owner, 1)
        qc.self.velocity = Vector(0, 0, 0)
        qc.self.avelocity = Vector(0, 0, 0)
        
    #  conveniently clears the sound channel of the CHAIN1 sound,
    #  which is a looping sample and would continue to play. Tink1 is
    #  the least offensive choice, ass NULL.WAV loops and clogs the
    #  channel with silence
    qc.self.owner.sound(defs.CHAN_NO_PHS_ADD + defs.CHAN_WEAPON, 'weapons/tink1.wav', 1, defs.ATTN_NORM)
    if not qc.self.owner.button0:
        Reset_Grapple(qc.self)
        return 
        
    if qc.self.owner.flags & defs.FL_ONGROUND:
        qc.self.owner.flags -= defs.FL_ONGROUND
        
    qc.self.owner.on_hook = defs.TRUE
    qc.self.owner.sound(defs.CHAN_WEAPON, 'weapons/chain2.wav', 1, defs.ATTN_NORM)
    #  CHAIN2 is a looping sample. Use LEFTY as a flag so that client.qc
    #  will know to only play the tink sound ONCE to clear the weapons
    #  sound channel. (Lefty is a leftover from AI.QC, so I reused it to
    #  avoid adding a field)
    qc.self.owner.lefty = defs.TRUE
    qc.self.enemy = qc.other #  remember this guy!
    qc.self.think = Grapple_Track
    qc.self.nextthink = qc.time
    qc.self.solid = defs.SOLID_NOT
    qc.self.touch = subs.SUB_Null
Esempio n. 3
0
def superspike_touch(*qwp_extra):
    if qc.other == qc.self.owner:
        return 
    if qc.self.cnt:
        return 
    if qc.other.solid == defs.SOLID_TRIGGER:
        return  #  trigger field, do nothing
    qc.self.cnt = 1
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return 
        
    #  hit something that bleeds
    if qc.other.takedamage:
        spawn_touchblood(18)
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 18)        
    else:
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_SUPERSPIKE)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
        engine.multicast(qc.self.origin, defs.MULTICAST_PHS)
        
    qc.self.remove()
Esempio n. 4
0
def T_MissileTouch(*qwp_extra):
    if qc.other == qc.self.owner:
        return  #  don't explode on owner
    if qc.self.cnt:
        return
    qc.self.cnt = 1
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return

    damg = 100 + random.random() * 20
    if qc.other.health:
        combat.T_Damage(qc.other, qc.self, qc.self.owner, damg)

    #  don't do radius damage to the other, because all the damage
    #  was done in the impact
    combat.T_RadiusDamage(qc.self, qc.self.owner, 120, qc.other)
    # 	sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
    qc.self.origin -= 8 * qc.self.velocity.normalize()
    qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
    qc.WriteByte(defs.MSG_MULTICAST, defs.TE_EXPLOSION)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
    engine.multicast(qc.self.origin, defs.MULTICAST_PHS)
    qc.self.remove()
Esempio n. 5
0
def T_MissileTouch(*qwp_extra):
    if qc.other == qc.self.owner:
        return  #  don't explode on owner
    if qc.self.cnt:
        return 
    qc.self.cnt = 1
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return 
        
    damg = 100 + random.random() * 20
    if qc.other.health:
        combat.T_Damage(qc.other, qc.self, qc.self.owner, damg)
        
    #  don't do radius damage to the other, because all the damage
    #  was done in the impact
    combat.T_RadiusDamage(qc.self, qc.self.owner, 120, qc.other)
    # 	sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
    qc.self.origin -= 8 * qc.self.velocity.normalize()
    qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
    qc.WriteByte(defs.MSG_MULTICAST, defs.TE_EXPLOSION)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
    engine.multicast(qc.self.origin, defs.MULTICAST_PHS)
    qc.self.remove()
Esempio n. 6
0
def Laser_Touch(*qwp_extra):
    org = Vector(0, 0, 0)
    if qc.other == qc.self.owner:
        return  #  don't explode on owner
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return

    qc.self.sound(defs.CHAN_WEAPON, 'enforcer/enfstop.wav', 1,
                  defs.ATTN_STATIC)
    org = qc.self.origin - 8 * qc.self.velocity.normalize()
    if qc.other.health:
        weapons.SpawnBlood(org, 15)
        qc.other.deathtype = 'laser'
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 15)

    else:
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_GUNSHOT)
        qc.WriteByte(defs.MSG_MULTICAST, 5)
        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)

    qc.self.remove()
Esempio n. 7
0
def spike_touch(*qwp_extra):
    rand = 0
    if qc.other == qc.self.owner:
        return 
    if qc.self.voided:
        return 
        
    qc.self.voided = 1
    if qc.other.solid == defs.SOLID_TRIGGER:
        return  #  trigger field, do nothing
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return 
        
    #  hit something that bleeds
    if qc.other.takedamage:
        spawn_touchblood(9)
        qc.other.deathtype = 'nail'
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 9)
        
    else:
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        if qc.self.classname == 'wizspike':
            qc.WriteByte(defs.MSG_MULTICAST, defs.TE_WIZSPIKE)
        elif qc.self.classname == 'knightspike':
            qc.WriteByte(defs.MSG_MULTICAST, defs.TE_KNIGHTSPIKE)
        else:
            qc.WriteByte(defs.MSG_MULTICAST, defs.TE_SPIKE)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
        qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
        engine.multicast(qc.self.origin, defs.MULTICAST_PHS)
        
    qc.self.remove()
Esempio n. 8
0
def Laser_Touch(*qwp_extra):
    org = Vector(0, 0, 0)
    if qc.other == qc.self.owner:
        return  #  don't explode on owner
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return 
        
    qc.self.sound(defs.CHAN_WEAPON, 'enforcer/enfstop.wav', 1, defs.ATTN_STATIC)
    org = qc.self.origin - 8 * qc.self.velocity.normalize()
    if qc.other.health:
        weapons.SpawnBlood(org, 15)
        qc.other.deathtype = 'laser'
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 15)
        
    else:
        qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
        qc.WriteByte(defs.MSG_MULTICAST, defs.TE_GUNSHOT)
        qc.WriteByte(defs.MSG_MULTICAST, 5)
        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)
        
    qc.self.remove()
Esempio n. 9
0
def T_MissileTouch(*qwp_extra):
    damg = 0
    # 	if (deathmatch == 4)
    # 	{
    # 	if ( ((other.weapon == 32) || (other.weapon == 16)))
    # 		{	
    # 			if (random() < 0.1)
    # 			{
    # 				if (other != world)
    # 				{
    # 	//				bprint (PRINT_HIGH, "Got here\n");
    # 					other.deathtype = "blaze";
    # 					T_Damage (other, self, self.owner, 1000 );
    # 					T_RadiusDamage (self, self.owner, 1000, other);
    # 				}
    # 			}
    # 		}	
    # 	}
    if qc.other == qc.self.owner:
        return  #  don't explode on owner
    if qc.self.voided:
        return 
        
    qc.self.voided = 1
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        qc.self.remove()
        return 
        
    damg = 100 + random.random() * 20
    if qc.other.health:
        qc.other.deathtype = 'rocket'
        combat.T_Damage(qc.other, qc.self, qc.self.owner, damg)
        
    #  don't do radius damage to the other, because all the damage
    #  was done in the impact
    combat.T_RadiusDamage(qc.self, qc.self.owner, 120, qc.other, 'rocket')
    #   sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
    qc.self.origin -= 8 * qc.self.velocity.normalize()
    qc.WriteByte(defs.MSG_MULTICAST, defs.SVC_TEMPENTITY)
    qc.WriteByte(defs.MSG_MULTICAST, defs.TE_EXPLOSION)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.x)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.y)
    qc.WriteCoord(defs.MSG_MULTICAST, qc.self.origin.z)
    engine.multicast(qc.self.origin, defs.MULTICAST_PHS)
    qc.self.remove()
Esempio n. 10
0
def Anchor_Grapple(*qwp_extra):
    if qc.other == qc.self.owner:
        return
    #  DO NOT allow the grapple to hook to any projectiles, no matter WHAT!
    #  if you create new types of projectiles, make sure you use one of the
    #  classnames below or write code to exclude your new classname so
    #  grapples will not stick to them.
    if qc.other.classname == 'missile' or qc.other.classname == 'grenade' or qc.other.classname == 'spike' or qc.other.classname == 'hook':
        return
    #  Don't stick the the sky.
    if engine.pointcontents(qc.self.origin) == defs.CONTENT_SKY:
        Reset_Grapple(qc.self)
        return

    if qc.other.classname == 'player':
        #  glance off of teammates
        if qc.other.steam == qc.self.owner.steam:
            return
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit1.wav', 1, defs.ATTN_NORM)
        combat.T_Damage(qc.other, qc.self, qc.self.owner, 10)
        #  make hook invisible since we will be pulling directly
        #  towards the player the hook hit. Quakeworld makes it
        #  too quirky to try to match hook's velocity with that of
        #  the client that it hit.
        qc.self.setmodel(None)

    elif qc.other.classname != 'player':
        qc.self.sound(defs.CHAN_WEAPON, 'player/axhit2.wav', 1, defs.ATTN_NORM)
        #  One point of damage inflicted upon impact. Subsequent
        #  damage will only be done to PLAYERS... this way secret
        #  doors and triggers will only be damaged once.
        if qc.other.takedamage:
            combat.T_Damage(qc.other, qc.self, qc.self.owner, 1)
        qc.self.velocity = Vector(0, 0, 0)
        qc.self.avelocity = Vector(0, 0, 0)

    #  conveniently clears the sound channel of the CHAIN1 sound,
    #  which is a looping sample and would continue to play. Tink1 is
    #  the least offensive choice, ass NULL.WAV loops and clogs the
    #  channel with silence
    qc.self.owner.sound(defs.CHAN_NO_PHS_ADD + defs.CHAN_WEAPON,
                        'weapons/tink1.wav', 1, defs.ATTN_NORM)
    if not qc.self.owner.button0:
        Reset_Grapple(qc.self)
        return

    if qc.self.owner.flags & defs.FL_ONGROUND:
        qc.self.owner.flags -= defs.FL_ONGROUND

    qc.self.owner.on_hook = defs.TRUE
    qc.self.owner.sound(defs.CHAN_WEAPON, 'weapons/chain2.wav', 1,
                        defs.ATTN_NORM)
    #  CHAIN2 is a looping sample. Use LEFTY as a flag so that client.qc
    #  will know to only play the tink sound ONCE to clear the weapons
    #  sound channel. (Lefty is a leftover from AI.QC, so I reused it to
    #  avoid adding a field)
    qc.self.owner.lefty = defs.TRUE
    qc.self.enemy = qc.other  #  remember this guy!
    qc.self.think = Grapple_Track
    qc.self.nextthink = qc.time
    qc.self.solid = defs.SOLID_NOT
    qc.self.touch = subs.SUB_Null