Skip to content

Commit

Permalink
Merge pull request #10 from xen-42/eos-is-the-bane-of-my-existance
Browse files Browse the repository at this point in the history
Eos is the bane of my existance
  • Loading branch information
xen-42 authored May 12, 2023
2 parents 2062c60 + dce6dd8 commit 0ad92ef
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
23 changes: 12 additions & 11 deletions CosmicHorrorFishingBuddies/BaseSync/TransformSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ internal abstract class TransformSync : NetworkBehaviour

private Transform _syncedTransform;

private void Start()
private NetworkTransform _networkTransform;

public void Awake()
{
_networkTransform = gameObject.GetComponent<NetworkTransform>();
_networkTransform.target = transform;
}

public void Start()
{
CFBCore.LogInfo($"Start TransformSync: {netId}");

_syncedTransform = isOwned ? InitLocalTransform() : InitRemoteTransform();

var networkTransform = gameObject.GetComponent<NetworkTransform>();
networkTransform.target = transform;
}
_networkTransform.transform.position = Vector3.zero;
_networkTransform.transform.rotation = Quaternion.identity;

private void Update()
{
if (isOwned)
{
transform.position = GameManager.Instance.Player.transform.position;
transform.rotation = GameManager.Instance.Player.transform.rotation;
}
_networkTransform.target = _syncedTransform;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ItemGroup>
<Reference Include="..\Mirror\*.dll" />
<PackageReference Include="HarmonyX" Version="2.10.1" />
<PackageReference Include="DredgeGameLibs" Version="1.0.4.1" />
<PackageReference Include="DredgeGameLibs" Version="1.1.0" />
<Reference Include="Winch">
<HintPath>$(GameInstall)\Winch.dll</HintPath>
<Private>false</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ namespace CosmicHorrorFishingBuddies.Debugging.Patches
[HarmonyPatch(typeof(Debug))]
internal static class DebugLogPatches
{
/*
[HarmonyPostfix]
[HarmonyPatch(nameof(Debug.Log), new Type[] { typeof(object) })]
public static void Debug_Log(object message) => CFBCore.LogInfo($"[UnityEngine.Debug.Log] {message}");

[HarmonyPostfix]
[HarmonyPatch(nameof(Debug.LogWarning), new Type[] { typeof(object) })]
public static void Debug_LogWarning(object message) => CFBCore.LogWarning($"[UnityEngine.Debug.Log] {message}");
*/

[HarmonyPostfix]
[HarmonyPatch(nameof(Debug.LogError), new Type[] { typeof(object) })]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public NetworkHarvestPOI GetNetworkObject(HarvestPOI harvestPOI)
}
else
{
CFBCore.LogError($"Untracked HarvestPOI {harvestPOI.name} on {NetworkPlayer.LocalPlayer.netId}");
CFBCore.LogError($"Untracked HarvestPOI {harvestPOI?.name} on {NetworkPlayer.LocalPlayer?.netId}");
return null;
}
}
Expand Down
15 changes: 12 additions & 3 deletions CosmicHorrorFishingBuddies/PlayerSync/PlayerTransformSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected override Transform InitLocalTransform()

GameManager.Instance.Player.gameObject.AddComponent<DebugCommands>();

return GameManager.Instance.Player.transform;
return transform;
}

protected override Transform InitRemoteTransform()
Expand All @@ -97,7 +97,7 @@ protected override Transform InitRemoteTransform()
remotePlayer.transform.localRotation = Quaternion.identity;

var networkPlayer = GetComponent<NetworkPlayer>();

networkPlayer.remotePlayerBoatGraphics.boatSubModelTogglers = remotePlayer.GetComponentsInChildren<BoatSubModelToggler>();
networkPlayer.remotePlayerBoatGraphics.boatModelProxies = remotePlayer.GetComponentsInChildren<BoatModelProxy>();
networkPlayer.remotePlayerBoatGraphics.wake = remotePlayer.Find("BoatTrailParticles").gameObject;
Expand All @@ -116,7 +116,16 @@ protected override Transform InitRemoteTransform()
networkPlayer.remoteAtrophyAbility.loopAudio.minDistance = 5;
networkPlayer.remoteAtrophyAbility.loopAudio.clip = atrophy.loopAudioSource.clip;

return remotePlayer;
return transform;
}

private void Update()
{
if (isOwned)
{
transform.position = GameManager.Instance.Player.transform.position;
transform.rotation = GameManager.Instance.Player.transform.rotation;
}
}
}
}
2 changes: 1 addition & 1 deletion CosmicHorrorFishingBuddies/mod_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Author": "xen-42",
"Version": "0.0.2",
"Version": "0.0.3",
"ModAssembly": "CosmicHorrorFishingBuddies.dll",
"MinWinchVersion": "alpha-1.3",
"Entrypoint": "CosmicHorrorFishingBuddies.Loader/Initialize"
Expand Down
2 changes: 1 addition & 1 deletion EpicOnlineTransport/EpicOnlineTransport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DredgeGameLibs" Version="1.0.4.1" IncludeAssets="compile" />
<PackageReference Include="DredgeGameLibs" Version="1.1.0" IncludeAssets="compile" />
<Reference Include="../Mirror/*.dll" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MirrorWeaver/MirrorWeaver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<Reference Include="Winch">
<HintPath>$(GameInstall)\Winch.dll</HintPath>
</Reference>
<PackageReference Include="DredgeGameLibs" Version="1.0.4.1" />
<PackageReference Include="DredgeGameLibs" Version="1.1.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion SteamAPIPatcher/SteamAPIPatcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="HarmonyX" Version="2.10.1" />
<PackageReference Include="DredgeGameLibs" Version="1.0.4.1" />
<PackageReference Include="DredgeGameLibs" Version="1.1.0" />
</ItemGroup>

</Project>

0 comments on commit 0ad92ef

Please sign in to comment.