-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Water Park experience improvements #2132
Open
tornac1234
wants to merge
4
commits into
SubnauticaNitrox:master
Choose a base branch
from
tornac1234:waterparks-overall-sync
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cb0b49b
Sync creature reproduction and egg hatching, fix fish movement in wat…
tornac1234 a2b3788
Fix players walking in water parks when spawning
tornac1234 e74e6ab
Fix creature size in water parks, fix level 100 creature respawner (t…
tornac1234 247060e
Fix simulation ownership not being given when first placing interior …
tornac1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Nitrox.Test/Patcher/Patches/Dynamic/WaterParkCreature_BornAsync_PatchTest.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using HarmonyLib; | ||
using NitroxTest.Patcher; | ||
|
||
namespace NitroxPatcher.Patches.Dynamic; | ||
|
||
[TestClass] | ||
public class WaterParkCreature_BornAsync_PatchTest | ||
{ | ||
[TestMethod] | ||
public void Sanity() | ||
{ | ||
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(WaterParkCreature_BornAsync_Patch.TARGET_METHOD); | ||
IEnumerable<CodeInstruction> transformedIl = WaterParkCreature_BornAsync_Patch.Transpiler(originalIl); | ||
transformedIl.Count().Should().Be(originalIl.Count() + 6); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Nitrox.Test/Patcher/Patches/Dynamic/WaterParkCreature_ManagedUpdate_PatchTest.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using HarmonyLib; | ||
using NitroxTest.Patcher; | ||
|
||
namespace NitroxPatcher.Patches.Dynamic; | ||
|
||
[TestClass] | ||
public class WaterParkCreature_ManagedUpdate_PatchTest | ||
{ | ||
[TestMethod] | ||
public void Sanity() | ||
{ | ||
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(WaterParkCreature_ManagedUpdate_Patch.TARGET_METHOD); | ||
IEnumerable<CodeInstruction> transformedIl = WaterParkCreature_ManagedUpdate_Patch.Transpiler(originalIl); | ||
transformedIl.Count().Should().Be(originalIl.Count() + 2); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
NitroxClient/GameLogic/Spawning/Metadata/Extractor/EggMetadataExtractor.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using NitroxClient.GameLogic.Spawning.Metadata.Extractor.Abstract; | ||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata; | ||
|
||
namespace NitroxClient.GameLogic.Spawning.Metadata.Extractor; | ||
|
||
public class EggMetadataExtractor : EntityMetadataExtractor<CreatureEgg, EggMetadata> | ||
{ | ||
public override EggMetadata Extract(CreatureEgg creatureEgg) | ||
{ | ||
// If the egg is not in a water park (when being picked up or dropped outside of one), | ||
// we only need the exact progress value because progress only increases while inside a water park | ||
if (Items.PickingUpObject == creatureEgg.gameObject || !creatureEgg.insideWaterPark) | ||
{ | ||
return new(-1f, creatureEgg.progress); | ||
} | ||
return new(creatureEgg.timeStartHatching, creatureEgg.progress); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
NitroxClient/GameLogic/Spawning/Metadata/Processor/EggMetadataProcessor.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using NitroxClient.GameLogic.Spawning.Metadata.Processor.Abstract; | ||
using NitroxClient.MonoBehaviours; | ||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata; | ||
using UnityEngine; | ||
|
||
namespace NitroxClient.GameLogic.Spawning.Metadata.Processor; | ||
|
||
public class EggMetadataProcessor : EntityMetadataProcessor<EggMetadata> | ||
{ | ||
public override void ProcessMetadata(GameObject gameObject, EggMetadata metadata) | ||
{ | ||
if (gameObject.TryGetComponent(out CreatureEgg creatureEgg)) | ||
{ | ||
if (metadata.TimeStartHatching == -1f) | ||
{ | ||
// If the egg is not in a water park we only need its progress value | ||
creatureEgg.progress = metadata.Progress; | ||
} | ||
else | ||
{ | ||
// If the egg is in a water park we only need its time start hatching value | ||
// the current progress will be automatically computed by UpdateProgress() | ||
creatureEgg.timeStartHatching = metadata.TimeStartHatching; | ||
|
||
// While being fully loaded, the base is inactive and coroutines shouldn't be started (they'll throw an exception) | ||
// To avoid, that we postpone their execution to 1 more second which is enough because time is frozen during initial sync | ||
if (Multiplayer.Main && !Multiplayer.Main.InitialSyncCompleted && | ||
creatureEgg.timeStartHatching + creatureEgg.GetHatchDuration() < DayNightCycle.main.timePassedAsFloat) | ||
{ | ||
creatureEgg.timeStartHatching = DayNightCycle.main.timePassedAsFloat + 1 - creatureEgg.GetHatchDuration(); | ||
} | ||
|
||
creatureEgg.UpdateProgress(); | ||
} | ||
} | ||
else | ||
{ | ||
Log.Error($"[{nameof(EggMetadataProcessor)}] Could not find {nameof(CreatureEgg)} on {gameObject.name}"); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we haven't got it on these so far but do we want to have the multi language support on them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would definitely say no. These are debug tools intended only for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that as well, just thought I would see people's appetite.
Also being a dev tool add and removing template strings would be a pain