Skip to content

Commit 5568f85

Browse files
committed
update Say emote to have default Extent of 0 instead of 1 (default chat broadcast range)
1 parent 5b87b14 commit 5568f85

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

EmoteScriptLib/Converter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public static List<string> BuildScript(Emote emote, int depth)
260260

261261
var indent = string.Concat(Enumerable.Repeat(" ", depth));
262262

263+
// TODO: detect when fields are used outside of fluent syntax, and fallback on kvp syntax
263264
scriptLines.Add($"{indent}- {emote.ToString(true)}");
264265

265266
if (emote.Branches != null)

EmoteScriptLib/JSON/Emote.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Emote(EmoteScriptLib.Emote emote)
4040
{
4141
type = (uint)emote.Type;
4242
delay = emote.Delay ?? 0.0f;
43-
extent = emote.Extent ?? 1.0f;
43+
extent = emote.Extent ?? (emote.Type == Entity.Enum.EmoteType.Say ? 0.0f : 1.0f);
4444
amount = (uint?)emote.Amount;
4545
motion = (uint?)emote.Motion;
4646
msg = emote.Message;

EmoteScriptLib/SQL/SQLReader.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,20 @@ public void PopulateFields(object record, List<string> currentColumns, List<stri
135135
}
136136
var value = GetValueType(prop, fields[i]);
137137

138-
if (DefaultValues.TryGetValue(propName, out var defaultValue) && value.ToString().Equals(defaultValue))
138+
// special handling for default extent based on emote type
139+
if (propName.Equals("Extent"))
140+
{
141+
var defaultExtent = "1";
142+
143+
var typeIdx = currentColumns.IndexOf("type");
144+
145+
if (typeIdx != -1 && fields[typeIdx] == "8") // EmoteType.Say
146+
defaultExtent = "0";
147+
148+
if (value.ToString().Equals(defaultExtent))
149+
continue;
150+
}
151+
else if (DefaultValues.TryGetValue(propName, out var defaultValue) && value.ToString().Equals(defaultValue))
139152
continue;
140153

141154
prop.SetValue(record, value, null);

EmoteScriptLib/SQL/SQLWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static List<string> GetSQL(List<Emote> emotes)
5858

5959
var typeStr = $"{(int)emote.Type} /* {emote.Type} */";
6060
var delay = emote.Delay?.ToString() ?? "0";
61-
var extent = emote.Extent?.ToString() ?? "1";
61+
var extent = emote.Extent?.ToString() ?? (emote.Type == EmoteType.Say ? "0" : "1");
6262
var motionStr = emote.Motion != null ? $"0x{(uint)emote.Motion:X8} /* {emote.Motion} */" : "NULL";
6363
var message = GetSQLString(emote.Message);
6464
var testString = GetSQLString(emote.TestString);

0 commit comments

Comments
 (0)