text stringlengths 1 2.32k |
|---|
this.endTimer = 0f; |
this.requireKill.Clear(); |
this.requireRescue.Clear(); |
this.items.Clear(); |
Submarine submarine = Submarine.Loaded.Find((Submarine s) => s.Info.Type == SubmarineType.Outpost) ?? Submarine.MainSub; |
this.InitItems(submarine); |
if (!Mission.IsClient) |
{ |
base.InitCharacters(submarine); |
} |
this.wasDocked = Submarine.MainSub.DockedTo.Contains(Level.Loaded.StartOutpost); |
} |
// Token: 0x06000B0F RID: 2831 RVA: 0x0006706C File Offset: 0x0006526C |
private void InitItems(Submarine submarine) |
{ |
if (!this.itemTag.IsEmpty) |
{ |
List<Item> list = Item.ItemList.FindAll(delegate(Item it) |
{ |
Submarine submarine2 = it.Submarine; |
return (submarine2 == null || submarine2.Info.Type > SubmarineType.Player) && it.HasTag(this.itemTag); |
}); |
if (!list.Any<Item>()) |
{ |
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(60, 2); |
defaultInterpolatedStringHandler.AppendLiteral("Error in mission \""); |
defaultInterpolatedStringHandler.AppendFormatted<Identifier>(this.Prefab.Identifier); |
defaultInterpolatedStringHandler.AppendLiteral("\". Could not find an item with the tag \""); |
defaultInterpolatedStringHandler.AppendFormatted<Identifier>(this.itemTag); |
defaultInterpolatedStringHandler.AppendLiteral("\"."); |
DebugConsole.ThrowError(defaultInterpolatedStringHandler.ToStringAndClear(), null, this.Prefab.ContentPackage, false, false); |
} |
else |
{ |
this.items.AddRange(list); |
} |
} |
if (this.itemConfig != null && !Mission.IsClient) |
{ |
foreach (XElement element in this.itemConfig.Elements()) |
{ |
Identifier attributeIdentifier = element.GetAttributeIdentifier("identifier", Identifier.Empty); |
ItemPrefab itemPrefab = MapEntityPrefab.FindByIdentifier(attributeIdentifier) as ItemPrefab; |
if (itemPrefab == null) |
{ |
DebugConsole.ThrowError("Couldn't spawn item for outpost destroy mission: item prefab \"" + attributeIdentifier.ToString() + "\" not found", null, this.Prefab.ContentPackage, false, false); |
} |
else |
{ |
Identifier[] attributeIdentifierArray = element.GetAttributeIdentifierArray("moduleflags", null, true); |
Identifier[] attributeIdentifierArray2 = element.GetAttributeIdentifierArray("spawnpointtags", null, true); |
ISpatialEntity spatialEntity = SpawnAction.GetSpawnPos(SpawnAction.SpawnLocationType.Outpost, new SpawnType?(SpawnType.Human | SpawnType.Enemy), attributeIdentifierArray, attributeIdentifierArray2, element.GetAttributeBool("asfaraspossible", false), false, true); |
if (spatialEntity == null) |
{ |
spatialEntity = submarine.GetHulls(false).GetRandomUnsynced<Hull>(); |
} |
Vector2 worldPosition = spatialEntity.WorldPosition; |
WayPoint wayPoint = spatialEntity as WayPoint; |
if (wayPoint != null && wayPoint.CurrentHull != null && wayPoint.CurrentHull.Rect.Width > 100) |
{ |
worldPosition..ctor(MathHelper.Clamp(wayPoint.WorldPosition.X + (float)Rand.Range(-200, 201, Rand.RandSync.Unsynced), (float)(wayPoint.CurrentHull.WorldRect.X + 50), (float)(wayPoint.CurrentHull.WorldRect.Right - 50)), (float)(wayPoint.CurrentHull.WorldRect.Y - wayPoint.CurrentHull.Rect.Height) + 16f); |
} |
Item item = new Item(itemPrefab, worldPosition, null, 0, true); |
this.items.Add(item); |
} |
} |
} |
} |
// Token: 0x06000B10 RID: 2832 RVA: 0x00067304 File Offset: 0x00065504 |
protected override void UpdateMissionSpecific(float deltaTime) |
{ |
if (this.State != 5) |
{ |
if (this.requireRescue.Any((Character r) => r.Removed || r.IsDead)) |
{ |
this.State = 5; |
return; |
} |
} |
else |
{ |
this.endTimer += deltaTime; |
float num = this.endTimer; |
} |
if (this.state == 0) |
{ |
if (this.items.All((Item it) => it.Removed || it.Condition <= 0f)) |
{ |
if (this.requireKill.All((Character c) => c.Removed || c.IsDead || (c.LockHands && c.Submarine == Submarine.MainSub))) |
{ |
if (this.requireRescue.All(delegate(Character c) |
{ |
Submarine submarine = c.Submarine; |
return submarine != null && submarine.Info.Type == SubmarineType.Player; |
})) |
{ |
this.State = 1; |
} |
} |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.