public override void OnAddedToScene() { base.OnAddedToScene(); if (!MrzUtils.IsServer) { return; } _block = this.Get <MyBlockComponent>(); if (_block == null) { MrzUtils.CreateNotificationDebug("MrzInventoryPullComponent can only be used on blocks."); return; } _destInventory = this.Get <MyInventoryBase>(tmp_destInventoryName) ?? this.Get <MyInventoryBase>(); if (_destInventory == null) { return; } FindSource(); }
private void BlockMoved(MyBlockComponent block, MyGridDataComponent gridData) { var nextGridPhys = gridData?.Container?.Get <MyPhysicsComponentBase>(); var nextGridPos = gridData?.Container?.Get <MyPositionComponentBase>(); if (nextGridPos == _gridPositionComponent && nextGridPhys == _gridPhysicsComponent) { return; } if (_gridPositionComponent != null) { _gridPositionComponent.OnPositionChanged -= WakePhysics; } _gridPhysicsComponent = nextGridPhys; _gridPositionComponent = nextGridPos; if (_gridPositionComponent != null) { WakePhysics(null); } else { RemoveFixedUpdate(Simulate); } }