Feat: Add Summoning Pets#983
Merged
Merged
Conversation
GregHib
requested changes
May 15, 2026
- Drop IncubatorDefinitions; walk Tables/Rows for incubator eggs directly. - Rename incubator state varbits to list-format with "empty/incubating/finished" labels; per-region end timer now a tick-based clock via start/remaining. - Collapse pet item/npc handlers to single comma-separated ops; thin PetDefinitions to a lazy Tables wrapper. - Replace the pet_stats blob with per-pet hunger/growth/warn vars; add DoubleValues so 0.0 defaults prune correctly. - Open pet_details (663) instead of familiar_details for pet followers; dismiss handler now globs *_details. - Stop the kitten in place when the Stroke option is used.
Contributor
Author
|
Review feedback addressed in 1b3959f. Per-comment notes:
|
The pet_details (663) call/dismiss buttons emit cache option labels
distinct from familiar_details (662) ("Call Follower" / "Dismiss
Familiar" / "Dismiss Now"). The existing handlers keyed off those
exact strings and silently no-op'd on pets.
Wildcard the option label (`*:*_details:call` / `dismiss`) and branch
on follower-vs-pet inside. Pet dismiss always calls pickupPet so the
item is returned to inventory; familiar dismiss keeps the
confirm-vs-immediate distinction.
Both pet_details:dismiss and the summoning_orb's right-click Dismiss now call dismissPet, which removes the NPC and clears pet state without putting the item back in inventory — the pet runs free. The pet_details path wraps it in an "Are you sure you want to release your pet?" confirmation since the item is gone for good; the orb's right-click path stays a one-click action (matches the familiar "Dismiss Now" semantics).
If the player had a minimap walk queued when they selected Stroke, the player kept moving during the dialogue suspension while the kitten sat in EmptyMode. When Follow was restored at the end of the interaction the kitten had to sprint several tiles to catch up. Clear the player's pending steps and face the kitten at the start of the interaction so the player stays put for the animation.
PR GregHib#980 deleted softQueue; replace the three pet/kitten call sites with weakQueue (closest semantic match: easily-preempted fire-and- forget) and drop the leftover `player.` prefixes inside the lambdas since Player is now the lambda receiver. While in KittenInteract, fix two bugs in chaseVermin: - The cat used to chase pirates because "pirate" contains the substring "rat". Predicate now matches the npc string id with a `_` word boundary (rat / *_rat / rat_* / *_rat_*). - The cat never caught anything because the 5-tick callback always fired the failure message. Roll a 33% catch chance up front; on success despawn the rat and message the win. Adjacency guard covers the case where the rat wanders before the kitten arrives.
Pre-chase dialogue runs before the kitten engages: player asks if it wants to hunt, kitten replies, player tells it to take it easy. On success the wiki "Hey well done puss, you got it!" / kitten "MeeeoooooW!" pair fires, and every 10th catch logs the milestone "Well done puss! N horrible rodents caught!". Caught count persists on the player via pet_rats_caught.
Branches every cat interaction on whether the player is wearing a catspeak amulet and whether the pet is a kitten or adult cat. Without amulet (kitten + adult cat): - Stroke narrates "You softly stroke your cat." + "Purr...purr..." + "The cat turns on its side while you bend down to pet it." - Chase vermin keeps the existing 3-line pre-chase chatter and the wiki success/fail/milestone copy. - Shoo away gains the wiki "Are you sure you want to shoo away the cat?" confirmation + "You choose not to shoo away the cat." cancel message. - Talk-to plays the simple "Hey puss! Any news?" / Purr / Meow lines. - "There aren't any vermin around." message when no rat in scan radius. With catspeak amulet (adult cat only): - Stroke prepends Player "Who's a good cat then?" / Cat "Me, me. Scratch me behind the ears." chathead exchange. - Chase vermin uses the wiki adult opener "Go on get that nasty rodent." / Cat "Yesss, food." - Talk-to opens a 4-option chathead loop (how are you / how old / where to / what to do) with a quit option. - Pick-up plays "Come here furball." / Cat "Can we go adventuring together again, soon?" / Player "Soon, I promise." before the item returns to the inventory. - Drop/Release plays "Hey cat, do you fancy stretching your legs..." / Cat "Miaaow, Are we going adventuring?" / "We'll see puss, we'll see." before summoning. KittenInteract registers Interact-with against every cat-like npc (baby, grown, overgrown) so the menu is reachable past kittenhood. PetScripts in Pet.kt routes the Pick-up / Drop / Release / Talk-to operate handlers to the catspeak variants when the conditions match, falling back to the generic pet handlers otherwise.
Three full-sentence lines were being emitted as overhead chat when they should have been chathead dialogue: - Cat's pre-chase reply "Meoowww. Yeah! Let's go kick some fur!" was cat.say (overhead bubble); now an npc<Happy> chathead line. - Player's success "Hey well done puss, you got it!" and the every- 10th-catch "Well done puss! N horrible rodents caught!" were player overhead; now player<Happy> chathead. Short imperative / sound-effect lines (Go on puss..., Shoo cat!, Meeeoooooowwww!, Eek!, MeeeoooooW!) stay as overhead — those belong above the speaker's head.
- Catspeak "Hey cat, do you fancy stretching your legs..." exchange now plays for every cat life stage (including kittens), not only the adult/overgrown items. - Dropping a cat without the amulet now plays a "Miaow!" overhead one tick after the spawn settles (the new NPC is wired in summonPet's own weakQueue at +2; we fire at +3 so pet?.say targets the freshly summoned cat). Folded the duplicated Drop/Release item-option bodies into a single suspend helper Player.dropPet to keep the branching in one place.
Splits the chase-vermin weakQueue into a +4 pounce tick and a +5 resolve tick. When the cat has reached the rat (adjacency check) it plays the new pet_pounce_kitten anim, then a tick later restores Follow and resolves the catch/miss outcome. The 9168 anim id is a best guess on the kitten anim grouping (stroke is 9173) and may need swapping for one of 9167/9169-9172 after a visual check in-game.
PR GregHib#799 added a Double->Int*10 conversion in PlayerSave's variables load branch to migrate old fractional XP saves into the new int experience format. The check was unconditional, so every Double variable got collapsed on load — including pet_*_hunger and pet_*_growth (declared format = "double"), which were turning into ints after every restart and then defaulting back to 0.0 on the next get<Double>() because Int can't be smart-cast to Double. Gate the conversion on VariableDefinitions.get(key)?.values being IntValues so it only fires for keys the current schema actually expects to be ints. Doubles for genuinely-double-typed vars now round-trip verbatim, which lets pet hunger / growth persist across server restarts.
GregHib
requested changes
May 17, 2026
The chase resolve was wrapped in nested weakQueues, which the new ActionQueue clears every time any Strong action enters the queue (clicking another NPC/object, taking a hit, teleporting). When the resolve dropped, the cat was left in EmptyMode and reverted to its default idle/hunt wander. Swap the two weakQueue calls in chaseVermin for queue (Normal priority). Normal queues sit in the main queue list, only weakQueue gets cleared on Strong, so the Follow restoration always fires — even after a mid-chase interruption.
Merges upstream/main (PR GregHib#984 brings inc(max) and skill drop gating). Engine reverts per Greg: - Delete DoubleValues from VariableValues, plus its factory mapping. - Remove both legacy double migrations from PlayerSave (variables loop and the experience fractional path). Doubles are not used in any player variable in the new schema. Pet stats moved to integers on a 0..10000 scale: - pet_state.vars.toml regenerated with format = "int". - pets.tables.toml swaps growth_rate (double) for growth_per_tick (int = rate * 50 * 100 per 30s tick). - PetState drops the PetStats class and updatePetStats wrapper; the getters return Int, callers use inc(key, amount, max = PET_STAT_MAX) and dec(key, amount) directly (PR GregHib#984 added the max parameter). - PetTimers thresholds become 7500 / 9000 / 10000 on the new scale, HUNGER_BABY/GROWN become 125 / 90 per tick. PetFeeding feeds 1500. - sendPetDetailsStats divides by 100 on the way out so the orb bars stay on the 0..100 client scale. PetDefinitions deleted; data lives in Tables now. The PetDefinition data class is gone too. Pets.kt adds RowDefinition extensions (isCatLike, stageForItem/Npc, npcFor/itemFor, nextStageItem/Npc, isFinalStage, ambientPhrases) plus petRowForItem / petRowForNpc and allPetRows lookup helpers. Every caller (Pet, KittenInteract, PetTimers, PetFeeding) now consumes RowDefinition directly. The Koin singleton in GameModules is gone. Incubator suffix derivation collapses to it.target.id.removePrefix("incubator_"). Renamed the per-region base objects to incubator_taverley (28550) and incubator_yanille (28352); kept the shared incubator_idle (28336) / incubator_active (28359) transform names so the dispatch finds a registered string id for the displayed mesh. target.id always reflects the base, so the suffix extraction never sees idle/active. The regionVarbits map and the tile.region.id helper are deleted. KittenInteract: - isRat simplifies to id.startsWith("rat") so giant_rat / warped_rat drop out of the chase pool. - talkToCatWithAmulet replaces the while(true) + keepGoing flag with Greg's recursive-option pattern: each answer recurses back into talkToCatWithAmulet, the quit option has no body. pet.npcs.toml: every options = { ... } map deleted; npcs only need the id field. dragon.drops.toml: black dragon egg gated on skill = "summoning", equals = 99 (PR GregHib#984 syntax). Tests adapted: PetLogoutTest stats are ints; IncubatorUseEggTest uses incubator_taverley for the test fixtures.
The previous version swapped the cat into EmptyMode for the duration of the dialogue and restored Follow afterwards. Restoring Follow recalculates against player.steps.follow immediately, which queues a step toward the player's last footprint tile and the cat ends up walking a tile out then back in. Use the movement_delay clock to suspend the cat's movement for the length of the dialogue instead, then clear the clock plus any queued steps at the end. Follow mode stays active throughout, so when the clock releases there is nothing for the recalculation to fight and the cat stays where it was being stroked.
Both pet shop owners (npc ids 6892 and 6893) share the same dialogue tree per the wiki, so a single PetShopOwner script handles both with one npcOperate matcher. Main menu offers four options: open the pet shop (pet_shop), buy a puppy, ask about other available pets, and sell spirit shards. Puppy purchase guards against owning a dog already, runs the wiki exchange about the 500 gold price, then either takes the coins and hands over a default colour puppy or backs out gracefully on no inventory space or insufficient coins. Six breeds are wired (Bulldog / Dalmatian / Greyhound / Labrador / Sheepdog / Terrier). The available-pets branch reproduces the wiki tree verbatim covering nuts, birds + incubator, Karamja lizards, geckos / raccoons and the banana-in-the-trap monkey tip. Spirit shard sale uses intEntry for the count, drops the shards and credits 25 coins each, with a graceful early-out when the player has none on them. Chathead expressions picked per line: Quiz for the player asking questions, Neutral when accepting / refusing, Happy and Pleased for the shop owner's friendlier or proud explanations.
dialogue_pick_a_puppy in summoning.ifaces.toml now declares the six breed components (.bulldog 3, .dalmatian 4, .greyhound 5, .terrier 6, .sheepdog 7, .labrador 8). Ordering taken from 2009scape's PuppyInterfacePlugin click map. PetShopOwner opens the iface instead of running a kotlin choice() list for breed selection, then suspends on pauseInt() and resumes against the clicked component's index. continueDialogue handlers per breed component resolve the suspension. Selecting a breed runs the existing buyPuppy flow (price exchange, coin / inventory checks, puppy item handed over). BREEDS order rearranged to match the iface index map so BREEDS.getOrNull(index) lands on the correct breed.
The cache buttons on iface 668 don't ship the continue-dialogue packet, so the existing continueDialogue handlers never received the click and the suspended caller stayed parked. Register each breed component under interfaceOption as well so the InteractInterface packet path also resumes the pauseInt; the continueDialogue registration stays as a fallback for any client variant that does ship the dialogue packet.
The option<Quiz>() inline form echoes the option text as a player chathead before invoking the block. spiritShards itself doesn't say that line, but the choice menu shows the question and then the player chathead repeated it a second time. Use the plain option() form for the shards entry so the player chathead echo is skipped and the conversation flows menu -> npc reply -> intEntry (or refusal).
I had the direction backwards: the Talk-to choice was correctly echoing "Are you interested in buying spirit shards?" as a player chathead, but the right-click Sell-shards path skipped straight to the npc reply. Restored the option<Quiz> inline echo on the Talk-to entry and added an explicit player<Quiz> line at the start of the Sell-shards handler so both paths play the same beat: player asks -> npc "I certainly am..." -> intEntry / refusal.
Two restart-safety fixes for the pets feature. Incubator state varbits now persist: - persist = true on incubator_state_taverley / incubator_state_yanille so the per-region state survives logout, instead of resetting to "empty" on relog and making the inspect / take-egg / place-egg paths think the incubator is empty even though the egg id is still saved. Incubator clock reset on relog: - Player.playerSpawn now checks each suffix; if the egg is still on file and the state is "incubating", restart the tick clock fresh from the egg row's incubation_seconds. GameLoop.tick resets to 0 on each server boot so the saved deadline is no longer comparable after a restart. Resetting the clock means the player loses any on-server progress, but the egg itself is preserved. Double-summon race in summonPet: - pet_index was written in a +2 weakQueue, so two pet drops on the same (or very next) tick both saw pet == null on the gate check and spawned parallel NPCs, leaving one orphaned. - Set pet synchronously now so the gate catches the second drop. - Also tighten the gate with pet_active_item.isNotBlank() (only when not restarting) so a follow-up regression in this area doesn't silently slip past again. The relogin path passes restart=true after clearing pet_index, so re-summon on login still works.
Cat-like baby pets (kittens) now track a loneliness stat alongside hunger and growth. The counter ticks up 125 per 30s pet_tick on the shared 0..10000 scale (40 minutes to run away). At 9000 (~36 min) the player sees "Your kitten is feeling lonely. Pay it some attention before it runs off." Hitting 10000 dispatches "Your kitten got lonely and ran away." and despawns the kitten. Resets to zero whenever the player interacts: Interact-with menu opens (Stroke / Chase vermin / Shoo away all count) and Talk-to on a kitten npc. Adult cats, hellcats, dogs, dragons etc. are unaffected because tickLoneliness only fires for isCatLike + PetStage.Baby. New persisted vars per cat-like row: pet_<id>_loneliness and pet_<id>_lonely_warn. clearPetStats clears both alongside hunger / growth / warn so a run-away or pickup wipes them too.
dog_talks.tables.toml carries every conversation per the wiki
transcripts (Bulldog, Dalmatian, Greyhound, Labrador, Sheepdog,
Terrier). One row per conversation with breed / stage / optional
inventory condition / a list of speaker-prefixed lines.
Speaker prefixes per line:
- b: overhead bark (dog.say) for puppy lines where the wiki shows
raw barks with no translation
- d: dog chathead (npc<Happy>) for adult lines that the wiki gives
in bark + parenthetical translation form
- p: player chathead (player<Happy>)
- no prefix: narrator chatbox via statement()
Pets.kt gains a RowDefinition.dogBreed() helper that collapses
colour suffixes ("bulldog_1", "bulldog_2") back to the canonical
breed name. Mirrors isCatLike().
DogTalk.kt holds the Player.talkToDog dispatcher: filters
dog_talks rows by breed + stage, prefers an inventory-conditional
branch when the player carries logs (Dalmatian), cup_of_tea
(Bulldog) or wool (Sheepdog), otherwise picks a random
unconditional row. Each line is rendered per its prefix.
Pet.kt's Talk-to handler now routes through a when block: cat-
like still goes to talkToCatWithAmulet/talkToCatPlain (kitten
loneliness reset preserved); dogs (row.dogBreed() != null) go to
talkToDog; everything else stays on the generic talkToPet.
The PR widened chathead word-wrap from 380 -> 400 inside the shared splitDialogueLines helper used by every npc(npcId, expression, ...) and player(expression, ...) call. That re-flowed line breaks for every existing dialogue in the game even though the change was only needed for the new pet chathead Int-anim overload. Restore the original 380 single-pass behaviour on the string- expression npc/player paths and move the 400px + hard-break-aware splitter into a new splitPetDialogueLines used only by the Int-anim overload. Revert NPCChatTest / PlayerChatTest expectations to the pre-PR wrap.
Follow-up to "Guard Player.pet getter against NPC index reuse". The new getter requires pet_active_item to be set before NPCs.indexed(pet_index) is considered a real pet. The summon- familiar exclusivity test assigned player.pet directly without the matching active_item write, so the guard correctly returned null and the test no longer represented an active pet. Mirror the real-life summonPet contract by writing the active item alongside the slot.
This reverts commit eace2cb.
This reverts commit 5bef406.
The dialogue chathead system already treats <br> as a hard line break, so the bark and its bracketed translation are split with <br> rather than a literal \n. This drops the need for the custom \n-splitting added to the dialogue helpers (reverted separately).
Restore main's line handling (\n split or width-380 word-wrap); content uses <br> for hard breaks so the extra \n-wrapping pass was unnecessary. The new npc(npcId, animationId, text) chathead-animation overload is kept.
Restore main's line handling; content uses <br> for hard breaks so the extra \n-wrapping pass was unnecessary.
A long queue exists to flush all remaining code on logout even when a suspension's predicate isn't yet satisfied, so the readiness guard is dropped and Custom suspensions resume unconditionally like Continue/Delay. The unrelated next-pointer capture in clear(priority) is left intact.
The hint field registers the area as a Penguin Hide-and-Seek location, which isn't intended here.
The hint field registers the area as a Penguin Hide-and-Seek location, which isn't intended here.
Declare the stage column as list<string> and read it with stringList so the life-stage filter no longer splits a comma-separated string at runtime. Both readers (DogTalk and talkToPet) updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collect the cat-like NPC ids into a single comma-separated list and register one npcOperate, resolving the target inside the handler, instead of looping a separate registration per id (lower startup and memory overhead).
Replace the var done / while(!done) loop with a recursive local menu() that each option re-invokes, and the quit option simply falls through.
Call talkWith(cat) up front and use the id-less npc() overload throughout, removing the repeated cat.id argument on every chathead line.
Each option recursively re-invokes talkToHellcatWithAmulet and the quit option falls through, replacing the var done / while(!done) loop.
NPCs.add returns a non-null NPC and never throws, so the rollback wrapper is unnecessary.
Drop the cached itemIndex/npcIndex maps; petRowForItem/petRowForNpc now scan
Tables.get("pets").rows() for the matching stage id rather than holding a
second in-memory copy of the table. Callers only ever have an item/npc id, so
the lookup is a reverse scan.
Replace the hardcoded BREEDS list and the DOG_BREEDS set with a dog_breeds table; PetShopOwner and dogBreed() read the breed option/id/puppy-item from the table instead of in-code literals.
Records the pre-rebase PR head as an ancestor so GitHub PR GregHib#983 can be reopened and re-sync its head; tree is kept identical to the rebased branch (44c316a), so no file content changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add pets system
Summary
Adds the pets system to Void. Pets are non-combat follower NPCs that follow the player, grow over time, get hungry, can be fed, and can be talked to. A player can have one follower at a time (pet or combat familiar, not both).
Features
pet:render as overhead speech; the rest as chatbox statements.Notable files
game/src/main/kotlin/content/skill/summoning/pet/: new package containing the registry, lifecycle, timers, feeding, incubator, dialogue, and persistence helpers.game/src/main/kotlin/content/skill/summoning/Summoning.kt: pet/familiar mutual exclusion and orb-option routing.game/src/main/kotlin/content/area/misthalin/varrock/Gertrude.kt: Minimal dialogue for Gertrude.data/skill/summoning/pet/: pet registry, incubator egg registry, NPC and item string-id overrides, incubator object string-ids, pet/incubator variable definitions.data/skill/summoning/summoning.ifaces.toml,data/entity/player/modal/toplevel/gameframe.ifaces.toml,data/skill/summoning/summoning.varps.toml: missing interface option and varp declarations.engine/src/main/kotlin/world/gregs/voidps/engine/data/PlayerSave.kt: bumps the save reader buffer for the pet stats blob.game/src/test/kotlin/content/skill/summoning/pet/: regression tests covering drop-to-summon, logout persistence, mutual exclusion, ownership, overhead chat, Talk-to dialogue, incubator flow, and orb/Follower Details routing.Test plan