Overview | Package | Class | Source | Class tree | Glossary | Deus Ex 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 |
//============================================================================= // AugDefense. //============================================================================= class AugDefense extends Augmentation; var float mpAugValue; var float mpEnergyDrain; var bool bDefenseActive; var float defenseSoundTime; const defenseSoundDelay = 2; // ---------------------------------------------------------------------------- // Networking Replication // ---------------------------------------------------------------------------- replication { //server to client variable propagation. reliable if (Role == ROLE_Authority) bDefenseActive; //server to client function call reliable if (Role == ROLE_Authority) TriggerDefenseAugHUD, SetDefenseAugStatus; } state Active { function Timer() { local DeusExProjectile minproj; local float mindist; minproj = None; // DEUS_EX AMSD Multiplayer check if (Player == None) { SetTimer(0.1,False); return; } // In multiplayer propagate a sound that will let others know their in an aggressive defense field // with range slightly greater than the current level value of the aug if ( (Level.NetMode != NM_Standalone) && ( Level.Timeseconds > defenseSoundTime )) { Player.PlaySound(Sound'AugDefenseOn', SLOT_Interact, 1.0, ,(LevelValues[CurrentLevel]*1.33), 0.75); defenseSoundTime = Level.Timeseconds + defenseSoundDelay; } //DEUS_EX AMSD Exported to function call for duplication in multiplayer. minproj = FindNearestProjectile(); // if we have a valid projectile, send it to the aug display window if (minproj != None) { bDefenseActive = True; mindist = VSize(Player.Location - minproj.Location); // DEUS_EX AMSD In multiplayer, let the client turn his HUD on here. // In singleplayer, turn it on normally. if (Level.Netmode != NM_Standalone) TriggerDefenseAugHUD(); else { SetDefenseAugStatus(True,CurrentLevel,minproj); } // play a warning sound Player.PlaySound(sound'GEPGunLock', SLOT_None,,,, 2.0); if (mindist < LevelValues[CurrentLevel]) { minproj.bAggressiveExploded=True; minproj.Explode(minproj.Location, vect(0,0,1)); Player.PlaySound(sound'ProdFire', SLOT_None,,,, 2.0); } } else { if ((Level.NetMode == NM_Standalone) || (bDefenseActive)) SetDefenseAugStatus(False,CurrentLevel,None); bDefenseActive = false; } } Begin: SetTimer(0.1, True); } function Deactivate() { Super.Deactivate(); SetTimer(0.1, False); SetDefenseAugStatus(False,CurrentLevel,None); } // ------------------------------------------------------------------------------ // FindNearestProjectile() // DEUS_EX AMSD Exported to a function since it also needs to exist in the client // TriggerDefenseAugHUD; // ------------------------------------------------------------------------------ simulated function DeusExProjectile FindNearestProjectile() { local DeusExProjectile proj, minproj; local float dist, mindist; local bool bValidProj; minproj = None; mindist = 999999; foreach AllActors(class'DeusExProjectile', proj) { if (Level.NetMode != NM_Standalone) bValidProj = !proj.bIgnoresNanoDefense; else bValidProj = (!proj.IsA('Cloud') && !proj.IsA('Tracer') && !proj.IsA('GreaselSpit') && !proj.IsA('GraySpit')); if (bValidProj) { // make sure we don't own it if (proj.Owner != Player) { // MBCODE : If team game, don't blow up teammates projectiles if (!((TeamDMGame(Player.DXGame) != None) && (TeamDMGame(Player.DXGame).ArePlayersAllied(DeusExPlayer(proj.Owner),Player)))) { // make sure it's moving fast enough if (VSize(proj.Velocity) > 100) { dist = VSize(Player.Location - proj.Location); if (dist < mindist) { mindist = dist; minproj = proj; } } } } } } return minproj; } // ------------------------------------------------------------------------------ // TriggerDefenseAugHUD() // ------------------------------------------------------------------------------ simulated function TriggerDefenseAugHUD() { local DeusExProjectile minproj; minproj = None; minproj = FindNearestProjectile(); // if we have a valid projectile, send it to the aug display window // That's all we do. if (minproj != None) { SetDefenseAugStatus(True,CurrentLevel,minproj); } } simulated function Tick(float DeltaTime) { Super.Tick(DeltaTime); // DEUS_EX AMSD Make sure it gets turned off in multiplayer. if (Level.NetMode == NM_Client) { if (!bDefenseActive) SetDefenseAugStatus(False,CurrentLevel,None); } } // ------------------------------------------------------------------------------ // SetDefenseAugStatus() // ------------------------------------------------------------------------------ simulated function SetDefenseAugStatus(bool bDefenseActive, int defenseLevel, DeusExProjectile defenseTarget) { if (Player == None) return; if (Player.rootWindow == None) return; DeusExRootWindow(Player.rootWindow).hud.augDisplay.bDefenseActive = bDefenseActive; DeusExRootWindow(Player.rootWindow).hud.augDisplay.defenseLevel = defenseLevel; DeusExRootWindow(Player.rootWindow).hud.augDisplay.defenseTarget = defenseTarget; } simulated function PreBeginPlay() { Super.PreBeginPlay(); // If this is a netgame, then override defaults if ( Level.NetMode != NM_StandAlone ) { LevelValues[3] = mpAugValue; EnergyRate = mpEnergyDrain; defenseSoundTime=0; } } defaultproperties { mpAugValue=500.000000 mpEnergyDrain=35.000000 EnergyRate=10.000000 Icon=Texture'DeusExUI.UserInterface.AugIconDefense' smallIcon=Texture'DeusExUI.UserInterface.AugIconDefense_Small' AugmentationName="Aggressive Defense System" Description="Aerosol nanoparticles are released upon the detection of objects fitting the electromagnetic threat profile of missiles and grenades; these nanoparticles will prematurely detonate such objects prior to reaching the agent.|n|nTECH ONE: The range at which incoming rockets and grenades are detonated is short.|n|nTECH TWO: The range at which detonation occurs is increased slightly.|n|nTECH THREE: The range at which detonation occurs is increased moderately.|n|nTECH FOUR: Rockets and grenades are detonated almost before they are fired." MPInfo="When active, enemy rockets detonate when they get close, doing reduced damage. Some large rockets may still be close enough to do damage when they explode. Energy Drain: Low" LevelValues(0)=160.000000 LevelValues(1)=320.000000 LevelValues(2)=480.000000 LevelValues(3)=800.000000 MPConflictSlot=7 } |
Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |