Skip to content

Commit

Permalink
Merge branch 'space-wizards:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
k3yw committed Jan 9, 2024
2 parents 64d2318 + ac60567 commit 50126c6
Show file tree
Hide file tree
Showing 37 changed files with 402 additions and 409 deletions.
2 changes: 1 addition & 1 deletion MSBuild/Robust.Engine.Version.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<!-- This file automatically reset by Tools/version.py -->
<PropertyGroup><Version>202.1.1</Version></PropertyGroup>
<PropertyGroup><Version>204.0.0</Version></PropertyGroup>
</Project>
Expand Down
49 changes: 47 additions & 2 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,59 @@ END TEMPLATE-->
*None yet*


## 204.0.0

### Breaking changes

* Make EntityManager abstract and make IEntityManager.EntityNetManager not nullable.
* Make VVAccess.ReadWrite default for all Datafields instead of VVAccess.ReadOnly

### New features

* `TextEdit.OnTextChanged`
* Add Pick and PickAndTake versions for System.Random for ICollections.

### Bugfixes

* Fix `IClipboardManager.GetText()` returning null in some cases.
* Fix possible NRE in server-side console command completion code.
* Fix possible NRE on DebugConsole logs.
* Fix exception when VVing non-networked components.

### Other

* Remove "Do not use from content" from IComponent.


## 203.0.0

### Breaking changes

* `IComponentFactory.RegisterIgnore()` no longer supports overwriting existing registrations, components should get ignored before they are registered.
* Event bus subscriptions are now locked after `IEntityManager` has started, instead of after the first component gets added. Any event subscriptions now need to happen before startup (but after init).
* Event bus subscriptions must now be locked before raising any events.
* Delete FodyWeavers.xsd as it hasn't been used for a long time.
* Remove physics sleep cancelling as it was, in hindsight, a bad idea.

### New features

* `RobustUnitTest` now has a `ExtraComponents` field for automatically registering additional components.
* `IComponentFactory.RegisterIgnore()` now accepts more than one string.
* Added `IComponentFactory.RegisterTypes` for simultaneously registering multiple components.

### Bugfixes

* Clamp volume calculations for audio rather than throwing.


## 202.1.1

### Bugfixes

* Reverted some map/grid initialisation changes that might've been causing broadphase/physics errors.
* Fixed PVS sometimes sending entities without first sending their children.
* Fixed a container state handling bug caused by containers not removing expected entities when shutting down.
* Fixed a `EnsureEntity<T>` state handling bug caused by improper handling of entity deletions.
* Fixed a `EnsureEntity<T>` state handling bug caused by improper handling of entity deletions.
* Fixed a bad NetSyncEnabled debug assert.


Expand All @@ -77,7 +122,7 @@ END TEMPLATE-->
### Breaking changes

* Various entity manager methods now have a new `where T : IComponent` constraint.
* The `IComponentFactory.ComponentAdded` event has been renamed to `ComponentsAdded` and now provides an array of component registrations.
* The `IComponentFactory.ComponentAdded` event has been renamed to `ComponentsAdded` and now provides an array of component registrations.
* `IComponentFactory.RegisterIgnore()` no longer supports overwriting existing registrations, components should get ignored before they are registered.

### New features
Expand Down
82 changes: 0 additions & 82 deletions Robust.Client/FodyWeavers.xsd

This file was deleted.

2 changes: 1 addition & 1 deletion Robust.Client/Graphics/Clyde/Windowing/Glfw.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public Task<string> ClipboardGetText(WindowReg mainWindow)

private static void WinThreadGetClipboard(CmdGetClipboard cmd)
{
var clipboard = GLFW.GetClipboardString((Window*) cmd.Window);
var clipboard = GLFW.GetClipboardString((Window*) cmd.Window) ?? "";
// Don't have to care about synchronization I don't think so just fire this immediately.
cmd.Tcs.TrySetResult(clipboard);
}
Expand Down
20 changes: 18 additions & 2 deletions Robust.Client/UserInterface/Controls/TextEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public sealed class TextEdit : Control
internal bool DebugOverlay;
private Vector2? _lastDebugMousePos;

public event Action<TextEditEventArgs>? OnTextChanged;

public TextEdit()
{
IoCManager.InjectDependencies(this);
Expand Down Expand Up @@ -315,7 +317,7 @@ protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
if (changed)
{
_selectionStart = _cursorPosition;
// OnTextChanged?.Invoke(new LineEditEventArgs(this, _text));
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));
// _updatePseudoClass();
// OnBackspace?.Invoke(new LineEditBackspaceEventArgs(oldText, _text, cursor, selectStart));
}
Expand Down Expand Up @@ -349,7 +351,7 @@ protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
if (changed)
{
_selectionStart = _cursorPosition;
// OnTextChanged?.Invoke(new LineEditEventArgs(this, _text));
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));
// _updatePseudoClass();
}

