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

Abstract docking from Refinery & Harvester #20636

Merged
merged 4 commits into from Aug 8, 2023

Conversation

PunkPun
Copy link
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
Member Author

PunkPun commented Jan 25, 2023

Preview:

SpaceAgeProcessing.mp4

@PunkPun PunkPun force-pushed the abstract-DockClientBase branch 4 times, most recently from 8752ce5 to 86f5240 Compare January 26, 2023 13:31
@PunkPun PunkPun force-pushed the abstract-DockClientBase branch 7 times, most recently from d0a30de to 7dfff17 Compare January 27, 2023 18:20
Copy link
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.

Copy link
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.

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

Mailaender commented Jul 25, 2023

Please remove the test case. 1fc6f6e

@PunkPun
Copy link
Member Author

PunkPun commented Aug 2, 2023

Dropped testcase and rebased

@penev92
Copy link
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
Copy link
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
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
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

OpenRA.Mods.Common/Traits/DockClientBase.cs Outdated Show resolved Hide resolved
OpenRA.Mods.Common/Traits/DockClientBase.cs Outdated Show resolved Hide resolved
@@ -170,6 +170,13 @@ public interface INotifyDockHost { void Docked(Actor self, Actor client); void U
[RequireExplicitImplementation]
public interface INotifyDockClient { void Docked(Actor self, Actor host); void Undocked(Actor self, Actor host); }

[RequireExplicitImplementation]
public interface INotifyDockClientMoving
Copy link
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
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

Redundant since 2013
PR: # 3407
Commit: 1eb04a7
HarvesterDockSequence -> GenericDockSequence
DeliverResources -> MoveToDock
@Mailaender Mailaender merged commit 82458b5 into OpenRA:bleed Aug 8, 2023
3 checks passed
@Mailaender
Copy link
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