Mostly Harmless
UE2:Weapon (UT2004)
From Unreal Wiki, The Unreal Engine Documentation Site
- Package:
- Engine
- Direct subclasses:
- AssaultRifle, BallLauncher, BioRifle, ClassicSniperRifle, ONSMineLayer, FlakCannon, Redeemer, LinkGun, Minigun, ONSAVRiL, ONSGrenadeLauncher, Painter, Weapon_Turret_Minigun, RocketLauncher, ShieldGun, ShockRifle, SniperRifle, TransLauncher, Weapon_Sentinel, Weapon_SpaceFighter, Weapon_Turret, Weapon_Turret_IonCannon
- Known custom subclass:
- ReloadableWeaponBase
- This class in other games:
- RTNP, U1, UT, UE2Runtime, U2XMP, U2, UT2003, UT3, UDK
Abstract base class for all kinds of weapons.
Constants[edit]
NUM_FIRE_MODES[edit]
Value: 2
Array size for various fire mode variables.
Properties[edit]
See Weapon properties.
Enums[edit]
EWeaponClientState[edit]
- WS_None
- WS_Hidden
- WS_BringUp
- WS_PutDown
- WS_ReadyToFire
Functions[edit]
Native functions[edit]
InitWeaponFires[edit]
native final function InitWeaponFires ()
Other native code[edit]
Weapon firing updates[edit]
void AWeapon::TickAuthoritative( FLOAT DeltaSeconds ) { guardSlow(AWeapon::TickAuthoritative); AActor::TickAuthoritative( DeltaSeconds ); if( bDeleteMe ) return; if ( Instigator && Instigator->Weapon == this && !Instigator->bDeleteMe && Instigator->Controller != NULL && !Instigator->Controller->bDeleteMe && !Instigator->bNoWeaponFiring ) { eventWeaponTick(DeltaSeconds); // client & server: update mode timing for (INT mode=0; mode<UCONST_NUM_FIRE_MODES; mode++ ) { if (FireMode[mode] != NULL) { FireMode[mode]->ModeTick( DeltaSeconds ); if (!Instigator || !Instigator->Controller) // pawn was killed during mode tick (ie: shieldgun against the wall) return; if (Role == ROLE_Authority) { if (FireMode[mode]->bServerDelayStartFire) { if (FireMode[mode]->NextFireTime <= Level->TimeSeconds + FireMode[mode]->PreFireTime) eventServerStartFire(mode); } else if (FireMode[mode]->bServerDelayStopFire) { FireMode[mode]->bServerDelayStopFire = false; //debugf(TEXT("ServerDelayStopFire %f"), Level->TimeSeconds); eventStopFire(mode); } } } } // client side only: determine when firing starts and stops if ( Instigator->IsLocallyControlled() && !bEndOfRound ) { if ( (ClientState == WS_None) || (ClientState == WS_Hidden) ) { debugf(TEXT("%s ClientState was WRONG! (%d)"),GetName(),ClientState); ClientState = WS_ReadyToFire; } if ( ClientState == WS_ReadyToFire ) { UBOOL bAltFire = Instigator->Controller->bAltFire; UBOOL bFire = Instigator->Controller->bFire; AWeapon *MyDefault = Cast<AWeapon>(GetClass()->GetDefaultActor()); if ( MyDefault && MyDefault->ExchangeFireModes ) { Exchange(bFire,bAltFire); } if (FireMode[0] != NULL) { if (FireMode[0]->bIsFiring && !bFire) { eventClientStopFire(0); } else if (!FireMode[0]->bIsFiring && bFire) { eventClientStartFire(0); } } if (FireMode[1] != NULL) { if (FireMode[1]->bIsFiring && !bAltFire) { eventClientStopFire(1); } else if (!FireMode[1]->bIsFiring && bAltFire) { eventClientStartFire(1); } } } else if ( TimerRate<=0.f ) { debugf(TEXT("%s no timer running with clientstate %d"),GetName(),ClientState); TimerRate = 0.3f; } } } unguardSlow; }
Events[edit]
AnimEnd[edit]
simulated event AnimEnd (int channel)
Overrides: Actor.AnimEnd
ClientStartFire[edit]
simulated event ClientStartFire (int Mode)
ClientStopFire[edit]
simulated event ClientStopFire (int Mode)
Destroyed[edit]
simulated event Destroyed ()
Overrides: Inventory.Destroyed
PostBeginPlay[edit]
simulated event PostBeginPlay ()
Overrides: Actor.PostBeginPlay
PostNetReceive[edit]
simulated event PostNetReceive ()
Overrides: Actor.PostNetReceive
RenderOverlays[edit]
simulated event RenderOverlays (Canvas Canvas)
Overrides: Inventory.RenderOverlays
ServerStartFire[edit]
event ServerStartFire (byte Mode)
StopFire[edit]
simulated event StopFire (int Mode)
Timer[edit]
simulated event Timer ()
Overrides: Actor.Timer
WeaponTick[edit]
simulated event WeaponTick (float dt)
Other instance functions[edit]
See Weapon instance functions.
States[edit]
Hidden[edit]
PendingClientWeaponSet[edit]
PendingClientWeaponSet.BeginState[edit]
simulated event BeginState ()
Overrides: Object.BeginState (global)
PendingClientWeaponSet.EndState[edit]
simulated event EndState ()
Overrides: Object.EndState (global)
PendingClientWeaponSet.Timer[edit]
simulated event Timer ()
Overrides: Timer (global)