private void FindTopServer(MyEntityUpdateEnum updateFlags) { MyAttachableTopBlockBase top = null; if (m_topBlockToReattach != null) { top = m_topBlockToReattach; } else { top = FindMatchingTop(); } if (top != null) { if (CanDetach()) { Detach(); } if (TryAttach(top)) { m_topBlockToReattach = null; } else { updateFlags |= MyEntityUpdateEnum.EACH_10TH_FRAME; } } else { updateFlags |= MyEntityUpdateEnum.EACH_10TH_FRAME; } }
public override sealed void Init(MyObjectBuilder_EntityBase objectBuilder) { myLogger = new Logger(null, "UpdateEnforcer"); MyObjectBuilder = objectBuilder; EnforcedUpdate = MyEntityUpdateEnum.EACH_100TH_FRAME; if (needsToInit == null) { needsToInit = new LinkedList <UpdateEnforcer>(); } needsToInit.AddLast(this); //myLogger.debugLog("queuing for init: " + Entity.getBestName(), "Init()"); }
public override sealed void UpdateBeforeSimulation100() { if (IsClient) { myLogger.debugLog("is client, not running script", "UpdateBeforeSimulation100()"); return; } if (needsToInit.Count > 0) { startStalled(); } if (IsInitialized) { return; } //(new Logger(null, "UpdateEnforcer")).log("running DelayedInit()", "UpdateBeforeSimulation100()", Logger.severity.TRACE); needsToInit.Remove(this); EnforcedUpdate = MyEntityUpdateEnum.NONE; DelayedInit(); IsInitialized = true; }
private void FindTopServer(MyEntityUpdateEnum updateFlags) { MyAttachableTopBlockBase top = null; if (m_topBlockToReattach != null) { top = m_topBlockToReattach; } else { top = FindMatchingTop(); } if (top != null) { if (CanDetach()) { Detach(); } if (TryAttach(top)) { m_topBlockToReattach = null; } else { updateFlags |= MyEntityUpdateEnum.EACH_10TH_FRAME; } } else { updateFlags |= MyEntityUpdateEnum.EACH_10TH_FRAME; } }