diff --git a/.github/scripts/thunderstore_bundle.js b/.github/scripts/thunderstore_bundle.js index 311efd5ac..bb63092b5 100644 --- a/.github/scripts/thunderstore_bundle.js +++ b/.github/scripts/thunderstore_bundle.js @@ -117,13 +117,13 @@ function generateManifest() { const manifest = { name: pluginInfo.name, description: - "With this mod you will be able to play with your friends in the same game! Now supports combat mode in game version 0.10.33", + "With this mod you will be able to play with your friends in the same game! Now supports combat mode in game version 0.10.34", version_number: pluginInfo.version, dependencies: [ BEPINEX_DEPENDENCY, `nebula-${apiPluginInfo.name}-${apiPluginInfo.version}`, "PhantomGamers-IlLine-1.0.0", - "starfi5h-BulletTime-1.5.12", + "starfi5h-BulletTime-1.5.13", "starfi5h-ErrorAnalyzer-1.3.3", "starfi5h-NebulaCompatibilityAssist-0.5.0" ], diff --git a/CHANGELOG.md b/CHANGELOG.md index 81ff63987..3d9866fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Changelog +0.9.20 +- Compatible with game version 0.10.34.28392 +- @gabrielgad: Sync Planet Memo +- @gabrielgad: Sync Holo Beacon (marker) + 0.9.19: - Add new config option `Chat View Mode` to switch between TMPro and IMGUI chat window. - Sync point-to-point transport setting window in client. diff --git a/NebulaModel/MultiplayerOptions.cs b/NebulaModel/MultiplayerOptions.cs index 2d9a75445..1f6bbdf56 100644 --- a/NebulaModel/MultiplayerOptions.cs +++ b/NebulaModel/MultiplayerOptions.cs @@ -190,12 +190,14 @@ public bool StreamerMode // Detail function group buttons - public bool PowerGridEnabled { get; set; } - public bool VeinDistributionEnabled { get; set; } - public bool SpaceNavigationEnabled { get; set; } = true; - public bool BuildingWarningEnabled { get; set; } = true; - public bool BuildingIconEnabled { get; set; } = true; - public bool GuidingLightEnabled { get; set; } = true; + public bool ShowDetailPowerGrid { get; set; } + public bool ShowDetailVeinDistribution { get; set; } + public bool ShowDetailSpaceNavigation { get; set; } = true; + public bool ShowDetailDefenseArea { get; set; } + public bool ShowDetailBuildingAlarm { get; set; } = true; + public bool ShowDetailBuildingIcon { get; set; } = true; + public bool ShowGuidingLight { get; set; } = true; + public bool ShowDetailHpBars { get; set; } = true; public bool RemoteAccessEnabled { get; set; } = false; public string RemoteAccessPassword { get; set; } = ""; diff --git a/NebulaModel/Packets/Factory/Monitor/MonitorSettingUpdatePacket.cs b/NebulaModel/Packets/Factory/Monitor/MonitorSettingUpdatePacket.cs index 37f070696..951d39a2a 100644 --- a/NebulaModel/Packets/Factory/Monitor/MonitorSettingUpdatePacket.cs +++ b/NebulaModel/Packets/Factory/Monitor/MonitorSettingUpdatePacket.cs @@ -29,9 +29,10 @@ public enum MonitorSettingEvent SetMonitorMode = 3, SetSystemWarningMode = 4, SetSystemWarningSignalId = 5, - SetCargoFilter = 6, - SetTargetCargoBytes = 7, - SetPeriodTickCount = 8, - SetTargetBelt = 9, - SetSpawnOperator = 10 + SetDigitalSignalId = 6, + SetCargoFilter = 7, + SetTargetCargoBytes = 8, + SetPeriodTickCount = 9, + SetTargetBelt = 10, + SetSpawnOperator = 11 } diff --git a/NebulaModel/Packets/Universe/MarkerSettingUpdatePacket.cs b/NebulaModel/Packets/Universe/MarkerSettingUpdatePacket.cs index 54b6f1b7a..059d7100a 100644 --- a/NebulaModel/Packets/Universe/MarkerSettingUpdatePacket.cs +++ b/NebulaModel/Packets/Universe/MarkerSettingUpdatePacket.cs @@ -1,4 +1,4 @@ -namespace NebulaModel.Packets.Universe; +namespace NebulaModel.Packets.Universe; public class MarkerSettingUpdatePacket { @@ -36,5 +36,6 @@ public enum MarkerSettingEvent SetVisibility = 6, SetDetailLevel = 7, SetHeight = 8, - SetRadius = 9 + SetRadius = 9, + SetDigitalSignalId = 10 } diff --git a/NebulaNetwork/PacketProcessors/Factory/Monitor/MonitorSettingUpdateProcessor.cs b/NebulaNetwork/PacketProcessors/Factory/Monitor/MonitorSettingUpdateProcessor.cs index 94da567d3..79e1af545 100644 --- a/NebulaNetwork/PacketProcessors/Factory/Monitor/MonitorSettingUpdateProcessor.cs +++ b/NebulaNetwork/PacketProcessors/Factory/Monitor/MonitorSettingUpdateProcessor.cs @@ -49,6 +49,10 @@ protected override void ProcessPacket(MonitorSettingUpdatePacket packet, NebulaC pool[packet.MonitorId].SetSystemWarningSignalId(packet.Parameter1); break; + case MonitorSettingEvent.SetDigitalSignalId: + pool[packet.MonitorId].SetDigitalSignalId(packet.Parameter1); + break; + case MonitorSettingEvent.SetCargoFilter: pool[packet.MonitorId].SetCargoFilter(packet.Parameter1); break; @@ -99,6 +103,10 @@ protected override void ProcessPacket(MonitorSettingUpdatePacket packet, NebulaC uIMonitor.iconTagImage.sprite = sprite ? sprite : uIMonitor.tagNotSelectedSprite; break; + case MonitorSettingEvent.SetDigitalSignalId: + uIMonitor.digitalSignalIdInput.SetTextWithoutNotify((packet.Parameter1 == 0) ? "" : packet.Parameter1.ToString()); + break; + case MonitorSettingEvent.SetCargoFilter: var sprite2 = LDB.items.Select(packet.Parameter1)?.iconSprite; uIMonitor.cargoFilterImage.sprite = sprite2 ? sprite2 : uIMonitor.cargoFilterNotSelectedSprite; diff --git a/NebulaNetwork/PacketProcessors/Universe/MarkerSettingUpdateProcessor.cs b/NebulaNetwork/PacketProcessors/Universe/MarkerSettingUpdateProcessor.cs index ddaf232cf..3aa04062b 100644 --- a/NebulaNetwork/PacketProcessors/Universe/MarkerSettingUpdateProcessor.cs +++ b/NebulaNetwork/PacketProcessors/Universe/MarkerSettingUpdateProcessor.cs @@ -1,4 +1,4 @@ -#region +#region using NebulaAPI.Packets; using NebulaModel.Logger; @@ -94,6 +94,10 @@ protected override void ProcessPacket(MarkerSettingUpdatePacket packet, NebulaCo case MarkerSettingEvent.SetRadius: marker.SetRadius(packet.FloatValue); break; + + case MarkerSettingEvent.SetDigitalSignalId: + marker.SetDigitalSignalId(packet.IntValue); + break; } try @@ -103,6 +107,13 @@ protected override void ProcessPacket(MarkerSettingUpdatePacket packet, NebulaCo catch { } + + //Update UI Window too if it is viewing the current marker + var window = UIRoot.instance.uiGame.markerWindow; + if (window.active && window.markerId == packet.MarkerId && window.factory == factory) + { + window.markerDesc.Refresh(); + } } } } diff --git a/NebulaPatcher/Patches/Dynamic/EntitySignRenderer_Patch.cs b/NebulaPatcher/Patches/Dynamic/EntitySignRenderer_Patch.cs deleted file mode 100644 index 3f7cb6a87..000000000 --- a/NebulaPatcher/Patches/Dynamic/EntitySignRenderer_Patch.cs +++ /dev/null @@ -1,26 +0,0 @@ -#region - -using HarmonyLib; -using NebulaModel; -using NebulaWorld; - -#endregion - -namespace NebulaPatcher.Patches.Dynamic; - -[HarmonyPatch(typeof(EntitySignRenderer))] -internal class EntitySignRenderer_Patch -{ - [HarmonyPostfix] - [HarmonyPatch(nameof(EntitySignRenderer.Init))] - public static void Init_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - EntitySignRenderer.showIcon = Config.Options.BuildingIconEnabled; - EntitySignRenderer.showSign = Config.Options.BuildingWarningEnabled; - } -} diff --git a/NebulaPatcher/Patches/Dynamic/GamePrefsData_Patch.cs b/NebulaPatcher/Patches/Dynamic/GamePrefsData_Patch.cs new file mode 100644 index 000000000..816201ef4 --- /dev/null +++ b/NebulaPatcher/Patches/Dynamic/GamePrefsData_Patch.cs @@ -0,0 +1,37 @@ +#region + +using HarmonyLib; +using NebulaModel; +using NebulaWorld; + +#endregion + +namespace NebulaPatcher.Patches.Dynamic; + +[HarmonyPatch(typeof(GamePrefsData))] +internal class GamePrefsData_Patch +{ + [HarmonyPostfix] + [HarmonyPatch(nameof(GamePrefsData.Restore))] + public static void Restore_Postfix() + { + if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) + { + return; + } + + NebulaModel.Logger.Log.Debug("Apply save prefs"); + var uiGame = UIRoot.instance.uiGame; + PowerSystemRenderer.powerGraphOn = Config.Options.ShowDetailPowerGrid; + uiGame.dfVeinOn = Config.Options.ShowDetailVeinDistribution; + uiGame.dfSpaceGuideOn = Config.Options.ShowDetailSpaceNavigation; + DefenseSystemRenderer.turretGraphOn = Config.Options.ShowDetailDefenseArea; + EntitySignRenderer.showSign = Config.Options.ShowDetailBuildingAlarm; + EntitySignRenderer.showIcon = Config.Options.ShowDetailBuildingIcon; + PostEffectController.headlight = Config.Options.ShowGuidingLight; + if (GameMain.sectorModel != null) + { + GameMain.sectorModel.disableHPBars = !Config.Options.ShowDetailHpBars; + } + } +} diff --git a/NebulaPatcher/Patches/Dynamic/MonitorComponent_Patch.cs b/NebulaPatcher/Patches/Dynamic/MonitorComponent_Patch.cs index f16fb7dec..c1c654918 100644 --- a/NebulaPatcher/Patches/Dynamic/MonitorComponent_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/MonitorComponent_Patch.cs @@ -109,6 +109,19 @@ public static void SetSystemWarningSignalId_Prefix(MonitorComponent __instance, new MonitorSettingUpdatePacket(planetId, __instance.id, MonitorSettingEvent.SetSystemWarningSignalId, __0)); } + [HarmonyPrefix] + [HarmonyPatch(nameof(MonitorComponent.SetDigitalSignalId))] + public static void SetDigitalSignalId(MonitorComponent __instance, int __0) + { + if (!Multiplayer.IsActive || Multiplayer.Session.Warning.IsIncomingMonitorPacket) + { + return; + } + var planetId = GameMain.data.localPlanet == null ? -1 : GameMain.data.localPlanet.id; + Multiplayer.Session.Network.SendPacketToLocalStar( + new MonitorSettingUpdatePacket(planetId, __instance.id, MonitorSettingEvent.SetDigitalSignalId, __0)); + } + [HarmonyPrefix] [HarmonyPatch(nameof(MonitorComponent.SetCargoFilter))] public static void SetCargoFilter_Prefix(MonitorComponent __instance, int __0) diff --git a/NebulaPatcher/Patches/Dynamic/PostEffectController_Patch.cs b/NebulaPatcher/Patches/Dynamic/PostEffectController_Patch.cs deleted file mode 100644 index fbb5985c8..000000000 --- a/NebulaPatcher/Patches/Dynamic/PostEffectController_Patch.cs +++ /dev/null @@ -1,25 +0,0 @@ -#region - -using HarmonyLib; -using NebulaModel; -using NebulaWorld; - -#endregion - -namespace NebulaPatcher.Patches.Dynamic; - -[HarmonyPatch(typeof(PostEffectController))] -internal class PostEffectController_Patch -{ - [HarmonyPostfix] - [HarmonyPatch(nameof(PostEffectController.Start))] - public static void Start_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - PostEffectController.headlight = Config.Options.GuidingLightEnabled; - } -} diff --git a/NebulaPatcher/Patches/Dynamic/PowerSystemRenderer_Patch.cs b/NebulaPatcher/Patches/Dynamic/PowerSystemRenderer_Patch.cs deleted file mode 100644 index 10be329aa..000000000 --- a/NebulaPatcher/Patches/Dynamic/PowerSystemRenderer_Patch.cs +++ /dev/null @@ -1,25 +0,0 @@ -#region - -using HarmonyLib; -using NebulaModel; -using NebulaWorld; - -#endregion - -namespace NebulaPatcher.Patches.Dynamic; - -[HarmonyPatch(typeof(PowerSystemRenderer))] -internal class PowerSystemRenderer_Patch -{ - [HarmonyPostfix] - [HarmonyPatch(nameof(PowerSystemRenderer.Init))] - public static void Init_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - PowerSystemRenderer.powerGraphOn = Config.Options.PowerGridEnabled; - } -} diff --git a/NebulaPatcher/Patches/Dynamic/UIGameMenu_Patch.cs b/NebulaPatcher/Patches/Dynamic/UIGameMenu_Patch.cs index 7f131b566..b4a330997 100644 --- a/NebulaPatcher/Patches/Dynamic/UIGameMenu_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/UIGameMenu_Patch.cs @@ -13,79 +13,33 @@ internal class UIGameMenu_Patch { [HarmonyPostfix] [HarmonyPatch(nameof(UIGameMenu.OnDfGuideButtonClick))] - public static void OnDfGuideButtonClick_Postfix(UIGameMenu __instance) - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - Config.Options.SpaceNavigationEnabled = __instance.uiGame.dfSpaceGuideOn; - Config.SaveOptions(); - } - - [HarmonyPostfix] [HarmonyPatch(nameof(UIGameMenu.OnDfIconButtonClick))] - public static void OnDfIconButtonClick_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - Config.Options.BuildingIconEnabled = EntitySignRenderer.showIcon; - Config.SaveOptions(); - } - - [HarmonyPostfix] [HarmonyPatch(nameof(UIGameMenu.OnDfLightButtonClick))] - public static void OnDfLightButtonClick_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - Config.Options.GuidingLightEnabled = PowerSystemRenderer.powerGraphOn; - Config.SaveOptions(); - } - - [HarmonyPostfix] [HarmonyPatch(nameof(UIGameMenu.OnDfPowerButtonClick))] - public static void OnDfPowerButtonClick_Postfix() - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - Config.Options.PowerGridEnabled = PostEffectController.headlight; - Config.SaveOptions(); - } - - [HarmonyPostfix] [HarmonyPatch(nameof(UIGameMenu.OnDfSignButtonClick))] - public static void OnDfSignButtonClick_Postfix() + [HarmonyPatch(nameof(UIGameMenu.OnDfVeinButtonClick))] + [HarmonyPatch(nameof(UIGameMenu.OnDfDefenseButtonClick))] + [HarmonyPatch(nameof(UIGameMenu.OnDfHpBarButtonClick))] + public static void SaveDetailOptions() { if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) { return; } + var uiGame = UIRoot.instance.uiGame; - Config.Options.BuildingWarningEnabled = EntitySignRenderer.showSign; - Config.SaveOptions(); - } + Config.Options.ShowDetailPowerGrid = PowerSystemRenderer.powerGraphOn; + Config.Options.ShowDetailVeinDistribution = uiGame.dfVeinOn; + Config.Options.ShowDetailSpaceNavigation = uiGame.dfSpaceGuideOn; + Config.Options.ShowDetailDefenseArea = DefenseSystemRenderer.turretGraphOn; - [HarmonyPostfix] - [HarmonyPatch(nameof(UIGameMenu.OnDfVeinButtonClick))] - public static void OnDfVeinButtonClick_Postfix(UIGameMenu __instance) - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) + Config.Options.ShowDetailBuildingAlarm = EntitySignRenderer.showSign; + Config.Options.ShowDetailBuildingIcon = EntitySignRenderer.showIcon; + Config.Options.ShowGuidingLight = PostEffectController.headlight; + if (GameMain.sectorModel != null) { - return; + Config.Options.ShowDetailHpBars = !GameMain.sectorModel.disableHPBars; } - - Config.Options.VeinDistributionEnabled = __instance.uiGame.dfVeinOn; Config.SaveOptions(); } } diff --git a/NebulaPatcher/Patches/Dynamic/UIGame_Patch.cs b/NebulaPatcher/Patches/Dynamic/UIGame_Patch.cs index 2bf10c085..ad466dfa1 100644 --- a/NebulaPatcher/Patches/Dynamic/UIGame_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/UIGame_Patch.cs @@ -1,8 +1,6 @@ #region -using System.Diagnostics.CodeAnalysis; using HarmonyLib; -using NebulaModel; using NebulaWorld; #endregion @@ -12,20 +10,6 @@ namespace NebulaPatcher.Patches.Dynamic; [HarmonyPatch(typeof(UIGame))] internal class UIGame_Patch { - [HarmonyPostfix] - [HarmonyPatch(nameof(UIGame._OnInit))] - [SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Original Function Name")] - public static void _OnInit_Postfix(UIGame __instance) - { - if (!Multiplayer.IsActive || Multiplayer.Session.LocalPlayer.IsHost) - { - return; - } - - __instance.dfSpaceGuideOn = Config.Options.SpaceNavigationEnabled; - __instance.dfVeinOn = Config.Options.VeinDistributionEnabled; - } - [HarmonyPrefix] [HarmonyPatch(nameof(UIGame.StarmapChangingToMilkyWay))] public static bool StarmapChangingToMilkyWay_Prefix() diff --git a/NebulaPatcher/Patches/Dynamic/UIMarkerDesc_Patch.cs b/NebulaPatcher/Patches/Dynamic/UIMarkerDesc_Patch.cs index afe5ae09b..9356ca1b1 100644 --- a/NebulaPatcher/Patches/Dynamic/UIMarkerDesc_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/UIMarkerDesc_Patch.cs @@ -1,4 +1,4 @@ -#region +#region using HarmonyLib; using NebulaModel.Packets.Universe; @@ -82,6 +82,24 @@ public static void OnTodoInputFieldEndEdit_Postfix(UIMarkerDesc __instance) colorData: __instance.marker.todo?.contentColorIndex)); } + [HarmonyPostfix] + [HarmonyPatch(nameof(UIMarkerDesc.OnDigitalSignalIdEndEdit))] + public static void OnDigitalSignalIdEndEdit(UIMarkerDesc __instance) + { + if (!Multiplayer.IsActive || Multiplayer.Session.Warning.IsIncomingMarkerPacket) + { + return; + } + if (__instance.marker == null || __instance.factory == null) + { + return; + } + Multiplayer.Session.Network.SendPacket( + new MarkerSettingUpdatePacket(__instance.factory.planetId, __instance.marker.id, + MarkerSettingEvent.SetDigitalSignalId, + intValue: __instance.marker.digitalSignalId)); + } + [HarmonyPostfix] [HarmonyPatch(nameof(UIMarkerDesc.OnVisibilityBoxItemIndexChanged))] public static void OnVisibilityBoxItemIndexChanged_Postfix(UIMarkerDesc __instance) diff --git a/README.md b/README.md index 501772e7b..2764193bd 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The mod supports running the server in non-GPU environment. Check [the wiki page Major refactors will happen while the project grows or game updates. Join the [Discord Server](https://discord.gg/UHeB2QvgDa) if you want to see to latest state of our development. Check [Wiki](https://github.com/NebulaModTeam/nebula/wiki/About-Nebula) for overview of features. -The multiplayer mod now supports Dark Fog combat mode in the latest game version (0.10.33.x). +The multiplayer mod now supports Dark Fog combat mode in the latest game version (0.10.34.x). Most of the battle aspects are sync, only few features are still work in progress.
@@ -76,6 +76,7 @@ Most of the battle aspects are sync, only few features are still work in progres - [x] Warning alarm syncing - [x] Broadcast notification syncing (events with guide icon) - [x] Logistics Control Panel (I) syncing (entry list and detail panel) +- [x] Planet Memo syncing - [ ] Goal system (currently not available in client) - [ ] Custom dashboard (clients will lost their custom stats when they leave the star system) - [ ] Wireless charge tower (power will not sync when mecha is charging) @@ -116,8 +117,8 @@ Most of the battle aspects are sync, only few features are still work in progres - [x] Patch DF unit to search for nearest alive mecha (sensor range) - [x] Patch DF turret to search for nearest alive mecha (attack when within attack range or counterattack) - [x] Show base/hive/relay invasion events in chat -- [ ] Sync kill stats - [x] Sync Dark Fog communicator (aggressiveness and truce) +- [ ] Sync kill stats - [ ] Show remote mecha combat drone fleet animation - [ ] Show remote mecha spacecraft fleet animation - [ ] Show ground-to-space attacks animation on client for remote planets (missile turrets, plasma cannon) diff --git a/version.json b/version.json index 5e277c06e..c49a6c343 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.9.19", + "version": "0.9.20", "assemblyVersion": { "precision": "build" },