You are viewing a potentially older version of this package. View all versions.
hiccup-MoreFishAPI-1.0.0 icon

MoreFishAPI

Lets other mods add custom fish to the game. Fish are caught, sold, cooked and listed in the journal like any other. Adds no fish on its own.

Date uploaded a day ago
Version 1.0.0
Download link hiccup-MoreFishAPI-1.0.0.zip
Downloads 323
Dependency string hiccup-MoreFishAPI-1.0.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305

README

MoreFishAPI

An API for mod authors who want to add custom fish to How to Fish.

This mod adds no fish on its own. Install it because a fish mod asked you to.

For players

Install it and it does nothing visible until you also install a fish mod. Custom fish are caught, sold, cooked and journalled like any other.

  • Everyone in a lobby should have the same fish mods. A player without a mod simply will not see those fish.
  • Removing a fish mod is safe. Items from a missing fish mod are skipped when a save loads, instead of taking the rest of your inventory with them.

For mod authors

A custom fish is not a prefab you build from scratch. The game's Item, Creature and NetworkObject components carry code generated by FishNet when the game itself is compiled, so they cannot be authored in your own Unity project. MoreFishAPI clones one of the game's own creatures at load time and grafts your artwork onto it.

You choose which creature with Template, and that decides body physics, how it fights on the line, and whether it is hostile. You supply the look, the stats and the rarity.

[BepInDependency("dazed.howtofish.morefishapi", BepInDependency.DependencyFlags.SoftDependency)]
public class Plugin : BaseUnityPlugin
{
    private void Awake()
    {
        AssetBundle bundle = MoreFish.LoadBundle(Path.Combine(Paths.PluginPath, "yourfish.bundle"));

        MoreFish.Register(new FishDefinition
        {
            Id       = "you.yourmod.anglerfish",
            Prefab   = bundle.LoadAsset<GameObject>("Anglerfish"),
            Template = "Cod",
            Worth    = 400,
            Rarity   = 0.3f,
            Health   = 120,
        });
    }
}

Register from Awake. Item ids and the network prefab list are built once at startup, and registering after that returns false.

A true return only means your arguments were valid. Check Live after OnFishRebuilt to confirm your fish actually made it in.

Full documentation

Everything else, including all 38 fish with their real measurements, and the Blender and Unity workflow lives in the documentation repository

Configuration

BepInEx/config/dazed.howtofish.morefishapi.cfg

Key Default Meaning
TemplateFish Cod Creature used when a fish does not name its own Template
AddToJournal true List custom fish in the journal. Turning this off overrides every fish
RarityMultiplier 1 Scales how often custom fish are caught. 0 stops them appearing

Compatibility

Custom fish take item ids from a reserved range, so 123 can exist across all installed fish mods at once. Each fish keeps the same id as long as the set of installed fish mods does not change, and the log warns when an id moves.

CHANGELOG

Changelog

1.0.0

First release.

  • Register custom fish from any mod with MoreFish.Register. Supply a prefab or a bare mesh, and the API builds a working networked fish from one of the game's own creatures.
  • 38 of the game's creatures can be used as a template, including 10 that attack. The template decides body shape, physics and hostility, and is logged at startup with real measurements so authors do not have to guess.
  • Custom fish appear in the journal and are tracked like vanilla catches.
  • Health, worth, endangered status, flopping, food and healing values, rarity and which baits a fish appears on are all settable, and anything left alone is inherited from the template.
  • MoreFish.ForceNextCatch makes the next catch a chosen fish, so authors do not have to fish for hours to test.
  • Item ids are derived from the fish's id string, so the same fish gets the same id on every machine with the same fish mods installed. The network prefab list is seeded by id rather than by load order, so a player missing a mod sees nothing rather than the wrong fish. A checksum is logged for comparing between players.
  • Loading a save that contains a fish from a mod you no longer have skips just that item. The game's own loader would otherwise drop the rest of the inventory and every purchased bait.