public void SetStartingSideRelationships(WorldSide side) { for (int i = 0; i < World_AIW2.Instance.Sides.Count; i++) { WorldSide otherSide = World_AIW2.Instance.Sides[i]; if (side == otherSide) { continue; } switch (otherSide.Type) { case WorldSideType.Player: case WorldSideType.AI: side.MakeFriendlyTo(otherSide); otherSide.MakeFriendlyTo(side); break; case WorldSideType.SpecialFaction: if (otherSide.SpecialFactionData != null && otherSide.SpecialFactionData.Implementation == SpecialFaction_Devourer.Instance) { side.MakeHostileTo(otherSide); otherSide.MakeHostileTo(side); } else { side.MakeFriendlyTo(otherSide); otherSide.MakeFriendlyTo(side); } break; } } }
public void SetStartingSideRelationships(WorldSide side) { for (int i = 0; i < World_AIW2.Instance.Sides.Count; i++) { WorldSide otherSide = World_AIW2.Instance.Sides[i]; if (side == otherSide) { continue; } switch (otherSide.Type) { case WorldSideType.Player: case WorldSideType.AI: case WorldSideType.SpecialFaction: side.MakeHostileTo(otherSide); otherSide.MakeHostileTo(side); break; } } }
public void DoPerSimStepLogic(WorldSide side, ArcenSimContext Context) { bool haveHumanOccupiers = false; bool haveAIOccupiers = false; side.Entities.DoForEntities(GameEntityCategory.Ship, delegate(GameEntity entity) { if (entity.LongRangePlanningData == null) { return(DelReturn.Continue); // if created after the start of this planning cycle, skip } Planet planet = World_AIW2.Instance.GetPlanetByIndex(entity.LongRangePlanningData.CurrentPlanetIndex); if (!entity.TypeData.GetHasTag(DYSON_SPHERE_TAG)) { return(DelReturn.Continue); } if (planet.GetIsControlledBySideType(WorldSideType.Player)) { haveHumanOccupiers = true; } if (planet.GetIsControlledBySideType(WorldSideType.AI)) { haveAIOccupiers = true; } return(DelReturn.Continue); }); if (haveHumanOccupiers) { World_AIW2.Instance.DoForSides(delegate(WorldSide otherSide) { if (side == otherSide) { return(DelReturn.Continue); } switch (otherSide.Type) { case WorldSideType.NaturalObject: break; case WorldSideType.AI: if (side.GetIsFriendlyTowards(otherSide)) { break; } side.MakeFriendlyTo(otherSide); otherSide.MakeFriendlyTo(side); break; default: if (side.GetIsHostileTowards(otherSide)) { break; } side.MakeHostileTo(otherSide); otherSide.MakeHostileTo(side); break; } return(DelReturn.Continue); }); } else if (!haveAIOccupiers) { World_AIW2.Instance.DoForSides(delegate(WorldSide otherSide) { if (side == otherSide) { return(DelReturn.Continue); } switch (otherSide.Type) { case WorldSideType.NaturalObject: break; case WorldSideType.Player: if (side.GetIsFriendlyTowards(otherSide)) { break; } side.MakeFriendlyTo(otherSide); otherSide.MakeFriendlyTo(side); break; default: if (side.GetIsHostileTowards(otherSide)) { break; } side.MakeHostileTo(otherSide); otherSide.MakeHostileTo(side); break; } return(DelReturn.Continue); }); } else { World_AIW2.Instance.DoForSides(delegate(WorldSide otherSide) { if (side == otherSide) { return(DelReturn.Continue); } if (otherSide.Type == WorldSideType.NaturalObject) { return(DelReturn.Continue); } if (side.GetIsHostileTowards(otherSide)) { return(DelReturn.Continue); } side.MakeHostileTo(otherSide); otherSide.MakeHostileTo(side); return(DelReturn.Continue); }); } }