var bool bQuickFire; // was this quickfired var bool ActuallyFiring; // hax var array MyBombs; // all the bombs I have in play var() DukeWeaponPipebombDetonator DetonatorTemplate; // Detonator to use var rotator BombRotation; simulated function vector GetPhysicalFireStartLoc(optional vector AimDir) { local vector v; SkeletalMeshComponent(Mesh).GetSocketWorldLocationAndRotation('BombSocket', v, BombRotation); return v; } simulated state WeaponFiring { simulated event BeginState( Name PreviousStateName ) { `LogInv("PreviousStateName:" @ PreviousStateName); // Fire the first shot right away FireAmmunition(); TimeWeaponFiring( CurrentFireMode ); } } // called from AnimNotify_Script!! simulated function SwitchWeapon() { if(//!bQuickFire && AIController(Pawn(Owner).Controller) == None) { DukeWeaponPipeBombDetonator(DukePawn(Owner).InvManager.FindInventoryType(class'DukeWeaponPipebombDetonator')).QuickFired = bQuickFire; DukeInventoryManager(DukePawn(Owner).InvManager).SwitchWeapon(WeaponGroup); } //else { bQuickFire = False; //} } simulated function ActualProjectileFire() { ActuallyFiring = True; ProjectileFire(); } simulated function Projectile ProjectileFire() { local vector RealStartLoc; local Projectile SpawnedProjectile; // tell remote clients that we fired, to trigger effects if(!ActuallyFiring) IncrementFlashCount(); if( Role == ROLE_Authority && ActuallyFiring) { // this is the location where the projectile is spawned. RealStartLoc = GetPhysicalFireStartLoc(); // Spawn projectile SpawnedProjectile = Spawn(GetProjectileClass(),,, RealStartLoc, BombRotation, GetProjectileTemplate()); if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe ) { SpawnedProjectile.Init( Vector(GetAdjustedAim( RealStartLoc )) ); } if(SpawnedProjectile != None) MyBombs.AddItem(DukeProjectilePipeBomb(SpawnedProjectile)); } ActuallyFiring = False; return SpawnedProjectile; } function GivenTo(Pawn thisPawn, optional bool bDoNotActivate) { super.GivenTo(thisPawn, bDoNotActivate); DukeInventoryManager(DukePawn(Owner).InvManager).CreateWeaponFromArchetype(DetonatorTemplate, True); // TODO: WILL THIS CREATE MULTIPLE DETONATORS?! //DukeInventoryManager(DukePawn(Owner).InvManager).CreateInventory(class'DukeWeaponPipebombDetonator'); } function DetonateBombs() { local DukeProjectilePipebomb p; foreach MyBombs(p) { p.Explode(p.Location, vect(0,0,0)); } MyBombs.Length = 0; } simulated function PlayWeaponAnimation(name Sequence, float duration, optional bool bLoop, optional SkeletalMeshComponent skel) { `Entry(Sequence@duration@bLoop@skel); `log(GetWeaponAnimNodeSeq()); super.PlayWeaponAnimation(Sequence, duration, bloop, skel); } simulated function AnimNodeSequence PlayWeaponAnimationex(name seq, optional float duration, optional bool bLoop, optional SkeletalMeshComponent skel) { `Entry(Seq@duration@bLoop@skel); return super.PlayWeaponAnimationEx(Seq, duration, bloop, skel); } simulated state Active { simulated event BeginState(name PreviousStateName) { super.BeginState(PreviousStateName); if(AmmoInWeapon == 0) DoReload(); if(bQuickFire) StartFire(0); } } simulated function float GetEquipTime() { return bQuickFire ? 0.01 : super.GetEquipTime(); } simulated function PlayWeaponEquip() { if(!bQuickFire) super.PlayWeaponEquip(); } DefaultProperties { AmmoPerReload=1 AmmoInWeapon=1 AmmoCapacity=50 InventoryGroup=6 WeaponGroup=6 GroupWeight=10 NoReloading=True }