Skip to content

Add CreatureManager for registering custom creatures - #21

Open
Segually wants to merge 2 commits into
eris-webserv:mainfrom
Segually:feature/creature-manager
Open

Segually wants to merge 2 commits into
eris-webserv:mainfrom
Segually:feature/creature-manager

Conversation

@Segually

@Segually Segually commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds CreatureManager, which lets mods register custom creatures that behave like built-in ones.

Creatures are registered from embedded resources: a .txt file holds the creature's data lines and an optional matching .png provides its sprite.

CreatureManager.Instance.RegisterFromEmbeddedResources(Assembly.GetExecutingAssembly(), "MyMod.Creatures.");

Harmony patches make registered creatures show up where the game expects them:

  • ResourceControl.GetTextFileLines: serves the creature's data lines instead of reading from disk
  • ResourceControl.AssignCreatureSprite: serves the registered sprite
  • CreatureMorpher.GenerateCreatureLists / LoadPlainCreatureFromDisk and BreedControl.LoadEverythingFromDisk: ensure the names are in the creature lists
  • BreedControl.SetUpBreeder: adds buttons for the custom creatures, and recomputes the game's max_buttons_y scroll limit afterwards (the game derives it from the vanilla button count, so without this the added rows can't be scrolled to)
  • CreatureMorpher.GetRandomCreature: occasionally picks a custom creature (hardcoded 15% chance, not currently configurable)

Changes

  • New Creatures/Creatures.Systems.cs (Creature, CreatureManager, patches), plus empty Creatures.Events.cs / Creatures.Interfaces.cs stubs following the layout of the other modules.
  • Base.GamePlugin.cs: initialize CreatureManager.

Notes

  • Split out of a larger set of changes; the other PRs (assets, interactables, .gitignore) are independent of this one. The only overlap is a small init registration in Base.GamePlugin.cs, which may need a trivial conflict resolution depending on merge order.
  • Builds cleanly on its own against current main.

🤖 Generated with Claude Code

Registers creatures from embedded .txt/.png resources and patches the creature loading, breeding and sprite paths so they behave like built-in creatures.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Segually
Segually marked this pull request as ready for review October 1, 2026 13:47
SetUpBreeder computes max_buttons_y from the vanilla button count before our postfix adds the custom creature buttons, so the added rows could not be scrolled to. Recompute it after CreateButtons using the game's formula (rows of 3, 110 unit spacing).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant