Skip to content
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

fix when prawn suit drilling doesn't save raw materials globally #2301

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions NitroxPatcher/Patches/Dynamic/ResourceTracker_OnPickedUp_Patch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Reflection;
using NitroxClient.GameLogic;
using NitroxModel.Helper;
using UnityEngine;

namespace NitroxPatcher.Patches.Dynamic;

/// <summary>
/// Event when someone picks up an item.
/// </summary>
public sealed partial class ResourceTracker_OnPickedUp_Patch : NitroxPatch, IDynamicPatch
{
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((ResourceTracker d) => d.OnPickedUp(default));

public static bool Prefix(ResourceTracker __instance)
{
TechType instanceTechType = __instance.techType;
GameObject instanceGameObject = __instance.gameObject;
if (instanceTechType != null && instanceGameObject != null)
{
Resolve<Items>().PickedUp(instanceGameObject, instanceTechType);
}
return true;
}
}