static public FriendlyShipIntel IGCUnpack(object data) { var unpacked = (MyTuple <MyTuple <Vector3D, Vector3D, double>, MyTuple <string, long, float, int>, MyTuple <int, string, int, int, Vector3I>, MyTuple <long, int> >)data; var fsi = new FriendlyShipIntel(); fsi.IGCUnpackInto(unpacked); return(fsi); }
public void ProcessIntel(FriendlyShipIntel intel) { if (engageCounter > 0) { intel.Radius = (float)Context.Reference.CubeGrid.WorldAABB.Size.Length() * 10; intel.AgentStatus |= AgentStatus.Engaged; } }
public void ProcessIntel(FriendlyShipIntel myIntel) { myIntel.HomeID = HomeID; if (Connector.Status == MyShipConnectorStatus.Connected) { myIntel.Radius = 0; myIntel.AgentStatus |= AgentStatus.Docked; if (Connector.OtherConnector.EntityId == HomeID) { myIntel.AgentStatus |= AgentStatus.DockedAtHome; } } myIntel.HangarTags = HangarTags; }
public void ReportCommand(FriendlyShipIntel agent, TaskType taskType, MyTuple <IntelItemType, long> targetKey, TimeSpan timestamp, CommandType commandType = CommandType.Override) { if (Host != null) { Host.ReportCommand(agent, taskType, targetKey, timestamp, commandType); } if (agent.ID == Context.Reference.CubeGrid.EntityId && MyAgent != null) { MyAgent.AddTask(taskType, targetKey, CommandType.Override, 0, timestamp + CanonicalTimeDiff); } else { Context.IGC.SendBroadcastMessage(agent.CommandChannelTag, MyTuple.Create((int)taskType, MyTuple.Create((int)targetKey.Item1, targetKey.Item2), (int)commandType, 0)); } }
void UpdateMyIntel(TimeSpan timestamp) { if (timestamp == TimeSpan.Zero) { return; } if (controller == null) { return; } FriendlyShipIntel myIntel; IMyCubeGrid cubeGrid = Context.Reference.CubeGrid; var key = MyTuple.Create(IntelItemType.Friendly, cubeGrid.EntityId); if (IntelItems.ContainsKey(key)) { myIntel = (FriendlyShipIntel)IntelItems[key]; } else { myIntel = new FriendlyShipIntel(); } myIntel.DisplayName = cubeGrid.DisplayName; myIntel.CurrentVelocity = controller.GetShipVelocities().LinearVelocity; myIntel.CurrentPosition = cubeGrid.WorldAABB.Center; myIntel.Radius = (float)(cubeGrid.WorldAABB.Max - cubeGrid.WorldAABB.Center).Length() * RadiusMulti + 20; myIntel.CurrentCanonicalTime = timestamp + CanonicalTimeDiff; myIntel.ID = cubeGrid.EntityId; myIntel.AgentStatus = AgentStatus.None; foreach (var processor in intelProcessors) { processor.ProcessIntel(myIntel); } if (Host != null) { Host.ReportFleetIntelligence(myIntel, timestamp); } else { ReportFleetIntelligence(myIntel, timestamp); } }
public void ProcessIntel(FriendlyShipIntel myIntel) { if (AvailableTasks != TaskType.None) { myIntel.CommandChannelTag = CommandChannelTag; myIntel.AcceptedTaskTypes = AvailableTasks; myIntel.AgentClass = AgentClass; if (TaskQueue.Count == 0) { myIntel.AgentStatus |= AgentStatus.Idle; } else if (TaskQueue.Peek() is MoveToAndDockTask) { myIntel.AgentStatus |= AgentStatus.Recalling; } } }
// This is designed to be static, but due to language features needs to be called from a proxy object. public MyTuple <IntelItemType, long>?TryIGCUnpack(object data, Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence> intelItems) { var unpacked = (MyTuple <int, long, MyTuple <MyTuple <Vector3D, Vector3D, double>, MyTuple <string, long, float, int>, MyTuple <int, string, int, int, Vector3I>, MyTuple <long, int> > >)data; var key = MyTuple.Create((IntelItemType)unpacked.Item1, unpacked.Item2); if (intelItems != null && key.Item1 == IntelItemType.Friendly) { if (intelItems.ContainsKey(key)) { ((FriendlyShipIntel)intelItems[key]).IGCUnpackInto(unpacked.Item3); } else { intelItems.Add(key, FriendlyShipIntel.IGCUnpack(unpacked.Item3)); } return(key); } return(null); }
public void ProcessIntel(FriendlyShipIntel intel) { intel.HydroPowerInv = new Vector3I((int)(hydrogenPercent * 100), (int)(powerPercent * 100), (int)(inventoryPercent * 100)); }