Skip to content

Commit

Permalink
support for preserving player's scale beforehand
Browse files Browse the repository at this point in the history
  • Loading branch information
Temmie3754 committed Sep 12, 2021
1 parent 01f3add commit d9eac87
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions LeftHandedPlayers/Commands/LeftHanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
Player player = Player.Get((PlayerCommandSender)sender);

// Ensures they are not left handed before applying the change
if (player.Scale == new UnityEngine.Vector3(1, 1, 1))
if (player.Scale.x > 0)
{
// Applies the left hand change
player.Scale = new UnityEngine.Vector3(-1, 1, 1);
player.Scale = UnityEngine.Vector3.Scale(player.Scale, new UnityEngine.Vector3(-1, 1, 1));

// Checks the player does not have DNT on before adding them to the saved list of left handed players
if (!player.DoNotTrack) LeftHandedPlayers.Instance.LeftHandList.Add(player.UserId);
Expand All @@ -38,7 +38,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
else
{
// Makes the player no longer appear left handed
player.Scale = new UnityEngine.Vector3(1, 1, 1);
player.Scale = UnityEngine.Vector3.Scale(player.Scale, new UnityEngine.Vector3(-1, 1, 1));

// Adds them to the removal list if they don't have DNT on and removes from left handed list if on it
if (!player.DoNotTrack) LeftHandedPlayers.Instance.ToRemoveList.Add(player.UserId);
Expand All @@ -48,8 +48,6 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
response = "You are no longer left handed";
return true;
}


}
}
}
1 change: 1 addition & 0 deletions LeftHandedPlayers/Handlers/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void OnRoundEnded(RoundEndedEventArgs ev)
LeftHandedPlayers.Instance.DataSaver.Serialize(writer, LeftHandedPlayers.Instance.LeftHandList);
}
}

public void OnWaitingForPlayers()
{
// Loads the list of left-handed players
Expand Down
3 changes: 1 addition & 2 deletions LeftHandedPlayers/LeftHandedPlayers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Exiled.Loader;
using System;
using YamlDotNet.Serialization;
using System.IO;
using System.Collections.Generic;

namespace LeftHandedPlayers
Expand All @@ -15,7 +14,7 @@ public class LeftHandedPlayers : Plugin<Config>
public static LeftHandedPlayers Instance => Singleton;
public override string Author => "TemmieGamerGuy";
public override string Name => "LeftHandedPlayers";
public override Version Version => new Version(1, 0, 0);
public override Version Version => new Version(1, 0, 1);
public override Version RequiredExiledVersion => new Version(3, 0, 0);

internal static string DataPath;
Expand Down

0 comments on commit d9eac87

Please sign in to comment.