internal void PacketizeO2GeneratorSettings(IMyCubeBlock block, ProtoO2GeneratorSettings settings) { var data = new DataO2GeneratorSettings(MyAPIGateway.Multiplayer.MyId, block.EntityId, settings); var bytes = MyAPIGateway.Utilities.SerializeToBinary(data); O2GeneratorSettingsToClients(block.CubeGrid.GetPosition(), bytes, data.Sender); }
} // empty ctor is required for deserialization public DataO2GeneratorSettings(ulong sender, long entityId, ProtoO2GeneratorSettings settings) { Type = PacketType.O2Generatorsettings; Sender = sender; EntityId = entityId; Settings = settings; }
public DataO2GeneratorSettings(ulong sender, long entityId, PacketType action) { Type = action; Sender = sender; EntityId = entityId; Settings = null; }
public bool LoadSettings() { if (O2Generator.Storage == null) { return(false); } string rawData; bool loadedSomething = false; if (O2Generator.Storage.TryGetValue(Session.Instance.O2GeneratorSettingsGuid, out rawData)) { ProtoO2GeneratorSettings loadedSettings = null; try { loadedSettings = MyAPIGateway.Utilities.SerializeFromXML <ProtoO2GeneratorSettings>(rawData); } catch (Exception e) { loadedSettings = null; Log.Line($"O2GeneratorId:{O2Generator.EntityId.ToString()} - Error loading settings!\n{e}"); } if (loadedSettings != null) { Settings = loadedSettings; loadedSomething = true; } } return(loadedSomething); }
internal void UpdateSettings(ProtoO2GeneratorSettings newSettings) { if (Session.Enforced.Debug == 3) { Log.Line($"UpdateSettings for O2Generator - Fix:{newSettings.FixRoomPressure} - O2GenId [{O2Generator.EntityId}]"); } SettingsUpdated = true; O2Set.Settings = newSettings; }