Skip to content

UseWith

namespace Griff.Modules.Adventures;
public sealed class UseWith : Component

What using an item on a Hotspot does, with no code: a key on a door, a coin given to a beggar, a bone thrown to a dog. Put one on the hotspot for each item that does something there. When the walker uses its Item on the hotspot (picked from the InventoryBar), it walks over and says its Line, does its action on its targets, sets its flag, sends its message, starts the hotspot’s dialogue (Talks), gives up the item (unless it KeepsItem) and gets what it Gives.

An item with no Use With on a hotspot gets its Wrong Item Line, or the bar’s Wrong Line. With NeedsFlag, it only counts while a flag is set (or isn’t): put two on a door for the same key, one needing “DoorLocked”.

This is a component: its saved properties are on its component page.

public string? Do { get; set; }

An action done on its Targets (or the hotspot itself): a door’s “Open”, a switch’s “Toggle”…

public string? Flag { get; set; }

A flag set, e.g. “DoorOpen”; “not Name” clears one. Flags are kept in the save data.

public string? Gives { get; set; }

Items put in the walker’s inventory, separated by commas, each with how many if more than one: “Coin 3, Map”.

public string? Item { get; set; }

The item that’s used on the hotspot, e.g. “Key”; several separated by commas each do the same.

public bool KeepsItem { get; set; }

Keeps the item rather than giving it up: a key that opens more than one door, a torch to light things with.

public string? Line { get; set; }

What the walker says, e.g. “The key turns. It’s open!”

public string? Message { get; set; }

A message sent, with the walker as its data.

public string? NeedsFlag { get; set; }

A flag it needs to count, e.g. “DoorLocked”, or “not DoorOpen”; while it doesn’t hold, the item is the wrong one here. Empty always counts.

public string? Sound { get; set; }

A sound played, e.g. “Sounds/unlock.wav”.

public bool Talks { get; set; }

Starts the Dialogue on the hotspot’s entity: giving something to a character.

public string? Targets { get; set; }

What Do is done on, by name, separated by commas (those inside the hotspot first). Empty does it on the hotspot’s entity.

public int TimesUsed { get; set; }

How many times it has been done. The game counts them.

public string? With { get; set; }

What Do is done with, for an action that takes a value. Empty uses the action’s own default.

public override string? SetupNote()

A line for the Inspector when it has no item.

public bool Takes(string item)

True if item is one it’s for.

public event Action<Walker, string>? Done

Raised as it’s done, with the walker and the item.