static bool Prefix(CustomNetworkTransform __instance) { if (!__instance.AmOwner) { if (Main.Instance.AllPlayers.Any(x => x._Object.NetTransform == __instance && x.ControllerOverride == Main.Instance.GetLocalModdedPlayer())) { return(false); } if (__instance.interpolateMovement != 0f) { Vector2 vector = __instance.targetSyncPosition - __instance.body.position; if (vector.sqrMagnitude >= 0.0001f) { float num = __instance.interpolateMovement / __instance.sendInterval; vector.x *= num; vector.y *= num; if (PlayerControl.LocalPlayer) { vector = Vector2.ClampMagnitude(vector, PlayerControl.LocalPlayer.MyPhysics.TrueSpeed); } __instance.body.velocity = vector; } else { __instance.body.velocity = Vector2.zero; } } __instance.targetSyncPosition += __instance.targetSyncVelocity * Time.fixedDeltaTime * 0.1f; return(false); } return(true); }
public static void PostfixNetwork(CustomNetworkTransform __instance) { if (__instance.AmOwner && __instance.interpolateMovement != 0.0f) { var player = __instance.gameObject.GetComponent <PlayerControl>(); __instance.body.velocity *= player.GetAppearance().SpeedFactor; } }
private static Vector2 ReadVector2(MessageReader reader, CustomNetworkTransform __instance) { float v = reader.ReadUInt16() / 65535f; float v2 = reader.ReadUInt16() / 65535f; var vector2 = new Vector2(Mathf.Lerp(__instance.XRange.min, __instance.XRange.max, v), Mathf.Lerp(__instance.YRange.min, __instance.YRange.max, v2)); return(vector2);// *= networkSize; }
public static void Postfix(CustomNetworkTransform __instance) { if (!__instance.AmOwner) { if (__instance.interpolateMovement != 0f) { if (__instance.gameObject.GetComponent <PlayerControl>().Is(ModifierEnum.BigBoi)) { __instance.body.velocity = __instance.body.velocity / 2; } } } }
public static void Postfix(CustomNetworkTransform __instance) { if (!__instance.AmOwner) { if (__instance.interpolateMovement != 0f) { if (shouldSpeedUp(__instance.gameObject.GetComponent <PlayerControl>())) { __instance.body.velocity *= 1.5f; } } } }
public static void Postfix(CustomNetworkTransform __instance) { if (!__instance.AmOwner) { if (__instance.interpolateMovement != 0f) { if (FastBoiUpdate.isFast(__instance.gameObject.GetComponent <PlayerControl>())) { __instance.body.velocity *= 2f; } } } }