forked from OrekiWoof/ChestPreview
support: vscode + VINTAGESTORY_DATA env + optional ConfigLib with warning (#1)
Co-authored-by: HoutarouOreki <thezjarek@gmail.com> Co-committed-by: HoutarouOreki <thezjarek@gmail.com>
This commit is contained in:
12
.timetracker
12
.timetracker
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"total": 51853,
|
||||
"total": 56092,
|
||||
"sessions": [
|
||||
{
|
||||
"begin": "2026-03-11T23:50:47+01:00",
|
||||
@@ -10,6 +10,16 @@
|
||||
"begin": "2026-03-12T17:18:14+01:00",
|
||||
"end": "2026-03-12T22:08:00+01:00",
|
||||
"duration": 17386
|
||||
},
|
||||
{
|
||||
"begin": "2026-03-14T13:19:51+01:00",
|
||||
"end": "2026-03-14T13:47:21+01:00",
|
||||
"duration": 1650
|
||||
},
|
||||
{
|
||||
"begin": "2026-03-14T16:53:26+01:00",
|
||||
"end": "2026-03-14T17:36:35+01:00",
|
||||
"duration": 2589
|
||||
}
|
||||
]
|
||||
}
|
||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Vintage Story Client",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build mod",
|
||||
"program": "${env:VINTAGE_STORY}/Vintagestory.dll",
|
||||
"args": [
|
||||
"--tracelog",
|
||||
"--dataPath",
|
||||
"${env:VINTAGE_STORY_DATA}",
|
||||
"--addModPath",
|
||||
"${workspaceFolder}/ChestPreview/ChestPreview/bin/Debug/Mods",
|
||||
"--addOrigin",
|
||||
"${workspaceFolder}/ChestPreview/ChestPreview/assets"
|
||||
],
|
||||
"cwd": "${env:VINTAGE_STORY}",
|
||||
"console": "integratedTerminal",
|
||||
"stopAtEntry": false
|
||||
}
|
||||
]
|
||||
}
|
||||
35
.vscode/tasks.json
vendored
Normal file
35
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "check env",
|
||||
"type": "shell",
|
||||
"command": "[ -n \"$VINTAGE_STORY\" ] || { echo 'ERROR: VINTAGE_STORY is not set'; exit 1; }; [ -n \"$VINTAGE_STORY_DATA\" ] || { echo 'ERROR: VINTAGE_STORY_DATA is not set'; exit 1; }",
|
||||
"windows": {
|
||||
"command": "if (-not $env:VINTAGE_STORY) { Write-Host 'ERROR: VINTAGE_STORY is not set'; exit 1 }; if (-not $env:VINTAGE_STORY_DATA) { Write-Host 'ERROR: VINTAGE_STORY_DATA is not set'; exit 1 }"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "build mod",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"dependsOn": ["check env"],
|
||||
"dependsOrder": "sequence",
|
||||
"options": {
|
||||
"env": {
|
||||
"VINTAGE_STORY": "${env:VINTAGE_STORY}"
|
||||
}
|
||||
},
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/ChestPreview/ChestPreview/ChestPreview.csproj",
|
||||
"-c",
|
||||
"Debug",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,6 +7,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;Version22</Configurations>
|
||||
<VintageStoryDataPathArgs></VintageStoryDataPathArgs>
|
||||
<VS_CONFIGLIB Condition="'$(VS_CONFIGLIB)' == ''">$([System.Environment]::GetEnvironmentVariable('VS_CONFIGLIB'))</VS_CONFIGLIB>
|
||||
<ConfigLibAvailable Condition="'$(VS_CONFIGLIB)' != '' and Exists('$(VS_CONFIGLIB)')">true</ConfigLibAvailable>
|
||||
<DefineConstants Condition="'$(ConfigLibAvailable)' == 'true'">$(DefineConstants);CONFIGLIB</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Version22'">
|
||||
@@ -59,12 +62,16 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="configlib">
|
||||
<HintPath>E:\Code\VintageStory\configlib_1.10.14\configlib.dll</HintPath>
|
||||
<Reference Include="configlib" Condition="'$(ConfigLibAvailable)' == 'true'">
|
||||
<HintPath>$(VS_CONFIGLIB)</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="WarnWithoutConfigLib" BeforeTargets="CoreCompile" Condition="'$(ConfigLibAvailable)' != 'true'">
|
||||
<Warning Text="No VS_CONFIGLIB - will compile without supporting ConfigLib. Set VS_CONFIGLIB env var to a path that contains the configlib's dlls." />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="modinfo.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using ChestPreview.Core;
|
||||
using ConfigLib;
|
||||
using System;
|
||||
using Vintagestory.API.Client;
|
||||
|
||||
#if CONFIGLIB
|
||||
using ChestPreview.Core;
|
||||
using ConfigLib;
|
||||
#endif
|
||||
|
||||
namespace ChestPreview.Configs;
|
||||
|
||||
#if CONFIGLIB
|
||||
internal class ConfigLibBridge(Config config) : IDisposable
|
||||
{
|
||||
public const string CONFIGLIB_MODID = "configlib";
|
||||
@@ -48,3 +52,13 @@ internal class ConfigLibBridge(Config config) : IDisposable
|
||||
settingObject.AssignSettingValue(config);
|
||||
}
|
||||
}
|
||||
#else
|
||||
internal class ConfigLibBridge : IDisposable
|
||||
{
|
||||
public const string CONFIGLIB_MODID = "configlib";
|
||||
|
||||
public static ConfigLibBridge? TryCreate(ICoreClientAPI api, Config config) => null;
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user