protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var ob = builder as MyObjectBuilder_CubeBlockDefinition;
            MyDebug.AssertDebug(ob != null);

            this.Size                  = ob.Size;
            this.Model                 = ob.Model;
            this.UseModelIntersection  = ob.UseModelIntersection;
            this.CubeSize              = ob.CubeSize;
            this.ModelOffset           = ob.ModelOffset;
            this.BlockTopology         = ob.BlockTopology;
            this.PhysicsOption         = ob.PhysicsOption;
            this.BlockPairName         = ob.BlockPairName;
            this.m_center              = ob.Center ?? ((Size - 1) / 2);
            this.m_symmetryX           = ob.MirroringX;
            this.m_symmetryY           = ob.MirroringY;
            this.m_symmetryZ           = ob.MirroringZ;
            this.DeformationRatio      = ob.DeformationRatio;
            this.EdgeType              = ob.EdgeType;
            this.AutorotateMode        = ob.AutorotateMode;
            this.m_mirroringBlock      = ob.MirroringBlock;
            this.MultiBlock            = ob.MultiBlock;
            this.GuiVisible            = ob.GuiVisible;
            this.Rotation              = ob.Rotation;
            this.Direction             = ob.Direction;
            this.Mirrored              = ob.Mirrored;
            this.RandomRotation        = ob.RandomRotation;
            this.BuildType             = ob.BuildType != null ? ob.BuildType.ToLower() : null;
            this.GeneratedBlockType    = MyStringId.GetOrCompute(ob.GeneratedBlockType != null ? ob.GeneratedBlockType.ToLower() : null);
            if (ob.DamageEffectId != 0)
                this.DamageEffectID = ob.DamageEffectId;

            this.CompoundTemplates = ob.CompoundTemplates;
            Debug.Assert(this.CompoundTemplates == null || this.CompoundTemplates.Length > 0, "Wrong compound templates, array is empty");

            if (ob.SubBlockDefinitions != null)
            {
                SubBlockDefinitions = new Dictionary<string, MyDefinitionId>();

                foreach (var definition in ob.SubBlockDefinitions)
                {
                    MyDefinitionId defId;
                    if (SubBlockDefinitions.TryGetValue(definition.SubBlock, out defId))
                    {
                        MyDebug.AssertDebug(false, "Subblock definition already defined!");
                        continue;
                    }

                    defId = definition.Id;
                    SubBlockDefinitions.Add(definition.SubBlock, defId);
                }
            }

            if (ob.BlockVariants != null)
            {
                BlockStages = new MyDefinitionId[ob.BlockVariants.Length];

                for (int i = 0; i < ob.BlockVariants.Length; ++i)
                {
                    BlockStages[i] = ob.BlockVariants[i];
                }
            }

            var cubeDef = ob.CubeDefinition;
            if (cubeDef != null)
            {
                MyCubeDefinition tmp = new MyCubeDefinition();
                tmp.CubeTopology = cubeDef.CubeTopology;
                tmp.ShowEdges = cubeDef.ShowEdges;

                var sides = cubeDef.Sides;
                tmp.Model = new string[sides.Length];
                tmp.PatternSize = new Vector2I[sides.Length];
                for (int j = 0; j < sides.Length; ++j)
                {
                    var side = sides[j];
                    tmp.Model[j] = side.Model;
                    tmp.PatternSize[j] = side.PatternSize;
                }
                this.CubeDefinition = tmp;
            }

            var components = ob.Components;
            MyDebug.AssertDebug(components != null);
            MyDebug.AssertDebug(components.Length != 0);
            float mass = 0.0f;
            float criticalIntegrity = 0f;
            float ownershipIntegrity = 0f;
            if (components != null && components.Length != 0)
            {
                Components = new MyCubeBlockDefinition.Component[components.Length];

                float integrity = 0.0f;
                int criticalTypeCounter = 0;
                for (int j = 0; j < components.Length; ++j)
                {
                    var component = components[j];

                    MyCubeBlockDefinition.Component tmp = new MyCubeBlockDefinition.Component()
                    {
                        Count = component.Count,
                        Definition = MyDefinitionManager.Static.GetComponentDefinition(new MyDefinitionId(component.Type, component.Subtype))
                    };

                    if (component.Type == typeof(MyObjectBuilder_Component) && component.Subtype == "Computer")
                    {
                        if (ownershipIntegrity == 0)
                            ownershipIntegrity = integrity + tmp.Definition.MaxIntegrity;
                    }

                    integrity += tmp.Count * tmp.Definition.MaxIntegrity;
                    if (component.Type == ob.CriticalComponent.Type &&
                        component.Subtype == ob.CriticalComponent.Subtype)
                    {
                        if (criticalTypeCounter == ob.CriticalComponent.Index)
                        {
                            CriticalGroup = (UInt16)j;
                            criticalIntegrity = integrity-1;
                        }
                        ++criticalTypeCounter;
                    }

                    mass += tmp.Count * tmp.Definition.Mass;

                    Components[j] = tmp;
                }
                MaxIntegrity = integrity;
                IntegrityPointsPerSec = integrity / ob.BuildTimeSeconds;
                DisassembleRatio = ob.DisassembleRatio;
                Mass = mass;
            }

            CriticalIntegrityRatio = criticalIntegrity / MaxIntegrity;
            OwnershipIntegrityRatio = ownershipIntegrity / MaxIntegrity;

            if (ob.BuildProgressModels != null)
            {
                ob.BuildProgressModels.Sort((a, b) => a.BuildPercentUpperBound.CompareTo(b.BuildPercentUpperBound));
                this.BuildProgressModels = new BuildProgressModel[ob.BuildProgressModels.Count];
                for (int i = 0; i < BuildProgressModels.Length; ++i)
                {
                    var builderModel = ob.BuildProgressModels[i];
                    if (!string.IsNullOrEmpty(builderModel.File))
                    {
                        this.BuildProgressModels[i] = new BuildProgressModel()
                        {
                            BuildRatioUpperBound = builderModel.BuildPercentUpperBound * CriticalIntegrityRatio,
                            File = builderModel.File,
                            RandomOrientation = builderModel.RandomOrientation
                        };
                    }
                }
            }

            if (ob.GeneratedBlocks != null)
            {
                this.GeneratedBlockDefinitions = new MyDefinitionId[ob.GeneratedBlocks.Length];

                for (int i = 0; i < ob.GeneratedBlocks.Length; ++i)
                {
                    var genBlockId = ob.GeneratedBlocks[i];
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.SubtypeName));
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.TypeIdString));

                    this.GeneratedBlockDefinitions[i] = genBlockId;
                }
            }

            Skeleton = ob.Skeleton;
            if (Skeleton != null)
            {
                Bones = new Dictionary<Vector3I,Vector3>(ob.Skeleton.Count);
                foreach (var bone in Skeleton)
                {
                    Bones[bone.BonePosition] = Vector3UByte.Denormalize(bone.BoneOffset, MyDefinitionManager.Static.GetCubeSize(ob.CubeSize));
                }
            }

            IsAirTight = ob.IsAirTight;

            InitMountPoints(ob);
            InitPressurization();

            InitNavigationInfo(ob, ob.NavigationDefinition);

            CheckBuildProgressModels();
            // Components and CriticalComponent will be initialized elsewhere

            this.PrimarySound = new MySoundPair(ob.PrimarySound);
        }
