public static void UpdateSlotData(ILSUpdateSlotData packet) { // PLS if (packet.PlanetId != 0) { PlanetData pData = GameMain.galaxy.PlanetById(packet.PlanetId); if (pData?.factory?.transport != null && packet.StationGId < pData.factory.transport.stationPool.Length) { StationComponent stationComponent = pData.factory.transport.stationPool[packet.StationGId]; if (stationComponent != null && stationComponent.slots != null) { stationComponent.slots[packet.Index].storageIdx = packet.StorageIdx; } } } else // ILS { if (packet.StationGId < GameMain.data.galacticTransport.stationPool.Length) { StationComponent stationComponent = GameMain.data.galacticTransport.stationPool[packet.StationGId]; if (stationComponent != null && stationComponent.slots != null) { stationComponent.slots[packet.Index].storageIdx = packet.StorageIdx; } } } }
public static void UpdateSlotData(ILSUpdateSlotData packet) { Log.Info($"Updating slot data for planet {packet.PlanetId}, station {packet.StationId} gid {packet.StationGId}. Index {packet.Index}, storageIdx {packet.StorageIdx}"); // Clients only care about what happens on their planet, hosts always need to apply this. // Using PlanetFactory to prevent getting the "fakes" that are creates on clients. if (LocalPlayer.IsMasterClient || (!LocalPlayer.IsMasterClient && packet.PlanetId == GameMain.localPlanet?.id)) { PlanetData pData = GameMain.galaxy.PlanetById(packet.PlanetId); StationComponent stationComponent = pData?.factory?.transport?.stationPool[packet.StationId]; if (stationComponent?.slots != null) { stationComponent.slots[packet.Index].storageIdx = packet.StorageIdx; } } }