Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn DMF properties into DMFProperty types #1757

Merged
merged 37 commits into from
Jun 6, 2024

Conversation

amylizzle
Copy link
Contributor

@amylizzle amylizzle commented Apr 21, 2024

winget stuff is more complicated than OD can handle right now, and it needs some type information needs to be passed along to process it properly. Notably pos and size vars can be accessed by their individual components, or formatted as json like {"x":123, "y":321}. Also pretty much all of the as blah features have different behaviour depending on the type of the var.

Requires: #1789
This PR implements:

I'm not doing this:

  • Allows thing.pos.x winget access
    because nobody uses it and it'd be a huge pain. I guess we'll do it later if it's needed.

@boring-cyborg boring-cyborg bot added the Client Involves the OpenDream client label Apr 21, 2024
@github-actions github-actions bot added size/XXL and removed size/XL labels Apr 23, 2024
@boring-cyborg boring-cyborg bot added the Runtime Involves the OpenDream server/runtime label May 10, 2024
@amylizzle amylizzle marked this pull request as ready for review May 10, 2024 15:42
@amylizzle
Copy link
Contributor Author

amylizzle commented May 10, 2024

This is now finished, in that I'm not intending to add anymore to it. However, our positioning code is kinda fucky (see: the buttons in the winget test window), and that probably ought to be fixed in a separate PR because this is already huge.

Also I'm not doing the .x/.y components of size/pos DMF props, because it'd be another rewrite of winget processing and ceebs.

Requires space-wizards/RobustToolbox#5120 to work.

@amylizzle
Copy link
Contributor Author

All required prs are merged, this is now good to go after review

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InspectCode found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

OpenDreamClient/Interface/InterfaceMenu.cs Outdated Show resolved Hide resolved
OpenDreamClient/Interface/Controls/InterfaceControl.cs Outdated Show resolved Hide resolved
OpenDreamClient/Interface/DreamInterfaceManager.cs Outdated Show resolved Hide resolved
OpenDreamClient/Interface/DreamInterfaceManager.cs Outdated Show resolved Hide resolved
TestGame/TestInterface.dmf Show resolved Hide resolved
TestGame/TestInterface.dmf Outdated Show resolved Hide resolved
break;
case MenuDescriptor menuDescriptor:
InterfaceMenu menu = new(menuDescriptor);

Menus.Add(menu.Id, menu);
Menus.Add(menu.Id.Value, menu);

Check warning

Code scanning / InspectCode

Possible null reference argument for a parameter. Warning

Possible null reference argument for parameter 'key' in 'System.Collections.Generic.Dictionary<TKey,TValue>.Add'
break;
case WindowDescriptor windowDescriptor:
ControlWindow window = new ControlWindow(windowDescriptor);

Windows.Add(windowDescriptor.Id, window);
Windows.Add(windowDescriptor.Id.Value, window);

Check warning

Code scanning / InspectCode

Possible null reference argument for a parameter. Warning

Possible null reference argument for parameter 'key' in 'System.Collections.Generic.Dictionary<TKey,TValue>.Add'
@@ -821,17 +844,17 @@
case MacroSetDescriptor macroSetDescriptor:
InterfaceMacroSet macroSet = new(macroSetDescriptor, _entitySystemManager, _inputManager, _uiManager);

MacroSets[macroSet.Id] = macroSet;
MacroSets[macroSet.Id.Value] = macroSet;

Check warning

Code scanning / InspectCode

Possible null reference argument for a parameter. Warning

Possible null reference argument for parameter 'key' in 'System.Collections.Generic.Dictionary<TKey,TValue>.this.get'

[DataField("id")]
protected string _id;
protected DMFPropertyString _id;

Check warning

Code scanning / InspectCode

Inconsistent Naming Warning

Name '_id' does not match rule 'Instance fields (not private)'. Suggested name is 'Id'.

[DataField("name")]
protected string? _name;
protected DMFPropertyString _name;

Check warning

Code scanning / InspectCode

Inconsistent Naming Warning

Name '_name' does not match rule 'Instance fields (not private)'. Suggested name is 'Name'.
}
}

[Virtual, ImplicitDataDefinitionForInheritors]
public partial class ElementDescriptor {
[DataField("type")]
public string _type;
public DMFPropertyString _type;

Check warning

Code scanning / InspectCode

Inconsistent Naming Warning

Name '_type' does not match rule 'Instance fields (not private)'. Suggested name is 'Type'.
@wixoaGit
Copy link
Member

wixoaGit commented Jun 1, 2024

TG contains this in its DMF:
font-size = 6pt

The number property doesn't recognize this and throws an exception, leading to the interface never loading.

@amylizzle
Copy link
Contributor Author

amylizzle commented Jun 3, 2024

TG contains this in its DMF: font-size = 6pt

The number property doesn't recognize this and throws an exception, leading to the interface never loading.

This is actually an error in TG's DMF - it should really be font-size = 6, but I'll make the parsing more permissive and maybe throw a warning instead.

EDIT: done

@amylizzle amylizzle requested a review from wixoaGit June 3, 2024 13:01
@wixoaGit wixoaGit merged commit ab03e50 into OpenDreamProject:master Jun 6, 2024
8 of 9 checks passed
@amylizzle amylizzle deleted the dmfprops branch June 6, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client Involves the OpenDream client Runtime Involves the OpenDream server/runtime size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Goon: Say messages which contain spaces don't send
2 participants