public override void OnAddedToScene(object source) { base.OnAddedToScene(source); MyGravityProviderSystem.AddGravityGenerator(this); UpdateEmissivity(); if (ResourceSink != null) { ResourceSink.Update(); } }
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid) { base.Init(objectBuilder, cubeGrid); if (CubeGrid.CreatePhysics) { MyGravityProviderSystem.AddGravityGenerator(this); // Put on my fake, because it does performance issues if (MyFakes.ENABLE_GRAVITY_PHANTOM) { var shape = CreateFieldShape(); Physics = new Engine.Physics.MyPhysicsBody(this, Engine.Physics.RigidBodyFlag.RBF_KINEMATIC); Physics.IsPhantom = true; Physics.CreateFromCollisionObject(shape, PositionComp.LocalVolume.Center, WorldMatrix, null, Sandbox.Engine.Physics.MyPhysics.GravityPhantomLayer); shape.Base.RemoveReference(); Physics.Enabled = IsWorking; } NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME; SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged; } }