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 |
class BaseInfo extends Engine.Info native placeable; enum enumBaseType { BaseType_Primary, BaseType_Secondary, BaseType_Mobile }; var() editdisplay(displayActorLabel) editcombotype(enumTeamInfo) TeamInfo team "The team that the base belongs to"; var() enumBaseType baseType "The base type for this base"; var() localized string description "A short description for this base which gets displayed when players respawn"; var() editdisplay(displayActorLabel) editcombotype(enumSpawnArray) SpawnArray spawnArray "A spawn array that is associated with this base"; var Vector SpawnArrayLocation; var() editdisplay(displayActorLabel) editcombotype(enumContainer) MPCarryableContainer container "An optional carryable container that is associated with this base. Carryables are withdrawn and given to the player when spawning at the base"; var Array<BaseDevice> devices; // list of devices owned by the base var Array<PowerGenerator> generators; // list of power generators (subset of 'devices') var Array<PlayerStart> playerStarts; // list of player starts var Array<PowerIndicator> powerIndicators; // list of power indicators var bool bValidRespawnBase; var private TeamInfo m_oldTeam; var private bool m_bPowered; // Whether the base is powered or not replication { reliable if(Role == ROLE_Authority) Team, SpawnArrayLocation; } // Intialize is called by GameInfo after object filtering occurs function Initialize() { local BaseDevice d; local PlayerStart start; local PowerIndicator pi; // build list of devices and power generators ForEach DynamicActors(class'BaseDevice', d) { if (d.ownerBase == self) { devices[devices.Length] = d; if (PowerGenerator(d) != None) { generators[generators.Length] = PowerGenerator(d); } } } // build an array of player starts ForEach DynamicActors(class'PlayerStart', start) { if(start.baseInfo == self) playerStarts[playerStarts.Length] = start; } // build an array of power indicators ForEach DynamicActors(class'PowerIndicator', pi) { if(pi.ownerBase == self) powerIndicators[powerIndicators.Length] = pi; } // check that this base has at least one player start // associated with it so it can be a valid spawn base bValidRespawnBase = (playerStarts.Length > 0); onTeamChanged(); m_oldTeam = team; SpawnArrayLocation = spawnArray.Location; checkForPower(); } // Tick function Tick(float Delta) { // check for changed team if (team != m_oldTeam) { onTeamChanged(); m_oldTeam = team; } // check for power outage or restoration checkForPower(); } // onTeamChanged // Switches the base and all its equipment to the new team // Achieved publicly by setting the 'team' variable private function onTeamChanged() { local int i; // add the base to the new teamInfo base array, & remove // it from the old one if (m_oldTeam != None) m_oldTeam.RemoveBase(self); team.AddBase(self); // set teams of base devices and power generators for (i = 0; i < devices.Length; i++) { devices[i].setTeam(team); } for(i = 0; i < playerStarts.Length; ++i) playerStarts[i].team = team; } // checkForPower // Check the conditions for the base being powered or unpowered, and adjust the state of the // base objects accordingly. function checkForPower() { local int i; local bool bHasActiveGenerators; for (i = 0; i < generators.Length; i++) { if (generators[i] != None && generators[i].IsInState('Active')) { bHasActiveGenerators = true; break; } } if (m_bPowered) { // if powered, check for power loss if (!bHasActiveGenerators) setPowered(false); } else { if (bHasActiveGenerators) setPowered(true); } } // setPowered // Disable or enable base objects according to the powered state function setPowered(bool bPowered) { local int i; // set state of base devices for (i = 0; i < devices.Length; i++) { devices[i].setHasPower(bPowered); } for (i = 0; i < powerIndicators.Length; ++i) { powerIndicators[i].setPower(bPowered); } m_bPowered = bPowered; } // isPowered function bool isPowered() { return m_bPowered; } // enumTeamInfo function enumTeamInfo(Engine.LevelInfo l, out Array<TeamInfo> s) { local TeamInfo t; ForEach l.AllActors(class'TeamInfo', t) { s[s.Length] = t; } } // enumSpawnArray function enumSpawnArray(Engine.LevelInfo l, out Array<SpawnArray> s) { local SpawnArray sa; ForEach l.AllActors(class'SpawnArray', sa) { s[s.Length] = sa; } } // displayActorLabel function string displayActorLabel(Actor t) { return string(t.label); } function enumContainer(Engine.LevelInfo l, Array<MPCarryableContainer> a) { local MPCarryableContainer c; ForEach DynamicActors(class'MPCarryableContainer', c) { if (team == c.team()) a[a.length] = c; } } defaultproperties { RemoteRole = ROLE_SimulatedProxy bHiddenEd = true bAlwaysRelevant = true baseType = BaseType_Primary bValidRespawnBase = false } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |