Skip to content

Commit

Permalink
Merge pull request #227 from InvalidArgument3/slipspace-patches
Browse files Browse the repository at this point in the history
rm faction lookup on warp exit for color, might be the cause of lagspike
  • Loading branch information
InvalidArgument3 authored Oct 31, 2024
2 parents 8b0b453 + 4a8bcf6 commit 32bd36c
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions Slipspace Engine/Data/Scripts/WarpDrive/WarpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,29 +1328,15 @@ private List<IMyFunctionalBlock> GetActiveWarpDrives()
public void Dewarp(bool Collision = false)
{
// Check if we've been in warp for more than 1 minute (assuming 60 updates per second)
if (WarpState == State.Active &&
grid?.MainGrid != null &&
currentSpeedPt > 0 &&
timeInWarpCounter >= 3600) // 60 seconds * 60 updates
{
if (WarpState == State.Active && grid?.MainGrid != null && currentSpeedPt > 0 && timeInWarpCounter >= 3600) {
Vector3D exitPosition = grid.MainGrid.PositionComp.GetPosition();

// Get faction color or use a default color
long ownerId = grid.MainGrid.BigOwners.FirstOrDefault();
var faction = MyAPIGateway.Session.Factions.TryGetPlayerFaction(ownerId);
Color gpsColor = faction != null
? MyColorPickerConstants.HSVOffsetToHSV(faction.CustomColor).HSVtoColor()
: Color.Black; // Default color if no faction

// Server-only block for adding GPS
if (MyAPIGateway.Multiplayer.IsServer || MyAPIGateway.Utilities.IsDedicated)
{
// Only the server or dedicated server adds the GPS marker once, visible to all players
if (MyAPIGateway.Multiplayer.IsServer || MyAPIGateway.Utilities.IsDedicated) {
MyVisualScriptLogicProvider.AddGPSForAll(
"Slipspace™ Exit Signature",
"A ship has exited slipspace™ here!",
exitPosition,
gpsColor,
Color.White, // Just using white instead of doing faction color lookup
30);
}
}
Expand Down

0 comments on commit 32bd36c

Please sign in to comment.