idk whar i did

This commit is contained in:
2025-07-24 00:25:01 +03:00
parent 5f148bc86f
commit f6f484549a
12 changed files with 68 additions and 19 deletions

13
.idea/.idea.BoneSync/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/.idea.BoneSync.iml
/projectSettingsUpdater.xml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/.idea.BoneSync/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -209,14 +209,21 @@ namespace BoneSync.Data
{
WriteVector3(value.position);
WriteQuaternion(value.rotation);
WriteVector3(value.scale);
WriteBool(value.scale.HasValue);
if (value.scale.HasValue)
WriteVector3(value.scale.Value);
}
public SimpleSyncTransform ReadSimpleTransform()
{
Vector3 position = ReadVector3();
Quaternion rotation = ReadQuaternion();
Vector3 scale = ReadVector3();
bool hasScale = ReadBool();
Vector3? scale = null;
if (hasScale)
{
scale = ReadVector3();
}
return new SimpleSyncTransform()
{
position = position,

View File

@@ -10,23 +10,23 @@ namespace BoneSync.Data
public static class SimpleTransformExtensions
{
public static void ApplySimpleTransform(this UnityEngine.Transform transform, SimpleSyncTransform simpleTransform)
public static void ApplySimpleTransform(this Transform transform, SimpleSyncTransform simpleTransform)
{
transform.position = simpleTransform.position;
transform.rotation = simpleTransform.rotation;
transform.localScale = simpleTransform.scale;
if (simpleTransform.scale.HasValue) transform.localScale = simpleTransform.scale.Value;
}
}
public struct SimpleSyncTransform
{
public Vector3 position;
public Quaternion rotation;
public Vector3 scale;
public SimpleSyncTransform(UnityEngine.Transform transform)
public Vector3? scale;
public SimpleSyncTransform(Transform transform, bool withScale = true)
{
position = transform.position;
rotation = transform.rotation;
scale = transform.localScale;
scale = withScale ? transform.localScale : (Vector3?)null;
}
}
}

View File

@@ -70,10 +70,16 @@ namespace BoneSync.Networking.LobbyManager
get;
private set;
}
private SteamId[] _steamIds;
public SteamId[] steamIds
{
get;
private set;
get => _steamIds;
private set
{
_steamIds = value;
_peersCache = _steamIds.Select(x => x.Value).ToArray();
}
}
public override bool IsConnected()
@@ -81,7 +87,8 @@ namespace BoneSync.Networking.LobbyManager
return _lobbyInstance.Id.IsValid;
}
public override ulong[] GetPeers() => steamIds.Select(x => x.Value).ToArray();
private ulong[] _peersCache = new ulong[0];
public override ulong[] GetPeers() => _peersCache;
public override ulong GetLocalId() => SteamClient.SteamId.Value;
public override ulong GetHostId() => _lobbyInstance.Owner.Id.Value;
public override ulong GetLobbyId() => _lobbyInstance.Id.Value;
@@ -90,6 +97,8 @@ namespace BoneSync.Networking.LobbyManager
{
LobbyMembers = _lobbyInstance.Members.ToArray();
steamIds = LobbyMembers.Select(x => x.Id).ToArray();
if (_lobbyInstance.Id.IsValid)
{

View File

@@ -46,10 +46,7 @@ namespace BoneSync.Networking
public class AlwaysExecuteAttribute : Attribute
{
public AlwaysExecuteAttribute()
{
}
public AlwaysExecuteAttribute() {}
}
public abstract class NetworkMessage

View File

@@ -157,9 +157,9 @@ namespace BoneSync.Player
PlayerSyncInfo playerSyncInfo = new PlayerSyncInfo()
{
rootPos = localRigSkeletonRoot.position,
headPos = new SimpleSyncTransform(localRigHeadTransform),
leftHandPos = new SimpleSyncTransform(localRigLeftHandTransform),
rightHandPos = new SimpleSyncTransform(localRigRightHandTransform),
headPos = new SimpleSyncTransform(localRigHeadTransform, false),
leftHandPos = new SimpleSyncTransform(localRigLeftHandTransform, false),
rightHandPos = new SimpleSyncTransform(localRigRightHandTransform, false),
//leftHandFingerCurl = new SimpleFingerCurl(PlayerScripts.playerLeftHand.fingerCurl),
//rightHandFingerCurl = new SimpleFingerCurl(PlayerScripts.playerRightHand.fingerCurl)
poseIndexLeft = SkeletonHandPatches.poseIndexLeft,

View File

@@ -289,6 +289,7 @@ namespace BoneSync.Sync.Components
{
AlignPlug alignPlug = plugs[i];
if (alignPlug.GetSocket()) return true;
if (alignPlug._isExitTransition || alignPlug._isEnterTransition) return true; // if plug is in transition, consider it plugged
}
return false;
}

View File

@@ -157,11 +157,15 @@ namespace BoneSync.Sync.Components
Rigidbody rb = rigidbodies[i];
rb.angularVelocity = objectSyncTransform.angularVelocity;
rb.velocity = objectSyncTransform.velocity;
//rb.MovePosition(objectSyncTransform.transform.position);
//rb.MoveRotation(objectSyncTransform.transform.rotation);
rb.position = objectSyncTransform.transform.position;
rb.rotation = objectSyncTransform.transform.rotation;
_transforms[i].localScale = objectSyncTransform.transform.scale;
if (objectSyncTransform.transform.scale.HasValue)
{
_transforms[i].localScale = objectSyncTransform.transform.scale.Value;
}
//_transforms[i].ApplySimpleTransform(objectSyncTransform.transform);
}
}

View File

@@ -57,7 +57,7 @@ namespace BoneSync.Sync
spawnInfo = new SpawnPoolableInfo()
{
spawnableTitle = spawnableTitle,
spawnLocation = new SimpleSyncTransform(syncable.poolee.transform),
spawnLocation = new SimpleSyncTransform(syncable.poolee.transform, false),
},
};
}