コード例 #1
0
def door_fire(*qwp_extra):
    if qc.self.owner != qc.self:
        qc.objerror('door_fire: self.owner != self')
    #  play use key sound
    if qc.self.items:
        qc.self.sound(defs.CHAN_VOICE, qc.self.noise4, 1, defs.ATTN_NORM)
    qc.self.message = defs.string_null  #  no more message
    oself = qc.self
    if qc.self.spawnflags & DOOR_TOGGLE:
        if qc.self.state == defs.STATE_UP or qc.self.state == defs.STATE_TOP:
            starte = qc.self
            while 1:
                door_go_down()
                qc.self = qc.self.enemy
                if not ((qc.self != starte) and (qc.self != qc.world)):
                    break
            qc.self = oself
            return

    #  trigger all paired doors
    starte = qc.self
    while 1:
        door_go_up()
        qc.self = qc.self.enemy
        if not ((qc.self != starte) and (qc.self != qc.world)):
            break
    qc.self = oself
コード例 #2
0
ファイル: triggers.py プロジェクト: barryp/qwpython
def trigger_multiple(*qwp_extra):
    if qc.self.sounds == 1:
        engine.precache_sound('misc/secret.wav')
        qc.self.noise = 'misc/secret.wav'
        
    elif qc.self.sounds == 2:
        engine.precache_sound('misc/talk.wav')
        qc.self.noise = 'misc/talk.wav'
        
    elif qc.self.sounds == 3:
        engine.precache_sound('misc/trigger1.wav')
        qc.self.noise = 'misc/trigger1.wav'
        
    if not qc.self.wait:
        qc.self.wait = 0.2
    qc.self.use = multi_use
    subs.InitTrigger()
    if qc.self.health:
        if qc.self.spawnflags & SPAWNFLAG_NOTOUCH:
            qc.objerror("health and notouch don't make sense\012")
        qc.self.max_health = qc.self.health
        qc.self.th_die = multi_killed
        qc.self.takedamage = defs.DAMAGE_YES
        qc.self.solid = defs.SOLID_BBOX
        qc.setorigin(qc.self, qc.self.origin) #  make sure it links into the world
        
    else:
        if not (qc.self.spawnflags & SPAWNFLAG_NOTOUCH):
            qc.self.touch = multi_touch
コード例 #3
0
ファイル: doors.py プロジェクト: barryp/qwpython
def door_fire(*qwp_extra):
    if qc.self.owner != qc.self:
        qc.objerror('door_fire: self.owner != self')
    #  play use key sound
    if qc.self.items:
        qc.self.sound(defs.CHAN_VOICE, qc.self.noise4, 1, defs.ATTN_NORM)
    qc.self.message = defs.string_null #  no more message
    oself = qc.self
    if qc.self.spawnflags & DOOR_TOGGLE:
        if qc.self.state == defs.STATE_UP or qc.self.state == defs.STATE_TOP:
            starte = qc.self
            while 1:
                door_go_down()
                qc.self = qc.self.enemy
                if not ((qc.self != starte) and (qc.self != qc.world)):
                    break
            qc.self = oself
            return 
                    
    #  trigger all paired doors
    starte = qc.self
    while 1:
        door_go_up()
        qc.self = qc.self.enemy
        if not ((qc.self != starte) and (qc.self != qc.world)):
            break
    qc.self = oself
コード例 #4
0
def SUB_CalcMove(tdest, tspeed, func, *qwp_extra):
    vdestdelta = Vector(0, 0, 0)
    len = 0
    traveltime = 0
    if not tspeed:
        qc.objerror('No speed is defined!')
    qc.self.think1 = func
    qc.self.finaldest = tdest
    qc.self.think = SUB_CalcMoveDone
    if tdest == qc.self.origin:
        qc.self.velocity = Vector(0, 0, 0)
        qc.self.nextthink = qc.self.ltime + 0.1
        return 
        
    #  set destdelta to the vector needed to move
    vdestdelta = tdest - qc.self.origin
    #  calculate length of vector
    len = vdestdelta.length()
    #  divide by speed to get time to reach dest
    traveltime = len / tspeed
    if traveltime < 0.03:
        traveltime = 0.03
    #  set nextthink to trigger a think when dest is reached
    qc.self.nextthink = qc.self.ltime + traveltime
    #  scale the destdelta vector by the time spent traveling to get velocity
    qc.self.velocity = vdestdelta * (1 / traveltime) #  qcc won't take vec/float	
