示例#1
0
 /// <summary>
 /// Duplicates the nutrition properties, which includes cloning the stack that was eaten.
 /// </summary>
 /// <returns></returns>
 public FoodNutritionProperties Clone()
 {
     return(new FoodNutritionProperties()
     {
         FoodCategory = FoodCategory,
         Satiety = Satiety,
         Health = Health,
         EatenStack = EatenStack?.Clone()
     });
 }
示例#2
0
 /// <summary>
 /// Duplicates the properties, which includes cloning the stack that was eaten.
 /// </summary>
 /// <returns></returns>
 public TransitionableProperties Clone()
 {
     return(new TransitionableProperties()
     {
         FreshHours = FreshHours.Clone(),
         TransitionHours = TransitionHours.Clone(),
         TransitionRatio = TransitionRatio,
         TransitionedStack = TransitionedStack?.Clone(),
         Type = Type
     });
 }
示例#3
0
        public BarrelRecipe Clone()
        {
            BarrelRecipeIngredient[] ingredients = new BarrelRecipeIngredient[Ingredients.Length];
            for (int i = 0; i < Ingredients.Length; i++)
            {
                ingredients[i] = Ingredients[i].Clone();
            }

            return(new BarrelRecipe()
            {
                SealHours = SealHours,
                Output = Output.Clone(),
                Code = Code,
                Enabled = Enabled,
                Name = Name,
                RecipeId = RecipeId,
                Ingredients = ingredients
            });
        }
示例#4
0
        public new CookingRecipeStack Clone()
        {
            CookingRecipeStack stack = new CookingRecipeStack()
            {
                Code = Code.Clone(),
                ResolvedItemstack = ResolvedItemstack?.Clone(),
                StackSize         = StackSize,
                Type           = Type,
                TextureMapping = (string[])TextureMapping?.Clone(),
                CookedStack    = CookedStack?.Clone()
            };

            if (Attributes != null)
            {
                stack.Attributes = Attributes.Clone();
            }

            stack.ShapeElement = ShapeElement;

            return(stack);
        }
        public T CloneTo <T>() where T : CraftingRecipeIngredient, new()
        {
            T stack = new T()
            {
                Code               = Code.Clone(),
                Type               = Type,
                Name               = Name,
                Quantity           = Quantity,
                IsWildCard         = IsWildCard,
                IsTool             = IsTool,
                ToolDurabilityCost = ToolDurabilityCost,
                AllowedVariants    = AllowedVariants == null ? null : (string[])AllowedVariants.Clone(),
                ResolvedItemstack  = ResolvedItemstack?.Clone(),
                ReturnedStack      = ReturnedStack?.Clone()
            };

            if (Attributes != null)
            {
                stack.Attributes = Attributes.Clone();
            }

            return(stack);
        }
示例#6
0
        /// <summary>
        /// Creates a deep copy
        /// </summary>
        /// <returns></returns>
        public CombustibleProperties Clone()
        {
            CombustibleProperties cloned = new CombustibleProperties();

            cloned.BurnDuration      = BurnDuration;
            cloned.BurnTemperature   = BurnTemperature;
            cloned.HeatResistance    = HeatResistance;
            cloned.MeltingDuration   = MeltingDuration;
            cloned.MeltingPoint      = MeltingPoint;
            cloned.SmokeLevel        = SmokeLevel;
            cloned.SmeltedRatio      = SmeltedRatio;
            cloned.RequiresContainer = RequiresContainer;
            cloned.SmeltingType      = SmeltingType;
            cloned.MaxTemperature    = MaxTemperature;

            if (SmeltedStack != null)
            {
                cloned.SmeltedStack = SmeltedStack.Clone();
            }


            return(cloned);
        }