Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 51 additions & 17 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,23 +715,7 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences
public Vector3 Scale
{
get => ReferenceHub.transform.localScale;
set
{
if (value == Scale)
return;

try
{
ReferenceHub.transform.localScale = value;

foreach (Player target in List)
Server.SendSpawnMessage?.Invoke(null, new object[] { NetworkIdentity, target.Connection });
}
catch (Exception exception)
{
Log.Error($"{nameof(Scale)} error: {exception}");
}
}
set => SetScale(value, List);
}

/// <summary>
Expand Down Expand Up @@ -2070,6 +2054,56 @@ public void Disconnect(string reason = null) =>
/// </summary>
public void ResetStamina() => Stamina = StaminaStat.MaxValue;

/// <summary>
/// Sets the scale of a player on the server side.
/// </summary>
/// <param name="scale">The scale to set.</param>
/// <param name="viewers">Who should see the updated scale.</param>
public void SetScale(Vector3 scale, IEnumerable<Player> viewers)
{
if (scale == Scale)
return;

try
{
ReferenceHub.transform.localScale = scale;

foreach (Player target in viewers)
Server.SendSpawnMessage?.Invoke(null, new object[] { NetworkIdentity, target.Connection });
}
catch (Exception exception)
{
Log.Error($"{nameof(SetScale)} error: {exception}");
}
}

/// <summary>
/// Sets the scale of the player for other players.
/// </summary>
/// <param name="fakeScale">The scale to set to.</param>
/// <param name="viewers">Who should see the fake scale.</param>
public void SetFakeScale(Vector3 fakeScale, IEnumerable<Player> viewers)
Comment thread
louis1706 marked this conversation as resolved.
{
Vector3 currentScale = Scale;

if (fakeScale == currentScale)
return;

try
{
ReferenceHub.transform.localScale = fakeScale;

foreach (Player target in viewers)
Server.SendSpawnMessage.Invoke(null, new object[] { NetworkIdentity, target.Connection });

ReferenceHub.transform.localScale = currentScale;
}
catch (Exception ex)
{
Log.Error($"{nameof(SetFakeScale)}: {ex}");
}
}

/// <summary>
/// Gets a user's SCP preference.
/// </summary>
Expand Down