Skip to content

Commit d34a93a

Browse files
committed
fix: Server-Side Compatibility
1 parent 6c14cfe commit d34a93a

5 files changed

Lines changed: 29 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Version 0.2.1
4+
- Fix: Compatibility with Docker Servers reintroduced
5+
- Fix: Server + EVERY Player must have OCDheim installed → Server + SOME Players must have OCDheim installed
6+
- Fix: Cultivator + Grass → sows Grass 100% of the time (used to be >99.9%) even if the OG Terrain Type ≠ Grass
7+
38
## Version 0.2.0
49
- New: [Grid Mode] World Grid Visualization
510
- New: [Grid Mode] Stacks & Piles now stack & pile vertically

OCDheim/OCDheim.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace OCDheim
1414
[HarmonyPatch]
1515
[BepInDependency(Jotunn.Main.ModGuid)]
1616
[BepInPlugin(GUID, Name, Version)]
17-
[NetworkCompatibility(CompatibilityLevel.EveryoneMustHaveMod, VersionStrictness.Minor)]
17+
[NetworkCompatibility(CompatibilityLevel.ServerMustHaveMod, VersionStrictness.Minor)]
1818
public class OCDheim : BaseUnityPlugin
1919
{
2020
public const string GUID = "dymek.dev.OCDheim";
@@ -34,15 +34,18 @@ private static AssetBundle LoadResourceBundle()
3434
{
3535
case RuntimePlatform.WindowsPlayer:
3636
case RuntimePlatform.WindowsEditor:
37+
case RuntimePlatform.WindowsServer:
3738
return AssetUtils.LoadAssetBundleFromResources(Path.Combine("bundle_windows"));
3839
case RuntimePlatform.LinuxPlayer:
3940
case RuntimePlatform.LinuxEditor:
41+
case RuntimePlatform.LinuxServer:
4042
return AssetUtils.LoadAssetBundleFromResources(Path.Combine("bundle_linux"));
4143
case RuntimePlatform.OSXPlayer:
4244
case RuntimePlatform.OSXEditor:
45+
case RuntimePlatform.OSXServer:
4346
return AssetUtils.LoadAssetBundleFromResources(Path.Combine("bundle_osx"));
4447
default:
45-
throw new PlatformNotSupportedException();
48+
throw new PlatformNotSupportedException(Application.platform.ToString());
4649
}
4750
}
4851

OCDheim/Package/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "OCDheim",
3-
"description": "OCDheim is an opinionated collection of building and terraforming tools that bring 22nd-century-level laser precision to... your merry Viking settlement 'Stokhölm' 🍻❤️",
4-
"version_number": "0.2.0",
3+
"description": "OCDheim is an opinionated collection of building and terraforming tools that bring 22nd-century-level laser precision to... your merry Viking settlement of 'Stokhölm' 🍻❤️",
4+
"version_number": "0.2.1",
55
"website_url": "https://github.com/java-devil/OCDheim",
66
"dependencies": [
77
"ValheimModding-Jotunn-2.29.0"

OCDheim/PreciseTerrainModifier.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private static bool Prefix(Vector3 pos, TerrainOp.Settings modifier, Heightmap _
2323
if (!modifier.m_level && !modifier.m_raise && !modifier.m_smooth && !modifier.m_paintCleared)
2424
{
2525
RemoveTerrainModifications(pos, ___m_hmap, ref ___m_levelDelta, ref ___m_smoothDelta, ref ___m_modifiedHeight);
26-
RecolorTerrain(pos, PaintType.Reset, ___m_hmap, ref ___m_paintMask, ref ___m_modifiedPaint);
26+
RecolorTerrain(pos, PaintType.Reset, ___m_hmap, ref ___m_paintMask, ref ___m_modifiedPaint, removeColor: true);
2727
}
2828
return true;
2929
}
@@ -99,7 +99,7 @@ public static void RaiseTerrain(Vector3 worldPos, Heightmap hMap, TerrainComp co
9999
Logger.Debug(() => "[SUCCESS] Raise Terrain Modification");
100100
}
101101

102-
public static void RecolorTerrain(Vector3 worldPos, PaintType paintType, Heightmap hMap, ref Color[] paintMask, ref bool[] modifiedPaint)
102+
public static void RecolorTerrain(Vector3 worldPos, PaintType paintType, Heightmap hMap, ref Color[] paintMask, ref bool[] modifiedPaint, bool removeColor = false)
103103
{
104104
Logger.Info(() => "[INIT] Color Terrain Modification");
105105

@@ -113,7 +113,7 @@ public static void RecolorTerrain(Vector3 worldPos, PaintType paintType, Heightm
113113
{
114114
for (var y = yMin; y <= yMax; y++)
115115
{
116-
ApplyColor(x, y, tileColor, ref paintMask, ref modifiedPaint);
116+
ApplyColor(x, y, tileColor, ref paintMask, ref modifiedPaint, removeColor);
117117
}
118118
}
119119

@@ -182,11 +182,11 @@ private static Color ResolveColor(PaintType paintType)
182182
}
183183
}
184184

185-
private static void ApplyColor(int x, int y, Color tileColor, ref Color[] paintMask, ref bool[] modifiedPaint)
185+
private static void ApplyColor(int x, int y, Color tileColor, ref Color[] paintMask, ref bool[] modifiedPaint, bool removeColor = false)
186186
{
187187
var tileIndex = y * PTilesPerChunk + x;
188188
paintMask[tileIndex] = tileColor;
189-
modifiedPaint[tileIndex] = tileColor != Color.black;
189+
modifiedPaint[tileIndex] = !removeColor;
190190
Logger.Info(() => $"tilePos: ({x}, {y}), tileIndex: {tileIndex}, tileColor: {tileColor}");
191191
}
192192
}

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# OCDheim - DEATH TO EYEBALLING!
22
The purpose of this mod is for me, a person suffering from severe OCD, to be able to enjoy Valheim in its full Glory™ while keeping noninvasive, consistent and respectful of the intended OG experience.
33

4-
OCDheim is an opinionated collection of building and terraforming tools that bring 22nd-century-level laser precision to... your merry Viking settlement 'Stokhölm' 🍻❤️
4+
OCDheim is an opinionated collection of building and terraforming tools that bring 22nd-century-level laser precision to... your merry Viking settlement of 'Stokhölm' 🍻❤️
55

66
Do you bleed from every orifice while trying to eyeball a line of torches, a wall of chests, or pin trophies on a wooden pole?
77
Do you suffer a violent seizure while trying to level a ledge?
@@ -80,6 +80,12 @@ Then this is the mod for you.
8080
- Stone Wall 2x1 (Smooth Stone Wall 2x1)
8181
- Stone Wall 4x2 (Smooth Stone Wall 4x2)
8282

83+
## Server-Side vs Client-Side Compatibility
84+
- The Server MUST run OCDheim if ANY Player runs OCDheim[^4]
85+
- if ALL Players run OCDheim → EVERYONE has FULL ACCESS to OCDheim functionality
86+
- if ONLY SOME Players run OCDheim → Players who DO NOT run OCDheim have NO ACCESS to OCDheim functionality
87+
- if ONLY SOME Players run OCDheim → Players who DO run OCDheim MUST refrain[^5] from using [Additional Build Pieces](#additional-build-pieces)
88+
8389
## Considered Possible Improvements
8490
- Config File
8591
- Keybinding Overrides
@@ -120,6 +126,8 @@ If you enjoy my work please consider a second to donate 😉
120126

121127
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z3GZVCJ)
122128

123-
[^1]: Every Build Piece that is NOT snappable in Vanilla Valheim (think: a Torch, a Forge or a Forge Cooler) - corresponds to the `Misc` `Crafting` and `Furniture` Tabs
124-
[^2]: Every Build Piece that is snappable in Vanilla Valheim (think: a Wood Floor, a Darkwood Pole or a Black Marble Column) - corresponds to the `Build` and `Heavy Building` Tabs
125-
[^3]: Every Build Piece suffixed with "Stack" or "Pile". Wood Stack, Corewood Stacks, Finewood Stacks, Bone Stacks, Stone Piles, Coal Piles, Coin Piles...
129+
[^1]: Every Build Piece that is NOT snappable in Vanilla Valheim (think: a Torch, a Forge or a Forge Cooler) - corresponds to the `Misc` `Crafting` and `Furniture` Tabs<br>
130+
[^2]: Every Build Piece that is snappable in Vanilla Valheim (think: a Wood Floor, a Darkwood Pole or a Black Marble Column) - corresponds to the `Build` and `Heavy Building` Tabs<br>
131+
[^3]: Every Build Piece suffixed with "Stack" or "Pile". Wood Stack, Corewood Stacks, Finewood Stacks, Bone Stacks, Stone Piles, Coal Piles, Coin Piles...<br>
132+
[^4]: This requirement MAY eventually be partially loosened<br>
133+
[^5]: There is no way as of now to enforce this Server-Side<br>

0 commit comments

Comments
 (0)