Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 |
//============================================================================= // Minigun //============================================================================= class Minigun extends Weapon config(user); #EXEC OBJ LOAD FILE=InterfaceContent.utx var float CurrentRoll; var float RollSpeed; //var float FireTime; var() xEmitter ShellCaseEmitter; var() vector AttachLoc; var() rotator AttachRot; var int CurrentMode; var() float GearRatio; var() float GearOffset; var() float Blend; simulated function PostBeginPlay() { Super.PostBeginPlay(); if ( Level.NetMode == NM_DedicatedServer ) return; ShellCaseEmitter = spawn(class'ShellSpewer'); if ( ShellCaseEmitter != None ) { ShellCaseEmitter.Trigger(Self, Instigator); //turn off AttachToBone(ShellCaseEmitter, 'shell'); } } function DropFrom(vector StartLocation) { Super.DropFrom(StartLocation); } simulated function OutOfAmmo() { if ( (Instigator == None) || !Instigator.IsLocallyControlled() || HasAmmo() ) return; Instigator.AmbientSound = None; Instigator.SoundVolume = Instigator.default.SoundVolume; DoAutoSwitch(); } simulated function Destroyed() { if (ShellCaseEmitter != None) { ShellCaseEmitter.Destroy(); ShellCaseEmitter = None; } Super.Destroyed(); } /* BotFire() called by NPC firing weapon. Weapon chooses appropriate firing Mode to use (typically no change) bFinished should only be true if called from the Finished() function FiringMode can be passed in to specify a firing Mode (used by scripted sequences) */ function bool BotFire(bool bFinished, optional name FiringMode) { local int newmode; local Controller C; C = Instigator.Controller; newMode = BestMode(); if ( newMode == 0 ) { C.bFire = 1; C.bAltFire = 0; } else { C.bFire = 0; C.bAltFire = 1; } if ( bFinished ) return true; if ( FireMode[BotMode].bIsFiring && (NewMode != BotMode) ) StopFire(BotMode); if ( !ReadyToFire(newMode) || ClientState != WS_ReadyToFire ) return false; BotMode = NewMode; StartFire(NewMode); return true; } // AI Interface function float GetAIRating() { local Bot B; B = Bot(Instigator.Controller); if ( B == None ) return AIRating; if ( B.Enemy == None ) { if ( (B.Target != None) && VSize(B.Target.Location - B.Pawn.Location) > 8000 ) return 0.5; return AIRating; } if ( !B.EnemyVisible() ) return AIRating - 0.15; return AIRating * FMin(Pawn(Owner).DamageScaling, 1.5); } /* BestMode() choose between regular or alt-fire */ function byte BestMode() { local float EnemyDist; local bot B; B = Bot(Instigator.Controller); if ( (B == None) || (B.Enemy == None) ) return 0; if ( FireMode[0].bIsFiring ) return 0; else if ( FireMode[1].bIsFiring ) return 1; EnemyDist = VSize(B.Enemy.Location - Instigator.Location); if ( EnemyDist < 2000 ) return 0; return 1; } // end AI Interface simulated function SpawnShells(float amountPerSec) { if(ShellCaseEmitter == None || !FirstPersonView()) return; if ( Bot(Instigator.Controller) != None ) { ShellCaseEmitter.Destroy(); return; } ShellCaseEmitter.mRegenRange[0] = amountPerSec; ShellCaseEmitter.mRegenRange[1] = amountPerSec; ShellCaseEmitter.Trigger(self, Instigator); } simulated function bool FirstPersonView() { return (Instigator.IsLocallyControlled() && (PlayerController(Instigator.Controller) != None) && !PlayerController(Instigator.Controller).bBehindView); } // Prevents wrong anims from playing simulated function AnimEnd(int channel) { } // Client-side only: update the first person barrel rotation simulated function UpdateRoll(float dt, float speed, int mode) { local rotator r; if (Level.NetMode == NM_DedicatedServer) return; if (mode == CurrentMode) // to limit to one mode { // log(self$" updateroll (mode="$mode$") speed="$speed); RollSpeed = speed; CurrentRoll += dt*RollSpeed; CurrentRoll = CurrentRoll % 65536.f; r.Roll = int(CurrentRoll); SetBoneRotation('Bone Barrels', r, 0, Blend); r.Roll = GearOffset + r.Roll*GearRatio; SetBoneRotation('Bone gear', r, 0, Blend); } } simulated function bool StartFire(int mode) { local bool bStart; if ( !MinigunFire(FireMode[0]).IsIdle() || !MinigunFire(FireMode[1]).IsIdle() ) return false; bStart = Super.StartFire(mode); if (bStart) FireMode[mode].StartFiring(); return bStart; } // Allow fire modes to return to idle on weapon switch (server) simulated function DetachFromPawn(Pawn P) { //log(self$" detach from pawn p="$p); ReturnToIdle(); Super.DetachFromPawn(P); } // Allow fire modes to return to idle on weapon switch (client) simulated function bool PutDown() { // log(self$" putdown"); ReturnToIdle(); return Super.PutDown(); } simulated function ReturnToIdle() { local int mode; for (mode=0; mode<NUM_FIRE_MODES; mode++) { if (FireMode[mode] != None) { FireMode[mode].GotoState('Idle'); } } } defaultproperties { HighDetailOverlay=Material'UT2004Weapons.WeaponSpecMap2' ItemName="Minigun" Description="The Schultz-Metzger T23-A 23mm rotary cannon is capable of firing both high-velocity caseless ammunition and cased rounds. With an unloaded weight of only 8 kilograms, the T23 is portable and maneuverable, easily worn across the back when employing the optional carrying strap.|The T23-A is the rotary cannon of choice for the discerning soldier." IconMaterial=Material'HudContent.Generic.HUD' IconCoords=(X1=246,Y1=80,X2=332,Y2=106) Blend=1.f GearRatio=-2.37 GearOffset=0.0 AttachLoc=(X=-77,Y=6,Z=4) AttachRot=(Pitch=22000,Roll=0,Yaw=-16384) FireModeClass(0)=MinigunFire FireModeClass(1)=MinigunAltFire InventoryGroup=6 Mesh=mesh'Weapons.Minigun_1st' BobDamping=2.25 PickupClass=class'MinigunPickup' EffectOffset=(X=100.0,Y=18.0,Z=-16.0) DisplayFOV=60 PutDownAnim=PutDown DrawScale=0.4 PlayerViewOffset=(X=2,Y=-1,Z=0) SmallViewOffset=(X=8,Y=1,Z=-2) PlayerViewPivot=(Pitch=0,Roll=0,Yaw=500) AttachmentClass=class'MinigunAttachment' SoundRadius=400.0 SelectSound=Sound'WeaponSounds.Minigun.SwitchToMinigun' SelectForce="SwitchToMiniGun" AIRating=+0.71 CurrentRating=+0.71 bDynamicLight=false LightType=LT_Pulse LightEffect=LE_NonIncidence LightPeriod=3 LightBrightness=255 LightHue=30 LightSaturation=150 LightRadius=5.0 HudColor=(r=255,g=255,b=255,a=255) CustomCrosshair=12 CustomCrosshairTextureName="Crosshairs.Hud.Crosshair_Circle1" CustomCrosshairColor=(r=255,g=255,b=255,a=255) Priority=9 CenteredOffsetY=-6.0 CenteredYaw=-500 CenteredRoll=0 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |