Skip to content

Abstract docking from Refinery & Harvester#20636

Merged
Mailaender merged 4 commits into
OpenRA:bleedfrom
PunkPun:abstract-DockClientBase
Aug 8, 2023
Merged

Abstract docking from Refinery & Harvester#20636
Mailaender merged 4 commits into
OpenRA:bleedfrom
PunkPun:abstract-DockClientBase

Conversation

@PunkPun
Copy link
Copy Markdown
Member

@PunkPun PunkPun commented Jan 25, 2023

Closes #20288
Closes #16464
Split from #20168
Supersedes #20181

Replaced search by actor name to search by BitSet<DockType>
Linking refactored and renamed to reserving
Abstracted DockHost : IDockHost from Refinery
Abstracted DockClientBase<> : IDockClient and DockClientManager from Harvester
Abstracted INotifyDockClientMoving from INotifyHarvesterAction

There are still a lot of features than need to be added to this codebase for it to be able to absorb Rearm / Repair docking.

I advise to review commit by commit as git diff doesn't deal with file renames well

@PunkPun PunkPun added this to the Next + 1 milestone Jan 25, 2023
@PunkPun
Copy link
Copy Markdown
Member Author

PunkPun commented Jan 25, 2023

Preview:

SpaceAgeProcessing.mp4

Comment thread OpenRA.Mods.Common/TraitsInterfaces.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockClientManager.cs Outdated
@PunkPun PunkPun force-pushed the abstract-DockClientBase branch 4 times, most recently from 8752ce5 to 86f5240 Compare January 26, 2023 13:31
Comment thread OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs Outdated
Comment thread OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockClientManager.cs Outdated
@PunkPun PunkPun force-pushed the abstract-DockClientBase branch 7 times, most recently from d0a30de to 7dfff17 Compare January 27, 2023 18:20
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockClientManager.cs
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockClientManager.cs
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockClientManager.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Copy link
Copy Markdown
Contributor

@AspectInteractive2 AspectInteractive2 left a comment

Choose a reason for hiding this comment

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

Overall this is very well designed and cleanly written, I only made some minor suggestions to make this a bit more extensible and tidy up a few parts.

Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Buildings/DockHost.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Comment thread OpenRA.Mods.Common/UpdateRules/Rules/20221203/AbstractDocking.cs Outdated
Copy link
Copy Markdown
Contributor

@AspectInteractive2 AspectInteractive2 left a comment

Choose a reason for hiding this comment

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

Same feedback as with my prior review, just a few extra proposed changes.

Comment thread OpenRA.Mods.Common/Traits/Harvester.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/Harvester.cs
Comment thread OpenRA.Mods.Common/Traits/Harvester.cs
@PunkPun PunkPun force-pushed the abstract-DockClientBase branch 3 times, most recently from 4838c2f to e23d2d4 Compare January 28, 2023 13:39
Comment thread OpenRA.Mods.Common/Traits/DockClientManager.cs Outdated
Mailaender
Mailaender previously approved these changes May 20, 2023
@Mailaender
Copy link
Copy Markdown
Member

Mailaender commented Jul 25, 2023

Please remove the test case. 1fc6f6e

@PunkPun
Copy link
Copy Markdown
Member Author

PunkPun commented Aug 2, 2023

Dropped testcase and rebased

@PunkPun PunkPun force-pushed the abstract-DockClientBase branch from eaebe67 to 60ba8e1 Compare August 2, 2023 06:31
@penev92
Copy link
Copy Markdown
Member

penev92 commented Aug 2, 2023

  • Commit 3, Abstract docking logic from Harvester and Refinery , removes GenericDockSequence.cs and MoveToDock.cs.
  • Commit 4, Add INotifyClientMoving interface adds them again. Also it doesn't add an INotifyClientMoving?
  • Commit 5 is with the same name?

@PunkPun PunkPun force-pushed the abstract-DockClientBase branch from 60ba8e1 to 5b46d5e Compare August 2, 2023 07:09
@PunkPun
Copy link
Copy Markdown
Member Author

PunkPun commented Aug 2, 2023

It was a rebase error, fixed by squashing 4th commit into the 3rd

return true;
}

public virtual bool DockingPossible(BitSet<DockType> type, bool forceEnter = false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IsDockingPossible. Boolean members should start with is or similar.
Also CanDock and IsDockingPossible seem redundant to each other.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

IsDockingPossible. Boolean members should start with is or similar.

sure

Also CanDock and IsDockingPossible seem redundant to each other.

They are completely different, you can read the documentation or just check out DockClientBase

Comment thread OpenRA.Mods.Common/Traits/DockClientBase.cs Outdated
Comment thread OpenRA.Mods.Common/Traits/DockClientBase.cs Outdated
public interface INotifyDockClient { void Docked(Actor self, Actor host); void Undocked(Actor self, Actor host); }

[RequireExplicitImplementation]
public interface INotifyDockClientMoving
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this not part of INotifyDockClient?

Copy link
Copy Markdown
Member Author

@PunkPun PunkPun Aug 2, 2023

Choose a reason for hiding this comment

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

Because Harvester (nor other clients) are not supposed to inherit it. It'a a notify inferface, meant for trait that wants to be notified

@PunkPun PunkPun force-pushed the abstract-DockClientBase branch from 5b46d5e to f26b598 Compare August 2, 2023 07:44
PunkPun added 4 commits August 7, 2023 22:57
Redundant since 2013
PR: # 3407
Commit: 1eb04a7
HarvesterDockSequence -> GenericDockSequence
DeliverResources -> MoveToDock
@PunkPun PunkPun force-pushed the abstract-DockClientBase branch from f26b598 to 6408dd5 Compare August 7, 2023 20:03
@Mailaender Mailaender merged commit 82458b5 into OpenRA:bleed Aug 8, 2023
@Mailaender
Copy link
Copy Markdown
Member

Changelog

@PunkPun PunkPun deleted the abstract-DockClientBase branch August 8, 2023 12:55
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.

IAcceptResource to maintain Occupance count Introduce an IResupplyAction interface

5 participants