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

Siderophore AI improvement #5345

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/microbe_stage/systems/MicrobeAISystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,11 @@ private void PursueAndConsumeChunks(ref WorldPosition position, ref MicrobeAI ai
if (isIronEater && chunkIsIron && gameWorld!.WorldSettings.ExperimentalFeatures)
{
control.EmitSiderophore(ref organelles, entity);
SetEngulfIfClose(ref control, ref engulfer, ref position, entity, chunk, 100);
}
else
{
SetEngulfIfClose(ref control, ref engulfer, ref position, entity, chunk);
SetEngulfIfClose(ref control, ref engulfer, ref position, entity, chunk, 2);
}

// Just in case something is obstructing chunk engulfing, wiggle a little sometimes
Expand Down Expand Up @@ -1057,11 +1058,11 @@ private bool IsVitalCompound(Compound compound, CompoundBag compounds)
}

private void SetEngulfIfClose(ref MicrobeControl control, ref Engulfer engulfer, ref WorldPosition position,
in Entity entity, Vector3 targetPosition)
in Entity entity, Vector3 targetPosition, float distanceMultiplier)
{
// Turn on engulf mode if close
// Sometimes "close" is hard to discern since microbes can range from straight lines to circles
if ((position.Position - targetPosition).LengthSquared() <= engulfer.EngulfingSize * 2.0f)
if ((position.Position - targetPosition).LengthSquared() <= engulfer.EngulfingSize * distanceMultiplier)
{
control.SetStateColonyAware(entity, MicrobeState.Engulf);
}
Expand Down