Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into pr/5185
  • Loading branch information
ElectroJr committed Jun 5, 2024
2 parents 5e7297e + 75626a8 commit e75eb88
Show file tree
Hide file tree
Showing 133 changed files with 2,512 additions and 2,070 deletions.
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<PackageVersion Include="ILReader.Core" Version="1.0.0.4" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.0" />
<PackageVersion Include="Linguini.Bundle" Version="0.1.3" />
<PackageVersion Include="Linguini.Bundle" Version="0.8.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzer.Testing" Version="1.1.1"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.NUnit" Version="1.1.1"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzer.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.NUnit" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
Expand Down Expand Up @@ -71,4 +71,4 @@
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.0" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
</ItemGroup>
</Project>
</Project>
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>223.3.0</Version></PropertyGroup>
<PropertyGroup><Version>224.0.1</Version></PropertyGroup>
</Project>
Expand Down
42 changes: 40 additions & 2 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ END TEMPLATE-->

### New features

*None yet*
* `ServerIntegrationInstance` has new methods for adding dummy player sessions for tests that require multiple players.

### Bugfixes

Expand All @@ -51,7 +51,45 @@ END TEMPLATE-->

### Internal

*None yet*
* Added `DummySession` and `DummyChannel` classes for use in integration tests and benchmarks to fool the server into thinking that there are multiple players connected.
* Added `ICommonSessionInternal` and updated `CommonSession` so that the internal setters now go through that interface.

## 224.0.1

### Bugfixes

