-
Notifications
You must be signed in to change notification settings - Fork 26
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 Enemy Control #352
Add Enemy Control #352
Conversation
Oh dear, there's a lot more problems than I thought. public EnemyIdentity IdentifyEnemy(EnemyAI enemy) {
return enemy is null
? EnemyIdentity.None
: enemy switch {
CentipedeAI => EnemyIdentity.Centipede,
BaboonBirdAI => EnemyIdentity.Baboon,
FlowermanAI => EnemyIdentity.Flowerman,
ForestGiantAI => EnemyIdentity.ForestGiant,
HoarderBugAI => EnemyIdentity.HoarderBug,
JesterAI => EnemyIdentity.Jester,
MaskedPlayerEnemy => EnemyIdentity.Masked,
MouthDogAI => EnemyIdentity.MouthDog,
NutcrackerEnemyAI => EnemyIdentity.Nutcracker,
PufferAI => EnemyIdentity.Puffer,
SandWormAI => EnemyIdentity.Sandworm,
SpringManAI => EnemyIdentity.Springman,
_ => EnemyIdentity.Default,
};
} Why did you not just return the enemy instead? You are making a lot of unnecessary indirections, which you later have to indirect back again. Please be patient while I fix this. |
that is how to identify which enemy class is to specifically control without casting the enemy over and over? |
You could probably just do this. T IdentifyEnemy(EnemyAI enemy) where T : EnemyAI {
...
}
Also, you are doing a lot of casting anyways. case EnemyIdentity.Centipede:
return ((CentipedeAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.Baboon:
return ((BaboonBirdAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.HoarderBug:
return ((HoarderBugAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.Jester:
return ((JesterAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.Nutcracker:
return ((NutcrackerEnemyAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.Puffer:
return ((PufferAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.Sandworm:
return ((SandWormAI)this.EnemyToPossess).GetSecondarySkillName();
case EnemyIdentity.MouthDog:
return ((MouthDogAI)this.EnemyToPossess).GetSecondarySkillName(); |
I am still looking really superficially. Give me a while to dig into it. |
It would've probably been better to use a |
yes, but the switch case casts only based off which enemy is, and the enum acts as a identity |
Have you seen |
nvm |
@winstxnhdw another issue is seconday attack while you are dead and controlling a enemy you risk of starting a vote for the ship to leave early |
Good catch. We can patch that out. |
@winstxnhdw i want to use Update() and add a better primary and secondary since with your input system sometimes it fails and it does not hold on the attacks. |
Can you tell me how it fails? You might be implementing it wrongly. Hold commands must be set within the update loop like this. void Update() {
InputListener.onShiftButtonHold?.Invoke(Keyboard.current[Key.LeftShift].isPressed);
InputListener.onFButtonHold?.Invoke(Keyboard.current[Key.F].isPressed);
InputListener.onRButtonHold?.Invoke(Keyboard.current[Key.R].isPressed);
InputListener.onEButtonHold?.Invoke(Keyboard.current[Key.E].isPressed);
foreach ((Func<bool> keyPressed, Action eventAction) in this.InputActions) {
if (!keyPressed()) continue;
eventAction();
}
} |
yeah, the secondary needs to be a hold attack, because you need to keep pressing the button to make the jester crank and when it pops out the secondary has to be released, ill investigate better, but im not sure about that, as well we need to disable ping scan until we stop possessing the enemy |
Would subscribing to the |
There's a bug where if an enemy despawns or you get kicked while possessing it, then you're unable to to possess any other enemies until you restart. |
There's also issue where the door gets absolutely spammed trying to open and close it as an enemy. And it seems disabling The death HUD doesn't work when possessing. |
@winstxnhdw a health checker to see if a possessed enemy is dead to eject PossessionMod and a way to give AI the enemy control and override it would be nice. |
What? |
Just use |
yeah triggermod can do it, but when you are dead is not working to open/close doors. |
Nope, it still works. |
not dedicated to the enemy itself tho? |
Oh, you mean the entrances? Honestly, there is nothing wrong with noclipping outside. Let's figure it out next time. |
void HandleEnemyMovements() { | ||
if (this.EnemyToPossess is null) return; | ||
switch (this.enemyIdentity) { | ||
case EnemyIdentity.Nutcracker: | ||
if (this.IsUsingPrimarySkill || this.IsUsingSecondarySkill) return; // prevent this from blocking the sentry skill of the nutcracker. | ||
(this.EnemyToPossess as NutcrackerEnemyAI)?.OnMoving(); | ||
break; | ||
case EnemyIdentity.Baboon: | ||
break; | ||
case EnemyIdentity.Centipede: | ||
break; | ||
case EnemyIdentity.Flowerman: | ||
break; | ||
case EnemyIdentity.ForestGiant: | ||
break; | ||
case EnemyIdentity.HoarderBug: | ||
break; | ||
case EnemyIdentity.Jester: | ||
break; | ||
case EnemyIdentity.Masked: | ||
break; | ||
case EnemyIdentity.MouthDog: | ||
break; | ||
case EnemyIdentity.Puffer: | ||
break; | ||
case EnemyIdentity.Sandworm: | ||
break; | ||
case EnemyIdentity.Springman: | ||
break; | ||
case EnemyIdentity.Blob: | ||
break; | ||
case EnemyIdentity.ElectricBees: | ||
break; | ||
case EnemyIdentity.Thumper: | ||
break; | ||
case EnemyIdentity.Default: | ||
break; | ||
case EnemyIdentity.None: | ||
break; | ||
default: | ||
break; | ||
} | ||
} |
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.
I have been wondering what's the point of this? Do we just let the Nutcracker move on its own?
I just spent 7 hours on this. This is the last time I will be accepting a PR of such dubious quality. The next time I see a PR that will take more more than 2 hours to fix, I am just closing it. I can't waste so much time anymore. |
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 was absolute mental abuse.
Closes #250