From ab6f7eb2911443c22960ea1f5517ff182c883615 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Fri, 14 Apr 2017 00:11:32 -0700 Subject: [PATCH 1/6] Hold music for Turn the Key, Square Button. Well, since trolls could issue a time, such that focus will be held on that module till that time is reached, or !cancel is issued, similar to what happens with the needy capacitor, hold music is fitting for that purpose. --- .../Modded/SquareButtonComponentSolver.cs | 23 +++++++++++++++++++ .../Modded/TurnTheKeyComponentSolver.cs | 17 +++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/SquareButtonComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/SquareButtonComponentSolver.cs index 7f78c72..87ea74e 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/SquareButtonComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/SquareButtonComponentSolver.cs @@ -81,11 +81,22 @@ private IEnumerator ReleaseCoroutine(string second) int timeTarget = sortedTimes[0]; sortedTimes.RemoveAt(0); + + int waitTime = (int)((float)CommonReflectedTypeInfo.TimeRemainingField.GetValue(timerComponent) + 0.25f); + waitTime -= timeTarget; + if (waitTime >= 30) + { + _musicPlayer = MusicPlayer.StartRandomMusic(); + } + float timeRemaining = float.PositiveInfinity; while (timeRemaining > 0.0f) { if (Canceller.ShouldCancel) { + if (waitTime >= 30) + _musicPlayer.StopMusic(); + Canceller.ResetCancel(); yield break; } @@ -94,9 +105,18 @@ private IEnumerator ReleaseCoroutine(string second) if (timeRemaining < timeTarget) { + if (waitTime >= 30) + _musicPlayer.StopMusic(); + if(sortedTimes.Count == 0) yield break; timeTarget = sortedTimes[0]; sortedTimes.RemoveAt(0); + + waitTime = (int)timeRemaining; + waitTime -= timeTarget; + if (waitTime >= 30) + _musicPlayer = MusicPlayer.StartRandomMusic(); + continue; } if (timeRemaining == timeTarget) @@ -108,6 +128,8 @@ private IEnumerator ReleaseCoroutine(string second) } DoInteractionEnd(_button); _held = false; + if (waitTime >= 30) + _musicPlayer.StopMusic(); break; } @@ -126,4 +148,5 @@ static SquareButtonComponentSolver() private MonoBehaviour _button = null; private bool _held = false; + private MusicPlayer _musicPlayer = null; } diff --git a/Assets/Scripts/ComponentSolvers/Modded/TurnTheKeyComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/TurnTheKeyComponentSolver.cs index 7ccbefb..1a695ea 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/TurnTheKeyComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/TurnTheKeyComponentSolver.cs @@ -54,13 +54,21 @@ private IEnumerator ReleaseCoroutine(string second) int timeTarget = sortedTimes[0]; sortedTimes.RemoveAt(0); + int waitingTime = (int)((float)CommonReflectedTypeInfo.TimeRemainingField.GetValue(timerComponent) + 0.25f); + waitingTime -= timeTarget; + + if (waitingTime >= 30) + { + _musicPlayer = MusicPlayer.StartRandomMusic(); + } + float timeRemaining = float.PositiveInfinity; while (timeRemaining > 0.0f) { if (Canceller.ShouldCancel) { Canceller.ResetCancel(); - yield break; + break; } timeRemaining = (int)((float)CommonReflectedTypeInfo.TimeRemainingField.GetValue(timerComponent) + 0.25f); @@ -82,6 +90,12 @@ private IEnumerator ReleaseCoroutine(string second) yield return null; } + + if (waitingTime >= 30) + { + _musicPlayer.StopMusic(); + } + } static TurnTheKeyComponentSolver() @@ -94,4 +108,5 @@ static TurnTheKeyComponentSolver() private static FieldInfo _lockField = null; private MonoBehaviour _lock = null; + private MusicPlayer _musicPlayer = null; } From 48ba5d0b43115c8a9dbb5c5d8d0aafb0b54b5e88 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 15 Apr 2017 03:06:31 -0700 Subject: [PATCH 2/6] Cleaned up Two Bits code ***Note - This will be removed if and when my PR into the Two Bits source code is accepted.*** --- .../Modded/TwoBitsComponentSolver.cs | 91 ++++++++++--------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs index c40b0ee..72b207f 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Linq; using System.Reflection; using UnityEngine; @@ -7,7 +8,7 @@ public class TwoBitsComponentSolver : ComponentSolver { private Component c; - private string pressedQuery; + private const string ButtonLabels = "bcdegkptvz"; public TwoBitsComponentSolver(BombCommander bombCommander, MonoBehaviour bombComponent, IRCConnection ircConnection, CoroutineCanceller canceller) : base(bombCommander, bombComponent, ircConnection, canceller) @@ -16,68 +17,67 @@ public TwoBitsComponentSolver(BombCommander bombCommander, MonoBehaviour bombCom _submit = (MonoBehaviour)_submitButtonField.GetValue(c); _query = (MonoBehaviour)_queryButtonField.GetValue(c); - _buttons = (Array)_buttonsField.GetValue(c); + _buttons = (MonoBehaviour[])_buttonsField.GetValue(c); } protected override IEnumerator RespondToCommandInternal(string inputCommand) { + var split = inputCommand.ToLowerInvariant().Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries); int beforeTwoBitsStrikeCount = StrikeCount; - string correctresponse = (string)_calculateCorrectSubmissionMethod.Invoke(c, null); - pressedQuery = string.Empty; + string correctresponse = ((string)_calculateCorrectSubmissionMethod.Invoke(c, null)).ToLowerInvariant(); - if (inputCommand.StartsWith("query ", StringComparison.InvariantCultureIgnoreCase)) + + if (split[0] != "query" && split[0] != "submit") + { + yield break; + } + foreach (var x in split.Skip(1)) { - var querystring = inputCommand.Substring(5).ToLowerInvariant(); - foreach (var q in querystring) + foreach (var y in x) { - yield return HandlePress(q); - if (beforeTwoBitsStrikeCount != StrikeCount) break; + if (!ButtonLabels.Contains(y)) + { + yield break; + } } - if (beforeTwoBitsStrikeCount != StrikeCount) yield break; - yield return HandleQuery(); } - else if (inputCommand.StartsWith("submit ", StringComparison.InvariantCultureIgnoreCase)) + + yield return "TwoBits Solve Attempt"; + foreach (var x in split.Skip(1)) { - var querystring = inputCommand.Substring(6).ToLowerInvariant(); - foreach (var q in querystring) + foreach (var y in x) { - yield return HandlePress(q); - if (beforeTwoBitsStrikeCount != StrikeCount) break; + yield return HandlePress(y); + /*if (beforeTwoBitsStrikeCount != StrikeCount) + { + yield break; + }*/ + yield return "trycancel"; } - if (beforeTwoBitsStrikeCount != StrikeCount) yield break; - yield return correctresponse.Equals(pressedQuery) ? "solve" : "strike"; - yield return HandleSubmit(); } - } - - private IEnumerator HandleQuery() - { - yield return "query"; - DoInteractionStart(_query); - yield return new WaitForSeconds(0.1f); - DoInteractionEnd(_query); - } - private IEnumerator HandleSubmit() - { - yield return "submit"; - DoInteractionStart(_submit); - yield return new WaitForSeconds(0.1f); - DoInteractionEnd(_submit); + if (split[0] == "query") + { + DoInteractionStart(_query); + yield return new WaitForSeconds(0.1f); + DoInteractionEnd(_query); + } + else + { + string currentQuery = ((string)_getCurrentQueryStringMethod.Invoke(c, null)).ToLowerInvariant(); + yield return correctresponse.Equals(currentQuery) ? "solve" : "strike"; + DoInteractionStart(_submit); + yield return new WaitForSeconds(0.1f); + DoInteractionEnd(_submit); + } } private IEnumerator HandlePress(char c) { - var buttonLabels = "bcdegkptvz"; - var pos = buttonLabels.IndexOf(c); - if (pos < 0) yield break; - pressedQuery += c; - - yield return c; - MonoBehaviour button = (MonoBehaviour)_buttons.GetValue(pos); - DoInteractionStart(button); + var pos = ButtonLabels.IndexOf(c); + DoInteractionStart(_buttons[pos]); yield return new WaitForSeconds(0.1f); - DoInteractionEnd(button); + DoInteractionEnd(_buttons[pos]); } static TwoBitsComponentSolver() @@ -88,6 +88,8 @@ static TwoBitsComponentSolver() _buttonsField = _componentSolverType.GetField("Buttons", BindingFlags.Public | BindingFlags.Instance); _calculateCorrectSubmissionMethod = _componentSolverType.GetMethod("CalculateCorrectSubmission", BindingFlags.NonPublic | BindingFlags.Instance); + _getCurrentQueryStringMethod = _componentSolverType.GetMethod("GetCurrentQueryString", + BindingFlags.NonPublic | BindingFlags.Instance); } private static Type _componentSolverType = null; @@ -95,9 +97,10 @@ static TwoBitsComponentSolver() private static FieldInfo _queryButtonField = null; private static FieldInfo _buttonsField = null; private static MethodInfo _calculateCorrectSubmissionMethod = null; + private static MethodInfo _getCurrentQueryStringMethod = null; - private Array _buttons = null; + private MonoBehaviour[] _buttons = null; private MonoBehaviour _query = null; private MonoBehaviour _submit = null; } From 6ac8e134ceb21c3702a6aebf39d034a92f3739b7 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 15 Apr 2017 03:10:17 -0700 Subject: [PATCH 3/6] Refactor the safety safe handler, Added "cycle", sped up regular input. --- .../Modded/SafetySafeComponentSolver.cs | 124 +++++++++++------- 1 file changed, 73 insertions(+), 51 deletions(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs index bc1160c..975b95e 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs @@ -1,98 +1,120 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Reflection; using UnityEngine; public class SafetySafeComponentSolver : ComponentSolver { - private static string[] DialPosNames = {"TL", "TM", "TR", "BL", "BM", "BR"}; + private static Dictionary DialPosNames = new Dictionary() + { + {"tl",0}, {"tm",1}, {"tc",1}, {"tr",2}, + {"lt",0}, {"mt",1}, {"ct",1}, {"rt",2}, + {"bl",3}, {"bm",4}, {"bc",4}, {"br",5}, + {"lb",3}, {"mb",4}, {"cb",4}, {"rb",5}, + {"topleft",0}, {"topmiddle",1}, {"topcenter",1}, {"topcentre",1}, {"topright",2}, + {"lefttop",0}, {"middletop",1}, {"centertop",1}, {"centretop",1}, {"righttop",2}, + {"bottomleft",3}, {"bottommiddle",4}, {"bottomcenter",4}, {"bottomcentre",4}, {"bottomright",5}, + {"leftbottom",3}, {"middlebottom",4}, {"centerbottom",4}, {"centrebottom",4}, {"rightbottom",5}, + }; public SafetySafeComponentSolver(BombCommander bombCommander, MonoBehaviour bombComponent, IRCConnection ircConnection, CoroutineCanceller canceller) : base(bombCommander, bombComponent, ircConnection, canceller) { - _buttons = (Array)_buttonsField.GetValue(bombComponent.GetComponent(_componentType)); + _buttons = (MonoBehaviour[])_buttonsField.GetValue(bombComponent.GetComponent(_componentType)); _lever = (MonoBehaviour)_leverField.GetValue(bombComponent.GetComponent(_componentType)); } protected override IEnumerator RespondToCommandInternal(string inputCommand) { - if (inputCommand.Equals("submit")) + var split = inputCommand.ToLowerInvariant().Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries); + int pos; + + if (split[0] == "submit" && split.Length == 1) { yield return "submit"; DoInteractionStart(_lever); yield return new WaitForSeconds(0.1f); DoInteractionEnd(_lever); - yield break; } - for(int a = 0; a < DialPosNames.Length; a++) + else if (split[0] == "cycle" && split.Length == 1) { - string id = DialPosNames[a]; - if (inputCommand.StartsWith(id, StringComparison.InvariantCultureIgnoreCase)) + yield return "cycle"; + for (var i = 0; i < 6; i++) { - string after = inputCommand.Substring(id.Length); - if (after.Length == 0) + for (var j = 0; j < 12; j++) { - IEnumerator coroutine = HandlePress(a); - while (coroutine.MoveNext()) + yield return HandlePress(i); + yield return new WaitForSeconds(0.3f); + if (Canceller.ShouldCancel) { - yield return coroutine.Current; + Canceller.ResetCancel(); + yield break; } } - else + if(i < 5) + yield return new WaitForSeconds(0.5f); + } + } + else if (DialPosNames.TryGetValue(split[0], out pos)) + { + if (split.Length == 1) + { + yield return split[0]; + yield return HandlePress(pos); + } + else if (split.Length == 2) + { + int val = 0; + if (!int.TryParse(split[1], out val)) yield break; + while (val < 0) + val += 12; + val %= 12; + yield return split[0]; + for (int z = 0; z < val; z++) { - int val = 0; - if(!int.TryParse(inputCommand.Substring(2), out val)) yield break; - if(val < 0) yield break; - for(int z = 0; z < val; z++) + yield return HandlePress(pos); + if (Canceller.ShouldCancel) { - IEnumerator coroutine = HandlePress(a); - while (coroutine.MoveNext()) - { - yield return coroutine.Current; - } - if (Canceller.ShouldCancel) - { - Canceller.ResetCancel(); - yield break; - } - yield return new WaitForSeconds(0.5f); + Canceller.ResetCancel(); + yield break; } } - yield break; } } - - string[] values = inputCommand.Split(new string[]{" "}, 99, StringSplitOptions.RemoveEmptyEntries); - if (values.Length != 6) yield break; - - for (int a = 0; a < 6; a++) + else if (split.Length == 6) { - int val = 0; - if(!int.TryParse(values[a], out val)) yield break; - if(val < 0) yield break; - for(int z = 0; z < val; z++) + int[] values = new int[6]; + for (int a = 0; a < 6; a++) { - IEnumerator coroutine = HandlePress(a); - while (coroutine.MoveNext()) - { - yield return coroutine.Current; - } - if (Canceller.ShouldCancel) - { - Canceller.ResetCancel(); + if (!int.TryParse(split[a], out values[a])) yield break; + while (values[a] < 0) + values[a] += 12; + values[a] %= 12; + } + + yield return inputCommand; + for (int a = 0; a < 6; a++) + { + for (int z = 0; z < values[a]; z++) + { + yield return HandlePress(a); + if (Canceller.ShouldCancel) + { + Canceller.ResetCancel(); + yield break; + } } - yield return new WaitForSeconds(0.2f); } } } private IEnumerator HandlePress(int pos) { - MonoBehaviour button = (MonoBehaviour)_buttons.GetValue(pos); - DoInteractionStart(button); + DoInteractionStart(_buttons[pos]); yield return new WaitForSeconds(0.1f); - DoInteractionEnd(button); + DoInteractionEnd(_buttons[pos]); } static SafetySafeComponentSolver() @@ -105,6 +127,6 @@ static SafetySafeComponentSolver() private static Type _componentType = null; private static FieldInfo _buttonsField, _leverField = null; - private Array _buttons = null; + private MonoBehaviour[] _buttons = null; private MonoBehaviour _lever = null; } From 2e5f5090d521b556d1c35a1210fa642efdf827fe Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 15 Apr 2017 04:48:41 -0700 Subject: [PATCH 4/6] Format of two bits changed to press [buttons] --- .../Modded/TwoBitsComponentSolver.cs | 82 ++++++++++++------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs index 72b207f..ffcd90b 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/TwoBitsComponentSolver.cs @@ -8,6 +8,18 @@ public class TwoBitsComponentSolver : ComponentSolver { private Component c; + protected enum State + { + Inactive, + Idle, + Working, + ShowingResult, + ShowingError, + SubmittingResult, + IncorrectSubmission, + Complete + } + private const string ButtonLabels = "bcdegkptvz"; public TwoBitsComponentSolver(BombCommander bombCommander, MonoBehaviour bombComponent, IRCConnection ircConnection, CoroutineCanceller canceller) : @@ -23,52 +35,59 @@ public TwoBitsComponentSolver(BombCommander bombCommander, MonoBehaviour bombCom protected override IEnumerator RespondToCommandInternal(string inputCommand) { var split = inputCommand.ToLowerInvariant().Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries); - int beforeTwoBitsStrikeCount = StrikeCount; - string correctresponse = ((string)_calculateCorrectSubmissionMethod.Invoke(c, null)).ToLowerInvariant(); - - if (split[0] != "query" && split[0] != "submit") - { + if (split.Length < 2 || split[0] != "press") yield break; - } + foreach (var x in split.Skip(1)) { - foreach (var y in x) + switch (x) { - if (!ButtonLabels.Contains(y)) - { - yield break; - } + case "query": + case "submit": + break; + default: + foreach (var y in x) + if (!ButtonLabels.Contains(y)) + yield break; + break; } } - yield return "TwoBits Solve Attempt"; + yield return "Two Bits Solve Attempt"; foreach (var x in split.Skip(1)) { - foreach (var y in x) + switch (x) { - yield return HandlePress(y); - /*if (beforeTwoBitsStrikeCount != StrikeCount) - { - yield break; - }*/ - yield return "trycancel"; + case "query": + DoInteractionStart(_query); + yield return new WaitForSeconds(0.1f); + DoInteractionEnd(_query); + break; + case "submit": + DoInteractionStart(_submit); + yield return new WaitForSeconds(0.1f); + DoInteractionEnd(_submit); + break; + default: + foreach (var y in x) + { + yield return HandlePress(y); + _state = (State)_stateField.GetValue(c); + if (_state == State.ShowingError || _state == State.Inactive) + yield break; + } + break; } - } - - if (split[0] == "query") - { - DoInteractionStart(_query); yield return new WaitForSeconds(0.1f); - DoInteractionEnd(_query); } - else + + _state = (State)_stateField.GetValue(c); + if (_state == State.SubmittingResult) { - string currentQuery = ((string)_getCurrentQueryStringMethod.Invoke(c, null)).ToLowerInvariant(); + string correctresponse = ((string)_calculateCorrectSubmissionMethod.Invoke(c, null)).ToLowerInvariant(); + string currentQuery = ((string) _getCurrentQueryStringMethod.Invoke(c, null)).ToLowerInvariant(); yield return correctresponse.Equals(currentQuery) ? "solve" : "strike"; - DoInteractionStart(_submit); - yield return new WaitForSeconds(0.1f); - DoInteractionEnd(_submit); } } @@ -86,6 +105,7 @@ static TwoBitsComponentSolver() _submitButtonField = _componentSolverType.GetField("SubmitButton", BindingFlags.Public | BindingFlags.Instance); _queryButtonField = _componentSolverType.GetField("QueryButton", BindingFlags.Public | BindingFlags.Instance); _buttonsField = _componentSolverType.GetField("Buttons", BindingFlags.Public | BindingFlags.Instance); + _stateField = _componentSolverType.GetField("currentState", BindingFlags.NonPublic | BindingFlags.Instance); _calculateCorrectSubmissionMethod = _componentSolverType.GetMethod("CalculateCorrectSubmission", BindingFlags.NonPublic | BindingFlags.Instance); _getCurrentQueryStringMethod = _componentSolverType.GetMethod("GetCurrentQueryString", @@ -98,9 +118,11 @@ static TwoBitsComponentSolver() private static FieldInfo _buttonsField = null; private static MethodInfo _calculateCorrectSubmissionMethod = null; private static MethodInfo _getCurrentQueryStringMethod = null; + private static FieldInfo _stateField = null; private MonoBehaviour[] _buttons = null; private MonoBehaviour _query = null; private MonoBehaviour _submit = null; + private State _state; } From 6825dcc1f448ac156bad92edc7377c31e34a9e31 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 15 Apr 2017 16:01:18 -0700 Subject: [PATCH 5/6] Probing has strike abort safety in it. This is because a strike elsewhere on the bomb, has a 20% chance of causing probing to change its frequency, and thus make the submitted answer an additional strike. Also, if that strike happens in the middle of the cycle command, the frequency change if it happens will make that set of frequencies read unsuable. --- .../Modded/ProbingComponentSolver.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/ProbingComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/ProbingComponentSolver.cs index cfc9268..cd1bda9 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/ProbingComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/ProbingComponentSolver.cs @@ -18,7 +18,7 @@ protected override IEnumerator RespondToCommandInternal(string inputCommand) _wires[4] == null || _wires[5] == null) yield break; - + var beforeStrikes = StrikeCount; if (split.Length == 1 && split[0] == "cycle") { yield return "Reading the frequencies"; @@ -27,6 +27,13 @@ protected override IEnumerator RespondToCommandInternal(string inputCommand) for (var i = 1; i < 6; i++) { yield return ConnectWires(i, 0); + if (beforeStrikes != StrikeCount) + { + //A strike somewhere else on the bomb has the possibility to change the frequencies, and thus + //ruin the reading. + yield return EnsureWiresConnected(4, 4); + yield break; + } yield return new WaitForSeconds(2.0f); } yield return ConnectWires(4, 4); //Leave the blue wire disconnected. @@ -41,7 +48,16 @@ protected override IEnumerator RespondToCommandInternal(string inputCommand) yield return "Probing Solve Attempt"; yield return EnsureWiresConnected(red-1, blue-1); - yield return new WaitForSeconds(6.5f); + + for (var i = 0; i < 65; i++) + { + yield return new WaitForSeconds(0.1f); + if (beforeStrikes == StrikeCount) continue; + + //A strike somewhere else on the bomb has the possibility to cause a strike here. + yield return EnsureWiresConnected(4, 4); + yield break; + } } From 6a132f7814b1ec7b0a5e5f739a6b220fd3d5b9b1 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 15 Apr 2017 20:07:15 -0700 Subject: [PATCH 6/6] Mod 12 before changing negative to correct positve value. --- .../ComponentSolvers/Modded/SafetySafeComponentSolver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs b/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs index 975b95e..799d5ab 100644 --- a/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs +++ b/Assets/Scripts/ComponentSolvers/Modded/SafetySafeComponentSolver.cs @@ -67,9 +67,9 @@ protected override IEnumerator RespondToCommandInternal(string inputCommand) { int val = 0; if (!int.TryParse(split[1], out val)) yield break; + val %= 12; while (val < 0) val += 12; - val %= 12; yield return split[0]; for (int z = 0; z < val; z++) { @@ -89,9 +89,9 @@ protected override IEnumerator RespondToCommandInternal(string inputCommand) { if (!int.TryParse(split[a], out values[a])) yield break; + values[a] %= 12; while (values[a] < 0) values[a] += 12; - values[a] %= 12; } yield return inputCommand;