* Fixes PVS throwing exceptions when invalid entities are passed to `ExpandPvsEvent`. Now it just logs an error.
* Fixes BUIs not properly closing, resulting in invalid entities in `UserInterfaceUserComponent.OpenInterfaces`
* Fixes an unknown/invalid prototype exception sometimes being thrown when running ``IPrototypeManager.ResolveResults()`


## 224.0.0

### Breaking changes

* `Matrix3` has been replaced with `System.Numerics.Matrix3x2`. Various Matrix related methods have been turned into extension methods in the `Matrix3Helpers` class.
* Engine `EntityCategory` prototype IDs have been changed to use CamelCase. I.e., `hideSpawnMenu` -> `HideSpawnMenu`
* Prototypes can now be implicitly cast `ProtoId<T>` or `EntProtoId` ID structs. The new implicit cast might cause previous function calls to be ambiguous.

### New features

* `Array.Clear(Array)` is now available in the sandbox.
* BUIs now use `ExpandPvsEvent`. I.e., if a player has a UI open, then the entity associated with that UI will always get sent to the player by the PVS system.
* Added `cvar_subs` command for listing all subscribers to cvar changes
* Entity categories have been reworked
* Each category now has a `HideSpawnMenu` field. The old `HideSpawnMenu` category is now just a normal category with that field set to true.
* Reworked category inheritance. Inheritance can now be disabled per category using a `Inheritable` field.
* Entity prototypes can now be automatically added to categories based on the components that they have, either by specifying components when defining the category in yml, or by adding the EntityCategoryAttribute to the component class.

### Bugfixes

* Fixed client-side BUI error log spam if an unknown entity has a UI open.
* Fixed placement manager spawning entities with incorrect rotations.

### Other

* Added a try-catch block to BUI constructors, to avoid clients getting stuck in error loops while applying states.
* Attempting to play sounds on terminating entities no longer logs an error.


## 223.3.0
Expand Down
2 changes: 1 addition & 1 deletion Resources/EnginePrototypes/Debug/rotation.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: entity
id: debugRotation
abstract: true
categories: [ debug ]
categories: [ Debug ]
components:
- type: Sprite
netsync: false
Expand Down
11 changes: 7 additions & 4 deletions Resources/EnginePrototypes/entityCategory.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# debug related entities
- type: entityCategory
id: debug
id: Debug
name: entity-category-name-debug
description: entity-category-desc-debug
suffix: entity-category-suffix-debug

# entities that spawn other entities
- type: entityCategory
id: spawner
id: Spawner
name: entity-category-name-spawner
description: entity-category-desc-spawner

# entities that should be hidden from the spawn menu
# simple category that just exists to hide prototypes in spawn menus
- type: entityCategory
id: hideSpawnMenu
id: HideSpawnMenu
name: entity-category-name-hide
description: entity-category-desc-hide
hideSpawnMenu: true
inheritable: false
29 changes: 9 additions & 20 deletions Resources/Locale/en-US/commands.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cmd-parse-failure-float = {$arg} is not a valid float.
cmd-parse-failure-bool = {$arg} is not a valid bool.
cmd-parse-failure-uid = {$arg} is not a valid entity UID.
cmd-parse-failure-mapid = {$arg} is not a valid MapId.
cmd-parse-failure-enum = {$arg} is not a {$enum} Enum.
cmd-parse-failure-grid = {$arg} is not a valid grid.
cmd-parse-failure-entity-exist = UID {$arg} does not correspond to an existing entity.
cmd-parse-failure-session = There is no session with username: {$username}
Expand Down Expand Up @@ -43,6 +44,13 @@ cmd-cvar-compl-list = List available CVars
cmd-cvar-arg-name = <name | ?>
cmd-cvar-value-hidden = <value hidden>
## 'cvar_subs' command
cmd-cvar_subs-desc = Lists the OnValueChanged subscriptions for a CVar.
cmd-cvar_subs-help = Usage: cvar_subs <name>
cmd-cvar_subs-invalid-args = Must provide exactly one argument.
cmd-cvar_subs-arg-name = <name>
## 'list' command
cmd-list-desc = Lists available commands, with optional search filter
cmd-list-help = Usage: list [filter]
Expand Down Expand Up @@ -245,9 +253,6 @@ cmd-bind-arg-command = <InputCommand>
cmd-net-draw-interp-desc = Toggles the debug drawing of the network interpolation.
cmd-net-draw-interp-help = Usage: net_draw_interp
cmd-net-draw-interp-desc = Toggles the debug drawing of the network interpolation.
cmd-net-draw-interp-help = Usage: net_draw_interp
cmd-net-watch-ent-desc = Dumps all network updates for an EntityId to the console.
cmd-net-watch-ent-help = Usage: net_watchent <0|EntityUid>
Expand Down Expand Up @@ -299,16 +304,9 @@ cmd-savegrid-help = savegrid <gridID> <Path>
cmd-testbed-desc = Loads a physics testbed on the specified map.
cmd-testbed-help = testbed <mapid> <test>
cmd-saveconfig-desc = Saves the client configuration to the config file.
cmd-saveconfig-help = saveconfig
## 'flushcookies' command
# Note: the flushcookies command is from Robust.Client.WebView, it's not in the main engine code.

cmd-flushcookies-desc = Flush CEF cookie storage to disk
cmd-flushcookies-help = This ensure cookies are properly saved to disk in the event of unclean shutdowns.
Note that the actual operation is asynchronous.
## 'addcomp' command
cmd-addcomp-desc = Adds a component to an entity.
cmd-addcomp-help = addcomp <uid> <componentName>
Expand Down Expand Up @@ -446,9 +444,6 @@ cmd-showanchored-help = Usage: showanchored
cmd-dmetamem-desc = Dumps a type's members in a format suitable for the sandbox configuration file.
cmd-dmetamem-help = Usage: dmetamem <type>
cmd-dmetamem-desc = Displays chunk bounds for the purposes of rendering.
cmd-dmetamem-help = Usage: showchunkbb <type>
cmd-launchauth-desc = Load authentication tokens from launcher data to aid in testing of live servers.
cmd-launchauth-help = Usage: launchauth <account name>
Expand Down Expand Up @@ -515,9 +510,6 @@ cmd-profsnap-help = Usage: profsnap
cmd-devwindow-desc = Dev Window
cmd-devwindow-help = Usage: devwindow
cmd-devwindow-desc = Open file
cmd-devwindow-help = Usage: testopenfile
cmd-scene-desc = Immediately changes the UI scene/state.
cmd-scene-help = Usage: scene <className>
Expand All @@ -528,14 +520,11 @@ cmd-hwid-desc = Returns the current HWID (HardWare ID).
cmd-hwid-help = Usage: hwid
cmd-vvread-desc = Retrieve a path's value using VV (View Variables).
cmd-vvread-desc = Usage: vvread <path>
cmd-vvread-help = Usage: vvread <path>
cmd-vvwrite-desc = Modify a path's value using VV (View Variables).
cmd-vvwrite-help = Usage: vvwrite <path>
cmd-vv-desc = Opens View Variables (VV).
cmd-vv-help = Usage: vv <path|entity ID|guihover>
cmd-vvinvoke-desc = Invoke/Call a path with arguments using VV.
cmd-vvinvoke-help = Usage: vvinvoke <path> [arguments...]
Expand Down
3 changes: 2 additions & 1 deletion Resources/Locale/en-US/entity-category.ftl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
entity-category-name-debug = Debug
entity-category-desc-debug = Entity prototypes intended for debugging & testing.
entity-category-suffix-debug = Debug
entity-category-name-spawner = Spawner
entity-category-desc-spawner = Entity prototypes that spawn other entities.
entity-category-name-hide = Hidden
entity-category-desc-hide = Entity prototypes that should be hidden from the spawn menu
entity-category-desc-hide = Entity prototypes that should be hidden from entity spawn menus
12 changes: 6 additions & 6 deletions Robust.Client/Debugging/DebugPhysicsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private void DrawWorld(DrawingHandleWorld worldHandle, OverlayDrawArgs args)
}

worldHandle.UseShader(null);
worldHandle.SetTransform(Matrix3.Identity);
worldHandle.SetTransform(Matrix3x2.Identity);
}

private void DrawScreen(DrawingHandleScreen screenHandle, OverlayDrawArgs args)
Expand Down Expand Up @@ -443,7 +443,7 @@ private void DrawScreen(DrawingHandleScreen screenHandle, OverlayDrawArgs args)
}

screenHandle.UseShader(null);
screenHandle.SetTransform(Matrix3.Identity);
screenHandle.SetTransform(Matrix3x2.Identity);
}

protected internal override void Draw(in OverlayDrawArgs args)
Expand Down Expand Up @@ -520,11 +520,11 @@ private void DrawJoint(DrawingHandleWorld worldHandle, Joint joint)
var matrix1 = xform1.WorldMatrix;
var matrix2 = xform2.WorldMatrix;

var xf1 = new Vector2(matrix1.R0C2, matrix1.R1C2);
var xf2 = new Vector2(matrix2.R0C2, matrix2.R1C2);
var xf1 = new Vector2(matrix1.M31, matrix1.M32);
var xf2 = new Vector2(matrix2.M31, matrix2.M32);

var p1 = matrix1.Transform(joint.LocalAnchorA);
var p2 = matrix2.Transform(joint.LocalAnchorB);
var p1 = Vector2.Transform(joint.LocalAnchorA, matrix1);
var p2 = Vector2.Transform(joint.LocalAnchorB, matrix2);

var xfa = new Transform(xf1, xform1.WorldRotation);
var xfb = new Transform(xf2, xform2.WorldRotation);
Expand Down
53 changes: 26 additions & 27 deletions Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public Vector2 Offset
[DataField("color")]
private Color color = Color.White;

public Matrix3 LocalMatrix = Matrix3.Identity;
public Matrix3x2 LocalMatrix = Matrix3x2.Identity;

[Animatable]
[ViewVariables(VVAccess.ReadWrite)]
Expand Down Expand Up @@ -389,10 +389,10 @@ public void CopyFrom(SpriteComponent other)

internal void UpdateLocalMatrix()
{
LocalMatrix = Matrix3.CreateTransform(in offset, in rotation, in scale);
LocalMatrix = Matrix3Helpers.CreateTransform(in offset, in rotation, in scale);
}

public Matrix3 GetLocalMatrix()
public Matrix3x2 GetLocalMatrix()
{
return LocalMatrix;
}
Expand Down Expand Up @@ -1304,22 +1304,21 @@ internal void RenderInternal(DrawingHandleWorld drawingHandle, Angle eyeRotation

// worldRotation + eyeRotation should be the angle of the entity on-screen. If no-rot is enabled this is just set to zero.
// However, at some point later the eye-matrix is applied separately, so we subtract -eye rotation for now:
var entityMatrix = Matrix3.CreateTransform(worldPosition, NoRotation ? -eyeRotation : worldRotation - cardinal);
var entityMatrix = Matrix3Helpers.CreateTransform(worldPosition, NoRotation ? -eyeRotation : worldRotation - cardinal);

Matrix3.Multiply(in LocalMatrix, in entityMatrix, out var transformSprite);
var transformSprite = Matrix3x2.Multiply(LocalMatrix, entityMatrix);

if (GranularLayersRendering)
{
//Default rendering
entityMatrix = Matrix3.CreateTransform(worldPosition, worldRotation);
Matrix3.Multiply(in LocalMatrix, in entityMatrix, out var transformDefault);
entityMatrix = Matrix3Helpers.CreateTransform(worldPosition, worldRotation);
var transformDefault = Matrix3x2.Multiply(LocalMatrix, entityMatrix);
//Snap to cardinals
entityMatrix = Matrix3.CreateTransform(worldPosition, worldRotation - angle.GetCardinalDir().ToAngle());
Matrix3.Multiply(in LocalMatrix, in entityMatrix, out var transformSnap);
entityMatrix = Matrix3Helpers.CreateTransform(worldPosition, worldRotation - angle.GetCardinalDir().ToAngle());
var transformSnap = Matrix3x2.Multiply(LocalMatrix, entityMatrix);
//No rotation
entityMatrix = Matrix3.CreateTransform(worldPosition, -eyeRotation);
Matrix3.Multiply(in LocalMatrix, in entityMatrix, out var transformNoRot);

entityMatrix = Matrix3Helpers.CreateTransform(worldPosition, -eyeRotation);
var transformNoRot = Matrix3x2.Multiply(LocalMatrix, entityMatrix);

foreach (var layer in Layers) {
switch (layer.RenderingStrategy)
Expand Down Expand Up @@ -1546,7 +1545,7 @@ [ViewVariables] public RSI.StateId State
private RSI.State? _actualState;
[ViewVariables] public RSI.State? ActualState => _actualState;

public Matrix3 LocalMatrix = Matrix3.Identity;
public Matrix3x2 LocalMatrix = Matrix3x2.Identity;

[ViewVariables(VVAccess.ReadWrite)]
public Vector2 Scale
Expand Down Expand Up @@ -1692,7 +1691,7 @@ void ISerializationHooks.AfterDeserialization()

internal void UpdateLocalMatrix()
{
LocalMatrix = Matrix3.CreateTransform(in _offset, in _rotation, in _scale);
LocalMatrix = Matrix3Helpers.CreateTransform(in _offset, in _rotation, in _scale);
}

RSI? ISpriteLayer.Rsi { get => RSI; set => SetRsi(value); }
Expand Down Expand Up @@ -1964,27 +1963,27 @@ internal void UpdateActualState()
/// Given the apparent rotation of an entity on screen (world + eye rotation), get layer's matrix for drawing &
/// relevant RSI direction.
/// </summary>
public void GetLayerDrawMatrix(RsiDirection dir, out Matrix3 layerDrawMatrix)
public void GetLayerDrawMatrix(RsiDirection dir, out Matrix3x2 layerDrawMatrix)
{
if (_parent.NoRotation || dir == RsiDirection.South)
layerDrawMatrix = LocalMatrix;
else
{
Matrix3.Multiply(in _rsiDirectionMatrices[(int)dir], in LocalMatrix, out layerDrawMatrix);
layerDrawMatrix = Matrix3x2.Multiply(_rsiDirectionMatrices[(int)dir], LocalMatrix);
}
}

private static Matrix3[] _rsiDirectionMatrices = new Matrix3[]
private static Matrix3x2[] _rsiDirectionMatrices = new Matrix3x2[]
{
// array order chosen such that this array can be indexed by casing an RSI direction to an int
Matrix3.Identity, // should probably just avoid matrix multiplication altogether if the direction is south.
Matrix3.CreateRotation(-Direction.North.ToAngle()),
Matrix3.CreateRotation(-Direction.East.ToAngle()),
Matrix3.CreateRotation(-Direction.West.ToAngle()),
Matrix3.CreateRotation(-Direction.SouthEast.ToAngle()),
Matrix3.CreateRotation(-Direction.SouthWest.ToAngle()),
Matrix3.CreateRotation(-Direction.NorthEast.ToAngle()),
Matrix3.CreateRotation(-Direction.NorthWest.ToAngle())
Matrix3x2.Identity, // should probably just avoid matrix multiplication altogether if the direction is south.
Matrix3Helpers.CreateRotation(-Direction.North.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.East.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.West.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.SouthEast.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.SouthWest.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.NorthEast.ToAngle()),
Matrix3Helpers.CreateRotation(-Direction.NorthWest.ToAngle())
};

/// <summary>
Expand Down Expand Up @@ -2018,7 +2017,7 @@ public static RsiDirection GetDirection(RsiDirectionType dirType, Angle angle)
/// <summary>
/// Render a layer. This assumes that the input angle is between 0 and 2pi.
/// </summary>
internal void Render(DrawingHandleWorld drawingHandle, ref Matrix3 spriteMatrix, Angle angle, Direction? overrideDirection)
internal void Render(DrawingHandleWorld drawingHandle, ref Matrix3x2 spriteMatrix, Angle angle, Direction? overrideDirection)
{
if (!Visible || Blank)
return;
Expand All @@ -2040,7 +2039,7 @@ internal void Render(DrawingHandleWorld drawingHandle, ref Matrix3 spriteMatrix,
if (CopyToShaderParameters == null)
{
// Set the drawing transform for this layer
Matrix3.Multiply(in layerMatrix, in spriteMatrix, out var transformMatrix);
var transformMatrix = Matrix3x2.Multiply(layerMatrix, spriteMatrix);
drawingHandle.SetTransform(in transformMatrix);

RenderTexture(drawingHandle, texture);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Shared.Console;
using Robust.Shared.Containers;
Expand Down Expand Up @@ -118,7 +119,7 @@ protected internal override void Draw(in OverlayDrawArgs args)
//DebugTools.Assert(!ent.IsInContainer(_entityManager));
var (entPos, entRot) = _transform.GetWorldPositionRotation(ent);
var lookupPos = invMatrix.Transform(entPos);
var lookupPos = Vector2.Transform(entPos, invMatrix);
var lookupRot = entRot - rotation;
var aabb = _lookup.GetAABB(ent, lookupPos, lookupRot, xform, _xformQuery);
Expand All @@ -127,6 +128,6 @@ protected internal override void Draw(in OverlayDrawArgs args)
}
});

worldHandle.SetTransform(Matrix3.Identity);
worldHandle.SetTransform(Matrix3x2.Identity);
}
}
Loading

0 comments on commit e75eb88

Please sign in to comment.