public FunctionalBlockEntity(CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition, Object backingObject) : base(parent, definition, backingObject) { m_enabled = definition.Enabled; m_powerReceiver = new PowerReceiver(ActualObject, Parent.PowerManager, InternalGetPowerReceiver( ), new Func <float>(InternalPowerReceiverCallback)); }
public override MyObjectBuilder_CubeBlock GetObjectBuilderCubeBlock(bool copy = false) { MyObjectBuilder_FunctionalBlock objectBuilderCubeBlock = (MyObjectBuilder_FunctionalBlock)base.GetObjectBuilderCubeBlock(copy); objectBuilderCubeBlock.Enabled = this.Enabled; return(objectBuilderCubeBlock); }
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid) { base.Init(objectBuilder, cubeGrid); MyObjectBuilder_FunctionalBlock block = (MyObjectBuilder_FunctionalBlock)objectBuilder; this.m_soundEmitter = new MyEntity3DSoundEmitter(this, true, 1f); this.m_enabled.SetLocalValue(block.Enabled); base.IsWorkingChanged += new Action <MyCubeBlock>(this.CubeBlock_IsWorkingChanged); this.m_baseIdleSound = base.BlockDefinition.PrimarySound; this.m_actionSound = base.BlockDefinition.ActionSound; }
public void ProcessCubeGrid(MyObjectBuilder_CubeGrid gridBuilder) { gridBuilder.IsStatic = false; gridBuilder.DestructibleBlocks = false; foreach (MyObjectBuilder_CubeBlock local1 in gridBuilder.CubeBlocks) { local1.Owner = 0L; local1.ShareMode = MyOwnershipShareModeEnum.None; local1.EntityId = 0L; MyObjectBuilder_FunctionalBlock block = local1 as MyObjectBuilder_FunctionalBlock; if (block != null) { block.Enabled = false; } } }
internal static T CreateNewComponent <T>(MyObjectBuilder_FunctionalBlock prefab) where T : VRage.Game.Components.MyComponentBase { try { PrefabBuilder.CubeBlocks.Clear(); // need no leftovers from previous spawns PrefabBuilder.CubeBlocks.Add(prefab); MyEntities.RemapObjectBuilder(PrefabBuilder); var ent = MyEntities.CreateFromObjectBuilder(PrefabBuilder, false); Log.Line("259"); ent.Render.CastShadows = false; ent.Render.Visible = false; ent.IsPreview = true; ent.Save = false; ent.SyncFlag = false; ent.NeedsWorldMatrix = false; ent.Flags |= EntityFlags.IsNotGamePrunningStructureObject; ent.Render.RemoveRenderObjects(); MyEntities.Add(ent, false); Log.Line("269"); var grid = (IMyCubeGrid)ent; var blocks = new List <IMySlimBlock>(); grid.GetBlocks(blocks); var blockSlim = blocks.FirstOrDefault(); Log.Line("271"); var blockFat = blockSlim.FatBlock; Log.Line("273"); Log.Line("275"); var component = blockFat.Components.Get <T>(); blockFat.Components.Remove <T>(); ent.Delete(); return(component); } catch (Exception ex) { Log.Error(ex); } return(null); }
public GravityBaseEntity(CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition, Object backingObject) : base(parent, definition, backingObject) { m_acceleration = 9.81f; }
public GravityBaseEntity( CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition, Object backingObject ) : base(parent, definition, backingObject) { m_acceleration = 9.81f; }
public FunctionalBlockEntity(CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition) : base(parent, definition) { }
public FunctionalBlockEntity(CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition, Object backingObject) : base(parent, definition, backingObject) { m_enabled = definition.Enabled; }
public FunctionalBlockEntity( CubeGridEntity parent, MyObjectBuilder_FunctionalBlock definition, Object backingObject ) : base(parent, definition, backingObject) { m_enabled = definition.Enabled; }