Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (TNManager.isHosting)
- {
- List<GameTown> towns = new List<GameTown>();
- for (int i = 0; i < GameTown.list.size; ++i)
- {
- GameTown t = GameTown.list[i];
- if (!t || t.isPlayerClose) continue;
- towns.Add(t);
- }
- if (towns.size == 0) return;
- float farthestDist = 0f;
- GameTown farthest = null;
- Vector3 pos = (MyPlayer.ship != null) ? MyPlayer.ship.position : Vector3.zero;
- for (int i = 0; i < towns.size; ++i)
- {
- float dist = Vector3.SqrMagnitude(pos - towns[i].dockPos);
- if (dist > farthestDist)
- {
- farthestDist = dist;
- farthest = towns[i];
- }
- }
- if (!farthest) return;
- farthest.ChangeFaction(0);
- for (int i = 0; i < farthest.sightRangeList.size; ++i)
- {
- GameUnit unit = farthest.sightRangeList[i];
- if (unit && unit.isActive && unit.player == null)
- unit.ChangeFaction(0);
- }
- GameZone.UpdateChannelInfo(false);
- }
- UIGameChat.AddCurrent("The pirates are invading!", Color.yellow);
Advertisement
Add Comment
Please, Sign In to add comment