Repository navigation
fix: protect husbandry records, ride trust and companion pets - #15
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Wolves and cats are remove-unowned animals, so a CompanionPets body that died lost its drops and experience as if it were unowned livestock. The death listener now skips bodies carrying companionpets:pet, through the same check the chunk-load cleanup uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This failure kept the records but logged nothing, so the scan reported an animal still missing without saying which one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
* feat: run livestock on Cooking's husbandry engine Replace the JSON engine with the husbandry module from Cooking, including its character ownership, estates, lost-animal snapshots, /animals and tests. Products come from Cooking's food API, so Cooking stays the owner of food. BreedingBuddies refuses to start while Cooking still runs livestock, and staff use /breedingbuddies with breedingbuddies.admin. The estate participant keeps the cooking-animals ID so estates already open carry on. Private build inputs are now MMOCore and MythicLib. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: take over Cooking's animal records and settings On the first start BreedingBuddies copies plugins/Cooking/Data/husbandry.db (with its journal) and husbandry.yml, which already hold the character owners, estates and snapshots. Cooking's files stay as a backup, the database is copied last so an interrupted copy is redone, and a failed copy stops startup instead of opening an empty database. Entities and tokens marked with Cooking's keys keep working; new marks use ours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: earn trust only through an owner's care Care becomes trust, shown as five hearts. Happy time no longer raises it by itself: owners earn it by feeding a hungry animal (trust.feed), brushing a dirty one (trust.glove) and a daily pet (trust.pet, once per trust.pet-cooldown). A pet is an empty-handed, standing right-click; for mounts, riding counts. Staff can still tend any animal, but only owners build its trust. Neglect still costs trust after decay-grace. The old care.up and offline-care keys are ignored. The last pet is stored in last_pet_at, added by column name so Cooking's schema numbering cannot skip it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: breed mounts stat by stat Mounts carry separate health, speed and jump genes, inherited with the old BreedingBuddies roll: from a little below the weaker parent up to a quarter of the headroom above the better one, with very different parents lowering that ceiling. Parents' trust and the breeding food's stars open that headroom, so neglected or poorly fed parents cannot produce a better foal. Wild mounts roll each stat; staff spawns get the chosen value for all three. The animal's genetics is the average of the three, and records from before keep their genetics for every stat until bred or reset. Default shares are now 40% base, 50% genes and 10% trust, so full genes and full trust reach the type's maximum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: make living products believable and earned A cow now leaves manure for the fields (bone meal by default) instead of leather, which only comes from slaughter. A pig roots about, with dirt and a rooting sound, before turning up its enchanted dust; a chicken moults its feathers. Milk and the extra wool from shearing need a happy animal, like eggs and shedding already did; vanilla sheep wool still always comes off. Llamas give leather at slaughter rather than feathers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: start from BreedingBuddies' own settings Copying Cooking's husbandry.yml would have kept the old leather shedding, llama feathers and mount shares, so the takeover now copies only the animal records and config.yml starts from BreedingBuddies' defaults. Those defaults carry the horse maximums tuned on TF Main (27 health, 0.27 speed, 0.8 jump strength). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: bring back the BreedingBuddies animal menu The menu follows the original layout again instead of 54 slots of concrete bars: a header row (owners, name and growth, products, status, neutered), a row of five trust hearts in red and grey dye, a row of five genetics eggs with the star rating, and for mounts a row with health, speed and jump and each stat's gene. Names drop the italics, the status says what to do (feed, brush, pet or ride) and when trust starts to drop, and giving an animal up now takes a second click within five seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: bring back the BreedingBuddies effects Taming, linking a co-ownership token and gaining a co-owner play the original cherry petals and amethyst chime. Feeding and brushing play a softer sparkle, leaving hearts to the trust they earn. Neutering a horse plays the foal's cry it used to; other animals give a short yelp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: name the mount stat shares mounts.shares The shares set health, speed and jump alike, so mounts.speed was a misleading name inherited from Cooking. mounts.shares is read first; mounts.speed still loads with a warning to rename it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep TF Main's mount shares Trust keeps counting for 30% of a mount's stats, as it does on TF Main today: 40% base, 30% genes and 30% trust, which still reaches the type's maximum with full genes and trust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: say so when the plugin folder cannot be created On TF Dev the server may not create folders in plugins/, so the first start failed with a missing husbandry.db while copying Cooking's records. Startup now stops with a message saying to create the folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: protect husbandry records, ride trust and companion pets (#15) Failed Cooking takeovers no longer replay stale WAL records: the database is staged, residual WAL/SHM files are cleared and the copy is published by an atomic rename. Failed snapshot recovery keeps the animal, its owners and its snapshot, marking it missing for retry or staff review instead of deleting it, and a snapshot without a world names its animal in the log. Ride trust is awarded at MONITOR after other plugins could cancel the ride. CompanionPets bodies, tagged companionpets:pet, are left out of chunk-load and startup cleanup and keep their drops and experience when they die. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Interrupted Cooking takeovers could replay old WAL records, and failed snapshot recovery could delete an animal together with its owners and only recovery copy. Migration now clears residual WAL/SHM files and publishes a staged database with an atomic rename. Snapshot recovery distinguishes skipped, scheduled and failed attempts; failed attempts preserve all SQLite records and mark the animal missing for retry or staff review.
Ride trust is awarded at MONITOR with ignoreCancelled, after ownership checks and other plugins have had their chance to cancel the mount event. Cancelled rides preserve both trust and the daily pet cooldown.
Chunk-load and startup cleanup also used to delete CompanionPets dogs and cats as unowned animals. It now excludes bodies carrying the persistent companionpets:pet marker, including before CompanionPets enables, while untagged wild animals still follow remove-unowned. Deaths of those bodies also keep their drops and experience instead of being cleared as unowned livestock. A snapshot that has no world to restore into now logs which animal it is.
Based on feat/absorb-husbandry (#13).
Validation: mvn verify passes all 303 tests and the 100% line coverage gate. Regression tests cover real SQLite stale-WAL replay, interrupted database copying, cancelled and successful owner rides, snapshot recovery failures, and tagged wolves/cats surviving chunk loads, startup cleanup and death-drop clearing while wild animals are still removed.
🤖 Generated with Claude Code