Skip to content

Latest commit

 

History

History
152 lines (114 loc) · 4.53 KB

author-guide.md

File metadata and controls

152 lines (114 loc) · 4.53 KB

← README

This page helps mod authors integrate with Lookup Anything. See the main README for other info.

Contents

Support for mod content

'Added by mod' field

When players look up content in-game (like an item or NPC), the added by mod field shows which mod added it if possible.

For this to work, you must apply the standard unique string ID format (including the mod ID prefix).

Nested items

Lookup Anything scans the world to detect items for the 'number owned' and gift taste fields. It scans inside standard items recursively; for example, if you have an Object with the heldObject field set to a chest, Lookup Anything will look inside the chest too.

If you have a custom non-Object item (e.g. a tool) which contains items, you can add a custom heldObject field or property with any Item type. For example:

// store one item
public Object heldObject;

// store many items
public Chest heldObject = new Chest();

Lookup Anything will detect the field and search inside it too.

Hovered content in custom menus

Lookup Anything detects when the cursor is over an item or NPC in standard menus.

In your custom menus, you can tell Lookup Anything about the hovered content by adding a field or property with a specific name:

name type
HoveredItem or
hoveredItem
Item (or subtype like Object)
HoveredNpc or
hoveredNpc
NPC (or subtype like Horse)

For example:

public Item HoveredItem { get; }

When the player presses F1 on your menu, they'll see the matching content automatically. If you have multiple fields/properties, Lookup Anything will choose one non-null value to show.

Add a UI theme

Lookup Anything uses visual themes to change its menu appearance.

You can add UI themes by editing the Mods/Pathoschild.LookupAnything/Themes asset. Any theme in that asset will appear in the config UI for Lookup Anything.

The asset consists of a string → model lookup, where...

  • The key is a unique ID for the theme.
  • The value is a model with the fields listed below.
field effect
DisplayName A translated display name shown in UIs.
BackgroundType

How the menu background should be drawn. Default FixedSprite.

The possible values are:

  • FixedSprite: draw a texture background sprite over the entire area.
  • MenuBox: draw a menu box by taking specific sprites from the texture background for the corners, edges, and center.
  • PlainColor: draw a plain colored background with no texture.
BackgroundTexture The background texture to draw, if applicable based on the BackgroundType.
BackgroundSourceRect The pixel area within the BackgroundTexture to draw.
BackgroundColor

The color code for the background (default White).

The effect depends on the BackgroundType:

  • FixedSprite and MenuBox: applied as a tint to the background texture (where White means no tint).
  • PlainColor: the color to use as the background.
BackgroundPadding The pixel spacing between the edge of the BackgroundTexture and the inner content. Default 0.
BorderColor

The color code for the border drawn around the background (default Black).

For example, using Content Patcher:

{
    "Action": "EditData",
    "Target": "Mods/Pathoschild.LookupAnything/Themes",
    "Entries": {
        "{{ModId}}_MenuBox_Purple": {
            "DisplayName": "Menu box (purple)",
            "BackgroundCategory": "MenuBox",
            "BackgroundTexture": "Maps/MenuTilesUncolored",
            "BackgroundSourceRect": { "X": 0, "Y": 256, "Width": 60, "Height": 60 },
            "BackgroundColor": "Purple",
            "BackgroundPadding": 4
        }
    }
}