Skip to content

Commit

Permalink
Implement preference for changing clones IsOnFriendsList
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuma committed Dec 13, 2023
1 parent 41ec13d commit a460745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Runtime/Scripts/LyumaAv3Emulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class LyumaAv3Emulator : MonoBehaviour
[Header("Networked and mirror clone emulation")]
public bool CreateNonLocalClone;
public int CreateNonLocalCloneCount;
public bool ClonesAreOnFriendsList = true;
public bool DisableMirrorClone;
public bool DisableShadowClone;
private bool lastHead;
Expand Down
9 changes: 8 additions & 1 deletion Runtime/Scripts/LyumaAv3Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public string GetTypeString()
runtime => Mathf.Clamp((runtime.avadesc.ViewPosition.y - 0.2f)/ (5.0f - 0.2f), 0.0f, 1.0f),
(runtime, value) => { }), //Modifying this doesn't make sense, this field is un-editable in VRC
new BuiltinParameterDefinition("IsOnFriendsList", VRCExpressionParameters.ValueType.Bool,
runtime => !runtime.IsLocal, // true for remote and false for local
runtime => !runtime.IsLocal && !runtime.IsMirrorClone && !runtime.IsShadowClone && runtime.IsOnFriendsList, // true for remote and false for local
(runtime, value) => { }), //Modifying this doesn't make sense, this field is un-editable in VRC
};

Expand Down Expand Up @@ -496,6 +496,7 @@ public string GetTypeString()
public Vector3 VisualOffset;
private Vector3 SavedPosition;
private bool IsCurrentlyVisuallyOffset = false;
public bool IsOnFriendsList = false;

[Header("Output State (Read-only)")]
public bool IsLocal;
Expand Down Expand Up @@ -2034,6 +2035,9 @@ void NormalUpdate()
Dictionary<string, float> stageNameToValue = EarlyRefreshExpressionParameters();
LateRefreshExpressionParameters(stageNameToValue);
}
if(this == AvatarSyncSource || IsMirrorClone || IsShadowClone) {
IsOnFriendsList = false;
}
if(this == AvatarSyncSource && !IsMirrorClone && !IsShadowClone) {
Transform head = animator.GetBoneTransform(HumanBodyBones.Head);
if (head != null) {
Expand Down Expand Up @@ -2093,6 +2097,9 @@ void NormalUpdate()
CreateNonLocalClone = false;
AvatarSyncSource.CloneCount++;
Vector3 oldOffset = VisualOffset;
if (emulator != null) {
OriginalSourceClone.IsOnFriendsList = emulator.ClonesAreOnFriendsList;
}
OriginalSourceClone.VisualOffset = AvatarSyncSource.CloneCount * new Vector3(0.4f, 0.0f, 0.4f);
GameObject go = GameObject.Instantiate(OriginalSourceClone.gameObject);
go.hideFlags = 0;
Expand Down

0 comments on commit a460745

Please sign in to comment.