コード例 #5
0
ファイル: ctfgame.py プロジェクト: angeld29/qwpy
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
コード例 #6
0
ファイル: triggers.py プロジェクト: angeld29/qwpy
def trigger_multiple(*qwp_extra):
    if qc.self.sounds == 1:
        engine.precache_sound('misc/secret.wav')
        qc.self.noise = 'misc/secret.wav'

    elif qc.self.sounds == 2:
        engine.precache_sound('misc/talk.wav')
        qc.self.noise = 'misc/talk.wav'

    elif qc.self.sounds == 3:
        engine.precache_sound('misc/trigger1.wav')
        qc.self.noise = 'misc/trigger1.wav'

    if not qc.self.wait:
        qc.self.wait = 0.2
    qc.self.use = multi_use
    subs.InitTrigger()
    if qc.self.health:
        if qc.self.spawnflags & SPAWNFLAG_NOTOUCH:
            qc.objerror("health and notouch don't make sense\012")
        qc.self.max_health = qc.self.health
        qc.self.th_die = multi_killed
        qc.self.takedamage = defs.DAMAGE_YES
        qc.self.solid = defs.SOLID_BBOX
        qc.setorigin(qc.self,
                     qc.self.origin)  #  make sure it links into the world

    else:
        if not (qc.self.spawnflags & SPAWNFLAG_NOTOUCH):
            qc.self.touch = multi_touch
コード例 #7
0
ファイル: plats.py プロジェクト: angeld29/qwpython
def func_train(*qwp_extra):
    if not qc.self.speed:
        qc.self.speed = 100
    if not qc.self.target:
        qc.objerror('func_train without a target')
    if not qc.self.dmg:
        qc.self.dmg = 2
    if qc.self.sounds == 0:
        qc.self.noise = ('misc/null.wav')
        engine.precache_sound('misc/null.wav')
        qc.self.noise1 = ('misc/null.wav')
        engine.precache_sound('misc/null.wav')
        
    if qc.self.sounds == 1:
        qc.self.noise = ('plats/train2.wav')
        engine.precache_sound('plats/train2.wav')
        qc.self.noise1 = ('plats/train1.wav')
        engine.precache_sound('plats/train1.wav')
        
    qc.self.cnt = 1
    qc.self.solid = defs.SOLID_BSP
    qc.self.movetype = defs.MOVETYPE_PUSH
    qc.self.blocked = train_blocked
    qc.self.use = train_use
    qc.self.classname = 'train'
    qc.self.setmodel(qc.self.model)
    qc.setsize(qc.self, qc.self.mins, qc.self.maxs)
    qc.setorigin(qc.self, qc.self.origin)
    #  start trains on the second frame, to make sure their targets have had
    #  a chance to spawn
    qc.self.nextthink = qc.self.ltime + 0.1
    qc.self.think = func_train_find
コード例 #8
0
ファイル: plats.py プロジェクト: barryp/qwpython
def func_train(*qwp_extra):
    if not qc.self.speed:
        qc.self.speed = 100
    if not qc.self.target:
        qc.objerror('func_train without a target')
    if not qc.self.dmg:
        qc.self.dmg = 2
    if qc.self.sounds == 0:
        qc.self.noise = ('misc/null.wav')
        engine.precache_sound('misc/null.wav')
        qc.self.noise1 = ('misc/null.wav')
        engine.precache_sound('misc/null.wav')        
    elif qc.self.sounds == 1:
        qc.self.noise = ('plats/train2.wav')
        engine.precache_sound('plats/train2.wav')
        qc.self.noise1 = ('plats/train1.wav')
        engine.precache_sound('plats/train1.wav')
        
    qc.self.cnt = 1
    qc.self.solid = defs.SOLID_BSP
    qc.self.movetype = defs.MOVETYPE_PUSH
    qc.self.blocked = train_blocked
    qc.self.use = train_use
    qc.self.classname = 'train'
    qc.self.setmodel(qc.self.model)
    qc.setsize(qc.self, qc.self.mins, qc.self.maxs)
    qc.setorigin(qc.self, qc.self.origin)
    #  start trains on the second frame, to make sure their targets have had
    #  a chance to spawn
    qc.self.nextthink = qc.self.ltime + 0.1
    qc.self.think = func_train_find
コード例 #9
0
ファイル: triggers.py プロジェクト: barryp/qwpython
def info_teleport_destination(*qwp_extra):
    #  this does nothing, just serves as a target spot
    qc.self.mangle = qc.self.angles
    qc.self.angles = Vector(0, 0, 0)
    qc.self.model = None
    qc.self.origin += Vector(0, 0, 27)
    if not qc.self.targetname:
        qc.objerror('no targetname')
コード例 #10
0
ファイル: triggers.py プロジェクト: angeld29/qwpy
def info_teleport_destination(*qwp_extra):
    #  this does nothing, just serves as a target spot
    qc.self.mangle = qc.self.angles
    qc.self.angles = Vector(0, 0, 0)
    qc.self.model = None
    qc.self.origin += Vector(0, 0, 27)
    if not qc.self.targetname:
        qc.objerror('no targetname')
コード例 #11
0
ファイル: plats.py プロジェクト: angeld29/qwpython
def plat_crush(*qwp_extra):
    # dprint ("plat_crush\n");
    qc.other.deathtype = 'squish'
    combat.T_Damage(qc.other, qc.self, qc.self, 1)
    if qc.self.state == defs.STATE_UP:
        plat_go_down()
    elif qc.self.state == defs.STATE_DOWN:
        plat_go_up()
    else:
        qc.objerror('plat_crush: bad self.state\012')
コード例 #12
0
ファイル: teamplay.py プロジェクト: barryp/qwpython
def TeamCaptureFlagThink(*qwp_extra):
    qc.self.nextthink = qc.time + 0.1
    if qc.self.cnt == FLAG_AT_BASE:
        return  #  just sitting around waiting to be picked up
    if qc.self.cnt == FLAG_DROPPED:
        if qc.time - qc.self.super_time > TEAM_CAPTURE_FLAG_RETURN_TIME:
            TeamCaptureReturnFlag(qc.self)
        return
    if qc.self.cnt != FLAG_CARRIED:
        qc.objerror("Flag in invalid state\012")
コード例 #13
0
ファイル: teamplay.py プロジェクト: angeld29/qwpy
def TeamCaptureFlagThink(*qwp_extra):
    qc.self.nextthink = qc.time + 0.1
    if qc.self.cnt == FLAG_AT_BASE:
        return  #  just sitting around waiting to be picked up
    if qc.self.cnt == FLAG_DROPPED:
        if qc.time - qc.self.super_time > TEAM_CAPTURE_FLAG_RETURN_TIME:
            TeamCaptureReturnFlag(qc.self)
        return
    if qc.self.cnt != FLAG_CARRIED:
        qc.objerror('Flag in invalid state\012')
コード例 #14
0
ファイル: doors.py プロジェクト: angeld29/qwpy
def LinkDoors(*qwp_extra):
    t = engine.world
    starte = engine.world
    cmins = Vector(0, 0, 0)
    cmaxs = Vector(0, 0, 0)
    if qc.self.enemy:
        return  #  already linked by another door
    if qc.self.spawnflags & 4:
        qc.self.owner = qc.self.enemy = qc.self
        return  #  don't want to link this door
        
    cmins = qc.self.mins
    cmaxs = qc.self.maxs
    starte = qc.self
    t = qc.self
    while 1:
        qc.self.owner = starte #  master door
        if qc.self.health:
            starte.health = qc.self.health
        if qc.self.targetname:
            starte.targetname = qc.self.targetname
        if qc.self.message != None:
            starte.message = qc.self.message
        t = qc.find(t, 'classname', qc.self.classname)
        if not t:
            qc.self.enemy = starte #  make the chain a loop
            #  shootable, fired, or key doors just needed the owner/enemy links,
            #  they don't spawn a field
            qc.self = qc.self.owner
            if qc.self.health:
                return 
            if qc.self.targetname:
                return 
            if qc.self.items:
                return 
            qc.self.owner.trigger_field = spawn_field(cmins, cmaxs)
            return 
            
        if EntitiesTouching(qc.self, t):
            if t.enemy:
                qc.objerror('cross connected doors')
            qc.self.enemy = t
            qc.self = t
            if t.mins.x < cmins.x:
                cmins %= Vector(t.mins.x, None, None)
            if t.mins.y < cmins.y:
                cmins %= Vector(None, t.mins.y, None)
            if t.mins.z < cmins.z:
                cmins %= Vector(None, None, t.mins.z)
            if t.maxs.x > cmaxs.x:
                cmaxs %= Vector(t.maxs.x, None, None)
            if t.maxs.y > cmaxs.y:
                cmaxs %= Vector(None, t.maxs.y, None)
            if t.maxs.z > cmaxs.z:
                cmaxs %= Vector(None, None, t.maxs.z)
