-
-
Notifications
You must be signed in to change notification settings - Fork 30
Add VEF 1.6 namespace support and RunAndGun desyncs #535
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
base: master
Are you sure you want to change the base?
Conversation
…nt, and fix RunAndGun button press desyncs (RNG target selection)
It's pointless to keep the old namespace around. There's not a single 1.6 VEF version that uses In fact, it would probably be wise to update all the other namespaces away from Also, you've added a bunch of check for null types which will cause warnings and return early if null. The code was designed to handle any exceptions and log errors when it happens, so it's not really needed to handle null types/methods there like that. MpCompat.harmony.Patch(AccessTools.DeclaredMethod(type, "Cast"),
prefix: new HarmonyMethod(typeof(VanillaExpandedFramework), nameof(PreAbilityCast)),
postfix: new HarmonyMethod(typeof(VanillaExpandedFramework), nameof(PostAbilityCast)));private static void PreAbilityCast(object __instance, out PatchingUtilities.TimeSnapshot? __state)
{
if (!MP.IsInMultiplayer)
{
__state = null;
return;
}
var pawn = abilityPawnField(__instance);
__state = pawn?.Map != null ? PatchingUtilities.TimeSnapshot.GetAndSetFromMap(pawn.Map) : null;
}
private static void PostAbilityCast(PatchingUtilities.TimeSnapshot? __state)
{
__state?.Set();
}What's the point of this patch? It's temporarily changing the current tick while casting the ability to match the map the pawn is on... Except that this method should already be called in a place where this is the case. (Or it won't do anything if casting from the world map.) |
/// <see href="https://github.com/MemeGoddess/RunAndGun-continued"/>Dead link. var type = AccessTools.TypeByName("RunAndGun.Harmony.Pawn_DraftController_GetGizmos_Patch");
if (type != null)
{
MP.RegisterSyncDelegateLambda(type, "Postfix", 1); // one fucking number, i cant believe this shit.
}From a quick look at the mod's code, I believe that it should be 2 and not 1. Currently this will sync the delegate for Second, is the null check even required here for anything? I don't think this check would fail in any release of Run and Gun, the original we patched or this particular one. Third, I don't think the comment contributes anything, is not informative, etc. and should be removed. type = AccessTools.TypeByName("RunAndGun.Utilities.WorldComponent_ToggleData");
if (type != null)
{
MP.RegisterSyncMethod(type, "SetRunAndGun");
}I'm sorry, but what? What is this supposed to be even doing? Run and Gun doesn't have any world components, nor any methods called var mentalStateMethod = AccessTools.Method("RunAndGun.Harmony.MentalStateHandler_TryStartMentalState:shouldRunAndGun");
if (mentalStateMethod != null)
{
PatchingUtilities.PatchSystemRand("RunAndGun.Harmony.MentalStateHandler_TryStartMentalState:shouldRunAndGun", false);
}First, pointless null check again? The method won't be null, and Second, this will now cause warnings/errors as that method has no system RNG. It instead uses Unity RNG, and a respective method from In fact, the whole conditional part seems... pointless? I checked code for a few versions of Run and Gun, and the conditional patches don't seem to do anything besides skipping code that doesn't exist for any of the mod versions. |
|
Also: please make a separate PR for changes to VEF and Run and Gun. It would be fine if the 2 patches were related to each other (using shared code, for example), but since those 2 aren't related at all - it's best to keep them separate. |
Changes
VEF.Abilitiesinstead ofVFECore.Abilities)VFECorenamespace for backward compatibility with older VEF versionsWorldComponent_ToggleData.SetRunAndGunsync method to fix toggle button desyncsThese changes should solve issues with mods like Dragon's Descent, VPE, and others that rely on VEF.
Testing
Tested with all DLC, VEF 1.6, Dragon's Descent, and Run and Gun - confirmed no desyncs when using dragon abilities or toggling run and gun.