Skip to content

Commit

Permalink
Merge pull request #3 from LunaMultiplayer/master
Browse files Browse the repository at this point in the history
Syncing
  • Loading branch information
Alfred-PictoCube committed Apr 14, 2018
2 parents 40ba5b8 + 8d03600 commit f4c648c
Show file tree
Hide file tree
Showing 33 changed files with 400 additions and 534 deletions.
4 changes: 2 additions & 2 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<Compile Include="Harmony\KscVesselMarkers_SpawnVesselMarkers.cs" />
<Compile Include="Harmony\LaunchSiteClear_Test.cs" />
<Compile Include="Harmony\KSCPauseMenu_QuickLoad.cs" />
<Compile Include="Harmony\Part_HandleCollision.cs" />
<Compile Include="Harmony\QuickSaveLoad_QuickLoad.cs" />
<Compile Include="Harmony\ProtoCrewMember_Die.cs" />
<Compile Include="Harmony\ShipConstruction_FindVesselsLandedAt.cs" />
Expand All @@ -93,6 +94,7 @@
<Compile Include="Harmony\VesselPrecalculate_MainPhysics.cs" />
<Compile Include="Harmony\TimeWarp_setMode.cs" />
<Compile Include="Harmony\TimeWarp_setRate.cs" />
<Compile Include="Harmony\Vessel_CheckKill.cs" />
<Compile Include="Localization\Structures\AdminWindowText.cs" />
<Compile Include="Localization\Structures\BannedPartsWindowText.cs" />
<Compile Include="Localization\Structures\ButtonTooltips.cs" />
Expand Down Expand Up @@ -201,7 +203,6 @@
<Compile Include="Systems\VesselPartModuleSyncSys\VesselPartModuleSyncMessageHandler.cs" />
<Compile Include="Systems\VesselPartModuleSyncSys\VesselPartModuleSyncMessageSender.cs" />
<Compile Include="Systems\VesselPartModuleSyncSys\VesselPartModuleSyncSystem.cs" />
<Compile Include="Systems\VesselPositionSys\MessageToPositionTransfer.cs" />
<Compile Include="Systems\VesselPositionSys\VesselPositionMessageHandler.cs" />
<Compile Include="Systems\VesselPositionSys\VesselPositionMessageSender.cs" />
<Compile Include="Systems\VesselPositionSys\VesselPositionSystem.cs" />
Expand All @@ -228,7 +229,6 @@
<Compile Include="Systems\VesselUpdateSys\VesselUpdateSystem.cs" />
<Compile Include="Utilities\ExtensionMethods.cs" />
<Compile Include="Utilities\OutdatedVersionDialog.cs" />
<Compile Include="Systems\VesselPrecalcSys\LunaPrecalc.cs" />
<Compile Include="VesselUtilities\VesselSerializer.cs" />
<Compile Include="VesselStore\VesselsProtoStore.cs" />
<Compile Include="Systems\VesselSwitcherSys\VesselSwitcherSystem.cs" />
Expand Down
30 changes: 30 additions & 0 deletions Client/Harmony/Part_HandleCollision.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Harmony;
using LunaClient.Systems.Lock;
using LunaClient.Systems.SettingsSys;
using LunaCommon.Enums;
using UnityEngine;
// ReSharper disable All

namespace LunaClient.Harmony
{
/// <summary>
/// This harmony patch is intended to avoid part explosions on other ppl vessels
/// </summary>
[HarmonyPatch(typeof(Part))]
[HarmonyPatch("HandleCollision")]
public class Part_HandleCollision
{
[HarmonyPrefix]
private static bool PrefixHandleCollision(Part __instance, Collision c)
{
if (MainSystem.NetworkState < ClientState.Connected) return true;

if (__instance?.vessel != null)
{
return LockSystem.LockQuery.UpdateLockBelongsToPlayer(__instance.vessel.id, SettingsSystem.CurrentSettings.PlayerName);
}

return true;
}
}
}
24 changes: 24 additions & 0 deletions Client/Harmony/Vessel_CheckKill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Harmony;
using LunaClient.Systems.Lock;
using LunaClient.Systems.SettingsSys;
using LunaCommon.Enums;
// ReSharper disable All

namespace LunaClient.Harmony
{
/// <summary>
/// This harmony patch is intended to avoid run the kill checks in vessels that are not yours
/// </summary>
[HarmonyPatch(typeof(Vessel))]
[HarmonyPatch("CheckKill")]
public class Vessel_CheckKill
{
[HarmonyPrefix]
private static bool PrefixCheckKill(Vessel __instance)
{
if (MainSystem.NetworkState < ClientState.Connected) return true;

return LockSystem.LockQuery.UnloadedUpdateLockBelongsToPlayer(__instance.id, SettingsSystem.CurrentSettings.PlayerName);
}
}
}
6 changes: 3 additions & 3 deletions Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
[assembly: ComVisible(false)]
[assembly: Guid("cc8e38bb-d6d5-4bb9-ab74-a3a1a11ddc8d")]

[assembly: AssemblyVersion("0.6.37")]
[assembly: AssemblyFileVersion("0.6.37")]
[assembly: AssemblyInformationalVersion("0.6.37-compiled")]
[assembly: AssemblyVersion("0.7.38")]
[assembly: AssemblyFileVersion("0.7.38")]
[assembly: AssemblyInformationalVersion("0.7.38-compiled")]
2 changes: 1 addition & 1 deletion Client/Systems/SettingsSys/SettingsStructures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class SettingStructure
public List<ServerEntry> Servers { get; set; } = new List<ServerEntry>();
public int InitialConnectionSyncTimeRequests { get; set; } = 10;
public bool RevertEnabled { get; set; }
public bool InterpolationEnabled { get; set; } = false;
public int MaxGroupsPerPlayer { get; set; } = 1;
public bool OverrideIntegrator { get; set; }
public bool UseInterpolation { get; set; } = true;

#if DEBUG

Expand Down
11 changes: 4 additions & 7 deletions Client/Systems/SettingsSys/SettingsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LunaClient.Base;
using LunaClient.Base;
using LunaClient.Network;
using LunaCommon.Enums;
using System.Text;
Expand All @@ -14,11 +14,8 @@ public class SettingsSystem : MessageSystem<SettingsSystem, SettingsMessageSende

public override string SystemName { get; } = nameof(SettingsSystem);

static SettingsSystem()
{
CurrentSettings = SettingsReadSaveHandler.ReadSettings();
}

static SettingsSystem() => CurrentSettings = SettingsReadSaveHandler.ReadSettings();

protected override void OnDisabled()
{
base.OnDisabled();
Expand Down Expand Up @@ -51,4 +48,4 @@ public static bool ValidateSettings()
return validationResult;
}
}
}
}
198 changes: 0 additions & 198 deletions Client/Systems/VesselPositionSys/MessageToPositionTransfer.cs

This file was deleted.

Loading

0 comments on commit f4c648c

Please sign in to comment.