示例#2
0
        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var ob = builder as MyObjectBuilder_CubeBlockDefinition;

            MyDebug.AssertDebug(ob != null);

            this.Size  = ob.Size;
            this.Model = ob.Model;
            this.UseModelIntersection = ob.UseModelIntersection;
            this.CubeSize             = ob.CubeSize;
            this.ModelOffset          = ob.ModelOffset;
            this.BlockTopology        = ob.BlockTopology;
            this.PhysicsOption        = ob.PhysicsOption;
            this.BlockPairName        = ob.BlockPairName;
            this.m_center             = ob.Center ?? ((Size - 1) / 2);
            this.m_symmetryX          = ob.MirroringX;
            this.m_symmetryY          = ob.MirroringY;
            this.m_symmetryZ          = ob.MirroringZ;
            this.DeformationRatio     = ob.DeformationRatio;
            this.EdgeType             = ob.EdgeType;
            this.AutorotateMode       = ob.AutorotateMode;
            this.m_mirroringBlock     = ob.MirroringBlock;
            this.MultiBlock           = ob.MultiBlock;
            this.GuiVisible           = ob.GuiVisible;
            this.Rotation             = ob.Rotation;
            this.Direction            = ob.Direction;
            this.Mirrored             = ob.Mirrored;
            this.RandomRotation       = ob.RandomRotation;
            this.BuildType            = ob.BuildType != null?ob.BuildType.ToLower() : null;

            this.GeneratedBlockType = MyStringId.GetOrCompute(ob.GeneratedBlockType != null ? ob.GeneratedBlockType.ToLower() : null);
            if (ob.DamageEffectId != 0)
            {
                this.DamageEffectID = ob.DamageEffectId;
            }

            this.CompoundTemplates = ob.CompoundTemplates;
            Debug.Assert(this.CompoundTemplates == null || this.CompoundTemplates.Length > 0, "Wrong compound templates, array is empty");

            if (ob.SubBlockDefinitions != null)
            {
                SubBlockDefinitions = new Dictionary <string, MyDefinitionId>();

                foreach (var definition in ob.SubBlockDefinitions)
                {
                    MyDefinitionId defId;
                    if (SubBlockDefinitions.TryGetValue(definition.SubBlock, out defId))
                    {
                        MyDebug.AssertDebug(false, "Subblock definition already defined!");
                        continue;
                    }

                    defId = definition.Id;
                    SubBlockDefinitions.Add(definition.SubBlock, defId);
                }
            }

            if (ob.BlockVariants != null)
            {
                BlockStages = new MyDefinitionId[ob.BlockVariants.Length];

                for (int i = 0; i < ob.BlockVariants.Length; ++i)
                {
                    BlockStages[i] = ob.BlockVariants[i];
                }
            }

            var cubeDef = ob.CubeDefinition;

            if (cubeDef != null)
            {
                MyCubeDefinition tmp = new MyCubeDefinition();
                tmp.CubeTopology = cubeDef.CubeTopology;
                tmp.ShowEdges    = cubeDef.ShowEdges;

                var sides = cubeDef.Sides;
                tmp.Model       = new string[sides.Length];
                tmp.PatternSize = new Vector2I[sides.Length];
                for (int j = 0; j < sides.Length; ++j)
                {
                    var side = sides[j];
                    tmp.Model[j]       = side.Model;
                    tmp.PatternSize[j] = side.PatternSize;
                }
                this.CubeDefinition = tmp;
            }

            var components = ob.Components;

            MyDebug.AssertDebug(components != null);
            MyDebug.AssertDebug(components.Length != 0);
            float mass = 0.0f;
            float criticalIntegrity  = 0f;
            float ownershipIntegrity = 0f;

            if (components != null && components.Length != 0)
            {
                Components = new MyCubeBlockDefinition.Component[components.Length];

                float integrity           = 0.0f;
                int   criticalTypeCounter = 0;
                for (int j = 0; j < components.Length; ++j)
                {
                    var component = components[j];

                    MyCubeBlockDefinition.Component tmp = new MyCubeBlockDefinition.Component()
                    {
                        Count      = component.Count,
                        Definition = MyDefinitionManager.Static.GetComponentDefinition(new MyDefinitionId(component.Type, component.Subtype))
                    };

                    if (component.Type == typeof(MyObjectBuilder_Component) && component.Subtype == "Computer")
                    {
                        if (ownershipIntegrity == 0)
                        {
                            ownershipIntegrity = integrity + tmp.Definition.MaxIntegrity;
                        }
                    }

                    integrity += tmp.Count * tmp.Definition.MaxIntegrity;
                    if (component.Type == ob.CriticalComponent.Type &&
                        component.Subtype == ob.CriticalComponent.Subtype)
                    {
                        if (criticalTypeCounter == ob.CriticalComponent.Index)
                        {
                            CriticalGroup     = (UInt16)j;
                            criticalIntegrity = integrity - 1;
                        }
                        ++criticalTypeCounter;
                    }

                    mass += tmp.Count * tmp.Definition.Mass;

                    Components[j] = tmp;
                }
                MaxIntegrity          = integrity;
                IntegrityPointsPerSec = integrity / ob.BuildTimeSeconds;
                DisassembleRatio      = ob.DisassembleRatio;
                Mass = mass;
            }

            CriticalIntegrityRatio  = criticalIntegrity / MaxIntegrity;
            OwnershipIntegrityRatio = ownershipIntegrity / MaxIntegrity;

            if (ob.BuildProgressModels != null)
            {
                ob.BuildProgressModels.Sort((a, b) => a.BuildPercentUpperBound.CompareTo(b.BuildPercentUpperBound));
                this.BuildProgressModels = new BuildProgressModel[ob.BuildProgressModels.Count];
                for (int i = 0; i < BuildProgressModels.Length; ++i)
                {
                    var builderModel = ob.BuildProgressModels[i];
                    if (!string.IsNullOrEmpty(builderModel.File))
                    {
                        this.BuildProgressModels[i] = new BuildProgressModel()
                        {
                            BuildRatioUpperBound = builderModel.BuildPercentUpperBound * CriticalIntegrityRatio,
                            File = builderModel.File,
                            RandomOrientation = builderModel.RandomOrientation
                        };
                    }
                }
            }

            if (ob.GeneratedBlocks != null)
            {
                this.GeneratedBlockDefinitions = new MyDefinitionId[ob.GeneratedBlocks.Length];

                for (int i = 0; i < ob.GeneratedBlocks.Length; ++i)
                {
                    var genBlockId = ob.GeneratedBlocks[i];
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.SubtypeName));
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.TypeIdString));

                    this.GeneratedBlockDefinitions[i] = genBlockId;
                }
            }

            Skeleton = ob.Skeleton;
            if (Skeleton != null)
            {
                Bones = new Dictionary <Vector3I, Vector3>(ob.Skeleton.Count);
                foreach (var bone in Skeleton)
                {
                    Bones[bone.BonePosition] = Vector3UByte.Denormalize(bone.BoneOffset, MyDefinitionManager.Static.GetCubeSize(ob.CubeSize));
                }
            }

            IsAirTight = ob.IsAirTight;

            InitMountPoints(ob);
            InitPressurization();

            InitNavigationInfo(ob, ob.NavigationDefinition);

            CheckBuildProgressModels();
            // Components and CriticalComponent will be initialized elsewhere

            this.PrimarySound = new MySoundPair(ob.PrimarySound);
        }
        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var ob = builder as MyObjectBuilder_CubeBlockDefinition;
            MyDebug.AssertDebug(ob != null);

            this.Size                  = ob.Size;
            this.Model                 = ob.Model;
            this.UseModelIntersection  = ob.UseModelIntersection;
            this.CubeSize              = ob.CubeSize;
            this.ModelOffset           = ob.ModelOffset;
            this.BlockTopology         = ob.BlockTopology;
            this.PhysicsOption         = ob.PhysicsOption;
            this.BlockPairName         = ob.BlockPairName;
            this.m_center              = ob.Center ?? ((Size - 1) / 2);
            this.m_symmetryX           = ob.MirroringX;
            this.m_symmetryY           = ob.MirroringY;
            this.m_symmetryZ           = ob.MirroringZ;
            this.DeformationRatio      = ob.DeformationRatio;
            this.SilenceableByShipSoundSystem = ob.SilenceableByShipSoundSystem;
            this.EdgeType              = ob.EdgeType;
            this.AutorotateMode        = ob.AutorotateMode;
            this.m_mirroringBlock      = ob.MirroringBlock;
            this.MultiBlock            = ob.MultiBlock;
            this.GuiVisible            = ob.GuiVisible;
            this.Rotation              = ob.Rotation;
            this.Direction             = ob.Direction;
            this.Mirrored              = ob.Mirrored;
            this.RandomRotation        = ob.RandomRotation;
            this.BuildType             = MyStringId.GetOrCompute(ob.BuildType != null ? ob.BuildType.ToLower() : null);
            this.BuildMaterial         = ob.BuildMaterial != null ? ob.BuildMaterial.ToLower() : null;
            this.BuildProgressToPlaceGeneratedBlocks = ob.BuildProgressToPlaceGeneratedBlocks;
            this.GeneratedBlockType    = MyStringId.GetOrCompute(ob.GeneratedBlockType != null ? ob.GeneratedBlockType.ToLower() : null);
            this.CompoundEnabled       = ob.CompoundEnabled;
            this.CreateFracturedPieces = ob.CreateFracturedPieces;
            this.VoxelPlacement      = ob.VoxelPlacement;

            if (ob.PhysicalMaterial != null)
            {
                this.PhysicalMaterial = MyDefinitionManager.Static.GetPhysicalMaterialDefinition(ob.PhysicalMaterial);
            }
            if (ob.Effects != null)
            {
                this.Effects = new CubeBlockEffectBase[ob.Effects.Length];
                for (int i = 0; i < ob.Effects.Length; i++)
                {
                    this.Effects[i] = new CubeBlockEffectBase(ob.Effects[i].Name, ob.Effects[i].ParameterMin, ob.Effects[i].ParameterMax);
                    if (ob.Effects[i].ParticleEffects != null && ob.Effects[i].ParticleEffects.Length > 0)
                    {
                        this.Effects[i].ParticleEffects = new CubeBlockEffect[ob.Effects[i].ParticleEffects.Length];
                        for (int j = 0; j < ob.Effects[i].ParticleEffects.Length; j++)
                        {
                            this.Effects[i].ParticleEffects[j] = new CubeBlockEffect(ob.Effects[i].ParticleEffects[j]);
                        }
                    }
                    else
                        this.Effects[i].ParticleEffects = null;
                }
            }
            if (ob.DamageEffectId != 0)
                this.DamageEffectID = ob.DamageEffectId;

            this.Points = ob.Points;
            InitEntityComponents(ob.EntityComponents);

            this.CompoundTemplates = ob.CompoundTemplates;
            Debug.Assert(this.CompoundTemplates == null || this.CompoundTemplates.Length > 0, "Wrong compound templates, array is empty");

            if (ob.SubBlockDefinitions != null)
            {
                SubBlockDefinitions = new Dictionary<string, MyDefinitionId>();

                foreach (var definition in ob.SubBlockDefinitions)
                {
                    MyDefinitionId defId;
                    if (SubBlockDefinitions.TryGetValue(definition.SubBlock, out defId))
                    {
                        MyDebug.AssertDebug(false, "Subblock definition already defined!");
                        continue;
                    }

                    defId = definition.Id;
                    SubBlockDefinitions.Add(definition.SubBlock, defId);
                }
            }

            if (ob.BlockVariants != null)
            {
                BlockStages = new MyDefinitionId[ob.BlockVariants.Length];

                for (int i = 0; i < ob.BlockVariants.Length; ++i)
                {
                    BlockStages[i] = ob.BlockVariants[i];
                }
            }

            var cubeDef = ob.CubeDefinition;
            if (cubeDef != null)
            {
                MyCubeDefinition tmp = new MyCubeDefinition();
                tmp.CubeTopology = cubeDef.CubeTopology;
                tmp.ShowEdges = cubeDef.ShowEdges;

                var sides = cubeDef.Sides;
                tmp.Model = new string[sides.Length];
                tmp.PatternSize = new Vector2I[sides.Length];
                for (int j = 0; j < sides.Length; ++j)
                {
                    var side = sides[j];
                    tmp.Model[j] = side.Model;
                    tmp.PatternSize[j] = side.PatternSize;
                }
                this.CubeDefinition = tmp;
            }

            var components = ob.Components;
            MyDebug.AssertDebug(components != null);
            MyDebug.AssertDebug(components.Length != 0);
            float mass = 0.0f;
            float criticalIntegrity = 0f;
            float ownershipIntegrity = 0f;

            MaxIntegrityRatio = 1;

            if (components != null && components.Length != 0)
            {
                Components = new MyCubeBlockDefinition.Component[components.Length];

                float integrity = 0.0f;
                int criticalTypeCounter = 0;
                for (int j = 0; j < components.Length; ++j)
                {
                    var component = components[j];

                    var definition = MyDefinitionManager.Static.GetComponentDefinition(new MyDefinitionId(component.Type, component.Subtype));
                    MyPhysicalItemDefinition deconstructDefinition = null;
                    if (!component.DeconstructId.IsNull() && !MyDefinitionManager.Static.TryGetPhysicalItemDefinition(component.DeconstructId, out deconstructDefinition))
                        deconstructDefinition = definition;

                    if (deconstructDefinition == null)
                        deconstructDefinition = definition;

                    MyCubeBlockDefinition.Component tmp = new MyCubeBlockDefinition.Component()
                    {
                        Definition = definition,
                        Count = component.Count,
                        DeconstructItem = deconstructDefinition,
                    };

                    if (component.Type == typeof(MyObjectBuilder_Component) && component.Subtype == "Computer")
                    {
                        if (ownershipIntegrity == 0)
                            ownershipIntegrity = integrity + tmp.Definition.MaxIntegrity;
                    }

                    integrity += tmp.Count * tmp.Definition.MaxIntegrity;
                    if (component.Type == ob.CriticalComponent.Type &&
                        component.Subtype == ob.CriticalComponent.Subtype)
                    {
                        if (criticalTypeCounter == ob.CriticalComponent.Index)
                        {
                            CriticalGroup = (UInt16)j;
                            criticalIntegrity = integrity-1;
                        }
                        ++criticalTypeCounter;
                    }

                    mass += tmp.Count * tmp.Definition.Mass;

                    Components[j] = tmp;
                }

                MaxIntegrity = integrity;
                IntegrityPointsPerSec = MaxIntegrity / ob.BuildTimeSeconds;
                DisassembleRatio = ob.DisassembleRatio;

                if (ob.MaxIntegrity != 0)
                {
                    // If we specify MaxIntegrity for a block, it conflicts with the original integrity
                    // So instead of overriding the MaxIntegrity, we multiply DeformationRatio so that the block
                    // behaves as if it had the integrity that we want!
                    MaxIntegrityRatio = ob.MaxIntegrity / MaxIntegrity;
                    DeformationRatio = DeformationRatio / MaxIntegrityRatio;
                }

                if(!MyPerGameSettings.Destruction)
                    Mass = mass;
            }
            else
            {
                if (ob.MaxIntegrity != 0)
                    MaxIntegrity = ob.MaxIntegrity;
            }

            CriticalIntegrityRatio = criticalIntegrity / MaxIntegrity;
            OwnershipIntegrityRatio = ownershipIntegrity / MaxIntegrity;

            if (ob.BuildProgressModels != null)
            {
                ob.BuildProgressModels.Sort((a, b) => a.BuildPercentUpperBound.CompareTo(b.BuildPercentUpperBound));
                this.BuildProgressModels = new BuildProgressModel[ob.BuildProgressModels.Count];
                for (int i = 0; i < BuildProgressModels.Length; ++i)
                {
                    var builderModel = ob.BuildProgressModels[i];
                    if (!string.IsNullOrEmpty(builderModel.File))
                    {
                        this.BuildProgressModels[i] = new BuildProgressModel()
                        {
                            BuildRatioUpperBound = builderModel.BuildPercentUpperBound * CriticalIntegrityRatio,
                            File = builderModel.File,
                            RandomOrientation = builderModel.RandomOrientation
                        };
                    }
                }
            }

            if (ob.GeneratedBlocks != null)
            {
                this.GeneratedBlockDefinitions = new MyDefinitionId[ob.GeneratedBlocks.Length];

                for (int i = 0; i < ob.GeneratedBlocks.Length; ++i)
                {
                    var genBlockId = ob.GeneratedBlocks[i];
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.SubtypeName));
                    Debug.Assert(!string.IsNullOrEmpty(genBlockId.TypeIdString));

                    this.GeneratedBlockDefinitions[i] = genBlockId;
                }
            }

            Skeleton = ob.Skeleton;
            if (Skeleton != null)
            {
                Bones = new Dictionary<Vector3I,Vector3>(ob.Skeleton.Count);
                foreach (var bone in Skeleton)
                {
                    Bones[bone.BonePosition] = Vector3UByte.Denormalize(bone.BoneOffset, MyDefinitionManager.Static.GetCubeSize(ob.CubeSize));
                }
            }

            IsAirTight = ob.IsAirTight;

            InitMountPoints(ob);
            InitPressurization();

            InitNavigationInfo(ob, ob.NavigationDefinition);

            CheckBuildProgressModels();
            // Components and CriticalComponent will be initialized elsewhere

            PrimarySound = new MySoundPair(ob.PrimarySound);
            ActionSound = new MySoundPair(ob.ActionSound);
            if (ob.DamagedSound!=null)
                DamagedSound = new MySoundPair(ob.DamagedSound);

        }