コード例 #15
0
ファイル: teamplay.py プロジェクト: barryp/qwpython
def Team_weapon_touch(*qwp_extra):
    if not (qc.other.flags & defs.FL_CLIENT):
        return

    #  Don't let the owner pick up his own weapon for a second.
    if (qc.other == qc.self.owner) and ((qc.self.nextthink - qc.time) > 119):
        return

    #  if the player was using his best weapon, change up to the new one if better
    stemp = qc.self
    qc.self = qc.other
    best = weapons.W_BestWeapon()
    qc.self = stemp

    if qc.self.classname == "weapon_nailgun":
        hadammo = qc.other.ammo_nails
        new = defs.IT_NAILGUN
    elif qc.self.classname == "weapon_supernailgun":
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_NAILGUN
    elif qc.self.classname == "weapon_supershotgun":
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_SHOTGUN
    elif qc.self.classname == "weapon_rocketlauncher":
        hadammo = qc.other.ammo_rockets
        new = defs.IT_ROCKET_LAUNCHER
    elif qc.self.classname == "weapon_grenadelauncher":
        hadammo = qc.other.ammo_rockets
        new = defs.IT_GRENADE_LAUNCHER
    elif qc.self.classname == "weapon_lightning":
        hadammo = qc.other.ammo_rockets
        new = defs.IT_LIGHTNING
    else:
        qc.objerror("Team_weapon_touch: unknown classname")

    qc.other.sprint(defs.PRINT_LOW, "You got the ")
    qc.other.sprint(defs.PRINT_LOW, qc.self.netname)
    qc.other.sprint(defs.PRINT_LOW, "\012")
    #  weapon touch sound
    qc.other.sound(defs.CHAN_ITEM, "weapons/pkup.wav", 1, defs.ATTN_NORM)
    qc.other.stuffcmd("bf\012")
    items.bound_other_ammo()
    #  change to the weapon
    old = qc.other.items
    qc.other.items |= new
    qc.self.remove()
    qc.self = qc.other
    if not defs.deathmatch:
        qc.self.weapon = new
    else:
        items.Deathmatch_Weapon(old, new)
    weapons.W_SetCurrentAmmo()
    defs.activator = qc.other
    subs.SUB_UseTargets()  #  fire all targets / killtargets
コード例 #16
0
ファイル: teamplay.py プロジェクト: angeld29/qwpy
def Team_weapon_touch(*qwp_extra):
    if not (qc.other.flags & defs.FL_CLIENT):
        return

    #  Don't let the owner pick up his own weapon for a second.
    if (qc.other == qc.self.owner) and ((qc.self.nextthink - qc.time) > 119):
        return

    #  if the player was using his best weapon, change up to the new one if better
    stemp = qc.self
    qc.self = qc.other
    best = weapons.W_BestWeapon()
    qc.self = stemp

    if qc.self.classname == 'weapon_nailgun':
        hadammo = qc.other.ammo_nails
        new = defs.IT_NAILGUN
    elif qc.self.classname == 'weapon_supernailgun':
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_NAILGUN
    elif qc.self.classname == 'weapon_supershotgun':
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_SHOTGUN
    elif qc.self.classname == 'weapon_rocketlauncher':
        hadammo = qc.other.ammo_rockets
        new = defs.IT_ROCKET_LAUNCHER
    elif qc.self.classname == 'weapon_grenadelauncher':
        hadammo = qc.other.ammo_rockets
        new = defs.IT_GRENADE_LAUNCHER
    elif qc.self.classname == 'weapon_lightning':
        hadammo = qc.other.ammo_rockets
        new = defs.IT_LIGHTNING
    else:
        qc.objerror('Team_weapon_touch: unknown classname')

    qc.other.sprint(defs.PRINT_LOW, 'You got the ')
    qc.other.sprint(defs.PRINT_LOW, qc.self.netname)
    qc.other.sprint(defs.PRINT_LOW, '\012')
    #  weapon touch sound
    qc.other.sound(defs.CHAN_ITEM, 'weapons/pkup.wav', 1, defs.ATTN_NORM)
    qc.other.stuffcmd('bf\012')
    items.bound_other_ammo()
    #  change to the weapon
    old = qc.other.items
    qc.other.items |= new
    qc.self.remove()
    qc.self = qc.other
    if not defs.deathmatch:
        qc.self.weapon = new
    else:
        items.Deathmatch_Weapon(old, new)
    weapons.W_SetCurrentAmmo()
    defs.activator = qc.other
    subs.SUB_UseTargets()  #  fire all targets / killtargets
コード例 #17
0
ファイル: triggers.py プロジェクト: barryp/qwpython
def trigger_teleport(*qwp_extra):
    subs.InitTrigger()
    qc.self.touch = teleport_touch
    #  find the destination 
    if not qc.self.target:
        qc.objerror('no target')
    qc.self.use = teleport_use
    if not (qc.self.spawnflags & SILENT):
        engine.precache_sound('ambience/hum1.wav')
        o = (qc.self.mins + qc.self.maxs) * 0.5
        engine.ambientsound(o, 'ambience/hum1.wav', 0.5, defs.ATTN_STATIC)
コード例 #18
0
ファイル: triggers.py プロジェクト: angeld29/qwpy
def trigger_teleport(*qwp_extra):
    subs.InitTrigger()
    qc.self.touch = teleport_touch
    #  find the destination
    if not qc.self.target:
        qc.objerror('no target')
    qc.self.use = teleport_use
    if not (qc.self.spawnflags & SILENT):
        engine.precache_sound('ambience/hum1.wav')
        o = (qc.self.mins + qc.self.maxs) * 0.5
        engine.ambientsound(o, 'ambience/hum1.wav', 0.5, defs.ATTN_STATIC)
コード例 #19
0
ファイル: plats.py プロジェクト: barryp/qwpython
def train_next(*qwp_extra):
    targ = qc.find(qc.world, 'targetname', qc.self.target)
    qc.self.target = targ.target
    if not qc.self.target:
        qc.objerror('train_next: no next target')
    if targ.wait:
        qc.self.wait = targ.wait
    else:
        qc.self.wait = 0
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise1, 1, defs.ATTN_NORM)
    subs.SUB_CalcMove(targ.origin - qc.self.mins, qc.self.speed, train_wait)
コード例 #20
0
ファイル: triggers.py プロジェクト: angeld29/qwpy
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
コード例 #21
0
ファイル: plats.py プロジェクト: angeld29/qwpython
def train_next(*qwp_extra):
    targ = engine.world
    targ = qc.find(qc.world, 'targetname', qc.self.target)
    qc.self.target = targ.target
    if not qc.self.target:
        qc.objerror('train_next: no next target')
    if targ.wait:
        qc.self.wait = targ.wait
    else:
        qc.self.wait = 0
    qc.self.sound(defs.CHAN_VOICE, qc.self.noise1, 1, defs.ATTN_NORM)
    subs.SUB_CalcMove(targ.origin - qc.self.mins, qc.self.speed, train_wait)
コード例 #22
0
ファイル: triggers.py プロジェクト: barryp/qwpython
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
コード例 #23
0
ファイル: subs.py プロジェクト: angeld29/qwpy
def SUB_CalcAngleMove(destangle, tspeed, func, *qwp_extra):
    if not tspeed:
        qc.objerror('No speed is defined!')
    #  set destdelta to the vector needed to move
    destdelta = destangle - qc.self.angles
    #  calculate length of vector
    len = destdelta.length()
    #  divide by speed to get time to reach dest
    traveltime = len / tspeed
    #  set nextthink to trigger a think when dest is reached
    qc.self.nextthink = qc.self.ltime + traveltime
    #  scale the destdelta vector by the time spent traveling to get velocity
    qc.self.avelocity = destdelta * (1 / traveltime)
    qc.self.think1 = func
    qc.self.finalangle = destangle
    qc.self.think = SUB_CalcAngleMoveDone
コード例 #24
0
ファイル: triggers.py プロジェクト: barryp/qwpython
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
コード例 #25
0
ファイル: triggers.py プロジェクト: angeld29/qwpy
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
コード例 #26
0
def FindIntermission(*qwp_extra):
    spot = engine.world
    cyc = 0
    #  look for info_intermission first
    spot = qc.find(qc.world, 'classname', 'info_intermission')
    if spot:
        #  pick a random one
        cyc = random.random() * 4
        while cyc > 1:
            spot = qc.find(spot, 'classname', 'info_intermission')
            if not spot:
                spot = qc.find(spot, 'classname', 'info_intermission')
            cyc -= 1

        return spot

    #  then look for the start position
    spot = qc.find(qc.world, 'classname', 'info_player_start')
    if spot:
        return spot
    qc.objerror('FindIntermission: no spot')
コード例 #27
0
ファイル: client.py プロジェクト: barryp/qwpython
def FindIntermission(*qwp_extra):
    spot = engine.world
    cyc = 0
    #  look for info_intermission first
    spot = qc.find(qc.world, 'classname', 'info_intermission')
    if spot:
        #  pick a random one
        cyc = random.random() * 4
        while cyc > 1:
            spot = qc.find(spot, 'classname', 'info_intermission')
            if not spot:
                spot = qc.find(spot, 'classname', 'info_intermission')
            cyc -= 1
            
        return spot
        
    #  then look for the start position
    spot = qc.find(qc.world, 'classname', 'info_player_start')
    if spot:
        return spot
    qc.objerror('FindIntermission: no spot')
