Mod Testing for v0.5.6-alpha


  • I just wanted to get my hands wet with the modding to see what I can do. So I decided to try to make a different type of chest. I got the plugin installed for Unity

    1. When I right click in the Hierarchy and add a new Eco World Object it only gives me a parent object [World Object Class Name] with a child object [Replace Me].
    2. I renamed the [World Object Class Name] to "StorageChestLargeObject".
    3. I renamed [Replace Me] Object to "StorageChestLarge".
    4. I added a texture to the StorageChestLarge.
    5. I went to export by clicking Eco Mod Tools > Export Mods
      But it complained about not having directories, so I added: ExportedData, ExportedMods, and World Object under the /Mods/ directory.
    6. I opened StorageChestLargeObject.cs and changed it to emulate the standard chest:

    using Eco.Gameplay.Components;
    using Eco.Gameplay.Items;
    using Eco.Gameplay.Objects;
    using Eco.Shared.Serialization;
    using Eco.Gameplay.Components.Auth;

    [Serialized]
    [RequireComponent(typeof(PropertyAuthComponent))]
    [RequireComponent(typeof(PublicStorageComponent))]
    [RequireComponent(typeof(LinkComponent))]
    [RequireComponent(typeof(MinimapComponent))]
    public class StorageChestLargeObject : WorldObject
    {
    public override string FriendlyName { get { return "Storage Chest Large"; } }

    static StorageChestLargeObject()
    {
    WorldObject.AddOccupancyFromString(typeof(StorageChestLargeObject), "1,1,2");
    }

    protected override void Initialize()
    {
    base.Initialize();

      var storage = this.GetComponent<PublicStorageComponent>();
      storage.Initialize(20);
      storage.Storage.Restrictions.Add(new NotCarriedRestriction()); // can't store block or large items
      this.GetComponent<PropertyAuthComponent>().Initialize(AuthModeType.Inherited);
      this.GetComponent<LinkComponent>().Initialize(5);
      this.GetComponent<MinimapComponent>().Initialize("Storage");
    

    }
    }

    But I noticed that there was no StorageChestLargeItem.cs created

    1. I duplicated the /Mods/Items/StorageChestItem.cs and created StorageChestLargeItem.cs

    using Eco.Gameplay.Components;
    using Eco.Gameplay.DynamicValues;
    using Eco.Gameplay.Items;
    using Eco.Gameplay.Property;
    using Eco.Gameplay.Skills;
    using Eco.Mods.TechTree;
    using Eco.Shared.Serialization;

    [Serialized]
    public class StorageChestLargeItem : WorldObjectItem<StorageChestLargeObject>
    {
    public override string FriendlyName { get { return "Storage Chest Large"; } }
    public override string Description { get { return "A large container you can store items in."; } }
    }

    [RequiresSkill(typeof(StorageSkill), 2)]
    public class StorageChestLargeRecipe : Recipe
    {
    public StorageChestLargeRecipe()
    {
    this.Products = new CraftingElement[]
    {
    new CraftingElement<StorageChestLargeItem>(),
    };
    this.Ingredients = new CraftingElement[]
    {
    new CraftingElement<LogItem>(typeof(WorkbenchConstructionSkill), 20, new PercentReductionStrategy(2, 0.25f)),
    };
    this.CraftMinutes = new ConstantValue(2);

        this.Initialize("Storage Chest Large", typeof(StorageChestLargeRecipe));
        CraftingComponent.AddRecipe(typeof(WorkbenchObject), this);
    }
    

    }

    1. I started up the server.
    2. Launched the client and connected
    3. Typed /give StorageChestLarge,1 and received the new item, but the icon is some default snowflake looking thing that says "StorageChestLargeItem".
    4. I placed the item on the ground, but it gives a default box with default textures indicating x+/x-, y+/y-, and z+/z-.

    Did I do something wrong? I don't see any place that holds the 3D model's information and textures in the server directories. And how do I specify an icon when it's in the inventory? I guess I'll try to make a new tool and see if the outcome is any better.

    Thanks


  • mod problem 1
    1
    Posts
    547
    Views
    Log in to reply

Internal error.

Oops! Looks like something went wrong!