Skip to content

Add sync for CrashFish - #2866

Open
MistaOmega wants to merge 2 commits into
SubnauticaNitrox:masterfrom
MistaOmega:feature/2673/sync-rest-of-crashfish-behaviour
Open

MistaOmega wants to merge 2 commits into
SubnauticaNitrox:masterfrom
MistaOmega:feature/2673/sync-rest-of-crashfish-behaviour

Conversation

@MistaOmega

@MistaOmega MistaOmega commented Aug 29, 2026 •

Copy link
Copy Markdown
Collaborator

Linked Issues / Context

Should conclude the fixes for: #2673

Monos Status

  • Crash (creature) : [X] - now Added crash to whitelist
  • ProtectCrashHome : [CAW] Safe to add, so added, now [X]
  • AggressiveWhenSeeTarget (sibling) : [X]
  • LastTarget : [X]
  • SwimBehaviour / Rigidbody : [X]
  • LiveMixin : [X]
  • CreatureFear : [X]
  • IPropulsionCannonAmmo.OnRelease() : [X] - Added in this patch

Description of Change

Added ProtectCrashHome to creatureActionWhitelist and Crash to syncedCreatureWhitelist
Synced up the prop cannon onrelease behaviour

Validation

Was able to see crash fish attacking as targeted player
Identified player B seeing crashfish aggro at player A after player A grabbed and released Crashfish with prop cannon

PR Checklist

  • PR rebased on top of main at the time of opening
  • Has tests for the changes (if applicable)
  • Has a linked issue
  • Has been tested in-game (if applicable) -- Ideally would need a proper 2 person test as unsure if applies properly as i've done

@MistaOmega
MistaOmega force-pushed the feature/2673/sync-rest-of-crashfish-behaviour branch from 013ff91 to 46c958c Compare August 29, 2026 17:36
@dartasen

Copy link
Copy Markdown
Member

#2627

Please make sure to follow the process described in this epic in order to add a creature to the whitelist

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Test Results

  1 files   -   1    1 suites   - 1   11s ⏱️ -9s
269 tests ±  0  264 ✅ ±  0  5 💤 ±0  0 ❌ ±0 
269 runs   - 269  264 ✅  - 264  5 💤  - 5  0 ❌ ±0 

Results for commit 9c5f69b. ± Comparison against base commit eb4535f.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes follow existing packet/processor and AI-whitelist patterns in the codebase, and the new behavior is narrowly scoped to Crashfish targeting replication.

Pull request overview

This PR extends Nitrox’s AI synchronization for Crashfish-related behavior to address multiplayer desyncs described in #2673 (notably around Crashfish targeting/aggro when affected by the Propulsion Cannon).

Changes:

  • Add ProtectCrashHome to the synced CreatureAction whitelist and add Crash to the synced creature whitelist.
  • Introduce a new CrashAttackLastTarget packet plus client/server processors to relay and apply Crashfish “attack last target” behavior.
  • Add a dynamic patch on Crash’s IPropulsionCannonAmmo.OnRelease() to broadcast the Crashfish target when it’s released.
File summaries
File Description
NitroxPatcher/Patches/Dynamic/Crash_OnRelease_Patch.cs New dynamic patch to emit a packet when a Crashfish is released from the Propulsion Cannon.
NitroxClient/GameLogic/AI.cs Expands AI whitelists and adds a handler to apply Crashfish “attack last target” on receivers.
NitroxClient/Communication/Packets/Processors/CrashAttackLastTargetProcessor.cs New client packet processor that applies the Crashfish target/attack update.
Nitrox.Server.Subnautica/Models/Packets/Processors/CrashAttackLastTargetProcessor.cs New server processor to relay the packet to clients who can see the involved entities.
Nitrox.Model.Subnautica/Packets/CrashAttackLastTarget.cs New packet definition carrying creature + target NitroxIds.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dartasen dartasen added Area: AI Related to state machines (as used by the fish) Status: Needs testing Pull Request is waiting for testing labels Sep 9, 2026
@dartasen dartasen changed the title feat(AI): Add Crash and ProtectCrashHome to respective whitelists Add sync for CrashFish Sep 9, 2026
@dartasen

dartasen commented Sep 9, 2026

Copy link
Copy Markdown
Member
  • Crashfish explosion isn't played for players that are not simulating the fish (you just suddenly see the fish disappear out of existence)
  • Half of the crash homes we found did not have a fish inside (and were already opened)

Don't know if it's related to that PR or not but we had a lot of those errors :

[21:03:25.117] [ERR-UNITY] NullReferenceException: Object reference not set to an instance of an object
NitroxClient.GameLogic.AI.BroadcastNewAction (Nitrox.Model.DataStructures.NitroxId creatureId, Creature creature, CreatureAction newAction) (at <53e056b29a6d468f9143fdf1e4c5044d>:0)
NitroxPatcher.Patches.Dynamic.Creature_ChooseBestAction_Patch.Postfix (Creature instance, System.Boolean runOriginal, Nitrox.Model.DataStructures.NitroxId state, CreatureAction& result) (at <f9d2ab92ae134068848ef93f1bea8246>:0)
(wrapper dynamic-method) Creature.DMD<Creature::ChooseBestAction>(Creature,single)
Creature.UpdateBehaviour (System.Single time, System.Single deltaTime) (at <c055c80802d14a9db359fbdc91eb371c>:0)
Creature.ScheduledUpdate () (at <c055c80802d14a9db359fbdc91eb371c>:0)
ScheduledUpdateBehaviourSet.CallUpdate (System.Int32 startIndex, System.Int32 numItems) (at <f4997fa4a732463aa415fdc5ebc447b9>:0)
UnityEngine.Debug:LogException(Exception, Object)
ScheduledUpdateBehaviourSet:CallUpdate(Int32, Int32)

@MistaOmega

MistaOmega commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Will take a peep this weekend 🙏
Waiting on #2873

@MistaOmega
MistaOmega force-pushed the feature/2673/sync-rest-of-crashfish-behaviour branch from 4fd0423 to 9c5f69b Compare September 25, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: AI Related to state machines (as used by the fish) Status: Needs testing Pull Request is waiting for testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants