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

Move GameActions to interface adherence over metadata #63

Open
DavidRieman opened this issue Dec 14, 2020 · 0 comments
Open

Move GameActions to interface adherence over metadata #63

DavidRieman opened this issue Dec 14, 2020 · 0 comments
Labels
enhancement This task is adding new behavior or performing other refactoring improvements.

Comments

@DavidRieman
Copy link
Owner

Currently when GameActions are exported, we have to also attach a bunch of metadata attributes to them to make them usable. e.g.

[ExportGameAction]
[ActionPrimaryAlias("clone", CommandCategory.Admin)]
[ActionDescription("Clones an object.")]
[ActionSecurity(SecurityRole.fullAdmin)]
public class Clone : GameAction

It is too easy to forget to add some of the metadata that is required for an action to function properly. Every action needs careful consideration of supported aliases and such to even be usable.
The action creator should also be required to provide a helpful starting description and security level, and so on. These things could be required as members when defining a class that derives from GameAction, making the only part we have to remember to add for metadata be the ExportGameAction attribute.

IIRC one of the reasons we used metadata to start with was brevity, but latest C# syntax makes it easy to one-line properties with hard-coded values now anyway. Also, an individual game admin will eventually still be able to customize commands without touching the Core code, by inheriting from the base command and overriding the values they want to override (while exporting their own version with a higher priority, once we respect a priority level on the ExportGameAction attribute via #62).

@duaneking adds:

I would like to see attributes removed from the system so that we can do more dependency injection anyway.
I think Attributes are great for some things but not for full export-import of game world data.

@DavidRieman DavidRieman added the enhancement This task is adding new behavior or performing other refactoring improvements. label Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This task is adding new behavior or performing other refactoring improvements.
Projects
None yet
Development

No branches or pull requests

1 participant