Skip to content

Commit 8a640ea

Browse files
fix: accept multi-unit cooldown durations in script flags
1 parent cd35a73 commit 8a640ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎Code/FlagSystem/ScriptFlagHandler.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using SER.Code.ScriptSystem.Structures;
88
using SER.Code.TokenSystem.Structures;
99
using SER.Code.TokenSystem.Tokens;
10+
using SER.Code.TokenSystem.Tokens.ValueTokens;
1011

1112
namespace SER.Code.FlagSystem;
1213

@@ -49,7 +50,10 @@ internal static TryGet<List<Flag>> PrepareScript(List<Line> scriptLinesWithFlags
4950
return $"Line {line.LineNumber}: Name of the flag is missing.";
5051
}
5152

52-
var args = tokens.Skip(2).Select(t => t.BestStaticTextRepr()).ToArray();
53+
// DurationValue.StringRep can contain spaces, so keep the parseable source token.
54+
var args = tokens.Skip(2)
55+
.Select(t => t is DurationToken ? t.RawRep : t.BestStaticTextRepr())
56+
.ToArray();
5357
var prefix = tokens.FirstOrDefault();
5458

5559
var result = prefix switch

0 commit comments

Comments
 (0)