// Copyright (c) Strange Loop Games. All rights reserved.
// See LICENSE file in the project root for full license information.
// <auto-generated from VehicleTemplate.cs />

namespace Eco.Mods.TechTree
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using Eco.Core.Items;
    using Eco.Gameplay.Components;
    using Eco.Gameplay.Components.Auth;
    using Eco.Gameplay.Components.VehicleModules;
    using Eco.Gameplay.DynamicValues;
    using Eco.Gameplay.Items;
    using Eco.Gameplay.Objects;
    using Eco.Gameplay.Players;
    using Eco.Gameplay.Skills;
    using Eco.Gameplay.Systems.TextLinks;
    using Eco.Shared.Math;
    using Eco.Shared.Networking;
    using Eco.Shared.Localization;
    using Eco.Shared.Serialization;
    using Eco.Shared.Utils;
    using Eco.Shared.Items;
    
    [Serialized]
    [LocDisplayName("Wood Cart")]
    [Weight(15000)]
    [Ecopedia("Crafted Objects", "Vehicles", createAsSubPage: true, display: InPageTooltip.DynamicTooltip)]
    public partial class WoodCartItem : WorldObjectItem<WoodCartObject>
    {
        public override LocString DisplayDescription { get { return Localizer.DoStr("Small cart for hauling small loads."); } }
    }


    [RequiresSkill(typeof(BasicEngineeringSkill), 1)]
    public partial class WoodCartRecipe : RecipeFamily
    {
        public WoodCartRecipe()
        {
            var recipe = new Recipe();
            recipe.Init(
                "WoodCart",  //noloc
                Localizer.DoStr("Wood Cart"),
                new List<IngredientElement>
                {
                    new IngredientElement("HewnLog", 4, typeof(BasicEngineeringSkill)), //noloc
                    new IngredientElement("WoodBoard", 8, typeof(BasicEngineeringSkill)), //noloc
                    new IngredientElement(typeof(WoodenWheelItem), 2, true),
                },
                new List<CraftingElement>
                {
                    new CraftingElement<WoodCartItem>()
                });
            this.Recipes = new List<Recipe> { recipe };
            this.ExperienceOnCraft = 10;
            this.LaborInCalories = CreateLaborInCaloriesValue(75, typeof(BasicEngineeringSkill));
            this.CraftMinutes = CreateCraftTimeValue(typeof(WoodCartRecipe), 2, typeof(BasicEngineeringSkill));
            this.ModsPreInitialize();
            this.Initialize(Localizer.DoStr("Wood Cart"), typeof(WoodCartRecipe));
            this.ModsPostInitialize();
            CraftingComponent.AddRecipe(typeof(WainwrightTableObject), this);
        }

        /// <summary>Hook for mods to customize RecipeFamily before initialization. You can change recipes, xp, labor, time here.</summary>
        partial void ModsPreInitialize();
        /// <summary>Hook for mods to customize RecipeFamily after initialization, but before registration. You can change skill requirements here.</summary>
        partial void ModsPostInitialize();
    }

    [Serialized]
    [RequireComponent(typeof(StandaloneAuthComponent))]
    [RequireComponent(typeof(PublicStorageComponent))]
    [RequireComponent(typeof(MovableLinkComponent))]
    [RequireComponent(typeof(VehicleComponent))]
    [RequireComponent(typeof(CustomTextComponent))]
    [RequireComponent(typeof(ModularStockpileComponent))]
    [RequireComponent(typeof(TailingsReportComponent))]
    public partial class WoodCartObject : PhysicsWorldObject, IRepresentsItem
    {
        static WoodCartObject()
        {
            WorldObject.AddOccupancy<WoodCartObject>(new List<BlockOccupancy>(0));
        }

        public override TableTextureMode TableTexture => TableTextureMode.Wood;
        public override LocString DisplayName { get { return Localizer.DoStr("Wood Cart"); } }
        public Type RepresentedItemType { get { return typeof(WoodCartItem); } }


        private WoodCartObject() { }

        protected override void Initialize()
        {
            base.Initialize();
            
            this.GetComponent<CustomTextComponent>().Initialize(200);
            this.GetComponent<PublicStorageComponent>().Initialize(12, 2100000);
            this.GetComponent<VehicleComponent>().Initialize(12, 1, 1, null, true);
            this.GetComponent<VehicleComponent>().HumanPowered(1);
            this.GetComponent<StockpileComponent>().Initialize(new Vector3i(2,1,2));
        }
    }
}
