COMPACT FURNITURE BASICS

Furniture offset ownership

The user handles furniture offsets personally. Do not calculate, change, or tune furniture-item offset, depth_offset, or related placement offsets unless the user explicitly requests it. The examples below are reference material only.

Compact installation for furniture items

A note about compact item installation

This is a streamlined version of the vanilla way of adding custom items into the game. This system relies on MOMI generating most of the required values.

More about custom item installations.

The folder structure

+---compact-furniture
|   to register your mod in MOMI
|   manifest.toml
|   
\---fiddle
|       to add your recipe or item to a store
|       stores.toml
|       
\---momi
    \---furniture
        \---images
        |   \---objects
        |   |       objects, shadows, and previews go here
        |   |       these are just examples
        |   |       spr_<furniture_name>_south.png
        |   |       spr_<furniture_name>_south_shadow.png
        |   |       spr_<furniture_name>_east.png
        |   |       spr_<furniture_name>_east_shadow.png
        |   |       spr_<furniture_name>_preview.png
        |   |       
        |   \---ui
        |           item and category icons go here
        |           spr_ui_item_<furniture_name>.png
        |           spr_ui_item_<furniture_name>_outline.png
        |           
        \---items
        |        to define the item properties of your furniture    
        |        mod_name_items.toml  
	    |
        \---objects
        |        to define the object properties of your furniture
        |        mod_name_objects.toml
        |
        \---sprites
	    |        optional - to adjust sprite properties
        |        mod_name_sprites.toml
        |

As we can see above, we have the main mod folder, which is compact-furniture for the purposes of this guide. This is where we store all our files needed for our mod. The only loose file in this main folder, or root folder as it's usually called, is manifest.toml.

The manifest

This file is needed to let MOMI register the mod in its installation process.

manifest.toml template
name = "mod name"
author = "your name"
version = "mod version, example 1.0.0 or v1.0 - doesn't have a strict format"
minInstallerVersion = "latest MOMI version, to be safe"
If you don't know the current MOMI version, you can put down the minimum required which is 0.12.0.

The momi folder

The bulk of the mod. This is where we put our sprites, define our furniture, and adjust their functionality and placement in the game. Since we're working with furniture items in this guide, the nested momi folder we'll be using is called furniture.

Animated sprites need to be compiled into a horizontal animation strip so it's only one .png!
The furniture\images folder
Sprite files have the prefix spr to indicate that the image is a sprite.

The images folder is where we'll put the furniture sprites. It's separated into images\objects and images\ui, which are rather self-explanatory. The objects folder is where we put the sprites of the furniture and shadows plus the preview images for the crafting menu and the ui folder is where we put object icons, custom store category icons and custom scroll icons.

Why does the crafting menu preview go into the objects folder if it's a UI element?

We do not know.

The furniture\images\objects folder

For objects, shadows, and crafting menu preview images.

Let's go over further file naming conventions.

Sprite file names

There are several things to keep in mind, the prefix spr, the furniture name and the additional appendixes a sprite can have, such as _cardinal direction, which then together form the specific sprite id.

The furniture name is more of a 'soft' convention, it should contain your author name (or a shortened version of it) and the name of furniture you are working on i.e ari_dining_table.
The advice is to keep it the same across all the related sprites, as well as your object id and item id, which we will talk about later.

The _cardinal direction is as you might have guessed, to distinguish the sprites for the rotations of your furniture. The game allows for only FOUR rotations, and that's it.

However, a neat trick is to use rotations to have variations on your base sprite instead! So you do not need to use _cardinal directions in your sprite name, as long as you name them differently.

The default rotation used by vanilla is usually _south, which is when the sprite faces the player. _north sprite faces backwards. _east and _west sprites face to the side and are mirrored by default if _west is absent, but can also be defined separately. You are not obliged to have any in particular, as long as you are obviously defining at least one of the cardinals.

Other examples of vanilla appendixes are as follows : _top, _on, _spring/winter, _opening, etc. They each belong to a different type of furniture, and if you want to learn more, check out the wiki hosted on MOMI's GitHub page.

\---momi
    \---furniture
        \---images
        |   \---objects
        |   |       spr_<furniture_name>_east.png
        |   |       spr_<furniture_name>_south.png
        |   |       

We can see here the file names start with the spr prefix, as they are sprites, and we used the <furniture_name> as our naming convention. The file names end with cardinal direction to indicate object rotations.

Object shadow sprite file names

We will extend the above naming convention for shadows. Append shadow to the file names.

\---momi
    \---furniture
        \---images
        |   \---objects
        |   |       spr_<furniture_name>_east_shadow.png
        |   |       spr_<furniture_name>_south_shadow.png
        |   |       
You need to keep the names of the shadow and the sprites it's associated consistent. It's the only way MOMI will know that they are associated and do background magic to just make them work without any further input from you.
Object preview sprite file names

