-
Notifications
You must be signed in to change notification settings - Fork 44
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
[question] #50
Comments
If you want to patch only if there's a condition then you can just make a Harmony instance and patch/unpatch it as needed, you'll just need to patch in a way that only affects that specific patch, so either PatchAll(Type) or Patch(). It's much easier to just always patch and check the condition inside of the patch. If the patched method doesn't run often then there will be no real performance effect. |
can u give me example like `[HarmonyPatch(typeof(MissionManager), nameof(MissionManager.SetMission))]
}` like that ( it's alwasy patching even patchmissions == false ) |
If you want to patch a single method then you can do something like this https://github.com/IllusionMods/IllusionModdingAPI/blob/dc09eed2c1b740e32f63400e5efde527ddad7077/src/KKSAPI/MainGame/TopicApi.cs#L242-L243 and then do h.UnpatchSelf() to remove the patch. You can then patch again, rinse and repeat. |
this is my code , I just want to know when ghostInfo.Syncvaluenetworked works print the parameters to console I don't want to patch that method
it print's the parameteres however it's also patching the method I don't want to patch thats why I added return true
cuz if u add return false = skip the orginial method
do you know how I can get it to patch only if certain conditions are met?
for example
if(checkbox.checked == true ) patch(ghostInfo.SyncValuesNetworked)
The text was updated successfully, but these errors were encountered: