Pet missing system#584
Merged
Merged
Conversation
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.
Description
Adds a temporary-absence mechanic for pets. A pet can be sent away for a
configurable number of rounds and will automatically return when the countdown
expires. While absent the pet is hidden from all game systems — room
descriptions, combat, stat and buff contributions, item interactions, and
script dispatch — until it comes back.
Changes
Core pet model (
internal/pets/pets.go)MissingCountdown intfield toPet. When non-zero the pet is absent.IsMissing() bool— returns true when the countdown is positive.GoMissing(rounds int)— sets the countdown; zero or negative clears it immediately.DecrementMissing() bool— decrements by one each round; returns true the round the countdown reaches zero.Round tick (
internal/hooks/NewRound_UserRoundTick.go)PetReturnis fired on the pet script.PetActis suppressed while the pet is missing and on the same round it returns.Scripting (
internal/scripting/)ScriptPetgainsIsMissing()andGoMissing(rounds)methods exposed to JavaScript.GoMissingwith a positive value firesPetLeave(only when the pet is not already missing, to avoid duplicate events on countdown extensions).GoMissing(0)firesPetReturnimmediately.GetPetnow accepts the owner'suserIdso script-triggered events have the context they need.PetLeaveandPetReturnare registered in the schema as new pet script events.Commands — missing-state guards
The following commands now treat a missing pet as non-present, matching the
same behaviour as a player who has no pet at all:
usercommands/feed.gousercommands/get.goget <item> from petignores missing petusercommands/give.gogive <item> to petignores missing petusercommands/go.gousercommands/look.golook pettargets missing pet for a "not here" message; restored first-person "You look at X" lineusercommands/pet.gousercommands/usercommands.goRoom and combat systems
rooms/roomdetails.go— missing pet excluded from the visible-players list.rooms/rooms.go—FindHasPetflag excludes missing pets for both players and mobs.combat/combat.go— pet combat participation gated on!IsMissing().characters/character.go—StatModandreapplyPermabuffsskip pet contributions while missing.GMCP (
modules/gmcp/gmcp.Char.go)CharGMCP payload.Documentation (
_datafiles/guides/building/scripting/)FUNCTIONS_PETS.md— documentsIsMissing()andGoMissing()with examples.SCRIPTING_PETS.md— documents thePetLeaveandPetReturnscript events with examples.Example script usage