Skip to content

Auto Mapper

WulfMarius edited this page Dec 26, 2018 · 4 revisions

Since version 1.2.0

Before the AutoMapper it was necessary to write a small piece of C# code to integrate new items using ModComponentMapper.
This was both repetitive and boring.

It also required that the mod author knows how to write C# code, how to use ModComponentMapper and how to use an IDE to compile that code into a usable DLL.

The AutoMapper completely replaces this mapping code with configuration done in the Unity Editor using Components provided by ModComponentAPI. If a mod uses only pre-existing game mechanics (like Food-Pack), it can be created without writing a single line of code. Writing code will only be required for creating new game mechanics.

Boot Strapping

The AutoMapper will scan the directory "mods/Auto-Mapped" (recursively) and try to handle all files encountered.

The following file extensions are supported:

  • .unity3d: This will be treated as an asset bundle and loaded accordingly.
    The assets in the bundle will be mapped and made available.
  • .bnk: This will be treated as a sound bank and loaded accordingly.
    The sounds (event names) in bank will be made available.
  • .dll: This will be treated as an assembly and loaded accordingly.
    The classes in the assembly will NOT be loaded or inspected for further bootstrapping. If you need bootstrapping from your assembly (e.g. harmony) put it directly in the "mods" directory, so the Mod-Loader will handle it.

All other files will be ignored!

Item Types

Every item must have exactly one item type.
All item types share the basic configuration settings any item must have (like its weigth, name, description, etc), but each individual item type defines additional settings specific to that type and will be mapped to be available for the appropriate game mechanics. So the item type defines the "primary function" of that item.

ModClothingComponent

This component defines a wearable clothing item.
The items from Clothing-Pack use this component.

The Ski Goggles use additional custom code because their behaviour is not part of the vanilla game.

ModCookableComponent

This component defines an item that can be cooked, but not eaten. When cooking finishes, the item will be replaced with another item.
The raw long-grain rice from Food-Pack uses this component and turns into cooked long-grain rice, which uses a ModFoodComponent.

ModFoodComponent

This component defines a consumable food or drink item.
Most items from Food-Pack use this component.

ModGenericItem

This component defines a simple item without a primary function.
Since these items can still be picked up and assigned additional behaviours, they can be useful to design crafting ingredients (like scrap metal), fire starting equipment (like books), and items that can be harvested to yield useful resources (like newspaper).

ModToolComponent

This component defines a usable tool.
The Binoculars use this component.

The Binoculars use additional custom code because their behaviour is not part of the vanilla game.

Behaviours

Behaviours are additional functions that can be attached to items.
All behaviours can be attached to any item and most behaviours can be combined with others.

ModAccelerantComponent

The item becomes an accelerant that can be used to increase the chance to successfully start a fire.

This cannot be combined with ModFireStarterComponent

ModFireStarterComponent

The item can be used to start fires.
Fire starters can either be reusable or not.

This cannot be combined with ModAccelerantComponent

ModHarvestableComponent

The item can be harvested to received some other items or materials.
The behaviour defines which and how many items will be provided.

ModRepairableComponent

The item's condition can be restored by repairing it.
The required materials and tools can be configured.