-
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
Crops persistence #2137
Open
tornac1234
wants to merge
13
commits into
SubnauticaNitrox:master
Choose a base branch
from
tornac1234:crops-persistence
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.
+1,851
−276
Open
Crops persistence #2137
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ff40e88
Add crops persistence (for water parks, and pots and all)
tornac1234 5431f87
Sync trash can
tornac1234 b1b0088
Add sync for plant exact slot in the planter
tornac1234 d2a4e85
Add sync for prefab picking deleting the giver object (required for m…
tornac1234 58f570f
Sync fruit growing and harvesting (from plants and objects like kelp)
tornac1234 38a29bf
Add a search by id in SceneDebugger, added some comments, some refact…
tornac1234 72a40d4
Sync fastgrow and fasthatch commands
tornac1234 8623775
Some refactoring, bug fixing (modal), and commenting
tornac1234 7c904bf
Fix a bug where a plant growing would duplicate itself and bug the pl…
tornac1234 2e1a58e
Centralize and improve the reference holding
tornac1234 b79a43d
Some refactoring, and change FastCommand to take the FastCheat enum a…
tornac1234 0091f1d
Fix numerous bugs related to water park edge cases (splitting and uni…
tornac1234 10d6b3c
Fix many instances of water park item transfer bugs
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,11 @@ public class Items | |
public static GameObject PickingUpObject { get; private set; } | ||
private readonly EntityMetadataManager entityMetadataManager; | ||
|
||
/// <summary> | ||
/// Whether or not <see cref="Inventory.Pickup"/> is running. It's useful to discriminate between Inventory.Pickup from a regular | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really understand this comment. What is regular? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cut the comment again 💀 "a regular Pickupable.Pickup" |
||
/// </summary> | ||
public bool InventoryPickingUp; | ||
|
||
public Items(IPacketSender packetSender, Entities entities, EntityMetadataManager entityMetadataManager) | ||
{ | ||
this.packetSender = packetSender; | ||
|
@@ -36,14 +41,18 @@ public void PickedUp(GameObject gameObject, TechType techType) | |
PickingUpObject = gameObject; | ||
|
||
InventoryItemEntity inventoryItemEntity = ConvertToInventoryEntityUntracked(gameObject); | ||
Log.Debug($"PickedUp item {inventoryItemEntity}"); | ||
|
||
if (inventoryItemEntity.TechType.ToUnity() != techType) | ||
{ | ||
Log.Warn($"Provided TechType: {techType} is different than the one automatically attributed to the item {inventoryItemEntity.TechType}"); | ||
} | ||
|
||
PickupItem pickupItem = new(inventoryItemEntity); | ||
packetSender.Send(pickupItem); | ||
|
||
if (packetSender.Send(pickupItem)) | ||
{ | ||
Log.Debug($"Picked up item {inventoryItemEntity}"); | ||
} | ||
PickingUpObject = null; | ||
} | ||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Reflection; | ||
using NitroxClient.GameLogic; | ||
using NitroxModel.Helper; | ||
|
||
namespace NitroxPatcher.Patches.Dynamic; | ||
|
||
public sealed partial class Inventory_Pickup_Patch : NitroxPatch, IDynamicPatch | ||
{ | ||
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((Inventory t) => t.Pickup(default, default)); | ||
|
||
public static void Prefix() | ||
{ | ||
Resolve<Items>().InventoryPickingUp = true; | ||
Measurity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
public static void Finalizer() | ||
tornac1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
Resolve<Items>().InventoryPickingUp = false; | ||
} | ||
} |
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
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.
V minor