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

[EXILED::Events] BeingObserved event #72

Closed
wants to merge 14 commits into from
Closed

Conversation

6hundred9
Copy link

@6hundred9 6hundred9 commented Aug 19, 2024

Description

Describe the changes
A new Scp173 event for when it's being observed

What is the current behavior? (You can also link to an open issue here)

What is the new behavior? (if this is a feature change)

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No

Other information:


Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing

6hundred9 and others added 3 commits August 19, 2024 21:57
Co-Authored-By: ZeroTwo <63092138+notzer0two@users.noreply.github.com>
Copy link

@VALERA771 VALERA771 left a comment

Choose a reason for hiding this comment

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

Hmm... I'm not sure that you've tested your IL code

Copy link

@VALERA771 VALERA771 left a comment

Choose a reason for hiding this comment

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

If transpiler works fine

@Misaka-ZeroTwo
Copy link
Collaborator

Scp173BeingObservedEventArgs should be renamed to BeingObservedEventArgs to ensure consistency. Same goes with patches.

@6hundred9
Copy link
Author

Scp173BeingObservedEventArgs should be renamed to BeingObservedEventArgs to ensure consistency. Same goes with patches.

Will do when I come back home, might be a little late kek

@6hundred9 6hundred9 changed the title [EXILED::Events] Scp173BeingObserved event [EXILED::Events] BeingObserved event Aug 28, 2024
@VladTheCow VladTheCow added the Requires Testing Things need to be verified by an Exiled Developer/Contributor label Sep 2, 2024
@VladTheCow
Copy link
Member

@ALEXWARELLC Do you mind testing it?

@iamalexrouse
Copy link

@ALEXWARELLC Do you mind testing it?

Yeah, I'll do a test now.
If I find any bugs I will make a change request, otherwise, I'll approve the PR if testing is complete and the code isn't pure horse ass 👍

@iamalexrouse
Copy link

Hi! @6hundred9

So I've tried to perform some testing, but I've received an error which is messing with my ability to do so, and I am to believe that you'll need to verify that your IL has been written correctly. You can find the error below.

[ERROR] [Exiled.Events] Patching by event failed!
                                 HarmonyLib.HarmonyException: Patching exception in method System.Boolean PlayerRoles.PlayableScps.Scp173.Scp173ObserversTracker::IsObservedBy(ReferenceHub target, System.Single widthMultiplier) ---> System.Reflection.AmbiguousMatchException: Ambiguous match in Harmony patch for PluginAPI.Events.EventManager:ExecuteEvent ---> System.Reflection.AmbiguousMatchException: Ambiguous match found.
                                   at System.DefaultBinder.FindMostDerivedNewSlotMeth (System.Reflection.MethodBase[] match, System.Int32 cMatches) [0x00024] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.RuntimeType.GetMethodImplCommon (System.String name, System.Int32 genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00079] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00000] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.Type.GetMethod (System.String name, System.Reflection.BindingFlags bindingAttr) [0x0000e] in <75633565436c42f0a6426b33f0132ade>:0
                                   at HarmonyLib.AccessTools+<>c__DisplayClass27_0.<Method>b__0 (System.Type t) [0x00000] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.AccessTools.FindIncludingBaseTypes[T] (System.Type type, System.Func`2[T,TResult] func) [0x00000] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.AccessTools.Method (System.Type type, System.String name, System.Type[] parameters, System.Type[] generics) [0x0004b] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                    --- End of inner exception stack trace ---
                                   at HarmonyLib.AccessTools.Method (System.Type type, System.String name, System.Type[] parameters, System.Type[] generics) [0x0008e] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at Exiled.Events.Patches.Events.Scp173.BeingObserved+<>c.<Transpiler>b__0_0 (HarmonyLib.CodeInstruction i) [0x00000] in <fb60fd48ca7946a4b3d2e2dc27e76aec>:0
                                   at System.Collections.Generic.List`1[T].FindIndex (System.Int32 startIndex, System.Int32 count, System.Predicate`1[T] match) [0x00033] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.Collections.Generic.List`1[T].FindIndex (System.Predicate`1[T] match) [0x00000] in <75633565436c42f0a6426b33f0132ade>:0
                                   at Exiled.Events.Patches.Events.Scp173.BeingObserved+<Transpiler>d__0.MoveNext () [0x0003c] in <fb60fd48ca7946a4b3d2e2dc27e76aec>:0
                                   at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in <75633565436c42f0a6426b33f0132ade>:0
                                   at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <1c318258bf0843289b0e2cbe692fee39>:0
                                   at HarmonyLib.CodeTranspiler.GetResult (System.Reflection.Emit.ILGenerator generator, System.Reflection.MethodBase method) [0x00051] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.MethodBodyReader.FinalizeILCodes (HarmonyLib.Emitter emitter, System.Collections.Generic.List`1[T] transpilers, System.Collections.Generic.List`1[T] endLabels, System.Boolean& hasReturnCode) [0x0014a] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.MethodCopier.Finalize (HarmonyLib.Emitter emitter, System.Collections.Generic.List`1[T] endLabels, System.Boolean& hasReturnCode) [0x00000] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.MethodPatcher.CreateReplacement (System.Collections.Generic.Dictionary`2[System.Int32,HarmonyLib.CodeInstruction]& finalInstructions) [0x002be] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) [0x00057] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.PatchClassProcessor.ProcessPatchJob (HarmonyLib.PatchJobs`1+Job[T] job) [0x000bb] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                    --- End of inner exception stack trace ---
                                   at HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original) [0x0010f] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at HarmonyLib.PatchClassProcessor.Patch () [0x00093] in <0020ee40255b4dc7a0eb8b2a76225b38>:0
                                   at Exiled.Events.Features.Patcher.Patch (Exiled.Events.EventArgs.Interfaces.IExiledEvent event) [0x00054] in <fb60fd48ca7946a4b3d2e2dc27e76aec>:0

Thanks,

  • Alex

Copy link

@iamalexrouse iamalexrouse left a comment

Choose a reason for hiding this comment

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

Please see above.

@iamalexrouse
Copy link

I will do a test later today.

@6hundred9
Copy link
Author

I will do a test later today.

Yay!!!!!

Copy link

@iamalexrouse iamalexrouse left a comment

Choose a reason for hiding this comment

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

Hello!

Please set this PR as draft until you can confirm that I won't encounter this error when testing.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Events Requires Testing Things need to be verified by an Exiled Developer/Contributor Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants