Skip to content

Commit 5783c45

Browse files
ValueMod Decimal fix added (#37)
* ValueMod Decimal fix added * Update README.md * oops, forgot to change the function name. * Inline simple function * Update position of fix in readme * Update en.json * Add myself as an author * fix md formatting hiding \<Decimal\>
1 parent 0018293 commit 5783c45

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

CommunityBugFixCollection/Contributors.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ internal static class Contributors
1616
public static string[] LeCloutPanda { get; } = ["LeCloutPanda"];
1717

1818
public static string[] Nytra { get; } = ["Nytra"];
19+
20+
public static string[] __Choco__ { get; } = ["__Choco__"];
1921
}
2022
}

CommunityBugFixCollection/Locale/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"localeCode": "en",
3-
"authors": [ "Banane9" ],
3+
"authors": [ "Banane9", "__Choco__" ],
44
"messages": {
55
"CommunityBugFixCollection.Name": "Community Bug-Fix Collection",
66
"CommunityBugFixCollection.Description": "This mod contains fixes for various small Resonite Issues that are still open.",
@@ -34,6 +34,7 @@
3434
"CommunityBugFixCollection.PauseAnimatorUpdates.Description": "Fixes animators updating all associated fields every frame while enabled but not playing.",
3535
"CommunityBugFixCollection.SmoothDraggables.Description": "Workaround for Sliders and Joints snapping in sessions hosted by a headless.",
3636
"CommunityBugFixCollection.StationaryGrabWorldActivation.Description": "Stops the Grab World Locomotion from moving the player with each activiation.",
37-
"CommunityBugFixCollection.UserInspectorAsNonHost.Description": "Fixes UserInspectors not listing existing users in the session for non-host users."
37+
"CommunityBugFixCollection.UserInspectorAsNonHost.Description": "Fixes UserInspectors not listing existing users in the session for non-host users.",
38+
"CommunityBugFixCollection.ValueModDecimal.Description": "Adds a zero check to the Decimal ValueMod ProtoFlux node to prevent DIV/0 crashes"
3839
}
39-
}
40+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Elements.Core;
2+
using FrooxEngine;
3+
using HarmonyLib;
4+
using MonkeyLoader.Resonite;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Text;
8+
9+
namespace CommunityBugFixCollection
10+
{
11+
[HarmonyPatchCategory(nameof(ValueModDecimal))]
12+
[HarmonyPatch(typeof(Elements.Core.Coder<Decimal>), nameof(Elements.Core.Coder<Decimal>.Mod))]
13+
internal sealed class ValueModDecimal : ResoniteMonkey<ValueModDecimal>
14+
{
15+
public override IEnumerable<string> Authors => Contributors.__Choco__;
16+
17+
public override bool CanBeDisabled => true;
18+
19+
private static bool Prefix(Decimal a, Decimal b) => !Enabled || b != 0;
20+
}
21+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ just disable them in the settings in the meantime.
4646
* References in multiple duplicated or transferred-between-worlds items breaking (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/984)
4747
* UserInspectors not listing existing users in the session for non-host users (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1964)
4848
* ProtoFlux value casts from byte to other values converting incorrectly (mono / graphical client only) (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2257)
49+
* `ValueMod<Decimal>` node crashes the game when B input is set to zero or disconnected. (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2746)
4950
* Grid World grid being off-center (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2754)
5051
* Animators updating all associated fields every frame while enabled but not playing (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3480)
5152
* Direct cursor size becoming very large when snapped to an object much closer than the true cursor (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3654)
@@ -72,4 +73,4 @@ The feature request issues that have been implemented in this mod will be linked
7273
If any of them have been implemented and not removed from the mod,
7374
just disable them in the settings in the meantime.
7475

75-
* _Copy to Clipboard_ action on any non-reference member fields in Inspectors (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/810)
76+
* _Copy to Clipboard_ action on any non-reference member fields in Inspectors (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/810)

0 commit comments

Comments
 (0)