Пример #1
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_PrefabKinematic objectBuilder   = base.GetObjectBuilderInternal(getExactCopy) as MyMwcObjectBuilder_PrefabKinematic;
            MyPrefabConfigurationKinematic     kinematicConfig = GetConfiguration() as MyPrefabConfigurationKinematic;

            for (int i = 0; i < kinematicConfig.KinematicParts.Count; i++)
            {
                // part is destroyed
                if (Parts[i] == null)
                {
                    objectBuilder.KinematicPartsHealth[i]    = 0f;
                    objectBuilder.KinematicPartsMaxHealth[i] = null;
                    objectBuilder.KinematicPartsEntityId[i]  = null; // Won't transfer
                }
                else
                {
                    objectBuilder.KinematicPartsHealth[i]    = Parts[i].Health;
                    objectBuilder.KinematicPartsMaxHealth[i] = Parts[i].GetMaxHealth();
                    objectBuilder.KinematicPartsEntityId[i]  = MyEntityIdentifier.ToNullableInt(Parts[i].EntityId);
                }
            }
            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();

            return(objectBuilder);
        }
Пример #2
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_PrefabGenerator objectBuilder = base.GetObjectBuilderInternal(getExactCopy) as MyMwcObjectBuilder_PrefabGenerator;

            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();
            return(objectBuilder);
        }
Пример #3
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_PrefabLargeWeapon objectBuilderWeapon = (MyMwcObjectBuilder_PrefabLargeWeapon)base.GetObjectBuilderInternal(getExactCopy);

            //This is duplicate from MyPrefab
            objectBuilderWeapon.PositionInContainer = MyPrefabContainer.GetRelativePositionInContainerCoords(this.LocalMatrix.Translation);

            float  yaw, pitch, roll;
            Matrix rot = this.LocalMatrix;

            rot.Translation = Vector3.Zero;

            MyUtils.RotationMatrixToYawPitchRoll(ref rot, out yaw, out pitch, out roll);
            objectBuilderWeapon.AnglesInContainer = new Vector3(yaw, pitch, roll);
            //end of duplicate from  MyPrefab

            objectBuilderWeapon.PrefabLargeWeaponType = weaponType;
            //objectBuilderWeapon.PrefabHealthRatio = Health;

            objectBuilderWeapon.UseProperties     = UseProperties.GetObjectBuilder();
            objectBuilderWeapon.SearchingDistance = SearchingDistance;
            objectBuilderWeapon.AimingDistance    = 0;

            return(objectBuilderWeapon);
        }
Пример #4
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            List <MyMwcObjectBuilder_PrefabBase> prefabs   = new List <MyMwcObjectBuilder_PrefabBase>(m_prefabs.Count);
            MyMwcObjectBuilder_Inventory         inventory = null;

            if (Inventory != null)
            {
                inventory = Inventory.GetObjectBuilder(getExactCopy);
            }
            foreach (MyPrefabBase prefab in m_prefabs)
            {
                MyEntity entity = prefab;
                if (MyEntities.IsMarkedForClose(entity))
                {
                    continue;
                }

                MyMwcObjectBuilder_PrefabBase prefabOld = entity.GetObjectBuilder(getExactCopy) as MyMwcObjectBuilder_PrefabBase;
                prefabs.Add(prefabOld);
            }

            MyMwcObjectBuilder_PrefabContainer objectBuilder
                = new MyMwcObjectBuilder_PrefabContainer(null, MyMwcObjectBuilder_PrefabContainer_TypesEnum.INSTANCE, prefabs,
                                                         GetUserID(), Faction, inventory);

            objectBuilder.PositionAndOrientation.Position = this.GetPosition();
            objectBuilder.PositionAndOrientation.Forward  = this.GetOrientation().Forward;
            objectBuilder.PositionAndOrientation.Up       = this.GetOrientation().Up;
            objectBuilder.DisplayName   = DisplayName;
            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();
            objectBuilder.AlarmOn       = AlarmOn;
            objectBuilder.RefillTime    = RefillTime;
            return(objectBuilder);
        }
Пример #5
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_PrefabBankNode objectBuilder = base.GetObjectBuilderInternal(getExactCopy) as MyMwcObjectBuilder_PrefabBankNode;

            objectBuilder.Cash          = Cash;
            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();

            return(objectBuilder);
        }
Пример #6
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_PrefabScanner objectBuilder = base.GetObjectBuilderInternal(getExactCopy) as MyMwcObjectBuilder_PrefabScanner;

            objectBuilder.Color         = Color;
            objectBuilder.Size          = Size;
            objectBuilder.ScanningSpeed = ScanningSpeed;
            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();

            return(objectBuilder);
        }
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            var objectBuilder = (MyMwcObjectBuilder_PrefabSecurityControlHUB)base.GetObjectBuilderInternal(getExactCopy);

            if (objectBuilder.ConnectedEntities == null)
            {
                objectBuilder.ConnectedEntities = new List <uint>();
            }
            else
            {
                objectBuilder.ConnectedEntities.Clear();
            }
            foreach (IMyUseableEntity connectedEntity in m_connectedEntities)
            {
                MyEntity entity = connectedEntity as MyEntity;
                Debug.Assert(entity != null);
                Debug.Assert(entity.EntityId != null);
                objectBuilder.ConnectedEntities.Add(entity.EntityId.Value.NumericValue);
            }
            objectBuilder.UseProperties = UseProperties.GetObjectBuilder();

            return(objectBuilder);
        }