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

Implement GameInteractor & move CrowdControl and console commands to it #2358

Merged
merged 47 commits into from
Jan 25, 2023

Conversation

aMannus
Copy link
Contributor

@aMannus aMannus commented Jan 17, 2023

Follow-up of #2195

The following are why this PR exists:

  • Seperate effects/functions from CrowdControl and the debug console commands so other stuff can use them.
  • Clean up CC quite a lot by utilizing the new GameInteractor.
  • Make it easier to add new effects down the line.

To do:

  • Test all console commands
  • Test all CC effects in SDK
  • Test all CC effects in CC client

Build Artifacts

@aMannus aMannus marked this pull request as ready for review January 18, 2023 10:13
@dcvz
Copy link
Contributor

dcvz commented Jan 19, 2023

@aMannus although I left you quite a number of comments -- I want to say this is looking pretty cool overall! I can tell a lot of work and thought went into it and I think its leading to a nicer way of doing CC but also allowing future things to be built on top.

@aMannus
Copy link
Contributor Author

aMannus commented Jan 25, 2023

@briaguya-ai

@dcvz has done a lot to address what came up in the last review round. As far as I could see, any comments should now be addressed. That said, a lot has changed, so it's probably best to look at this completely fresh again.

Also, I have not done another round of thorough testing after all these changes. Feeling a bit under the weather right now, but will try to get to that ASAP. I think it's safe to review right now though, we just shouldn't merge this before that testing is done.

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

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

This is beautiful!

I left a couple comments with questions in there, most are actually about things this PR hasn't changed, so @dcvz might be the one with the best answers to those.

I also left a couple tiny cleanup comments (like a place where a hardcoded string is still being checked)

Assuming testing goes well, there's nothing here that makes me think we shouldn't :shipit:!

EmitMessage(tcpsock, incomingEffect->id, incomingEffect->timeRemaining, result);
} else {
// check if a conflicting event is already active
// If another timed effect is already active that conflicts with the
// incoming effect, let CC retry later.
bool isConflictingEffectActive = false;
for (Effect* pack : activeEffects) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this isn't a new name, but why pack?

Copy link
Contributor

Choose a reason for hiding this comment

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

historical from Melon's implementation -- I can do a separate PR to clean up these things to take it out of aMannus' hands.

bool isConflictingEffectActive = false;
for (Effect* pack : activeEffects) {
if (pack != incomingEffect && pack->category == incomingEffect->category &&
pack->id < incomingEffect->id) {
isConflictingEffectActive = true;
EmitMessage(tcpsock, incomingEffect->id, incomingEffect->timeRemaining,
EffectResult::Retry);

break;
Copy link
Contributor

Choose a reason for hiding this comment

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

again, not something that's new to this PR, but i'm not fully understanding the logic here. when we break out of this for (Effect* pack : activeEffects) loop, we still make it down to L172 where incomingEffect is executed

if the idea that the checks within ExecuteEffect will also catch the incoming/active time effect conflict? if so do we need this loop here?

Copy link
Contributor

Choose a reason for hiding this comment

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

No. This seems like a bug -- before it used to be a run with a dryRun = true. it should've been replaced with a CanApply() instead of an execute.

There might be a second issue that we shouldn't be emitting another event anyway, if isConflictingEffectActive

soh/soh/Enhancements/crowd-control/CrowdControl.cpp Outdated Show resolved Hide resolved
soh/soh/Enhancements/crowd-control/CrowdControl.cpp Outdated Show resolved Hide resolved
soh/soh/Enhancements/debugconsole.cpp Show resolved Hide resolved
Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

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

perfect! :shipit:

@aMannus aMannus added do not merge Not ready or not valid changes and removed merge ready labels Jan 25, 2023
@aMannus
Copy link
Contributor Author

aMannus commented Jan 25, 2023

Changing it to do not merge until it's been properly tested.

@@ -95,6 +95,7 @@ class CrowdControl {
Effect* ParseMessage(char payload[512]);
EffectResult ExecuteEffect(Effect* effect);
EffectResult CanApplyEffect(Effect *effect);
EffectResult TranslateGiEnum(GameInteractionEffectQueryResult giResult);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open for a better name

Copy link
Contributor

Choose a reason for hiding this comment

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

works for me!

@aMannus
Copy link
Contributor Author

aMannus commented Jan 25, 2023

Apart from the name for the function in my own review comment, I think this is good to go now (for realsies this time maybe hopefully).

@aMannus aMannus removed the do not merge Not ready or not valid changes label Jan 25, 2023
@briaguya-ai briaguya-ai merged commit 170a910 into HarbourMasters:develop Jan 25, 2023
@aMannus aMannus deleted the cc-v2 branch January 26, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants