Skip to content

Commit

Permalink
Fix AutoGun targeting spectators.
Browse files Browse the repository at this point in the history
Fix Tranq Gun deleting items.
  • Loading branch information
joker-119 committed Jul 24, 2021
1 parent 7a1fb28 commit 09fbfb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CustomItems/Items/AutoGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ protected override void OnShooting(ShootingEventArgs ev)
{
if (ev.Shooter.CurrentItem.durability != ammoUsed || (PerHitAmmo && ev.Shooter.CurrentItem.durability != 0))
{
if (player.Side != ev.Shooter.Side || (player.Side == ev.Shooter.Side && TeamKill))
if (player.Role != RoleType.Spectator && (player.Side != ev.Shooter.Side || (player.Side == ev.Shooter.Side && TeamKill)))
{
if (player != ev.Shooter && Vector3.Distance(ev.Shooter.Position, player.Position) < MaxDistance)
{
if (!Physics.Linecast(ev.Shooter.Position, player.Position, player.ReferenceHub.playerMovementSync.CollidableSurfaces))
{
ammoUsed++;
player.Hurt(Damage, ev.Shooter, DamageTypes.Com15);
player.Hurt(Damage, DamageTypes.Com15, ev.Shooter.Nickname, ev.Shooter.Id);
if (player.IsDead)
player.ShowHint("<color=#FF0000>YOU HAVE BEEN KILLED BY AUTO AIM GUN</color>");
ev.Shooter.ReferenceHub.weaponManager.RpcConfirmShot(true, ev.Shooter.ReferenceHub.weaponManager.curWeapon);
Expand Down
5 changes: 3 additions & 2 deletions CustomItems/Items/TranquilizerGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ private IEnumerator<float> DoTranquilize(Player player, float duration)
foreach (Inventory.SyncItemInfo item in player.Inventory.items.ToList())
{
if (TryGet(item, out CustomItem customItem))
{
customItem.Spawn(player.Position, item, out _);

player.Inventory.items.Remove(item);
player.Inventory.items.Remove(item);
}
}

player.DropItems();
Expand Down
2 changes: 1 addition & 1 deletion CustomItems/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.2.0")]
[assembly: AssemblyVersion("2.3.3.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]

0 comments on commit 09fbfb8

Please sign in to comment.