From d1ed96abb5565a72d0089cc60eb9397a3937c21e Mon Sep 17 00:00:00 2001 From: GrafDimenzio <66207264+GrafDimenzio@users.noreply.github.com> Date: Fri, 18 Feb 2022 17:05:15 +0100 Subject: [PATCH] fixed SCP1499 bug --- MoreWeapons/EventHandlers.cs | 2 +- MoreWeapons/PluginClass.cs | 4 ++-- MoreWeapons/Scripts/Scp1499PlayerScript.cs | 15 ++++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/MoreWeapons/EventHandlers.cs b/MoreWeapons/EventHandlers.cs index 742a168..3be00d6 100644 --- a/MoreWeapons/EventHandlers.cs +++ b/MoreWeapons/EventHandlers.cs @@ -65,7 +65,7 @@ private void OnItemUse(PlayerItemInteractEventArgs ev) break; case (int)CustomItemType.Scp1499 when ev.State == Synapse.Api.Events.SynapseEventArguments.ItemInteractState.Finalizing: - ev.Player.GetComponent().Use1499(); + ev.Player.GetComponent().Use1499(ev.CurrentItem); ev.Allow = false; break; } diff --git a/MoreWeapons/PluginClass.cs b/MoreWeapons/PluginClass.cs index 505d69b..ce4927c 100644 --- a/MoreWeapons/PluginClass.cs +++ b/MoreWeapons/PluginClass.cs @@ -11,8 +11,8 @@ namespace MoreWeapons Description = "A Plugin that adds new Weapons & Items to the Game", LoadPriority = 100, SynapseMajor = 2, - SynapseMinor = 8, - SynapsePatch = 3, + SynapseMinor = 9, + SynapsePatch = 0, Version = "1.3.2" )] public class PluginClass : AbstractPlugin diff --git a/MoreWeapons/Scripts/Scp1499PlayerScript.cs b/MoreWeapons/Scripts/Scp1499PlayerScript.cs index e82f90a..66dcaa8 100644 --- a/MoreWeapons/Scripts/Scp1499PlayerScript.cs +++ b/MoreWeapons/Scripts/Scp1499PlayerScript.cs @@ -3,6 +3,7 @@ using MEC; using Synapse.Api; using Synapse.Api.Enum; +using Synapse.Api.Items; using UnityEngine; namespace MoreWeapons.Scripts @@ -17,7 +18,7 @@ public class Scp1499PlayerScript : MonoBehaviour public bool IsInDimension { get; set; } = false; - public void Use1499() + public void Use1499(SynapseItem scp1499) { if (player.Zone == ZoneType.Pocket) { @@ -34,7 +35,7 @@ public void Use1499() IsInDimension = false; - (player.ItemInHand?.ItemBase as Scp268)?.ServerSetGlobalItemCooldown(PluginClass.Scp1499Config.Cooldown); + (scp1499?.ItemBase as Scp268)?.ServerSetGlobalItemCooldown(PluginClass.Scp1499Config.Cooldown); Timing.KillCoroutines(kickcoroutine.ToArray()); } @@ -44,25 +45,25 @@ public void Use1499() OldPosition = player.Position; player.Position = PluginClass.Scp1499Config.Scp1499Dimension.Parse().Position; - KickOut(PluginClass.Scp1499Config.Scp1499ResidenceTime); + KickOut(PluginClass.Scp1499Config.Scp1499ResidenceTime,scp1499); IsInDimension = true; } } - public void KickOut(float delay) + public void KickOut(float delay, SynapseItem scp1499) { if (delay < 0f) return; - kickcoroutine.Add(Timing.RunCoroutine(KickOutOfScp1499(delay))); + kickcoroutine.Add(Timing.RunCoroutine(KickOutOfScp1499(delay,scp1499))); } private readonly List kickcoroutine = new List(); - private IEnumerator KickOutOfScp1499(float delay) + private IEnumerator KickOutOfScp1499(float delay, SynapseItem scp1499) { yield return Timing.WaitForSeconds(delay); if (IsInDimension) - Use1499(); + Use1499(scp1499); } } }