Skip to content

Commit

Permalink
Can now set safety bubble size in Config/Settings.txt (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianErikson authored and godarklight committed Aug 7, 2015
1 parent f2d2097 commit e78176b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Client/NetworkWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ private void HandleServerSettings(byte[] messageData)
AsteroidWorker.fetch.maxNumberOfUntrackedAsteroids = mr.Read<int>();
ChatWorker.fetch.consoleIdentifier = mr.Read<string>();
Client.fetch.serverDifficulty = (GameDifficulty)mr.Read<int>();
VesselWorker.fetch.safetyBubbleDistance = mr.Read<float>();
if (Client.fetch.serverDifficulty != GameDifficulty.CUSTOM)
{
Client.fetch.serverParameters = GameParameters.GetDefaultParameters(Client.fetch.ConvertGameMode(Client.fetch.gameMode), (GameParameters.Preset)Client.fetch.serverDifficulty);
Expand Down
4 changes: 2 additions & 2 deletions Client/VesselWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class VesselWorker
private static VesselWorker singleton;
//Update frequency
private const float VESSEL_PROTOVESSEL_UPDATE_INTERVAL = 30f;
private const float SAFETY_BUBBLE_DISTANCE = 100;
public float safetyBubbleDistance = 100f;
//Spectate stuff
private const string DARK_SPECTATE_LOCK = "DMP_Spectating";
private const float UPDATE_SCREEN_MESSAGE_INTERVAL = 1f;
Expand Down Expand Up @@ -1053,7 +1053,7 @@ public bool isInSafetyBubble(Vector3d worlPos, CelestialBody body)
Vector3d runwayPosition = body.GetWorldSurfacePosition(-0.0486001121594686, 285.275552559723, 60);
double landingPadDistance = Vector3d.Distance(worlPos, landingPadPosition);
double runwayDistance = Vector3d.Distance(worlPos, runwayPosition);
return runwayDistance < SAFETY_BUBBLE_DISTANCE || landingPadDistance < SAFETY_BUBBLE_DISTANCE;
return runwayDistance < safetyBubbleDistance || landingPadDistance < safetyBubbleDistance;
}
//Adapted from KMP.
private bool isProtoVesselInSafetyBubble(ProtoVessel protovessel)
Expand Down
2 changes: 1 addition & 1 deletion Common/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Common
//Split messages into 8kb chunks to higher priority messages have more injection points into the TCP stream.
public const int SPLIT_MESSAGE_LENGTH = 8192;
//Bump this every time there is a network change (Basically, if MessageWriter or MessageReader is touched).
public const int PROTOCOL_VERSION = 38;
public const int PROTOCOL_VERSION = 39;
//Program version. This is written in the build scripts.
public const string PROGRAM_VERSION = "Custom";
//Mod control version - The last version to add parts
Expand Down
2 changes: 2 additions & 0 deletions Server/Messages/ServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static void SendServerSettings(ClientObject client)
mw.Write<int>(Settings.settingsStore.numberOfAsteroids);
mw.Write<string>(Settings.settingsStore.consoleIdentifier);
mw.Write<int>((int)Settings.settingsStore.gameDifficulty);
mw.Write<float>(Settings.settingsStore.safetyBubbleDistance);

if (Settings.settingsStore.gameDifficulty == GameDifficulty.CUSTOM)
{
mw.Write<bool>(GameplaySettings.settingsStore.allowStockVessels);
Expand Down
2 changes: 2 additions & 0 deletions Server/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,7 @@ public class SettingsStore
public bool compressionEnabled = true;
[Description("Specify the amount of days a log file should be considered as expired and deleted. 0 = Disabled")]
public double expireLogs = 0;
[Description("Specify the minimum distance in which vessels can interact with eachother at the launch pad and runway")]
public float safetyBubbleDistance = 100.0f;
}
}

0 comments on commit e78176b

Please sign in to comment.