public override void UpdateOnceBeforeFrame() { if (firstrun) { var info = new List <MyUpgradeModuleInfo>(); hyperDriveBlock.GetUpgradeList(out info); Maxhyper = info.FirstOrDefault(x => x.UpgradeType == "WarpFactor").Modifier; ResourceSink.SetMaxRequiredInputByType(_electricity, HyperFunctions.MinimumPowertoActivate()); ResourceSink.SetRequiredInputByType(_electricity, HyperFunctions.PowerConsumption()); ResourceSink.SetRequiredInputFuncByType(_electricity, HyperFunctions.PowerConsumption); ResourceSink.Update(); hyperDriveBlock.AppendingCustomInfo += HyperFunctions.hyperDriveBlock_AppendingCustomInfo; Maxhyper = Maxhyper * 100f; emitter = new Sandbox.Game.Entities.MyEntity3DSoundEmitter(hyperDriveBlock as MyEntity); MyEntity3DSoundEmitter.PreloadSound(pair); HyperFunctions.CreatehyperUI(); firstrun = false; White = Color.White; MyVisualScriptLogicProvider.ScreenColorFadingSetColor(White); } }
protected void GetMaxPower() { try { IMyUpgradeModule block = Entity as IMyUpgradeModule; List <MyUpgradeModuleInfo> Info; block.GetUpgradeList(out Info); MaxPower = Info.First(x => x.UpgradeType == "Radar").Modifier; } catch (Exception Scrap) { RadarCore.LogError($"{RadarBlock.CustomName}.Load().GetMaxPower", Scrap); } }