-
Notifications
You must be signed in to change notification settings - Fork 234
my new unit_attributes_generic #5608
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
|
|
||
| function gadget:UnitDestroyed(unitID, unitDefID, teamID) | ||
| local deathExplodeMult=spGetUnitRulesParam(unitID, "deathExplodeMult") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GG would be better.
|
This looks pretty good and seems like a decent next step in the genericising of attributes.Some comments.
|
|
Scary amount of changes for so few commits. Would be nice if this was cut into minimal commits |
|
Most UnitAttributeHandlers files are generated by Grok and I'm sure that AI is more careful than me, and I think the commit can just be cut into 1 file per commit, or you want me to show what are taken out from unit_attributes_generic.lua to handlers. I will do it if you really want me to do. |
| ---@type AttributesHandlerFactory | ||
| JumpRange = { | ||
| handledAttributeNames={ | ||
| build=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? What does jump range have to do with "build"?
| handledAttributeNames={ | ||
| setRadar=true,setSonar=true,setJammer=true,setSight=true,sense=true,abilityDisabled=true | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone specifies handledAttributeNames incorrectly, will the attribute just randomly break?
| "burst", | ||
| "burstRate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not particularly generic if you have to bundle burst into the huge file that deals with weapons.
| ---@class AttributesDataHandler | ||
| ---@field fold fun(domainData:table) | ||
| ---@field apply fun() | ||
|
|
||
| ---@class AttributesHandler | ||
| ---@field newDataHandler fun(frame:number):AttributesDataHandler | ||
| ---@field clear fun() | ||
|
|
||
| ---@class AttributesHandlerFactory | ||
| ---@field new fun(unitID:UnitId,unitDefID:UnitDefId):AttributesHandler | ||
| ---@field initialize nil|fun() | ||
| ---@field handledAttributeNames table<string,boolean> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this stuff means nothing to me.
|
TBH I don't really want to pull a bunch of generic files created by AI. These files need to be human writable, readable, and maintainable. It is a bad sign that some files haven't even been written. I also think I've gone off the idea of splitting things into lots of files just for the sake of it. Take the case of fixing a bug: with a bunch of generic files to search through it is going to be harder to find where the bug is. Currently all attribute combination logic is handled in one 250 line block by Adding things also seems harder. Eg what does In terms of being generic, weapons and movement haven't become simpler, they're just in their own large files. To me it looks like the existing attributes is similar, in an important sense, because I think more iterative improvement of the existing file is required, rather than a full rewrite. At least when I am the one who is going to be searching for bugs and extending the system in the future. |
a unit_attributes_generic system which is more flexible and more readable.
It split attribute handling into files at LuaRules/Configs/UnitAttributeHandlers
also separate unit death explosion and unit reload pause into 2 gadgets.
Added ability to handle
burst(mult),
burstRate(mult),
sprayAngle(add),
Tested behaviors:
Techk level up health, projectileMult, rangeMult, minSpray, death explosion, econ
Jump,