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
Add place variant building for BaseBuilderBotModule. #19941
Conversation
I got probably lots of grammar mistakes in english so... I need help with that in comment |
c057919
to
dcc2361
Compare
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.
Looks like a neat feature, have some minor suggestions for you.
The build failure would be resolved by one of my suggestions, or alternatively you can replace new string[0]
with Array.Empty<string>()
to solve it if you prefer.
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Outdated
Show resolved
Hide resolved
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Outdated
Show resolved
Hide resolved
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Show resolved
Hide resolved
// Add all the build varriant name in the name list and use it for count | ||
var actorInfo = world.Map.Rules.Actors[name]; | ||
var buildingVariantInfo = actorInfo.TraitInfoOrDefault<PlaceBuildingVariantsInfo>(); | ||
var variants = (buildingVariantInfo != null && buildingVariantInfo.Actors != null) ? buildingVariantInfo.Actors : new string[0]; |
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.
This might be a bit cleaner, up to you:
var varients = buildingVariantInfo?.Actors;
var count = playerBuildings.Count(a => a.Info.Name == name || variants?.Contains(a.Info.Name));
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 is a pity that ||
cannot apply to a bool
and bool?
(by variants?.Contains(a.Info.Name))
)
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Outdated
Show resolved
Hide resolved
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Outdated
Show resolved
Hide resolved
047b795
to
b7eb360
Compare
Fixed and tested. As for testcase of this branch: At that time I need your permission and help @MustaphaTR |
OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs
Outdated
Show resolved
Hide resolved
b7eb360
to
f36f5dc
Compare
f36f5dc
to
218f91d
Compare
|
1. If it follow the refinery placing logic, then we can use Facings in PlaceBuildingVariants to help BaseBuilderBotModule "rotates" it to minefield. 2. If it is a normal building, BaseBuilderBotModule will place a random variant actor.
218f91d
to
f0a0717
Compare
test case mod: Any AI will do |
Add place variant building for BaseBuilderBotModule.
If it follow the refinery placing logic, then we can use Facings in PlaceBuildingVariants to help BaseBuilderBotModule "rotates" it to minefield.
If it is a normal building, BaseBuilderBotModule will place a random variant actor.
Ingame Picture
Usage