Expand Down Expand Up @@ -382,7 +384,10 @@ protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
}

if (changed)
{
_selectionStart = _cursorPosition;
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));
}

InvalidateHorizontalCursorPos();
args.Handle();
Expand Down Expand Up @@ -411,7 +416,10 @@ protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
}

if (changed)
{
_selectionStart = _cursorPosition;
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));
}

InvalidateHorizontalCursorPos();
args.Handle();
Expand Down Expand Up @@ -748,6 +756,7 @@ protected internal override void TextEditing(GUITextEditingEventArgs args)

var startPos = _cursorPosition;
TextRope = Rope.Insert(TextRope, startPos.Index, ev.Text);
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));

_selectionStart = _cursorPosition = new CursorPos(startPos.Index + startChars, LineBreakBias.Top);
_imeData = (startPos, ev.Text.Length);
Expand Down Expand Up @@ -844,6 +853,7 @@ public void InsertAtCursor(string text)
var upper = SelectionUpper.Index;

TextRope = Rope.ReplaceSubstring(TextRope, lower, upper - lower, text);
OnTextChanged?.Invoke(new TextEditEventArgs(this, _textRope));

_selectionStart = _cursorPosition = new CursorPos(lower + text.Length, LineBreakBias.Top);
// OnTextChanged?.Invoke(new LineEditEventArgs(this, _text));
Expand Down Expand Up @@ -1441,6 +1451,12 @@ protected internal override void KeyboardFocusExited()
AbortIme(delete: false);
}

public sealed class TextEditEventArgs(TextEdit control, Rope.Node textRope) : EventArgs
{
public TextEdit Control { get; } = control;
public Rope.Node TextRope { get; } = textRope;
}

/// <summary>
/// Specifies which line the cursor is positioned at when on a word-wrapping break.
/// </summary>
Expand Down
11 changes: 4 additions & 7 deletions Robust.Client/UserInterface/CustomControls/DebugConsole.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IDebugConsoleView
// And also if Update() stops firing due to an exception loop the console will still work.
// (At least from the main thread, which is what's throwing the exceptions..)
[GenerateTypedNameReferences]
public sealed partial class DebugConsole : Control, IDebugConsoleView, IPostInjectInit
public sealed partial class DebugConsole : Control, IDebugConsoleView
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
Expand All @@ -49,14 +49,16 @@ public sealed partial class DebugConsole : Control, IDebugConsoleView, IPostInje
private static readonly ResPath HistoryPath = new("/debug_console_history.json");

private readonly ConcurrentQueue<FormattedMessage> _messageQueue = new();
private ISawmill _logger = default!;
private readonly ISawmill _logger;

public DebugConsole()
{
RobustXamlLoader.Load(this);

IoCManager.InjectDependencies(this);

_logger = _logMan.GetSawmill("dbgconsole");

InitCompletions();

CommandBar.OnTextChanged += OnCommandChanged;
Expand Down Expand Up @@ -282,10 +284,5 @@ await Task.Run(async () =>
}
});
}

void IPostInjectInit.PostInject()
{
_logger = _logMan.GetSawmill("dbgconsole");
}
}
}
3 changes: 3 additions & 0 deletions Robust.Server/Console/ServerConsoleHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ private async void HandleConCompletions(MsgConCompletion message)
}

done:

result ??= CompletionResult.Empty;

var msg = new MsgConCompletionResp
{
Result = result,
Expand Down
2 changes: 1 addition & 1 deletion Robust.Server/ViewVariables/ViewVariablesSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void Modify(object[] propertyIndex, object value)

// Auto-dirty component. Only works when modifying a field that is directly on a component,
// Does not work for nested objects.
if (Object is Component comp)
if (Object is Component { NetSyncEnabled: true } comp)
EntityManager.Dirty(comp.Owner, comp);
}

Expand Down
2 changes: 1 addition & 1 deletion Robust.Shared/Audio/Systems/SharedAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static float GainToVolume(float value)
{
if (value < 0f)
{
throw new InvalidOperationException($"Tried to get volume calculation for gain of {value}.");
value = 0f;
}

return 10f * MathF.Log10(value);
Expand Down
Loading

0 comments on commit 50126c6

Please sign in to comment.