Created
August 29, 2017 03:04
-
-
Save krypt-lynx/0ec783717c19b735a36485197a112231 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Harmony; | |
using Havok; | |
using Sandbox.Engine.Physics; | |
using Sandbox.Game.Entities.Cube; | |
using System; | |
using System.Reflection; | |
using VRage.Plugins; | |
namespace SpeedLimitFix | |
{ | |
public class SpeedLimitFix : IPlugin | |
{ | |
public void Dispose() | |
{ | |
} | |
public void Init(object gameInstance) | |
{ | |
var harmony = HarmonyInstance.Create("name.krypt.speedlimit"); | |
harmony.PatchAll(Assembly.GetExecutingAssembly()); | |
} | |
public void Update() | |
{ | |
} | |
} | |
[HarmonyPatch(typeof(MyPhysicsBody), "set_RigidBody", new Type[] { typeof(HkRigidBody) })] | |
class MyPhysicsBody_RigidBody_patch | |
{ | |
public static void Postfix(ref MyPhysicsBody __instance, HkRigidBody value) | |
{ | |
if (__instance.RigidBody != null) | |
{ | |
__instance.RigidBody.MaxLinearVelocity = MyGridPhysics.ShipMaxLinearVelocity() + 100; | |
} | |
} | |
} | |
[HarmonyPatch(typeof(MyPhysicsBody), "set_RigidBody2", new Type[] { typeof(HkRigidBody) })] | |
class MyPhysicsBody_RigidBody2_patch | |
{ | |
public static void Postfix(ref MyPhysicsBody __instance, HkRigidBody value) | |
{ | |
if (__instance.RigidBody2 != null) | |
{ | |
__instance.RigidBody2.MaxLinearVelocity = MyGridPhysics.ShipMaxLinearVelocity() + 100; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment