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

ActorSelectorLogic: Keep track of available owners. #14656

Closed
wants to merge 1 commit into from

Conversation

LipkeGu
Copy link
Member

@LipkeGu LipkeGu commented Jan 4, 2018

This PR implements OnUpdate() in ActorSelectorLogic so that the OwnersDropdown.Text gets updated when owners gets removed (by removing spawn points. It will first try to pick up the last "MultiX" entry otherwise when no "Multi" is found. it will use the first available owner (ex: Neutral).

The next part of this PR is the Question "What should happen with placed) Actors
which was owned by a removed Owner?

fixes #9364

@LipkeGu LipkeGu force-pushed the editor_prevent_crash_mpspawn branch from 271b5b7 to bee54ae Compare January 4, 2018 04:10
@LipkeGu LipkeGu force-pushed the editor_prevent_crash_mpspawn branch from bee54ae to e51738a Compare January 4, 2018 12:43
@LipkeGu LipkeGu changed the title EditorActorLayer: Select the first available owner (so far..) ActorSelectorLogic: Keep track of available owners. Jan 4, 2018
@LipkeGu
Copy link
Member Author

LipkeGu commented Jan 4, 2018

updated testcase: #9364 (comment)
The next actor placed should be have "Neutral" as owner

Copy link
Member

@RoosterDragon RoosterDragon left a comment

Choose a reason for hiding this comment

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

You could override Tick in ActorSelectorLogic and check there to avoid having to add the OnUpdate stuff.

.OrderBy(p => p.Name);

selectedOwner = (players.Count() != 0) ?
players.Last() : editorLayer.Players.Players.FirstOrDefault().Value;
Copy link
Member

Choose a reason for hiding this comment

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

Possibly simpler as:

var multiPlayer = editorLayer.Players.Players.Values
.Where(p => p.Name.StartsWith("Multi"))
.OrderByDescending(p => p.Name)
.FirstOrDefault();

selectedOwner = multiPlayer ?? editorLayer.Players.Players.First().Value;

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

@RoosterDragon
Copy link
Member

Looks like a sensible approach overall.

@LipkeGu
Copy link
Member Author

LipkeGu commented Mar 28, 2018

I will adress this and move this to Tick.

@pchote
Copy link
Member

pchote commented May 21, 2018

Any progress here @LipkeGu?

@pchote
Copy link
Member

pchote commented Oct 1, 2018

Closing in favour of #15628.

@pchote pchote closed this Oct 1, 2018
@LipkeGu LipkeGu deleted the editor_prevent_crash_mpspawn branch May 12, 2023 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenRA.Mods.Common.Traits.EditorActorLayer.Add KeyNotFoundException
4 participants