diff --git a/Mockups/Blocks/MockAirVent.debug.cs b/Mockups/Blocks/MockAirVent.debug.cs index e0fadbc..a5b0a40 100644 --- a/Mockups/Blocks/MockAirVent.debug.cs +++ b/Mockups/Blocks/MockAirVent.debug.cs @@ -13,17 +13,17 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockAirVent : MockFunctionalBlock, IMyAirVent { - public float OxygenLevel { get; set; } = 0; + public virtual float OxygenLevel { get; set; } = 0; - public bool CanPressurize { get; set; } + public virtual bool CanPressurize { get; set; } = true; - public bool IsDepressurizing { get; set; } + public virtual bool IsDepressurizing => Enabled && (Status == VentStatus.Depressurizing || Status == VentStatus.Depressurized); - public bool Depressurize { get; set; } = false; + public virtual bool Depressurize { get; set; } = false; - public VentStatus Status { get; set; } + public virtual VentStatus Status { get; set; } - public bool PressurizationEnabled { get; } = true; + public virtual bool PressurizationEnabled { get; } = true; protected override IEnumerable CreateTerminalProperties() { @@ -33,12 +33,8 @@ protected override IEnumerable CreateTerminalProperties() }); } - public float GetOxygenLevel() => OxygenLevel; + public virtual float GetOxygenLevel() => OxygenLevel; - public void SetCustomName(string text) => CustomName = text; - - public void SetCustomName(StringBuilder text) => CustomName = text.ToString(); - - public bool IsPressurized() => PressurizationEnabled && (Status == VentStatus.Pressurized || Status == VentStatus.Pressurizing); + public virtual bool IsPressurized() => PressurizationEnabled && (Status == VentStatus.Pressurized || Status == VentStatus.Pressurizing); } } diff --git a/Mockups/Blocks/MockDoor.debug.cs b/Mockups/Blocks/MockDoor.debug.cs index 29ed224..c38e682 100644 --- a/Mockups/Blocks/MockDoor.debug.cs +++ b/Mockups/Blocks/MockDoor.debug.cs @@ -12,7 +12,7 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockDoor : MockFunctionalBlock, IMyDoor { - public bool Open => OpenRatio != 0; + public virtual bool Open => OpenRatio != 0; public virtual DoorStatus Status { get; set; } = DoorStatus.Closed; diff --git a/Mockups/Blocks/MockInteriorLight.debug.cs b/Mockups/Blocks/MockInteriorLight.debug.cs index ddc95a9..4eb1742 100644 --- a/Mockups/Blocks/MockInteriorLight.debug.cs +++ b/Mockups/Blocks/MockInteriorLight.debug.cs @@ -11,25 +11,24 @@ namespace IngameScript.Mockups.Blocks #if !MOCKUP_DEBUG [System.Diagnostics.DebuggerNonUserCode] #endif - public partial class MockInteriorLight : MockTerminalBlock, IMyInteriorLight + public partial class MockInteriorLight : MockFunctionalBlock, IMyInteriorLight { - float _offset; + protected float _offset; public virtual float Radius { get; set; } = 2; [Obsolete("Use " + nameof(Radius))] - public float ReflectorRadius => Radius; + public virtual float ReflectorRadius => Radius; public virtual float Intensity { get; set; } = 1; public virtual float Falloff { get; set; } = 1; public virtual float BlinkIntervalSeconds { get; set; } = 0; [Obsolete("Use " + nameof(BlinkLength) + " instead.")] - public float BlinkLenght => BlinkLength; + public virtual float BlinkLenght => BlinkLength; public virtual float BlinkLength { get; set; } = 0; public virtual float BlinkOffset { get; set; } = 0; public virtual Color Color { get; set; } = new Color(255, 255, 255); - public virtual bool Enabled { get; set; } = true; protected override IEnumerable CreateTerminalProperties() { @@ -45,8 +44,5 @@ protected override IEnumerable CreateTerminalProperties() new MockTerminalProperty("Offset", b => _offset, (b, v) => _offset = v) }); } - - [Obsolete("Use " + nameof(Enabled) + " instead.")] - public void RequestEnable(bool enable) => Enabled = enable; } } diff --git a/Mockups/Blocks/MockMotorRotor.debug.cs b/Mockups/Blocks/MockMotorRotor.debug.cs index 226967d..9ebad5f 100644 --- a/Mockups/Blocks/MockMotorRotor.debug.cs +++ b/Mockups/Blocks/MockMotorRotor.debug.cs @@ -8,7 +8,7 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockMotorRotor : MockCubeBlock, IMyMotorRotor { - public bool IsAttached => Base != null; - public IMyMechanicalConnectionBlock Base { get; set; } + public virtual bool IsAttached => Base != null; + public virtual IMyMechanicalConnectionBlock Base { get; set; } } } diff --git a/Mockups/Blocks/MockMotorStator.debug.cs b/Mockups/Blocks/MockMotorStator.debug.cs index d14e87d..7ec51a4 100644 --- a/Mockups/Blocks/MockMotorStator.debug.cs +++ b/Mockups/Blocks/MockMotorStator.debug.cs @@ -10,47 +10,47 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockMotorStator : MockFunctionalBlock, IMyMotorStator { - public float Angle { get; set; } = 0; - public float Torque { get; set; } - public float BrakingTorque { get; set; } - public float TargetVelocityRad + public virtual float Angle { get; set; } = 0; + public virtual float Torque { get; set; } + public virtual float BrakingTorque { get; set; } + public virtual float TargetVelocityRad { get { return Convert.ToSingle(2 * Math.PI) / 60 * TargetVelocityRPM; } set { TargetVelocityRPM = value / Convert.ToSingle(2 * Math.PI) * 60; } } public float TargetVelocityRPM { get; set; } - public float LowerLimitRad + public virtual float LowerLimitRad { get { return ToRads(LowerLimitDeg); } set { LowerLimitDeg = FromRads(value); } } - public float LowerLimitDeg { get; set; } = -1; - public float UpperLimitRad + public virtual float LowerLimitDeg { get; set; } = -1; + public virtual float UpperLimitRad { get { return ToRads(LowerLimitDeg); } set { LowerLimitDeg = FromRads(value); } } - public float UpperLimitDeg { get; set; } = -1; - public float Displacement { get; set; } = 0f; - public bool RotorLock { get; set; } = false; + public virtual float UpperLimitDeg { get; set; } = -1; + public virtual float Displacement { get; set; } = 0f; + public virtual bool RotorLock { get; set; } = false; - public IMyCubeGrid TopGrid => Top?.CubeGrid; + public virtual IMyCubeGrid TopGrid => Top?.CubeGrid; - public IMyAttachableTopBlock Top { get; private set; } + public virtual IMyAttachableTopBlock Top { get; private set; } - public float SafetyLockSpeed { get; set; } - public bool SafetyLock { get; set; } + public virtual float SafetyLockSpeed { get; set; } + public virtual bool SafetyLock { get; set; } - public bool IsLocked { get; set; } = false; + public virtual bool IsLocked { get; set; } = false; - public bool IsAttached => Top != null; - public bool PendingAttachment => MockPendingAttachment != null; + public virtual bool IsAttached => Top != null; + public virtual bool PendingAttachment => MockPendingAttachment != null; - public IMyAttachableTopBlock MockPendingAttachment { get; set; } + public virtual IMyAttachableTopBlock MockPendingAttachment { get; set; } - private float FromRads(float value) + protected float FromRads(float value) { if (value == -1) return -1; @@ -58,7 +58,7 @@ private float FromRads(float value) return value * 180 / Convert.ToSingle(Math.PI); } - private float ToRads(float value) + protected float ToRads(float value) { if (value == -1) return -1; @@ -66,7 +66,7 @@ private float ToRads(float value) return Convert.ToSingle(Math.PI) * value / 180; } - public void Attach() + public virtual void Attach() { if (PendingAttachment && !IsAttached) { @@ -84,7 +84,7 @@ public void Attach() } } - public void Detach() + public virtual void Detach() { MockPendingAttachment = Top; Top = null; diff --git a/Mockups/Blocks/MockProgrammableBlock.debug.cs b/Mockups/Blocks/MockProgrammableBlock.debug.cs index 15ff7b4..0449674 100644 --- a/Mockups/Blocks/MockProgrammableBlock.debug.cs +++ b/Mockups/Blocks/MockProgrammableBlock.debug.cs @@ -18,9 +18,9 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockProgrammableBlock : MockFunctionalBlock, IMyProgrammableBlock { - string _storage = string.Empty; - readonly IMyTextSurface _primary = new MockTextSurface(new VRageMath.Vector2(512, 512), new VRageMath.Vector2(512, 512)); - readonly IMyTextSurface _keyboard = new MockTextSurface(new VRageMath.Vector2(512, 256), new VRageMath.Vector2(512, 256)); + protected string _storage = string.Empty; + protected readonly IMyTextSurface _primary = new MockTextSurface(new VRageMath.Vector2(512, 512), new VRageMath.Vector2(512, 512)); + protected readonly IMyTextSurface _keyboard = new MockTextSurface(new VRageMath.Vector2(512, 256), new VRageMath.Vector2(512, 256)); public virtual int SurfaceCount { get; } = 1; diff --git a/Mockups/Blocks/MockTextPanel.debug.cs b/Mockups/Blocks/MockTextPanel.debug.cs index 3ba27ed..89db282 100644 --- a/Mockups/Blocks/MockTextPanel.debug.cs +++ b/Mockups/Blocks/MockTextPanel.debug.cs @@ -17,8 +17,8 @@ namespace IngameScript.Mockups.Blocks #endif public partial class MockTextPanel : MockFunctionalBlock, IMyTextPanel { - readonly MockTextSurface _surface = new MockTextSurface(new Vector2(512, 512), new Vector2(512, 512)); - readonly StringBuilder _publicTitle = new StringBuilder(); + protected readonly MockTextSurface _surface = new MockTextSurface(new Vector2(512, 512), new Vector2(512, 512)); + protected readonly StringBuilder _publicTitle = new StringBuilder(); TextAlignmentEnum _alignment = TextAlignmentEnum.Align_Left; public virtual string CurrentlyShownImage @@ -30,7 +30,7 @@ public virtual string CurrentlyShownImage [Obsolete("This property no has meaning in-game. If you need a secondary storage, use CustomData")] public virtual ShowTextOnScreenFlag ShowOnScreen { get; set; } = ShowTextOnScreenFlag.PUBLIC; - public bool ShowText => _surface.ContentType == ContentType.TEXT_AND_IMAGE; + public virtual bool ShowText => _surface.ContentType == ContentType.TEXT_AND_IMAGE; public virtual float FontSize { @@ -62,57 +62,57 @@ public virtual string Font set { _surface.Font = value; } } - public byte BackgroundAlpha + public virtual byte BackgroundAlpha { get { return _surface.BackgroundAlpha; } set { _surface.BackgroundAlpha = value; } } - public TextAlignment Alignment + public virtual TextAlignment Alignment { get { return _surface.Alignment; } set { _surface.Alignment = value; } } - public string Script + public virtual string Script { get { return _surface.Script; } set { _surface.Script = value; } } - public ContentType ContentType + public virtual ContentType ContentType { get { return _surface.ContentType; } set { _surface.ContentType = value; } } - public bool PreserveAspectRatio + public virtual bool PreserveAspectRatio { get { return _surface.PreserveAspectRatio; } set { _surface.PreserveAspectRatio = value; } } - public float TextPadding + public virtual float TextPadding { get { return _surface.TextPadding; } set { _surface.TextPadding = value; } } - public Color ScriptBackgroundColor + public virtual Color ScriptBackgroundColor { get { return _surface.ScriptBackgroundColor; } set { _surface.ScriptBackgroundColor = value; } } - public Color ScriptForegroundColor + public virtual Color ScriptForegroundColor { get { return _surface.ScriptForegroundColor; } set { _surface.ScriptForegroundColor = value; } } - public Vector2 SurfaceSize => _surface.SurfaceSize; + public virtual Vector2 SurfaceSize => _surface.SurfaceSize; - public Vector2 TextureSize => _surface.TextureSize; + public virtual Vector2 TextureSize => _surface.TextureSize; protected override IEnumerable CreateTerminalProperties() { @@ -235,13 +235,13 @@ public virtual bool WritePublicTitle(string value, bool append = false) return true; } - public bool WriteText(string value, bool append = false) => _surface.WriteText(value, append); - public string GetText() => _surface.GetText(); - public bool WriteText(StringBuilder value, bool append = false) => _surface.WriteText(value, append); - public void ReadText(StringBuilder buffer, bool append = false) => _surface.ReadText(buffer, append); - public void GetSprites(List sprites) => _surface.GetSprites(sprites); - public void GetScripts(List scripts) => _surface.GetScripts(scripts); - public MySpriteDrawFrame DrawFrame() => _surface.DrawFrame(); - public Vector2 MeasureStringInPixels(StringBuilder text, string font, float scale) => _surface.MeasureStringInPixels(text, font, scale); + public virtual bool WriteText(string value, bool append = false) => _surface.WriteText(value, append); + public virtual string GetText() => _surface.GetText(); + public virtual bool WriteText(StringBuilder value, bool append = false) => _surface.WriteText(value, append); + public virtual void ReadText(StringBuilder buffer, bool append = false) => _surface.ReadText(buffer, append); + public virtual void GetSprites(List sprites) => _surface.GetSprites(sprites); + public virtual void GetScripts(List scripts) => _surface.GetScripts(scripts); + public virtual MySpriteDrawFrame DrawFrame() => _surface.DrawFrame(); + public virtual Vector2 MeasureStringInPixels(StringBuilder text, string font, float scale) => _surface.MeasureStringInPixels(text, font, scale); } }