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

Protection level of attack move trait #21392

Open
DracoHouston opened this issue Apr 7, 2024 · 2 comments
Open

Protection level of attack move trait #21392

DracoHouston opened this issue Apr 7, 2024 · 2 comments

Comments

@DracoHouston
Copy link

Hi, I am trying to reimplement the attack move order generator as part of QoL mods for the various games, namely line moves/a-moves like spring engine has. I immediately ran into an issue, attack move's trait can't be referenced outside the Common mod. If I replace AttackMove with a duplicate in my mod with a new name that will break many related traits. This leaves me with no apparent option to do this as an overlay mod. Also being sealed seems excessive to me, in addition to being private it is hostile for any sort of reuse.

sealed class AttackMove : IResolveOrder, IOrderVoice

Reimplementing the default unit order generator was a breeze by comparison.

@PunkPun
Copy link
Member

PunkPun commented Apr 8, 2024

It was likely sealed due to style choice of having private classes sealed. In general it's a performance boost.

As for extendability, it doesn't have any virtual fields so there's not much point in inheriting it

@DracoHouston
Copy link
Author

It was likely sealed due to style choice of having private classes sealed. In general it's a performance boost.

As for extendability, it doesn't have any virtual fields so there's not much point in inheriting it

A handful of classes directly use the type and search for it. AttackMoveOrderGenerator, AttackWander and its associated activity. Thinking about it more, seems like a case for an IAttackMove similar to IMove. Overriding attack move per se is not my problem, though, and I probably shouldn't have even brought it up in the same issue as my actual problem with the file.

I just imagine this would be a nightmare if someone wanted to add more brains to the units above what a-move already does. A standalone game would be less squeamish about modifying the Common mod but adding other forms of attack move in another binary would require a new order generator, and a new command bar logic class.

Anyway, if the class is private nothing outside Common can even reference the trait. This would also not be an issue if I could filter for an interface.

In my mod I now have working line commands for attack move, but you would need my fork of Common that literally just adds 'public' to the start of AttackMove and AttackMoveInfo, in order to run it. I was hoping to let people just drop my binary into their projects to get the Order Generators the mod provides.

I have otherwise been very impressed by the codebase and was pleasantly surprised by how quickly I got my mod to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants