-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNPCVoiceControl.csproj
More file actions
695 lines (620 loc) · 43.2 KB
/
Copy pathNPCVoiceControl.csproj
File metadata and controls
695 lines (620 loc) · 43.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<Project Sdk="Microsoft.NET.Sdk">
<!-- Optional per-machine overrides, git-ignored. Never committed, never synced. -->
<Import Project="$(MSBuildProjectDirectory)\Local.props" Condition="Exists('$(MSBuildProjectDirectory)\Local.props')" />
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<AssemblyName>1-XNPCVoiceControl</AssemblyName>
<RootNamespace>XNPCVoiceControl</RootNamespace>
<LangVersion>9.0</LangVersion>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!-- Output directly to mod folder -->
<OutputPath>bin\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<!-- Suppress warnings about missing XML docs and Unsafe version conflict (game's MemoryPack.dll refs v6.0.0.0, NuGet ships v4.0.4.1) -->
<NoWarn>CS1591;CS0436;MSB3277</NoWarn>
<!-- Define UNITY_STANDALONE_WIN for Windows builds -->
<DefineConstants>$(DefineConstants);UNITY_STANDALONE_WIN</DefineConstants>
<BaseOutputPath>.\</BaseOutputPath>
</PropertyGroup>
<!--
Location of tools/*.ps1, resolved for BOTH repo layouts:
dev repo - csproj lives in NPCVoiceControlMod/NPCVoiceControl/, tools/ is its sibling -> ../tools
public repo - sync-to-public.bat copies the csproj to the repo ROOT, tools/ sits beside it -> ./tools
Hardcoding ../tools resolved OUTSIDE the public repo, so every public clone failed its build
on the unconditional ValidateModXml target (MSB3073, script not found). Probe for the script
itself rather than the directory, so a partial sync is treated as missing rather than silently
passing an empty path to powershell.
-->
<PropertyGroup>
<ToolsDir Condition="Exists('$(MSBuildProjectDirectory)/../tools/Validate-ModXml.ps1')">$(MSBuildProjectDirectory)/../tools</ToolsDir>
<ToolsDir Condition="'$(ToolsDir)' == '' AND Exists('$(MSBuildProjectDirectory)/tools/Validate-ModXml.ps1')">$(MSBuildProjectDirectory)/tools</ToolsDir>
</PropertyGroup>
<!-- The sidecar sources exist only in the dev repo. A source-only clone (public
repo, release ZIP) has Scripts/ and the csproj but no sidecar projects, so
the publish/copy/dist targets below must not run there: they fail into
ContinueOnError warnings, and AssembleDist writes to ../dist which sits
OUTSIDE a source-only clone. Probe for a sidecar project, not a folder. -->
<PropertyGroup>
<FullPipeline Condition="Exists('$(MSBuildProjectDirectory)\..\sherpa-server\sherpa-server.csproj')">true</FullPipeline>
<FullPipeline Condition="'$(FullPipeline)' == ''">false</FullPipeline>
</PropertyGroup>
<!-- Remove stale NPCLLMChat.dll artifacts from old builds -->
<Target Name="CleanStaleArtifacts" BeforeTargets="Build">
<ItemGroup>
<_StaleDll Include="$(OutputPath)NPCLLMChat.dll" />
<_StaleDll Include="$(OutputPath)NPCLLMChat.pdb" />
<_StaleDll Include="$(OutputPath)Whisper.net.dll" />
<_StaleDll Include="$(OutputPath)whisper.dll" />
</ItemGroup>
<Delete Files="@(_StaleDll)" ContinueOnError="true" />
</Target>
<!-- Validate shipped XML: no em-dash or en-dash in comments, no encoding UTF-8 declaration -->
<Target Name="ValidateModXml" BeforeTargets="AssembleDist;Build">
<Message Text="=== Validating Config XML ===" Importance="high" />
<!-- This target is unconditional, so a missing tools/ must WARN rather than fail the build —
otherwise a clone without tools/ cannot build at all. Warn, never silently skip. -->
<Warning Condition="'$(ToolsDir)' == ''" Text="tools/Validate-ModXml.ps1 not found - skipping Config XML validation. Bad XML (em-dash or -- in comments, encoding=UTF-8 in the declaration) will NOT be caught and crashes Unity Mono at runtime. Copy the tools/ folder next to the csproj to re-enable." />
<Exec Condition="'$(ToolsDir)' != ''" Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(ToolsDir)/Validate-ModXml.ps1" -ConfigPath "$(MSBuildProjectDirectory)/Config"">
<Output TaskParameter="ExitCode" PropertyName="XmlValidationExitCode" />
</Exec>
<Error Condition="'$(XmlValidationExitCode)' != '0' AND '$(XmlValidationExitCode)' != ''" Text="Config XML validation failed! Check output above." />
</Target>
<!--
Platform-specific paths. Nothing here needs editing for a standard Steam install.
Override for a custom install, in order of precedence:
1. dotnet build -p:GamePath="E:\My Games\7 Days To Die"
2. set SDTD_GAMEPATH=E:\My Games\7 Days To Die
3. create Local.props next to this csproj (see Local.props.example)
Probes test for Assembly-CSharp.dll so an empty leftover folder cannot win.
-->
<!-- Windows paths -->
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<GamePath Condition="'$(GamePath)' == '' AND '$(SDTD_GAMEPATH)' != ''">$(SDTD_GAMEPATH)</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('C:\Program Files\Steam\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">C:\Program Files\Steam\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('C:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">C:\SteamLibrary\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('D:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">D:\SteamLibrary\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('D:\Steam\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">D:\Steam\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('E:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">E:\SteamLibrary\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('E:\Steam\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">E:\Steam\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == '' AND Exists('F:\SteamLibrary\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\Assembly-CSharp.dll')">F:\SteamLibrary\steamapps\common\7 Days To Die</GamePath>
<GamePath Condition="'$(GamePath)' == ''">C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die</GamePath>
<ManagedPath>$(GamePath)\7DaysToDie_Data\Managed</ManagedPath>
<SCorePath>$(GamePath)\Mods\0-SCore</SCorePath>
<HarmonyPath>$(GamePath)\Mods\0_TFP_Harmony</HarmonyPath>
</PropertyGroup>
<!-- Linux paths (customize for your system) -->
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<GamePath>$(HOME)/.steam/steam/steamapps/common/7 Days To Die</GamePath>
<ManagedPath>$(GamePath)/7DaysToDie_Data/Managed</ManagedPath>
<SCorePath>$(GamePath)/Mods/0-SCore</SCorePath>
<HarmonyPath>$(GamePath)/Mods/0_TFP_Harmony</HarmonyPath>
</PropertyGroup>
<!-- A wrong GamePath otherwise produces hundreds of unrelated CS0246 errors and
the actual cause never appears. Fail once, before the compiler, saying what to do. -->
<Target Name="VerifyGamePath" BeforeTargets="CoreCompile">
<Error Condition="!Exists('$(ManagedPath)\Assembly-CSharp.dll')"
Text="7 Days To Die not found at: $(GamePath)%0A%0AExpected: $(ManagedPath)\Assembly-CSharp.dll%0A%0AFix by passing your install path:%0A dotnet build -p:GamePath="E:\Your\Path\7 Days To Die"%0Aor set the SDTD_GAMEPATH environment variable, or create Local.props (see Local.props.example)." />
<Error Condition="!Exists('$(SCorePath)\SCore.dll')"
Text="0-SCore not found at: $(SCorePath)%0ANPCVoiceControl requires SphereII's 0-SCore installed in the game's Mods folder. Install it, then rebuild." />
<Error Condition="!Exists('$(HarmonyPath)\0Harmony.dll')"
Text="0_TFP_Harmony not found at: $(HarmonyPath)%0AThis ships with the game. If it is missing, verify the game files in Steam." />
</Target>
<!-- Game Assembly References -->
<ItemGroup>
<!-- Core Unity -->
<Reference Include="UnityEngine">
<HintPath>$(ManagedPath)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(ManagedPath)/UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestModule">
<HintPath>$(ManagedPath)/UnityEngine.UnityWebRequestModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>$(ManagedPath)/UnityEngine.JSONSerializeModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>$(ManagedPath)/UnityEngine.AnimationModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>$(ManagedPath)/UnityEngine.PhysicsModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(ManagedPath)/UnityEngine.IMGUIModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>$(ManagedPath)/UnityEngine.AudioModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>$(ManagedPath)/UnityEngine.InputLegacyModule.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- UnityWebRequestAudioModule for UnityWebRequestMultimedia.GetAudioClip -->
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
<HintPath>$(ManagedPath)/UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- NGUI (UILabel, UIWidget, UIPanel — needed for subtitle font assignment) -->
<Reference Include="NGUI">
<HintPath>$(ManagedPath)/NGUI.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- UnityEngine.TextRenderingModule (Font, Resources.Load<Font>) -->
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(ManagedPath)/UnityEngine.TextRenderingModule.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- 7DTD Game Assembly -->
<Reference Include="Assembly-CSharp">
<HintPath>$(ManagedPath)/Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- Harmony (from TFP_Harmony) -->
<Reference Include="0Harmony">
<HintPath>$(HarmonyPath)/0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- SCore mod (EntityUtilities, HarvestManager, EntitySyncUtils, IEntityAliveSDX) -->
<Reference Include="SCore">
<HintPath>$(SCorePath)/SCore.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- Newtonsoft.Json (from game's Managed folder) -->
<Reference Include="Newtonsoft.Json">
<HintPath>$(ManagedPath)/Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- System libs -->
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<!-- KokoroSharp TTS dependencies removed — TTS now runs via sherpa-server HTTP process -->
<!-- Whisper.net STT removed — STT now runs via whisper-server HTTP process -->
<!-- NanoWakeWord ONNX runtime -->
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.27.0" />
</ItemGroup>
<!-- Item groups for build/deploy targets -->
<ItemGroup>
<!-- Resources (models, voices, espeak data) -->
<ResourcesFiles Include="Resources\*" />
<ResourcesFiles Include="Resources\**\*" />
</ItemGroup>
<!-- Publish sherpa-server to bin/SherpaServer/ -->
<Target Name="PublishSherpaServer" AfterTargets="Build" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<PropertyGroup>
<SherpaServerProject>$(MSBuildProjectDirectory)/../sherpa-server/sherpa-server.csproj</SherpaServerProject>
<SherpaServerOutput>$(MSBuildProjectDirectory)/$(OutputPath)bin/SherpaServer</SherpaServerOutput>
</PropertyGroup>
<Message Text="Publishing sherpa-server to $(SherpaServerOutput)..." Importance="high" />
<!-- Wipe output first so removed source files don't ship forever -->
<RemoveDir Directories="$(SherpaServerOutput)" ContinueOnError="true" />
<MakeDir Directories="$(SherpaServerOutput)" />
<Exec Command="dotnet publish "$(SherpaServerProject)" -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o "$(SherpaServerOutput)"" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="SherpaPublishExitCode" />
</Exec>
<Message Text="sherpa-server publish exit code: $(SherpaPublishExitCode)" Importance="high" />
</Target>
<!-- Trim SherpaServer: remove build artifacts from self-contained single-file publish -->
<Target Name="TrimSherpaServer" AfterTargets="PublishSherpaServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<Message Text="Trimming SherpaServer bloat..." Importance="high" />
<!-- Remove non-Windows runtimes (we only need win-x64 for a self-contained win-x64 publish) -->
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/android" Condition="Exists('$(SherpaServerOutput)/runtimes/android')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/ios" Condition="Exists('$(SherpaServerOutput)/runtimes/ios')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/linux-arm64" Condition="Exists('$(SherpaServerOutput)/runtimes/linux-arm64')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/linux-x64" Condition="Exists('$(SherpaServerOutput)/runtimes/linux-x64')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/osx-arm64" Condition="Exists('$(SherpaServerOutput)/runtimes/osx-arm64')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/osx-x64" Condition="Exists('$(SherpaServerOutput)/runtimes/osx-x64')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/win-arm64" Condition="Exists('$(SherpaServerOutput)/runtimes/win-arm64')" />
<RemoveDir Directories="$(SherpaServerOutput)/runtimes/win-x86" Condition="Exists('$(SherpaServerOutput)/runtimes/win-x86')" />
<!-- Remove build artifacts from self-contained single-file publish -->
<!-- aspnetcorev2_inprocess.dll is an IIS in-process module; these are Kestrel self-hosted -->
<ItemGroup>
<_SherpaTrim Include="$(SherpaServerOutput)/*.pdb" />
<_SherpaTrim Include="$(SherpaServerOutput)/*.deps.json" />
<_SherpaTrim Include="$(SherpaServerOutput)/*.runtimeconfig.json" />
<_SherpaTrim Include="$(SherpaServerOutput)/*.staticwebassets.endpoints.json" />
<_SherpaTrim Include="$(SherpaServerOutput)/aspnetcorev2_inprocess.dll" />
</ItemGroup>
<Delete Files="@(_SherpaTrim)" ContinueOnError="true" />
</Target>
<!-- Publish supertonic-server to bin/SupertonicServer/ -->
<Target Name="PublishSupertonicServer" AfterTargets="Build" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<PropertyGroup>
<SupertonicServerProject>$(MSBuildProjectDirectory)/../supertonic-server/supertonic-server.csproj</SupertonicServerProject>
<SupertonicServerOutput>$(MSBuildProjectDirectory)/$(OutputPath)bin/SupertonicServer</SupertonicServerOutput>
</PropertyGroup>
<Message Text="Publishing supertonic-server to $(SupertonicServerOutput)..." Importance="high" />
<!-- Wipe output first so removed source files don't ship forever -->
<RemoveDir Directories="$(SupertonicServerOutput)" ContinueOnError="true" />
<MakeDir Directories="$(SupertonicServerOutput)" />
<Exec Command="dotnet publish "$(SupertonicServerProject)" -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o "$(SupertonicServerOutput)"" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="SupertonicPublishExitCode" />
</Exec>
<Message Text="supertonic-server publish exit code: $(SupertonicPublishExitCode)" Importance="high" />
</Target>
<!-- Trim SupertonicServer: remove build artifacts from self-contained single-file publish -->
<Target Name="TrimSupertonicServer" AfterTargets="PublishSupertonicServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<Message Text="Trimming SupertonicServer bloat..." Importance="high" />
<!-- Remove non-Windows runtimes (we only need win-x64 for a self-contained win-x64 publish) -->
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/android" Condition="Exists('$(SupertonicServerOutput)/runtimes/android')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/ios" Condition="Exists('$(SupertonicServerOutput)/runtimes/ios')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/linux-arm64" Condition="Exists('$(SupertonicServerOutput)/runtimes/linux-arm64')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/linux-x64" Condition="Exists('$(SupertonicServerOutput)/runtimes/linux-x64')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/osx-arm64" Condition="Exists('$(SupertonicServerOutput)/runtimes/osx-arm64')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/osx-x64" Condition="Exists('$(SupertonicServerOutput)/runtimes/osx-x64')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/win-arm64" Condition="Exists('$(SupertonicServerOutput)/runtimes/win-arm64')" />
<RemoveDir Directories="$(SupertonicServerOutput)/runtimes/win-x86" Condition="Exists('$(SupertonicServerOutput)/runtimes/win-x86')" />
<!-- Remove build artifacts from self-contained single-file publish -->
<!-- aspnetcorev2_inprocess.dll is an IIS in-process module; these are Kestrel self-hosted -->
<ItemGroup>
<_SupertonicTrim Include="$(SupertonicServerOutput)/*.pdb" />
<_SupertonicTrim Include="$(SupertonicServerOutput)/*.deps.json" />
<_SupertonicTrim Include="$(SupertonicServerOutput)/*.runtimeconfig.json" />
<_SupertonicTrim Include="$(SupertonicServerOutput)/*.staticwebassets.endpoints.json" />
<_SupertonicTrim Include="$(SupertonicServerOutput)/*.lib" />
<_SupertonicTrim Include="$(SupertonicServerOutput)/aspnetcorev2_inprocess.dll" />
</ItemGroup>
<Delete Files="@(_SupertonicTrim)" ContinueOnError="true" />
</Target>
<!-- Ship MSVC runtime app-local next to supertonic-server.exe so ONNX doesn't grab a stale copy from System32 -->
<Target Name="ShipSupertonicVcRuntime" AfterTargets="TrimSupertonicServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<Message Text="Shipping MSVC runtime to SupertonicServer..." Importance="high" />
<ItemGroup>
<_VcDlls Include="$(SystemRoot)/System32/vcruntime140.dll;$(SystemRoot)/System32/vcruntime140_1.dll;$(SystemRoot)/System32/msvcp140.dll" />
</ItemGroup>
<Copy SourceFiles="@(_VcDlls)" DestinationFolder="$(SupertonicServerOutput)" SkipUnchangedFiles="true" ContinueOnError="true" />
</Target>
<!-- Copy llama-server to bin/LlamaServer/ -->
<Target Name="CopyLlamaServer" AfterTargets="Build" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<PropertyGroup>
<LlamaServerSource>$(MSBuildProjectDirectory)/LlamaServer</LlamaServerSource>
<LlamaServerOutput>$(MSBuildProjectDirectory)/$(OutputPath)bin/LlamaServer</LlamaServerOutput>
</PropertyGroup>
<Message Text="Copying llama-server to $(LlamaServerOutput)..." Importance="high" />
<!-- Wipe output first so removed source files don't ship forever -->
<RemoveDir Directories="$(LlamaServerOutput)" ContinueOnError="true" />
<MakeDir Directories="$(LlamaServerOutput)" />
<ItemGroup>
<LlamaServerFiles Include="$(LlamaServerSource)\**\*" />
</ItemGroup>
<Copy SourceFiles="@(LlamaServerFiles)" DestinationFiles="@(LlamaServerFiles->'$(LlamaServerOutput)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<!-- Trim LlamaServer: remove benchmark/utility DLLs not needed at runtime -->
<Target Name="TrimLlamaServer" AfterTargets="CopyLlamaServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<Message Text="Trimming LlamaServer bloat..." Importance="high" />
<ItemGroup>
<_LlamaTrim Include="$(LlamaServerOutput)/llama-batched-bench-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-bench-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-cli-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-completion-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-fit-params-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-perplexity-impl.dll" />
<_LlamaTrim Include="$(LlamaServerOutput)/llama-quantize-impl.dll" />
</ItemGroup>
<Delete Files="@(_LlamaTrim)" ContinueOnError="true" />
</Target>
<!-- Copy whisper-server to bin/WhisperServer/ -->
<Target Name="CopyWhisperServer" AfterTargets="Build" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<PropertyGroup>
<WhisperServerSource>$(MSBuildProjectDirectory)/WhisperServer</WhisperServerSource>
<WhisperServerOutput>$(MSBuildProjectDirectory)/$(OutputPath)bin/WhisperServer</WhisperServerOutput>
</PropertyGroup>
<Message Text="Copying whisper-server to $(WhisperServerOutput)..." Importance="high" />
<!-- Wipe output first so removed source files don't ship forever -->
<RemoveDir Directories="$(WhisperServerOutput)" ContinueOnError="true" />
<MakeDir Directories="$(WhisperServerOutput)" />
<ItemGroup>
<WhisperServerFiles Include="$(WhisperServerSource)\**\*" />
</ItemGroup>
<Copy SourceFiles="@(WhisperServerFiles)" DestinationFiles="@(WhisperServerFiles->'$(WhisperServerOutput)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<!-- Trim WhisperServer: remove .pdb and staticwebassets metadata -->
<!-- KEEP .deps.json and .runtimeconfig.json — whisper-server is framework-dependent and needs them to launch -->
<Target Name="TrimWhisperServer" AfterTargets="CopyWhisperServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<Message Text="Trimming WhisperServer bloat..." Importance="high" />
<ItemGroup>
<_WhisperTrim Include="$(WhisperServerOutput)/*.pdb" />
<_WhisperTrim Include="$(WhisperServerOutput)/*.staticwebassets.endpoints.json" />
</ItemGroup>
<Delete Files="@(_WhisperTrim)" ContinueOnError="true" />
</Target>
<!-- Ship wake-word ONNX + MSVC runtime into Plugins/OnnxRuntime/ so NativeLibrary.Load pins the correct DLL -->
<Target Name="ShipWakeWordOnnxRuntime" AfterTargets="TrimWhisperServer" Condition="'$(OS)' == 'Windows_NT' AND '$(FullPipeline)' == 'true'">
<PropertyGroup>
<WakeWordOnnxOutput>$(MSBuildProjectDirectory)/$(OutputPath)Plugins/OnnxRuntime</WakeWordOnnxOutput>
</PropertyGroup>
<Message Text="Shipping wake-word ONNX runtime to Plugins/OnnxRuntime..." Importance="high" />
<MakeDir Directories="$(WakeWordOnnxOutput)" />
<!-- Copy ONNX native DLLs from Plugins/ root -->
<ItemGroup>
<_OnnxDlls Include="$(MSBuildProjectDirectory)/Plugins/onnxruntime.dll;$(MSBuildProjectDirectory)/Plugins/onnxruntime_providers_shared.dll" />
</ItemGroup>
<Copy SourceFiles="@(_OnnxDlls)" DestinationFolder="$(WakeWordOnnxOutput)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- Copy MSVC runtime app-local so ONNX doesn't grab a stale copy from System32 -->
<ItemGroup>
<_VcDlls Include="$(SystemRoot)/System32/vcruntime140.dll;$(SystemRoot)/System32/vcruntime140_1.dll;$(SystemRoot)/System32/msvcp140.dll" />
</ItemGroup>
<Copy SourceFiles="@(_VcDlls)" DestinationFolder="$(WakeWordOnnxOutput)" SkipUnchangedFiles="true" ContinueOnError="true" />
</Target>
<!-- Copy DLL to mod folder after build -->
<Target Name="CopyToModFolder" AfterTargets="Build">
<Message Text="Build complete! DLL at: $(OutputPath)$(AssemblyName).dll" Importance="high" />
<Message Text="Copy to your 7DTD Mods folder to install." Importance="high" />
<!-- Copy Resources to output directory (recursive) -->
<ItemGroup>
<_AllResourceFiles Include="$(MSBuildProjectDirectory)/Resources/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_AllResourceFiles->'%(FullPath)')" DestinationFiles="@(_AllResourceFiles->'$(OutputPath)Resources/%(RecursiveDir)%(Filename)%(Extension)')" Condition="'$(FullPipeline)' == 'true'" />
<!-- Copy Config XMLs to output directory (so servers find them at ../../Config/) -->
<ItemGroup>
<_AllConfigFiles Include="$(MSBuildProjectDirectory)/Config/*.xml" />
</ItemGroup>
<Copy SourceFiles="@(_AllConfigFiles)" DestinationFolder="$(OutputPath)Config" SkipUnchangedFiles="true" Condition="'$(FullPipeline)' == 'true'" />
</Target>
<!-- Assemble dist/ — clean, drift-proof mod package assembled after all staging targets -->
<Target Name="AssembleDist" AfterTargets="ShipWakeWordOnnxRuntime;CopyToModFolder" Condition="'$(FullPipeline)' == 'true'">
<PropertyGroup>
<DistDir>$(MSBuildProjectDirectory)/../dist</DistDir>
</PropertyGroup>
<Message Text="=== Assembling dist/ ===" Importance="high" />
<!-- (a) Fresh start: wipe then recreate -->
<RemoveDir Directories="$(DistDir)" ContinueOnError="true" />
<MakeDir Directories="$(DistDir)" />
<MakeDir Directories="$(DistDir)/Config/XUi_InGame" />
<MakeDir Directories="$(DistDir)/Plugins/OnnxRuntime" />
<MakeDir Directories="$(DistDir)/bin/SherpaServer" />
<MakeDir Directories="$(DistDir)/bin/SupertonicServer" />
<MakeDir Directories="$(DistDir)/bin/LlamaServer" />
<MakeDir Directories="$(DistDir)/bin/WhisperServer" />
<!-- (b) ALLOWLIST copies — nothing sneaks in -->
<!-- Managed DLLs + main mod DLL from build output -->
<ItemGroup>
<_DistDlls Include="$(OutputPath)1-XNPCVoiceControl.dll;$(OutputPath)Microsoft.ML.OnnxRuntime.dll;$(OutputPath)System.Buffers.dll;$(OutputPath)System.Memory.dll;$(OutputPath)System.Numerics.Vectors.dll;$(OutputPath)System.Runtime.CompilerServices.Unsafe.dll" />
</ItemGroup>
<Copy SourceFiles="@(_DistDlls)" DestinationFolder="$(DistDir)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- ModInfo.xml -->
<Copy SourceFiles="$(MSBuildProjectDirectory)/ModInfo.xml" DestinationFolder="$(DistDir)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- Test_Servers.bat (tester-facing sidecar diagnostic) -->
<Copy SourceFiles="$(MSBuildProjectDirectory)/../Test_Servers.bat" DestinationFolder="$(DistDir)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- Config/*.xml (9 files) + Localization.csv + ReadMeFirst.md + voice-command-card.html.
ALLOWLIST, not a glob: a new Config file is NOT deployed until it is added here. -->
<ItemGroup>
<_DistConfig Include="$(MSBuildProjectDirectory)/Config/modconfig.xml;$(MSBuildProjectDirectory)/Config/ServerConfig.xml;$(MSBuildProjectDirectory)/Config/SupertonicConfig.xml;$(MSBuildProjectDirectory)/Config/personalities.xml;$(MSBuildProjectDirectory)/Config/phrasetriggers.xml;$(MSBuildProjectDirectory)/Config/utilityai.xml;$(MSBuildProjectDirectory)/Config/buffs.xml;$(MSBuildProjectDirectory)/Config/dialogs.xml;$(MSBuildProjectDirectory)/Config/Localization.csv;$(MSBuildProjectDirectory)/Config/ReadMeFirst.md;$(MSBuildProjectDirectory)/Config/voice-command-card.html;$(MSBuildProjectDirectory)/Config/entityclasses.xml" />
</ItemGroup>
<Copy SourceFiles="@(_DistConfig)" DestinationFolder="$(DistDir)/Config" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- Config/XUi_InGame/{windows,xui}.xml -->
<ItemGroup>
<_DistXUi Include="$(MSBuildProjectDirectory)/Config/XUi_InGame/windows.xml;$(MSBuildProjectDirectory)/Config/XUi_InGame/xui.xml" />
</ItemGroup>
<Copy SourceFiles="@(_DistXUi)" DestinationFolder="$(DistDir)/Config/XUi_InGame" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- Plugins/OnnxRuntime/** (native onnxruntime + vcruntime) -->
<ItemGroup>
<_DistOnnx Include="$(OutputPath)Plugins/OnnxRuntime/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DistOnnx->'%(FullPath)')" DestinationFiles="@(_DistOnnx->'$(DistDir)/Plugins/OnnxRuntime/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- bin/SherpaServer/** -->
<ItemGroup>
<_DistSherpa Include="$(OutputPath)bin/SherpaServer/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DistSherpa->'%(FullPath)')" DestinationFiles="@(_DistSherpa->'$(DistDir)/bin/SherpaServer/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- bin/SupertonicServer/** -->
<ItemGroup>
<_DistSuper Include="$(OutputPath)bin/SupertonicServer/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DistSuper->'%(FullPath)')" DestinationFiles="@(_DistSuper->'$(DistDir)/bin/SupertonicServer/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- bin/LlamaServer/** -->
<ItemGroup>
<_DistLlama Include="$(OutputPath)bin/LlamaServer/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DistLlama->'%(FullPath)')" DestinationFiles="@(_DistLlama->'$(DistDir)/bin/LlamaServer/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- bin/WhisperServer/** -->
<ItemGroup>
<_DistWhisper Include="$(OutputPath)bin/WhisperServer/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DistWhisper->'%(FullPath)')" DestinationFiles="@(_DistWhisper->'$(DistDir)/bin/WhisperServer/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- (c) Resources: multi-GB models NOT copied, write README instead -->
<ItemGroup>
<_ReadmeLine Include="# Model Resources" />
<_ReadmeLine Include="#" />
<_ReadmeLine Include="These model files are not included in the build output." />
<_ReadmeLine Include="Copy them from your local model cache into this directory:" />
<_ReadmeLine Include="#" />
<_ReadmeLine Include="## Resources/KokoroSherpa/ (TTS)" />
<_ReadmeLine Include="# model.onnx - Kokoro-82M-v1.0 multi-language TTS (~325MB)" />
<_ReadmeLine Include="# voices.bin - Voice speaker embeddings (~26MB)" />
<_ReadmeLine Include="# tokens.txt - Token vocabulary" />
<_ReadmeLine Include="# lexicon-us-en.txt, lexicon-gb-en.txt, lexicon-zh.txt" />
<_ReadmeLine Include="# dict/ - Japanese phonemizer data" />
<_ReadmeLine Include="# espeak-ng-data/ - eSpeak NG data" />
<_ReadmeLine Include="#" />
<_ReadmeLine Include="## Resources/WakeWord/models/ (wake-word detection)" />
<_ReadmeLine Include="# embedding_model.onnx - Embedding extractor" />
<_ReadmeLine Include="# hey_marvin_v0.1.onnx - "Hey Marvin" wake word model" />
<_ReadmeLine Include="# melspectrogram.onnx - Mel spectrogram preprocessor" />
<_ReadmeLine Include="#" />
<_ReadmeLine Include="## Resources/Models/Llama/ (LLM)" />
<_ReadmeLine Include="# Llama-3.2-3B-Instruct-IQ4_NL.gguf - GGUF chat model (~1.8GB)" />
<_ReadmeLine Include="#" />
<_ReadmeLine Include="## Resources/Models/Embed/ (RAG embeddings)" />
<_ReadmeLine Include="# nomic-embed-text-v1.5.Q8_0.gguf - GGUF embedding model (~139MB)" />
</ItemGroup>
<WriteLinesToFile File="$(DistDir)/Resources/README.txt" Lines="@(_ReadmeLine)" Overwrite="true" />
<Message Text="dist/ assembled complete." Importance="high" />
</Target>
<!--
================================================================
DEDICATED SERVER BUILD — DediBuild=true
Produces dist-dedi/ (~6MB) — mod logic only, NO AI sidecars.
Every client does its own STT/LLM/TTS locally and relays audio
via NetPackageNPCVoice. The dedi runs phrase triggers, actions,
UAI, and audio relay.
================================================================
-->
<!-- Assemble dist-dedi/ — allowlist only, nothing sneaks in -->
<Target Name="AssembleDistDedi" AfterTargets="CopyToModFolder" Condition="'$(DediBuild)' == 'true'">
<PropertyGroup>
<DediDistDir>$(MSBuildProjectDirectory)/../dist-dedi</DediDistDir>
</PropertyGroup>
<Message Text="=== Assembling dist-dedi/ (dedicated server) ===" Importance="high" />
<!-- Wipe + recreate -->
<RemoveDir Directories="$(DediDistDir)" ContinueOnError="true" />
<MakeDir Directories="$(DediDistDir)/Config" />
<!--
ALLOWLIST — copy exactly these files, nothing globbed.
Config/XUi_InGame/ IS INCLUDED — do not "optimise" it out again.
It was excluded in the first dedi build on the reasoning that XUi is client-only.
That is WRONG: a client joining the dedi rebuilds XUi against the SERVER's mod
config, so with these files absent server-side the client throws
"Window 'NPCSubtitlesGroup' unknown" on every subtitle show/clear and all NPC
subtitles are dead — even though the client has the files locally.
Verified on a real dedi 2026-07-26.
Deliberately EXCLUDED (not an oversight):
- bin/** : all four sidecars; none start on dedi
(NPCVoiceControlMod.cs guards all server starts with
!GameManager.IsDedicatedServer)
- Resources/** : all models; every AI stage (STT/LLM/TTS/embeddings)
runs on the client. NPC_Voices excluded safe —
VoiceClipLibrary.cs:60 skips a missing directory.
- Plugins/OnnxRuntime/ : native ONNX, used only by the client-side wake word.
NOTE: the MANAGED Microsoft.ML.OnnxRuntime.dll IS shipped
on purpose — a stray type reference can trigger an
assembly load, and 2.7MB is cheaper than debugging that.
- ServerConfig.xml / SupertonicConfig.xml are read only by sidecar binaries that
never start here. They are kept anyway (8KB) so their absence cannot produce
confusing config warnings.
-->
<!-- (a) Managed DLLs from build output -->
<ItemGroup>
<_DediDlls Include="$(OutputPath)1-XNPCVoiceControl.dll" />
<_DediDlls Include="$(OutputPath)Microsoft.ML.OnnxRuntime.dll" />
<_DediDlls Include="$(OutputPath)System.Buffers.dll" />
<_DediDlls Include="$(OutputPath)System.Memory.dll" />
<_DediDlls Include="$(OutputPath)System.Numerics.Vectors.dll" />
<_DediDlls Include="$(OutputPath)System.Runtime.CompilerServices.Unsafe.dll" />
</ItemGroup>
<Copy SourceFiles="@(_DediDlls)" DestinationFolder="$(DediDistDir)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- (b) ModInfo.xml -->
<Copy SourceFiles="$(MSBuildProjectDirectory)/ModInfo.xml" DestinationFolder="$(DediDistDir)" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- (c) Config allowlist (10 files) -->
<ItemGroup>
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/modconfig.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/ServerConfig.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/SupertonicConfig.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/personalities.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/phrasetriggers.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/utilityai.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/buffs.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/entityclasses.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/dialogs.xml" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/Localization.csv" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/ReadMeFirst.md" />
<_DediConfig Include="$(MSBuildProjectDirectory)/Config/voice-command-card.html" />
</ItemGroup>
<Copy SourceFiles="@(_DediConfig)" DestinationFolder="$(DediDistDir)/Config" SkipUnchangedFiles="true" ContinueOnError="true" />
<!-- (d) Config/XUi_InGame — REQUIRED on dedi. See the note above: the client
rebuilds XUi against the server's mod config, so omitting these kills
NPC subtitles for every connected client. -->
<MakeDir Directories="$(DediDistDir)/Config/XUi_InGame" />
<ItemGroup>
<_DediXUi Include="$(MSBuildProjectDirectory)/Config/XUi_InGame/windows.xml" />
<_DediXUi Include="$(MSBuildProjectDirectory)/Config/XUi_InGame/xui.xml" />
</ItemGroup>
<Copy SourceFiles="@(_DediXUi)" DestinationFolder="$(DediDistDir)/Config/XUi_InGame" SkipUnchangedFiles="true" ContinueOnError="true" />
<Message Text="dist-dedi/ assembled complete." Importance="high" />
</Target>
<!-- Validate dist-dedi/: presence of allowlist files + absence of forbidden dirs -->
<Target Name="ValidateDistDedi" AfterTargets="AssembleDistDedi" Condition="'$(DediBuild)' == 'true'">
<Message Text="=== Validating dist-dedi/ ===" Importance="high" />
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(ToolsDir)/Validate-DistDedi.ps1" -DistDir "$(MSBuildProjectDirectory)/../dist-dedi"">
<Output TaskParameter="ExitCode" PropertyName="DediValidationExitCode" />
</Exec>
<Error Condition="'$(DediValidationExitCode)' != '0' AND '$(DediValidationExitCode)' != ''" Text="dist-dedi/ validation failed! Check output above." />
</Target>
<!-- Deploy dist-dedi/ to dedi server mods folder (overlay, no deletes) -->
<!-- DependsOnTargets (not just AfterTargets) so validation is GUARANTEED to run before
we deploy. Both targets hook AfterTargets="AssembleDistDedi", and MSBuild would
otherwise order them by declaration position alone — a reorder could silently
deploy an unvalidated package. -->
<Target Name="DeployToDedi" AfterTargets="AssembleDistDedi" DependsOnTargets="ValidateDistDedi" Condition="'$(DeployToDedi)' == 'true'">
<PropertyGroup>
<DediModsFolder Condition="'$(DediModsFolder)' == ''">Q:\SteamCMD\a3_0\Mods\1-XNPCVoiceControl</DediModsFolder>
</PropertyGroup>
<Message Text="=== Deploying dist-dedi/ to $(DediModsFolder) ===" Importance="high" />
<MakeDir Directories="$(DediModsFolder)" />
<!-- Overlay-copy everything from dist-dedi/ into dedi Mods folder; SkipUnchangedFiles=true, NO delete -->
<ItemGroup>
<_DediDeployAll Include="$(MSBuildProjectDirectory)/../dist-dedi/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DediDeployAll->'%(FullPath)')" DestinationFiles="@(_DediDeployAll->'$(DediModsFolder)/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<Message Text="Dedi deploy complete (overlay from dist-dedi/, no deletes)." Importance="high" />
</Target>
<!-- Optional: Auto-deploy to game mods folder (overlay dist/ into live Mods, never delete) -->
<Target Name="DeployToGame" AfterTargets="AssembleDist" Condition="'$(DeployToGame)' == 'true'">
<PropertyGroup>
<ModsFolder>$(GamePath)/Mods/1-XNPCVoiceControl</ModsFolder>
</PropertyGroup>
<Message Text="=== Deploying dist/ to $(ModsFolder) ===" Importance="high" />
<MakeDir Directories="$(ModsFolder)" />
<!-- Overlay-copy everything from dist/ into live Mods folder; SkipUnchangedFiles=true, NO delete -->
<!-- Exclude Resources/ — models are managed separately, README leaks next to real files -->
<ItemGroup>
<_DeployAll Include="$(MSBuildProjectDirectory)/../dist/**/*" />
<_DeployAll Remove="$(MSBuildProjectDirectory)/../dist/Resources/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_DeployAll->'%(FullPath)')" DestinationFiles="@(_DeployAll->'$(ModsFolder)/%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" ContinueOnError="true" />
<Message Text="Deploy complete (overlay from dist/, no deletes)." Importance="high" />
</Target>
<!-- Validate deploy folder matches dist/ exactly (SP/listen-host) -->
<Target Name="ValidateDeploy" AfterTargets="DeployToGame" Condition="'$(DeployToGame)' == 'true'">
<PropertyGroup>
<ModsFolderForValidate>$(GamePath)/Mods/1-XNPCVoiceControl</ModsFolderForValidate>
</PropertyGroup>
<Message Text="=== Validating deploy (SP) ===" Importance="high" />
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(ToolsDir)/Validate-Deploy.ps1" -DistDir "$(MSBuildProjectDirectory)/../dist" -DeployDir "$(ModsFolderForValidate)"">
<Output TaskParameter="ExitCode" PropertyName="DeployValidationExitCode" />
</Exec>
<Error Condition="'$(DeployValidationExitCode)' != '0' AND '$(DeployValidationExitCode)' != ''" Text="Deploy validation failed (SP)! Check output above." />
</Target>
<!-- Validate deploy folder matches dist-dedi/ exactly (dedicated server) -->
<Target Name="ValidateDeployDedi" AfterTargets="DeployToDedi" Condition="'$(DeployToDedi)' == 'true'">
<PropertyGroup>
<DediModsFolderForValidate>$(DediModsFolder)</DediModsFolderForValidate>
</PropertyGroup>
<Message Text="=== Validating deploy (dedi) ===" Importance="high" />
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(ToolsDir)/Validate-Deploy.ps1" -DistDir "$(MSBuildProjectDirectory)/../dist-dedi" -DeployDir "$(DediModsFolderForValidate)"">
<Output TaskParameter="ExitCode" PropertyName="DediDeployValidationExitCode" />
</Exec>
<Error Condition="'$(DediDeployValidationExitCode)' != '0' AND '$(DediDeployValidationExitCode)' != ''" Text="Deploy validation failed (dedi)! Check output above." />
</Target>
<!--
================================================================
RELEASE PREP — ReleasePrep=true (OPT-IN, NOT part of normal deploy)
Deletes runtime artifacts from BOTH deploy folders so the zip
does not include sidecar stdout logs or debug pdbs.
Warns on NPC_Memories files (never deletes them).
Prints READY TO ZIP summary. Verifies cleanup by re-scanning.
================================================================
-->
<Target Name="ReleasePrep" AfterTargets="DeployToGame;DeployToDedi" Condition="'$(ReleasePrep)' == 'true'">
<PropertyGroup>
<SpDeployPath Condition="'$(SpDeployPath)' == ''">$(GamePath)/Mods/1-XNPCVoiceControl</SpDeployPath>
<DediDeployPath Condition="'$(DediDeployPath)' == ''">Q:\SteamCMD\a3_0\Mods\1-XNPCVoiceControl</DediDeployPath>
</PropertyGroup>
<Message Text="=== Release prep (opt-in) ===" Importance="high" />
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File "$(ToolsDir)/Release-Prep.ps1" -SpPath "$(SpDeployPath)" -DediPath "$(DediDeployPath)"">
<Output TaskParameter="ExitCode" PropertyName="ReleasePrepExitCode" />
</Exec>
<Error Condition="'$(ReleasePrepExitCode)' != '0' AND '$(ReleasePrepExitCode)' != ''" Text="Release prep failed! Check output above." />
</Target>
</Project>