generated from Distance-Modding/Template.CSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added ability to adjust the maximum detail for cars - Added ability to disable the killgrid rendering for every player online - Updated Collision logic - Added ability to adjust Outline Brightness - Increased maximum timeout value
- Loading branch information
Showing
11 changed files
with
190 additions
and
9 deletions.
There are no files selected for viewing
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
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
24 changes: 24 additions & 0 deletions
24
Distance.OnlineAdditions/Harmony/Assembly-CSharp/CarLevelOfDetail/IncrementLevel.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using HarmonyLib; | ||
|
||
namespace Distance.OnlineAdditions.Harmony | ||
{ | ||
[HarmonyPatch(typeof(CarLevelOfDetail), "IncrementLevel")] | ||
internal class CarLevelOfDetail__IncrementLevel | ||
{ | ||
[HarmonyPostfix] | ||
internal static void MakeSureSimulationIsOn(CarLevelOfDetail __instance) | ||
{ | ||
if (__instance.type_ == CarLevelOfDetail.Type.Networked && Mod.Instance.Config.EnableCollision) | ||
{ | ||
__instance.SetCarSimulationEnabled(true); | ||
} | ||
else | ||
{ | ||
if(__instance.rigidbody_.isKinematic) | ||
{ | ||
__instance.rigidbody_.isKinematic = false; | ||
} | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Distance.OnlineAdditions/Harmony/Assembly-CSharp/CarLevelOfDetail/SetLevelOfDetail.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using HarmonyLib; | ||
|
||
namespace Distance.OnlineAdditions.Harmony | ||
{ | ||
[HarmonyPatch(typeof(CarLevelOfDetail), "SetLevelOfDetail", new System.Type[] { typeof(CarLevelOfDetail.Level) })] | ||
internal class CarLevelOfDetail__SetLevelOfDetail | ||
{ | ||
[HarmonyPrefix] | ||
internal static bool MaxLevelDetail(CarLevelOfDetail __instance, CarLevelOfDetail.Level newLevel) | ||
{ | ||
if(newLevel < (CarLevelOfDetail.Level)Mod.Instance.Config.MaxLevelOfDetail && G.Sys.NetworkingManager_.IsOnline_) | ||
{ | ||
return false; | ||
} | ||
else | ||
{ | ||
return true; | ||
} | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
Distance.OnlineAdditions/Harmony/Assembly-CSharp/KillGrid/OnEventAddRemovePlayerData.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using HarmonyLib; | ||
using Events.Player; | ||
|
||
namespace Distance.OnlineAdditions.Harmony | ||
{ | ||
[HarmonyPatch(typeof(KillGrid), "OnEventAddRemovePlayerData", new System.Type[] { typeof(AddRemovePlayerData.Data) })] | ||
internal class OnEventAddRemovePlayerData | ||
{ | ||
[HarmonyPrefix] | ||
internal static bool KillGridRenderControl(KillGrid __instance, AddRemovePlayerData.Data data) | ||
{ | ||
if(Mod.Instance.Config.DisableMultiKillGridRender) | ||
{ | ||
if (data.added_) | ||
{ | ||
if (!__instance.startCalled_) | ||
Mod.Instance.Logger.Debug((object)"start wasn't called yet"); | ||
if (__instance.isInvisible_) | ||
return false; | ||
if (data.type_ == AddRemovePlayerData.PDType.Replay) | ||
{ | ||
PlayerDataReplay player = data.player_ as PlayerDataReplay; | ||
if ((bool)(UnityEngine.Object)player && player.IsGhost_) | ||
return false; | ||
} | ||
if (data.type_ == AddRemovePlayerData.PDType.Net) | ||
{ | ||
//This should disable rendering for network cars on the killgrids. | ||
Mod.Instance.Logger.Debug("No killgrids for network car!"); | ||
return false; | ||
} | ||
UnityEngine.Renderer component = __instance.GetComponent<UnityEngine.Renderer>(); | ||
__instance.CreateParentIfNeeded(); | ||
UnityEngine.GameObject followerObj = UnityEngine.Object.Instantiate(__instance.followerPrefab_); | ||
followerObj.transform.SetParentKeepingLocalTransform(__instance.followerParent_); | ||
__instance.helpers_.Add(new KillGrid.KillGridFollowerHelper(data.player_, followerObj, component.sharedMaterial.color, __instance.curvature_, new KillGrid.PositionFollowerFn(__instance.PositionFollower))); | ||
} | ||
else | ||
{ | ||
KillGrid.KillGridFollowerHelper gridFollowerHelper = __instance.helpers_.Find((System.Predicate<KillGrid.KillGridFollowerHelper>)(val => (UnityEngine.Object)val.player_ == (UnityEngine.Object)data.player_)); | ||
if (gridFollowerHelper == null) | ||
return false; | ||
gridFollowerHelper.Destroy(); | ||
__instance.helpers_.Remove(gridFollowerHelper); | ||
} | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
Distance.OnlineAdditions/Harmony/Assembly-CSharp/PlayerDataNet/SetOutlineColor.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using HarmonyLib; | ||
|
||
namespace Distance.OnlineAdditions.Harmony | ||
{ | ||
[HarmonyPatch(typeof(PlayerDataNet), "SetOutlineColor")] | ||
internal class PlayerDataNet__SetOutlineColor | ||
{ | ||
[HarmonyPrefix] | ||
internal static bool NetworkOutline(PlayerDataNet __instance) | ||
{ | ||
if (!(bool)(UnityEngine.Object)__instance.outline_) | ||
return false; | ||
__instance.outline_.SetOutlineColorNoNorm(UnityEngine.Color.Lerp(UnityEngine.Color.black, __instance.GlowColor_.Normalized(), Mod.Instance.Config.OutlineBrightness)); | ||
return false; | ||
} | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
Distance.OnlineAdditions/Harmony/Assembly-CSharp/RigidbodyStateTransceiver/FixedUpdate.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using HarmonyLib; | ||
|
||
namespace Distance.OnlineAdditions.Harmony | ||
{ | ||
[HarmonyPatch(typeof(RigidbodyStateTransceiver), "FixedUpdate")] | ||
internal class RigidbodyStateTransceiver__FixedUpdate | ||
{ | ||
[HarmonyPrefix] | ||
internal static bool FixedTheFixedUpdate(RigidbodyStateTransceiver __instance) | ||
{ | ||
if (!__instance.setCarOnFixedUpdate_) | ||
return false; | ||
__instance.rigidbody_.transform.position = __instance.posSpring_.Pos_ + __instance.setCarOnFixedUpdateCoef_ * 0.01f * __instance.velSpring_.Pos_; | ||
__instance.rigidbody_.transform.rotation = __instance.rotSpring_.Pos_; | ||
__instance.rigidbody_.velocity = __instance.velSpring_.Pos_; | ||
__instance.rigidbody_.angularVelocity = __instance.rotSpring_.Vel_; | ||
return false; | ||
} | ||
} | ||
} |
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
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