コード例 #28
0
ファイル: plats.py プロジェクト: angeld29/qwpython
def misc_teleporttrain(*qwp_extra):
    if not qc.self.speed:
        qc.self.speed = 100
    if not qc.self.target:
        qc.objerror('func_train without a target')
    qc.self.cnt = 1
    qc.self.solid = defs.SOLID_NOT
    qc.self.movetype = defs.MOVETYPE_PUSH
    qc.self.blocked = train_blocked
    qc.self.use = train_use
    qc.self.avelocity = Vector(100, 200, 300)
    qc.self.noise = ('misc/null.wav')
    engine.precache_sound('misc/null.wav')
    qc.self.noise1 = ('misc/null.wav')
    engine.precache_sound('misc/null.wav')
    engine.precache_model('progs/teleport.mdl')
    qc.self.setmodel('progs/teleport.mdl')
    qc.setsize(qc.self, qc.self.mins, qc.self.maxs)
    qc.setorigin(qc.self, qc.self.origin)
    #  start trains on the second frame, to make sure their targets have had
    #  a chance to spawn
    qc.self.nextthink = qc.self.ltime + 0.1
    qc.self.think = func_train_find
コード例 #29
0
ファイル: plats.py プロジェクト: barryp/qwpython
def misc_teleporttrain(*qwp_extra):
    if not qc.self.speed:
        qc.self.speed = 100
    if not qc.self.target:
        qc.objerror('func_train without a target')
    qc.self.cnt = 1
    qc.self.solid = defs.SOLID_NOT
    qc.self.movetype = defs.MOVETYPE_PUSH
    qc.self.blocked = train_blocked
    qc.self.use = train_use
    qc.self.avelocity = Vector(100, 200, 300)
    qc.self.noise = ('misc/null.wav')
    engine.precache_sound('misc/null.wav')
    qc.self.noise1 = ('misc/null.wav')
    engine.precache_sound('misc/null.wav')
    engine.precache_model('progs/teleport.mdl')
    qc.self.setmodel('progs/teleport.mdl')
    qc.setsize(qc.self, qc.self.mins, qc.self.maxs)
    qc.setorigin(qc.self, qc.self.origin)
    #  start trains on the second frame, to make sure their targets have had
    #  a chance to spawn
    qc.self.nextthink = qc.self.ltime + 0.1
    qc.self.think = func_train_find
コード例 #30
0
ファイル: items.py プロジェクト: barryp/qwpython
def item_sigil(*qwp_extra):
    if not qc.self.spawnflags:
        qc.objerror('no spawnflags')
    engine.precache_sound('misc/runekey.wav')
    qc.self.noise = 'misc/runekey.wav'
    if qc.self.spawnflags & 1:
        engine.precache_model('progs/end1.mdl')
        qc.self.setmodel('progs/end1.mdl')
        
    if qc.self.spawnflags & 2:
        engine.precache_model('progs/end2.mdl')
        qc.self.setmodel('progs/end2.mdl')
        
    if qc.self.spawnflags & 4:
        engine.precache_model('progs/end3.mdl')
        qc.self.setmodel('progs/end3.mdl')
        
    if qc.self.spawnflags & 8:
        engine.precache_model('progs/end4.mdl')
        qc.self.setmodel('progs/end4.mdl')
        
    qc.self.touch = sigil_touch
    qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32))
    StartItem()
コード例 #31
0
ファイル: items.py プロジェクト: angeld29/qwpy
def item_sigil(*qwp_extra):
    if not qc.self.spawnflags:
        qc.objerror('no spawnflags')
    engine.precache_sound('misc/runekey.wav')
    qc.self.noise = 'misc/runekey.wav'
    if qc.self.spawnflags & 1:
        engine.precache_model('progs/end1.mdl')
        qc.self.setmodel('progs/end1.mdl')
        
    if qc.self.spawnflags & 2:
        engine.precache_model('progs/end2.mdl')
        qc.self.setmodel('progs/end2.mdl')
        
    if qc.self.spawnflags & 4:
        engine.precache_model('progs/end3.mdl')
        qc.self.setmodel('progs/end3.mdl')
        
    if qc.self.spawnflags & 8:
        engine.precache_model('progs/end4.mdl')
        qc.self.setmodel('progs/end4.mdl')
        
    qc.self.touch = sigil_touch
    qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32))
    StartItem()
コード例 #32
0
ファイル: items.py プロジェクト: barryp/qwpython
def weapon_touch(*qwp_extra):
    hadammo = 0
    best = 0
    new = 0
    old = 0
    stemp = engine.world
    leave = 0
    #  For client weapon_switch
    w_switch = 0
    if not (qc.other.flags & defs.FL_CLIENT):
        return 
    if (qc.stof(qc.other.infokey('w_switch'))) == 0:
        w_switch = 8
    else:
        w_switch = qc.stof(qc.other.infokey('w_switch'))
    #  if the player was using his best weapon, change up to the new one if better          
    stemp = qc.self
    qc.self = qc.other
    best = weapons.W_BestWeapon()
    qc.self = stemp
    if defs.deathmatch == 2 or defs.deathmatch == 3 or defs.deathmatch == 5:
        leave = 1
    else:
        leave = 0
    if qc.self.classname == 'weapon_nailgun':
        if leave and (qc.other.items & defs.IT_NAILGUN):
            return 
        hadammo = qc.other.ammo_nails
        new = defs.IT_NAILGUN
        qc.other.ammo_nails += 30
        
    elif qc.self.classname == 'weapon_supernailgun':
        if leave and (qc.other.items & defs.IT_SUPER_NAILGUN):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_NAILGUN
        qc.other.ammo_nails += 30
        
    elif qc.self.classname == 'weapon_supershotgun':
        if leave and (qc.other.items & defs.IT_SUPER_SHOTGUN):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_SHOTGUN
        qc.other.ammo_shells += 5
        
    elif qc.self.classname == 'weapon_rocketlauncher':
        if leave and (qc.other.items & defs.IT_ROCKET_LAUNCHER):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_ROCKET_LAUNCHER
        qc.other.ammo_rockets += 5
        
    elif qc.self.classname == 'weapon_grenadelauncher':
        if leave and (qc.other.items & defs.IT_GRENADE_LAUNCHER):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_GRENADE_LAUNCHER
        qc.other.ammo_rockets += 5
        
    elif qc.self.classname == 'weapon_lightning':
        if leave and (qc.other.items & defs.IT_LIGHTNING):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_LIGHTNING
        qc.other.ammo_cells += 15
        
    else:
        qc.objerror('weapon_touch: unknown classname')
    qc.other.sprint(defs.PRINT_LOW, 'You got the ')
    qc.other.sprint(defs.PRINT_LOW, qc.self.netname)
    qc.other.sprint(defs.PRINT_LOW, '\012')
    #  weapon touch sound
    qc.other.sound(defs.CHAN_ITEM, 'weapons/pkup.wav', 1, defs.ATTN_NORM)
    qc.other.stuffcmd('bf\012')
    bound_other_ammo()
    #  change to the weapon
    old = qc.other.items
    qc.other.items |= new
    stemp = qc.self
    qc.self = qc.other
    if WeaponCode(new) <= w_switch:
        if qc.self.flags & defs.FL_INWATER:
            if new != defs.IT_LIGHTNING:
                Deathmatch_Weapon(old, new)
                
            
        else:
            Deathmatch_Weapon(old, new)
            
        
    weapons.W_SetCurrentAmmo()
    qc.self = stemp
    if leave:
        return 
    if defs.deathmatch != 3 or defs.deathmatch != 5:
        #  remove it in single player, or setup for respawning in deathmatch
        qc.self.model = defs.string_null
        qc.self.solid = defs.SOLID_NOT
        if defs.deathmatch != 2:
            qc.self.nextthink = qc.time + 30
        qc.self.think = SUB_regen
        
    defs.activator = qc.other
    subs.SUB_UseTargets() #  fire all targets / killtargets
コード例 #33
0
ファイル: client.py プロジェクト: barryp/qwpython
def trigger_changelevel(*qwp_extra):
    if not qc.self.map:
        qc.objerror("chagnelevel trigger doesn't have map")
    subs.InitTrigger()
    qc.self.touch = changelevel_touch
