public void AssignReceived(SyncBlockSettings newSettings, NanobotBuildAndRepairSystemPriorityHandling buildPriority) { _AllowBuild = newSettings.AllowBuild; _UseIgnoreColor = newSettings.UseIgnoreColor; _IgnoreColor = newSettings.IgnoreColor; _UseGrindColor = newSettings.UseGrindColor; _GrindColor = newSettings.GrindColor; _ShowArea = newSettings.ShowArea; _AreaWidthLeft = newSettings.AreaWidthLeft; _AreaWidthRight = newSettings.AreaWidthRight; _AreaHeightTop = newSettings.AreaHeightTop; _AreaHeightBottom = newSettings.AreaHeightBottom; _AreaDepthFront = newSettings.AreaDepthFront; _AreaDepthRear = newSettings.AreaDepthRear; _BuildPriority = newSettings.BuildPriority; _ScriptControlled = newSettings.ScriptControlled; _SoundVolume = newSettings.SoundVolume; _SearchMode = newSettings.SearchMode; _WorkMode = newSettings.WorkMode; RecalcAreaBoundigBox(); buildPriority.SetEntries(BuildPriority); Changed = 2u; }
public static SyncBlockSettings Load(IMyEntity entity, Guid guid, NanobotBuildAndRepairSystemPriorityHandling buildPriority) { var storage = entity.Storage; string data; SyncBlockSettings settings = null; if (storage != null && storage.TryGetValue(guid, out data)) { try { settings = MyAPIGateway.Utilities.SerializeFromXML <SyncBlockSettings>(data); if (settings != null) { settings.RecalcAreaBoundigBox(); buildPriority.SetEntries(settings.BuildPriority); settings.Changed = 0; return(settings); } } catch { } } settings = new SyncBlockSettings(); var control = entity as IMyTerminalBlock; var system = control != null?control.GameLogic.GetAs <NanobotBuildAndRepairSystemBlock>() : null; var maxValue = system != null ? system.WelderMaximumRange : NanobotBuildAndRepairSystemMod.Settings.Range; settings.AreaWidthLeft = maxValue; settings.AreaWidthRight = maxValue; settings.AreaHeightTop = maxValue; settings.AreaHeightBottom = maxValue; settings.AreaDepthFront = maxValue; settings.AreaDepthRear = maxValue; buildPriority.SetEntries(settings.BuildPriority); settings.Changed = 0; return(settings); }