Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
werasik2aa authored Apr 13, 2022
1 parent 1c51917 commit 61ef00c
Show file tree
Hide file tree
Showing 8 changed files with 488 additions and 204 deletions.
61 changes: 56 additions & 5 deletions HMpatch.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,72 @@
using HarmonyLib;
using System;
using UnhollowerBaseLib.Attributes;
using UnityEngine;
using vehiclemod;
namespace vehiclemod
{
[HarmonyLib.HarmonyPatch(typeof(GameManager), "LoadSceneWithLoadingScreen")] // FUCK THE OBJ
[HarmonyPatch(typeof(WheelCollider), "LoadWheelCollider")] /* https://github.com/werasik2aa/BringBackComponents */
public class WheelCollider : Collider
{
public extern WheelCollider(IntPtr Value);
public static Il2CppSystem.Type Il2CppType { get; }
public float radius;
public bool isGrounded { get; }
public float steerAngle;
public float brakeTorque;
public float motorTorque;
public WheelFrictionCurve sidewaysFriction;
public WheelFrictionCurve forwardFriction;
public float wheelDampingRate;
public float mass;
public float forceAppPointDistance;
public JointSpring suspensionSpring;
public float suspensionDistance;
public float sprungMass;
public Vector3 center;
public float rpm;
public delegate void ConfigureVehicleSubsteps(IntPtr ptr, ref float speedThreshold, ref int stepsBelowThreshold, ref int stepsAboveThreshold);
public delegate void GetWorldPose(IntPtr ptr, out Vector3 ptr2, out Quaternion ptr3);
public delegate Vector3 get_center(IntPtr ptr, out Vector3 ptr2);
public delegate void set_centerS(IntPtr ptr, Vector3 Value);
public delegate WheelFrictionCurve get_forwardFriction(IntPtr ptr); //FORWARD FR
public delegate void set_forwardFriction(IntPtr ptr, WheelFrictionCurve Value);
public delegate WheelFrictionCurve get_sidewaysFriction(IntPtr ptr); //SIDEWAY FR
public delegate void set_sidewaysFriction(IntPtr ptr, WheelFrictionCurve Value);
public delegate JointSpring get_suspensionSpring(IntPtr ptr); //SUS SPRING
public delegate void set_suspensionSpring(IntPtr ptr, JointSpring Value);
public delegate void ResetSprungMasses();
public delegate float get_motorTorque(IntPtr ptr); //Torque motor
public delegate void set_motorTorque(IntPtr ptr, float Value);
public delegate float get_brakeTorque(IntPtr ptr); // BrakeToque
public delegate void set_brakeTorque(IntPtr ptr, float Value);
public delegate float get_steerAngle(IntPtr ptr); // steerAngle
public delegate void set_steerAngle(IntPtr ptr, float Value);
public delegate float get_radius(IntPtr ptr); // Radius
public delegate void set_radius(IntPtr ptr, float Value);
public delegate float get_sprungMass(IntPtr ptr); // MASS sprung
public delegate void set_sprungMass(IntPtr ptr, float Value);
public delegate float get_suspensionDistance(IntPtr ptr); // Suspension dist
public delegate void set_suspensionDistance(IntPtr ptr, float Value);
public delegate float get_mass(IntPtr ptr); //MASS
public delegate void set_mass(IntPtr ptr, float Value);
public delegate float get_wheelDampingRate(IntPtr ptr); // WHEEL damping rate
public delegate void set_wheelDampingRate(IntPtr ptr, float Value);
public delegate float get_forceAppPointDistance(IntPtr ptr); // WHEEL damping rate
public delegate void set_forceAppPointDistance(IntPtr ptr, float Value);
public delegate float get_rpm(IntPtr ptr); //RMP
}
[HarmonyPatch(typeof(GameManager), "LoadSceneWithLoadingScreen")] // FUCK THE OBJ
public static class GameManager_LoadSceneWithLoadingScreen
{
private static void Prefix(ref string sceneName)
private static void Prefix()
{
if (main.levelname != "Empty" && main.levelname != "MainMenu" && main.levelname != "Boot" && main.levelname != "" && GameManager.GetPlayerTransform())
if (VehicleController.myparent != GameManager.GetPlayerTransform().transform.parent) GameManager.GetPlayerTransform().transform.SetParent(VehicleController.myparent);
if(data.GetObj(main.targetcar)) GameObject.DontDestroyOnLoad(data.GetObj(main.targetcar));
if(main.isSit) main.changedDrivePlace = true;
}
}
[HarmonyLib.HarmonyPatch(typeof(GameManager), "LoadScene", new Type[] { typeof(string), typeof(string) })] // FUCK THE OBJ
[HarmonyPatch(typeof(GameManager), "LoadScene", new Type[] { typeof(string), typeof(string) })] // FUCK THE OBJ
public class GameManager_LoadSceneOverLoad1
{
public static void Prefix()
Expand All @@ -26,7 +77,7 @@ public static void Prefix()
if (main.isSit) main.changedDrivePlace = true;
}
}
[HarmonyLib.HarmonyPatch(typeof(GameManager), "LoadScene", new Type[] { typeof(string) })] // FUCK THE OBJ
[HarmonyPatch(typeof(GameManager), "LoadScene", new Type[] { typeof(string) })] // FUCK THE OBJ
public class GameManager_LoadSceneOverLoad2
{
public static void Prefix()
Expand Down
14 changes: 1 addition & 13 deletions NETHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ public static void NetPacketStat(bool allowdrive, bool allowsit, float fuel, str
packet.Write(name);
Send(packet);
}
public static void NetSendMyCar(string CarName, Vector3 pos, Quaternion rot)
{
if (SkyCoop.API.m_ClientState == SkyCoop.API.SkyCoopClientState.NONE) return;
Packet packet = packet = new Packet((int)ClientPackets.CUSTOM);

packet.Write(1011);
packet.Write(CarName);
packet.Write(pos);
packet.Write(rot);
Send(packet);
}
public static void NETSIT(int CarID, int SitID)
{
if (SkyCoop.API.m_ClientState == SkyCoop.API.SkyCoopClientState.NONE) return;
Expand Down Expand Up @@ -60,13 +49,12 @@ public static void NetSendDriver(int ID, bool drived)
Send(packet);
}

public static void NetCar(int CarID, string CarName, Vector3 Position, Quaternion Rotation)
public static void NetCar(int CarID, Vector3 Position, Quaternion Rotation)
{
if (SkyCoop.API.m_ClientState == SkyCoop.API.SkyCoopClientState.NONE) return;
Packet packet = packet = new Packet((int)ClientPackets.CUSTOM);

packet.Write(0000);
packet.Write(CarName);
packet.Write(CarID);
packet.Write(Position);
packet.Write(Rotation);
Expand Down
3 changes: 1 addition & 2 deletions PACKETS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ static void Postfix(SkyCoop.API __instance, Packet _pak, int from)
int packetid = _pak.ReadInt();
if (packetid == 0000) // MOVE CAR
{
string name = _pak.ReadString();
int ID = _pak.ReadInt();
Vector3 Position = _pak.ReadVector3();
Quaternion Rotation = _pak.ReadQuaternion();
Expand All @@ -21,7 +20,7 @@ static void Postfix(SkyCoop.API __instance, Packet _pak, int from)
from = _pak.ReadInt();
}
if (API.m_ClientState == API.SkyCoopClientState.HOST) API.SendDataToEveryone(_pak, from, true);
if (CheckEnv(from)) VehicleController.PlayerCarMove(ID, name, Position, Rotation);
if (CheckEnv(from)) VehicleController.PlayerCarMove(ID, Position, Rotation);
}

if (packetid == 1000) // SPAWN CAR
Expand Down
Loading

0 comments on commit 61ef00c

Please sign in to comment.