public override void UpdateOnceBeforeFrame() { base.UpdateOnceBeforeFrame(); IsCountingDown = false; if (Sync.IsServer) { for (int i = 0; i < Toolbar.ItemCount; ++i) { Toolbar.UpdateItem(i); Toolbar.ActivateItemAtIndex(i); } //Visual scripting action if (CubeGrid.Physics != null && MyVisualScriptLogicProvider.TimerBlockTriggered != null) { MyVisualScriptLogicProvider.TimerBlockTriggered(CustomName.ToString()); } if (CubeGrid.Physics != null && !string.IsNullOrEmpty(Name) && MyVisualScriptLogicProvider.TimerBlockTriggeredEntityName != null) { MyVisualScriptLogicProvider.TimerBlockTriggeredEntityName(Name); } } UpdateEmissivity(); DetailedInfo.Clear(); RaisePropertiesChanged(); }
private void CreateTextBox(bool isEditable, string description) { m_textBox = new MyGuiScreenTextPanel(CustomName.ToString(), currentObjectivePrefix: "", currentObjective: MyTexts.GetString(MySpaceTexts.Terminal_CustomData), description: description, editable: isEditable, resultCallback: OnClosedTextBox); }
public override void UpdateBeforeSimulation() { base.UpdateBeforeSimulation(); if (SafeConstraint != null) { if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_CONNECTORS_AND_MERGE_BLOCKS && CustomName.ToString() == "DEBUG") { DebugDrawInfo(new Vector2(0.0f, 0.0f)); m_other.DebugDrawInfo(new Vector2(0.0f, 120.0f)); MyRenderProxy.DebugDrawLine3D(PositionComp.GetPosition(), PositionComp.GetPosition() + WorldMatrix.GetDirectionVector(m_right) * 10.0f, Color.Red, Color.Red, false); MyRenderProxy.DebugDrawLine3D(m_other.PositionComp.GetPosition(), m_other.PositionComp.GetPosition() + m_other.WorldMatrix.GetDirectionVector(m_other.m_otherRight) * 10.0f, Color.Red, Color.Red, false); MyRenderProxy.DebugDrawLine3D(PositionComp.GetPosition(), PositionComp.GetPosition() + WorldMatrix.GetDirectionVector(m_otherRight) * 5.0f, Color.Yellow, Color.Yellow, false); MyRenderProxy.DebugDrawLine3D(m_other.PositionComp.GetPosition(), m_other.PositionComp.GetPosition() + m_other.WorldMatrix.GetDirectionVector(m_other.m_right) * 5.0f, Color.Yellow, Color.Yellow, false); } Vector3 thisVelocity = CubeGrid.Physics.GetVelocityAtPoint(PositionComp.GetPosition()); Vector3 otherVelocity = m_other.CubeGrid.Physics.GetVelocityAtPoint(m_other.PositionComp.GetPosition()); Vector3 relativeVelocity = otherVelocity - thisVelocity; // Damping to avoid too quick approach if (relativeVelocity.Length() > 0.5f) { CubeGrid.Physics.LinearVelocity += relativeVelocity * 0.05f; m_other.CubeGrid.Physics.LinearVelocity -= relativeVelocity * 0.05f; } } }