RynthServers/Plugins/Shared/ServerPack/ServerPlugin.props
Daniel Wallace 0ba3b5909e ServerPack: use the engine's web panel when it has one
OpenWeb now opens the page in RynthCore's in-game web panel (plugin API v93)
and falls back to the system browser only when the panel refused before
navigating. A handle from OpenWebPanel only means queued, so the open is
answered from OnTick (PollWeb), which reads GetWebPanelState until it decides:
Loading/Ready opened; Failed+OpenedInBrowser the engine opened the browser
(do nothing more); Failed+ProcessFailed spent; Failed+RuntimeMissing or
CreateFailed with no browser and no navigation falls back. A 20 s poll
timeout answers NoAnswer (neutral, no fallback). done fires exactly once.

ServerWebPanel.cs is pure (an int/string engine seam), so the mappings and
the once-only answer are tested with a fake engine. Every SDK web-panel name
sits in four NoInlining helpers in ServerPackWeb.cs, each called inside
catch (MissingMethodException) and catch (TypeLoadException); a source scan
pins that, the poll's place in OnTick, and the absence of locks. CloseWeb
closes only the handle this plugin opened.

Builds only against a RynthCore SDK with the web panel (0ef12d7); against
418d80b the helpers do not compile (8 errors, all in ServerPackWeb.cs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:37:49 -08:00

102 lines
7.2 KiB
XML

<Project>
<!--
The common build of a server plugin (RynthColdeve, RynthAelrynth, ...): one NativeAOT plugin
per game server, built like RynthILT, so each server's plugin ships and updates on its own
(its own DLL, feed entry and C:\Games\RynthSuite\<Name>\ folder).
A server plugin's csproj sets, then imports this file:
AssemblyName RynthCore.Plugin.Rynth<Server> (plugin name = without the prefix)
Version its own version (Publish-Update.ps1 overrides it for a release)
RynthPluginServerId lower-case id (a-z 0-9 -); the Mini Remote's server id
RynthPluginServerName display name
RynthPluginServerHosts connect hosts, '|'-separated (a name matches hosts under it)
RynthPluginServerWorldNames world names the server announces, '|'-separated ('*' wildcards)
RynthPluginDescription one line for the launcher's plugin list
and keeps one source file, ServerData.cs (ServerData.Create: what is known about the server).
Detection data lives only in the csproj: the SDK writes it into the embedded manifest (the
engine loads the plugin only for its server) and into RynthPluginInfo (the plugin's own use).
Server-specific features go in the project as more files, through the partial hooks in
ServerPackPlugin.cs (ServerTick, ServerChatCommand, ServerChatText, ServerPages, ...), so the
shared code stays the same for all (the hooks and helpers are listed at the top of that file).
A server's quest pack is Resources\quests.<server id>.csv in its project: embedded below and
offered to RynthOracle through "RynthServer.QuestPack" (ServerPackQuestPack.cs).
-->
<PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<NativeLib>Shared</NativeLib>
<InvariantGlobalization>true</InvariantGlobalization>
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
<StripSymbols>false</StripSymbols>
<RootNamespace>RynthCore.Plugin.ServerPack</RootNamespace>
<Platforms>x86</Platforms>
<!-- Nothing above the v66 baseline: chat commands, world names and the plugin-command broker
are behind HasInvokeChatParser / HasGetWorldName / HasWriteToChat. -->
<RynthPluginMinEngineApi Condition="'$(RynthPluginMinEngineApi)' == ''">66</RynthPluginMinEngineApi>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\SafeImGui.cs" Link="Shared\SafeImGui.cs" />
<!-- ImGui.NET bound to the engine's cimgui: one ImGui, one current context, pop-outs included. -->
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\ImGuiNativeBinding.cs" Link="Shared\ImGuiNativeBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackInfo.cs" Link="ServerPack\ServerPackInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackModel.cs" Link="ServerPack\ServerPackModel.cs" />
<!-- The server's own pages, settings file, reply window and Refresh row (ServerPackPlugin.cs lists the hooks). -->
<Compile Include="$(MSBuildThisFileDirectory)ServerPackPages.cs" Link="ServerPack\ServerPackPages.cs" />
<!-- Windows of its own on RynthCore's bar (ServerWindows, 2026-11-07). -->
<Compile Include="$(MSBuildThisFileDirectory)ServerPackWindows.cs" Link="ServerPack\ServerPackWindows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackSettings.cs" Link="ServerPack\ServerPackSettings.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerChatRequest.cs" Link="ServerPack\ServerChatRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackRefresh.cs" Link="ServerPack\ServerPackRefresh.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackUi.cs" Link="ServerPack\ServerPackUi.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackPlugin.cs" Link="ServerPack\ServerPackPlugin.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackExports.cs" Link="ServerPack\ServerPackExports.cs" />
<!-- "/rserver ..." words and answers, and the shared reply queue they go through (2026-10-28). -->
<Compile Include="$(MSBuildThisFileDirectory)ServerPackCommands.cs" Link="ServerPack\ServerPackCommands.cs" />
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
<!-- "RynthServer.Profile": the server's settings for other plugins (RynthPluginQueryInterface). -->
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\RynthServerProfileApi.cs" Link="Shared\RynthServerProfileApi.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackProfile.cs" Link="ServerPack\ServerPackProfile.cs" />
<!-- "RynthServer.QuestPack": the server's own quest list for RynthOracle (and any quest reader). -->
<Compile Include="$(RynthSuiteRoot)Plugins\Shared\RynthServerQuestPackApi.cs" Link="Shared\RynthServerQuestPackApi.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackQuestPack.cs" Link="ServerPack\ServerPackQuestPack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackInterface.cs" Link="ServerPack\ServerPackInterface.cs" />
<!-- Open a web page in the engine's panel, else the browser (allowlisted https only). -->
<Compile Include="$(MSBuildThisFileDirectory)ServerWebOpen.cs" Link="ServerPack\ServerWebOpen.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerWebPanel.cs" Link="ServerPack\ServerWebPanel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServerPackWeb.cs" Link="ServerPack\ServerPackWeb.cs" />
</ItemGroup>
<ItemGroup>
<!-- The server's quest pack, when the project has one: Resources\quests.<server id>.csv (RynthOracle's
quest list columns), served through "RynthServer.QuestPack" (ServerPackQuestPack.cs). -->
<EmbeddedResource Include="$(MSBuildProjectDirectory)\Resources\quests.$(RynthPluginServerId).csv"
Condition="Exists('$(MSBuildProjectDirectory)\Resources\quests.$(RynthPluginServerId).csv')"
LogicalName="ServerPack.quests.csv" Link="Resources\quests.$(RynthPluginServerId).csv" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ImGui.NET" Version="1.91.6.1" />
<TrimmerRootAssembly Include="ImGui.NET" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\..\..\RynthCore\src\RynthCore.PluginCore\RynthCore.PluginCore.csproj" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\..\..\RynthCore\src\RynthCore.PluginSdk\RynthCore.PluginSdk.csproj" />
</ItemGroup>
<!-- The engine already loaded cimgui.dll into the client; a second copy next to the plugin is never used. -->
<Target Name="RemoveBundledImGuiNativeFromBuild" AfterTargets="Build">
<Delete Files="$(OutputPath)cimgui.dll" Condition="Exists('$(OutputPath)cimgui.dll')" />
</Target>
<Target Name="RemoveBundledImGuiNativeFromPublish" AfterTargets="Publish" Condition="'$(PublishDir)' != ''">
<Delete Files="$(PublishDir)cimgui.dll" Condition="Exists('$(PublishDir)cimgui.dll')" />
</Target>
</Project>