コード例 #34
0
ファイル: items.py プロジェクト: angeld29/qwpy
def weapon_touch(*qwp_extra):
    #  For client weapon_switch
    w_switch = 0
    if not (qc.other.flags & defs.FL_CLIENT):
        return 
    if (qc.stof(qc.other.infokey('w_switch'))) == 0:
        w_switch = 8
    else:
        w_switch = qc.stof(qc.other.infokey('w_switch'))
        
    #  if the player was using his best weapon, change up to the new one if better		
    stemp = qc.self
    qc.self = qc.other
    best = weapons.W_BestWeapon()
    qc.self = stemp
    if defs.deathmatch == 2 or defs.deathmatch == 3:
        leave = 1
    else:
        leave = 0
        
    if qc.self.classname == 'weapon_nailgun':
        if leave and (qc.other.items & defs.IT_NAILGUN):
            return 
        hadammo = qc.other.ammo_nails
        new = defs.IT_NAILGUN
        #  *TEAMPLAY*
        qc.other.ammo_nails += 30        
    elif qc.self.classname == 'weapon_supernailgun':
        if leave and (qc.other.items & defs.IT_SUPER_NAILGUN):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_NAILGUN
        #  *TEAMPLAY*
        qc.other.ammo_nails += 30        
    elif qc.self.classname == 'weapon_supershotgun':
        if leave and (qc.other.items & defs.IT_SUPER_SHOTGUN):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_SUPER_SHOTGUN
        #  *TEAMPLAY*
        qc.other.ammo_shells += 5        
    elif qc.self.classname == 'weapon_rocketlauncher':
        if leave and (qc.other.items & defs.IT_ROCKET_LAUNCHER):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_ROCKET_LAUNCHER
        #  *TEAMPLAY*
        qc.other.ammo_rockets += 5        
    elif qc.self.classname == 'weapon_grenadelauncher':
        if leave and (qc.other.items & defs.IT_GRENADE_LAUNCHER):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_GRENADE_LAUNCHER
        #  *TEAMPLAY*
        qc.other.ammo_rockets += 5        
    elif qc.self.classname == 'weapon_lightning':
        if leave and (qc.other.items & defs.IT_LIGHTNING):
            return 
        hadammo = qc.other.ammo_rockets
        new = defs.IT_LIGHTNING
        qc.other.ammo_cells += 15        
    else:
        qc.objerror('weapon_touch: unknown classname')
        
    qc.other.sprint(defs.PRINT_LOW, 'You got the ')
    qc.other.sprint(defs.PRINT_LOW, qc.self.netname)
    qc.other.sprint(defs.PRINT_LOW, '\012')
    #  weapon touch sound
    qc.other.sound(defs.CHAN_ITEM, 'weapons/pkup.wav', 1, defs.ATTN_NORM)
    qc.other.stuffcmd('bf\012')
    bound_other_ammo()
    #  change to the weapon
    old = qc.other.items
    qc.other.items |= new
    stemp = qc.self
    qc.self = qc.other
    prevweapon = qc.self.weapon
    if WeaponCode(new) <= w_switch:
        if qc.self.flags & defs.FL_INWATER:
            if new != defs.IT_LIGHTNING:
                Deathmatch_Weapon(old, new)            
        else:
            Deathmatch_Weapon(old, new)
        
    if qc.self.weapon != prevweapon:
        qc.self.previous_weapon = prevweapon
    weapons.W_SetCurrentAmmo()
    qc.self = stemp
    if leave:
        return 
    #  remove it in single player, or setup for respawning in deathmatch
    qc.self.model = defs.string_null
    qc.self.solid = defs.SOLID_NOT
    if defs.deathmatch == 1 or defs.deathmatch == 3:
        qc.self.nextthink = qc.time + 30
    qc.self.think = SUB_regen
    defs.activator = qc.other
    subs.SUB_UseTargets() #  fire all targets / killtargets
コード例 #35
0
def trigger_changelevel(*qwp_extra):
    if not qc.self.map:
        qc.objerror("chagnelevel trigger doesn't have map")
    subs.InitTrigger()
    qc.self.touch = changelevel_touch
コード例 #36
0
ファイル: plats.py プロジェクト: angeld29/qwpython
def plat_use(*qwp_extra):
    qc.self.use = subs.SUB_Null
    if qc.self.state != defs.STATE_UP:
        qc.objerror('plat_use: not in up state')
    plat_go_down()
コード例 #37
0
def movetarget_f(*qwp_extra):
    if not qc.self.targetname:
        qc.objerror('monster_movetarget: no targetname')
    qc.self.solid = defs.SOLID_TRIGGER
    qc.self.touch = t_movetarget
    qc.setsize(qc.self, Vector(-8, -8, -8), Vector(8, 8, 8))
コード例 #38
0
ファイル: plats.py プロジェクト: barryp/qwpython
def plat_use(*qwp_extra):
    qc.self.use = subs.SUB_Null
    if qc.self.state != defs.STATE_UP:
        qc.objerror('plat_use: not in up state')
    plat_go_down()