Skip to content

Commit

Permalink
Added additional interference for inline small props
Browse files Browse the repository at this point in the history
  • Loading branch information
xianson committed Jul 1, 2024
1 parent e6fc183 commit 6c8bae1
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions SkyPiratesCoreDev/Data/Scripts/SkyPirates/Propellers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,31 @@ private float CalculatePropellerInterference()
foreach (IMyThrust prop in plane.props)
{
IMySlimBlock slim = prop.SlimBlock;

if (slim == block.SlimBlock)
continue;

Vector3I propellerPosition2 = FindPropellerTip(slim);
float manhattandistance = (float)Vector3I.DistanceManhattan(propellerPosition2, propellerPosition1);
if (slim != block.SlimBlock && manhattandistance < 10)
var perpendicularDistance = CalculatePerpendicularDistance(propellerPosition1, propellerPosition2, block.SlimBlock.Orientation.Forward);

if (manhattandistance < 10)
{
var perpendicularDistance = CalculatePerpendicularDistance(propellerPosition1, propellerPosition2, block.SlimBlock.Orientation.Forward);
var interference = (1.5f + prop.CurrentThrustPercentage) / (1f + (perpendicularDistance + manhattandistance) / 2);
interference = Math.Min(1f, interference);

interferenceModifier -= interference;
interferenceProps.Add($"{interference:P2}, ({perpendicularDistance}) from {prop.CustomName}\n");
interferenceProps.Add($"{interference:P2}, ({perpendicularDistance}) from {prop.CustomName} (too close!)\n");
continue;
}

if(grid.GridSizeEnum == MyCubeSize.Small && perpendicularDistance < 5)
{
var interference = (1.5f + prop.CurrentThrustPercentage) / (1f + perpendicularDistance);
interference = Math.Min(1f, interference);

interferenceModifier -= interference;
interferenceProps.Add($"{interference:P2}, ({perpendicularDistance}) from {prop.CustomName} (small props are inline!)\n");
}
}
}
Expand Down

0 comments on commit 6c8bae1

Please sign in to comment.