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 |
//============================================================================= // ROAmmoPickup //============================================================================= // Base class for all Red Orchestra weapon ammunition pickups //============================================================================= // Red Orchestra Source // Copyright (C) 2005 Tripwire Interactive LLC // - John "Ramm-Jaeger" Gibson //============================================================================= class ROAmmoPickup extends Ammo abstract; // TODO: Probably want to add notplaceable here when we are done debugging var class<LocalMessage> TouchMessageClass; // Message class for picking up this pickup var() localized string TouchMessage; // Human readable description when touched up. var float LastNotifyTime; // Last time someone selected this pickup var() float DropLifeTime; // How long the pickup will hang around for after being dropped var bool bAmmoPickupIsWeapon;// This ammo pickup give the weapon if the user doesnt have it. used for things like nades and panzerfausts // Testing, don't want bots to stand around and stare at pickups - Ramm // TODO: Implement this properly. Bots should try and pickup ammo if they are low or out function float BotDesireability(Pawn Bot) { local Inventory inv; local Weapon W; local float Desire; local Ammunition M; // Ramm - Test return 0; if ( Bot.Controller.bHuntPlayer ) return 0; for ( Inv=Bot.Inventory; Inv!=None; Inv=Inv.Inventory ) { W = Weapon(Inv); if ( W != None ) { Desire = W.DesireAmmo(InventoryType, false); if ( Desire != 0 ) return Desire * MaxDesireability; } } M = Ammunition(Bot.FindInventoryType(InventoryType)); if ( (M != None) && (M.AmmoAmount >= M.MaxAmmo) ) return -1; return 0.25 * MaxDesireability; } // Let the player know they can pick this up simulated event NotifySelected( Pawn user ) { if( user.IsHumanControlled() && (( Level.TimeSeconds - LastNotifyTime ) >= TouchMessageClass.default.LifeTime)) { PlayerController(User.Controller).ReceiveLocalizedMessage(TouchMessageClass,1,,,self.class); LastNotifyTime = Level.TimeSeconds; } } static function string GetLocalString( optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2 ) { switch(Switch) { case 0: return Default.PickupMessage; case 1: return default.TouchMessage; } } function InitDroppedPickupFor(Inventory Inv) { SetPhysics(PHYS_Falling); GotoState('FallingPickup'); Inventory = Inv; bAlwaysRelevant = false; bOnlyReplicateHidden = false; bUpdateSimulatedPosition = true; bDropped = true; LifeSpan = DropLifeTime + rand(10); bIgnoreEncroachers = false; // handles case of dropping stuff on lifts etc NetUpdateFrequency = 8; } state FallingPickup { ignores Touch; function CheckTouching() { } function Timer() { GotoState('FadeOut'); } function BeginState() { SetTimer(8, false); } } auto state Pickup { function bool ReadyToPickup(float MaxWait) { return true; } /* ValidTouch() Validate touch (if valid return true to let other pick me up and trigger event). */ function bool ValidTouch( actor Other ) { // make sure its a live player if ( (Pawn(Other) == None) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).Health <= 0) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None)) return false; if( ROPawn(Other) != none && ROPawn(Other).AutoTraceActor != none && ROPawn(Other).AutoTraceActor == self ) { // do nothing } // make sure not touching through wall else if ( !FastTrace(Other.Location, Location) ) return false; // make sure game will let player pick me up if( Level.Game.PickupQuery(Pawn(Other), self) ) { TriggerEvent(Event, self, Pawn(Other)); return true; } return false; } // When touched by an actor. function Touch( actor Other ) { } function CheckTouching() { } function UsedBy( Pawn user ) { local Inventory Copy; if( user == none ) return; // valid touch will pickup the object if( ValidTouch( user ) ) { Copy = SpawnCopy(user); AnnouncePickup(user); if ( Copy != None ) Copy.PickupFunction(user); Destroy(); } } function Timer() { if ( bDropped ) GotoState('FadeOut'); } function BeginState() { UntriggerEvent(Event, self, None); if ( bDropped ) { AddToNavigation(); SetTimer(DropLifeTime, false); } } function EndState() { if ( bDropped ) RemoveFromNavigation(); } Begin: CheckTouching(); } // Overrides the UT fadeout since we don't want our pickups to spin and disappear state FadeOut { function Tick(float DeltaTime) { SetDrawScale(FMax(0.01, DrawScale - Default.DrawScale * DeltaTime)); } // Overriden so this item won't get picked up automatically if it is touching someone when it fades out function Touch( actor Other ){} function CheckTouching(){} function BeginState() { LifeSpan = 1.0; } function EndState() { LifeSpan = 0.0; SetDrawScale(Default.DrawScale); } } //==================================================================== // Reset(UT) - Destroy any remaining pickups when the round restarts //==================================================================== function Reset() { Destroy(); } defaultproperties { TouchMessageClass=Class'ROEngine.ROTouchMessagePlus' DropLifeTime=45.000000 bCanAutoTraceSelect=True bAutoTraceNotify=True } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |