EcoGSCE-Modpack/AutoGen/Vehicle/SmallWoodCart.cs

75 lines
2.9 KiB
C#

namespace Eco.Mods.TechTree
{
using System;
using System.Collections.Generic;
using Eco.Gameplay.Components;
using Eco.Gameplay.Components.Auth;
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;
[Serialized]
[Weight(10000)]
public class SmallWoodCartItem : WorldObjectItem<SmallWoodCartObject>
{
public override string FriendlyName { get { return "Small Wood Cart"; } }
public override string Description { get { return "A tiny cart for tiny things."; } }
}
[RequiresSkill(typeof(WoodworkingSkill), 1)]
public class SmallWoodCartRecipe : Recipe
{
public SmallWoodCartRecipe()
{
this.Products = new CraftingElement[]
{
new CraftingElement<SmallWoodCartItem>(),
};
this.Ingredients = new CraftingElement[]
{
new CraftingElement<LogItem>(typeof(WoodworkingEfficiencySkill), 20, WoodworkingEfficiencySkill.MultiplicativeStrategy),
new CraftingElement<BoardItem>(typeof(WoodworkingEfficiencySkill), 30, WoodworkingEfficiencySkill.MultiplicativeStrategy),
};
this.CraftMinutes = new ConstantValue(2);
this.Initialize("Small Wood Cart", typeof(SmallWoodCartRecipe));
CraftingComponent.AddRecipe(typeof(WorkbenchObject), this);
}
}
[Serialized]
[RequireComponent(typeof(StandaloneAuthComponent))]
[RequireComponent(typeof(PublicStorageComponent))]
[RequireComponent(typeof(MovableLinkComponent))]
[RequireComponent(typeof(VehicleComponent))]
[RequireComponent(typeof(TailingsReportComponent))]
public class SmallWoodCartObject : PhysicsWorldObject
{
private static Dictionary<Type, float> roadEfficiency = new Dictionary<Type, float>()
{
{ typeof(DirtRoadBlock), 1 }, { typeof(DirtRoadWorldObjectBlock), 1 },
{ typeof(StoneRoadBlock), 1.4f }, { typeof(StoneRoadWorldObjectBlock), 1.4f },
{ typeof(AsphaltRoadBlock), 1.6f }, { typeof(AsphaltRoadWorldObjectBlock), 1.6f }
};
public override string FriendlyName { get { return "Small Wood Cart"; } }
private SmallWoodCartObject() { }
protected override void Initialize()
{
base.Initialize();
this.GetComponent<PublicStorageComponent>().Initialize(6, 750000);
this.GetComponent<VehicleComponent>().Initialize(8, 1, roadEfficiency);
this.GetComponent<VehicleComponent>().HumanPowered(0.5f);
}
}
}