Crafting menu previews don't need rotations so just append preview to the <furniture_name> or whatever you're using as your sprite file name.

\---momi
    \---furniture
        \---images
        |   \---objects
        |   |       spr_<furniture_name>_preview.png
        |   |       
For the example mod used by this guide, the images\objects folder will look like this by the end:
\---momi
    \---furniture
        \---images
        |   \---objects
        |   |       spr_<furniture_name>_east.png
        |   |       spr_<furniture_name>_east_shadow.png
        |   |       spr_<furniture_name>_south.png
        |   |       spr_<furniture_name>_south_shadow.png
        |   |       spr_<furniture_name>_preview.png
        |   |   
Remember that the names you have defined here are considered your sprite ids. When the code asks you for a sprite, you need to copy the name exactly as you wrote it for it to work. Do not include the .png part!
The furniture\images\ui folder

For UI icons.

UI icon

This includes the small images on the left of the crafting and store menu, plus the small image that pops out when Ari picks a furniture.

Let's go over further file naming conventions. This will be simpler, as we have only two things to consider, the icon itself and the icon outline.

\---momi
    \---furniture
        \---images     
        |   \---ui
        |           spr_ui_item_<furniture_name>.png
        |           spr_ui_item_<furniture_name>_outline.png
        |           

You can see from the example that we append _ui_item at the front of the file name for the icon, as that is how the game handles it. Similarly to the preview file name append, for the icon outline we only need to add _outline to the end of the icon file name, and MOMI will handle the rest for you.

An example of a finished furniture\images directory
\---momi
\---furniture
        \---images
        |   \---objects
        |   |       spr_<furniture_name>_east.png
        |   |       spr_<furniture_name>_east_shadow.png
        |   |       spr_<furniture_name>_south.png
        |   |       spr_<furniture_name>_south_shadow.png
        |   |       spr_<furniture_name>_preview.png
        |   |       
        |   \---ui
        |           spr_ui_item_<furniture_name>.png
        |           spr_ui_item_<furniture_name>_outline.png
        |   
The furniture\items folder

This is where we define the item properties of your furniture, meaning information you would see when you are interacting with it in a menu, like name/description/price etc.

mod_name_items.toml

You can change this file name.
[<furniture_name>_item_id]
   name = "Furniture Name" 				
   icon_sprite = "spr_ui_item_<furniture_name>"	
   description = "Furniture Description"				
   value = { bin = "self.recipe * 1.1", store = 20 } 
   tags = [										
      "furniture",				
      "unlock_set_tag",			
      "additional_tag",				
   ]

   object = "<furniture_name>_object_id"				
   
   recipe_key = "unlock_set_tag"				
   recipe_is_default = true					
   crafting_preview_sprite = "spr_ui_menu_<furniture_name>_preview" 
   crafting_level_requirement = 1				
   recipe = [									
      { count = 1, item = "ore_stone" },		
      { hours = 0, minutes = 10 },				
   ]

Let's unpack the two id keys.

<furniture_name>_item_id is what the game recognizes our furniture as. This is what MOMI refers to to write into the game's toml files pertaining to the furniture details like UI elements, tags, and labels.

<furniture_name>_object_id is what the object.toml will refer to when adjusting the furniture's physical properties. This can have the same name as furniture_item_id, and we encourage it.

These are the major keys that will be referred to by MOMI and the game. KEEP THEM CONSISTENT.

The furniture details
[<furniture_name>_item_id]
   name = "Furniture Name" 				
   icon_sprite = "spr_ui_item_furniture_sprite_id"	
   description = "Furniture Description"				
   value = { bin = "self.recipe * 1.1", store = 20 } 
   tags = [										
      "furniture",				
      "unlock_set_tag",			
      "additional_tag",				
   ]
  1. name and description are UI labels for the in-game menu.
  2. Point the icon_sprite key to the furniture icon in the images\ui folder.
  3. The value key determines an object's monetary value. There are two parameters for the value key, bin and store.
    3a. bin calculates the amount of tesserae we receive after selling items via the shipping bin.
    3b. store determines the item's value in the game's stores. We can't sell things directly to stores.
  4. tags are used to organize items in the menu. All furniture has the furniture tag. Custom furniture need a unique unlock_set_tag for recipe purposes. We may also add a vanilla tag if we're adding into a vanilla set. additional_tag are useful to put your furniture in the other more specific tabs, like tables or lamps, and it can have more than one. All furniture without a set_tag, custom or vanilla, will be categorized as other in the crafting menu.
   object = "<furniture_name>_object_id"				

As we mentioned before, the most important part. Without this, the game will not know to connect the two pieces of code and your furniture will not be able to exist as an object in the overworld.

The furniture recipe
   recipe_key = "unlock_set_tag"				
   recipe_is_default = true					
   crafting_preview_sprite = "spr_ui_menu_<furniture_name>_preview" 
   crafting_level_requirement = 1				
   recipe = [									
      { count = 1, item = "ore_stone" },		
      { hours = 0, minutes = 10 },				
   ]
  1. Custom recipe_key needs the same unlock_set_tag we used for tags, also for recipe purposes. Non-craftable furniture don't need this key.
  2. Furniture will unlock at new game with recipe_is_default = true. Set to false to unlock only with recipe scrolls.
  3. Point the crafting_preview_sprite key to the furniture preview in the images\objects folder. Optional, best used for fences and other bulkier furniture.
  4. crafting_level_requirement to set the required level to craft the furniture. Max is 60.
  5. There are two parameters for recipe, item/count and hours/minutes. The game does not accept 0 for count value. hours and minutes accept 0 value.
    5a. To use essence for our recipe, change count = 1, item = "ore_stone" to essence = 1 .
The furniture\objects folder

We take the furniture defined in items.toml and add properties and the sprites here so it can exist as an object in the game.

mod_name_objects.toml

You can change this file name.
[<furniture_name>_object_id]		
    size = [4, 2] 				
	collision_grid = "1"		
	depth_offset = -16		

	[<furniture_name>_object_id.south]
		sprite = "spr_<furniture_name>_south" 
		offset = [16, 40]			

	[<furniture_name>_object_id.east]
		sprite = "spr_<furniture_name>_east" 
		offset = [16, 40]			

These are the least amount of code we need for our furniture to show up properly in the game.

Remember the <furniture_name>_object_id we defined in the items.toml? This is where it comes to play. Let's examine the header keys.

The general sprite
[<furniture_name>_object_id]		
    size = [4, 2] 				
	collision_grid = "1"				
	depth_offset = -16	
  1. size is the object's hitbox, visualized by white borders we see when we place objects in the world. Each unit here is referring to a half a tile in game, so 8px. So a default tile size is 2,2. Keep that in mind!
  2. Use collision_grid to define object collisions. There are three values.
    2a. Put 0 to disable collision for the object entirely.
    2b. Putting 1 will let Ari jump over the object (eg, fences).
    2c. While 2 means Ari won't be able to pass the object at all.
  3. depth_offset deals with sprites overlaying characters. Set the value in pixels if the furniture sprite covers Ari/NPCs in the game.
The cardinal sprite
	[<furniture_name>_object_id.south]
		sprite = "spr_<furniture_name>_south" 
		offset = [16, 40]			

	[<furniture_name>_object_id.east]
		sprite = "spr_<furniture_name>_east" 
		offset = [16, 40]			
  1. The sprite key points to the sprite image in images\objects used for the rotation.
  2. The offset value, adjust this to line up your sprite with the hitbox the game generates.
    2a. Without going too much into it, MOMI generates something we call the anchor point in the bottom middle of the sprite canvas for us. So to extrapolate the offset value, you will need to determine where on the canvas you want your hitbox to sit, and then calculate the distance in pixels between the hitbox's top left corner and this previously mentioned anchor point.
The furniture\sprites folder
mod_name_sprites.toml

You can change this file name.

You can skip this and not have a sprites folder and sprites.toml if your objects aren't animated.
[furniture_sprite_id_cardinal]
	frame_size = [x, y]

[furniture_sprite_id_shadow]
	frame_size = [x, y]

frame_size is the size of your individual frames in your animation strip.
You can either check the size of a non animated sprite of the same furniture for the values, or extrapolate it from the size of the canvas of your animation strip (x px/no. of frames, y px).

An example of finished toml directories
\---momi
    \---furniture
        \---items
        |        mod_name_items.toml  
	    |
        \---objects
        |        mod_name_objects.toml
        |
        \---sprites
        |        mod_name_sprites.toml
        |

The fiddle folder

To write into the game's stores.toml. In other words, to add our items into in-game stores.

[[general.categories]] 
   MOMIidentify = { icon = "spr_ui_store_category_icon_furniture" }
   MOMIaction = "merge"
   constant_stock = [
      "<furniture_name>_item_id",
      { crafting_scroll = "<furniture_name>_item_id" },
   ]

For this guide, we are adding the items into a vendor's existing category. There are some things to explain here;

  1. [[general.categories]] means we will be putting our items in the general store. The vanilla stores.toml has the information for all vendors.
  2. We are adding it to constant_stock, meaning the vendor will always have the item, but random_stock is also an option for a randomized pool.
  3. MOMIidentify and merge are MOMI actions. MOMIidentify is meant to find the category we are adding our items to, and by using MOMIaction = "merge" before constant stock we're making sure that our items get added into the store's item pool.
And that's it! Install your new mod with MOMI and enjoy!