-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update build to load from NuGet and update theoretical max amounts to consider Proliferator Points #125
Open
mattsemar
wants to merge
16
commits into
DysonSphereMod:master
Choose a base branch
from
mattsemar:features/updateBuild
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update build to load from NuGet and update theoretical max amounts to consider Proliferator Points #125
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
67f739b
Update BetterStats build to load dependencies from NuGet and not requ…
mattsemar 7d167cd
Fix theoretical max production for advanced miners
mattsemar 07ccaee
Add adjustment for assemblers that have the speed toggle enabled
mattsemar 6da0bf4
Add adjustment for assemblers with Extra Products toggled
mattsemar 5c5bd93
Update lab theoretical max calculations to incorporate speed into equ…
mattsemar 4da7f8a
Update max speed calculations for labs and assemblers to use highest …
mattsemar 70932ba
Update to apply productivity bonus only to production
mattsemar 2509e7d
revert change to base assembler speed calculation
mattsemar c10a8f8
Fix universe matrix max consumption calculation.
mattsemar 7928dbe
First pass on buttons added to control the different calculation modes
mattsemar 9880e0c
Fixed items allowing force productivity mode
mattsemar e4c756e
Hide proliferator UI elements when spray is not unlocked
mattsemar 33ac3f9
Fix issue with package script where it would hang after completion
mattsemar 94abab4
Add config to disable proliferator point calculation
mattsemar bb8ea4d
Add max consumption for the sprays themselves
mattsemar 9a3dd26
Fix handling of recipes/items added after startup. Fix detection of n…
mattsemar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,12 @@ | |
!.editorconfig | ||
!.gitignore | ||
!*.md | ||
!*.ps1 | ||
!*.psm1 | ||
!NuGet.Config | ||
|
||
bin/ | ||
obj/ | ||
tmp_release | ||
.idea | ||
.vs |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{F415C8D1-768D-407C-86AE-4D2EEAC179F1}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>DSM.BetterStats</RootNamespace> | ||
<AssemblyName>BetterStats</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
<PublishUrl>publish\</PublishUrl> | ||
<Install>true</Install> | ||
<InstallFrom>Disk</InstallFrom> | ||
<UpdateEnabled>false</UpdateEnabled> | ||
<UpdateMode>Foreground</UpdateMode> | ||
<UpdateInterval>7</UpdateInterval> | ||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> | ||
<UpdatePeriodically>false</UpdatePeriodically> | ||
<UpdateRequired>false</UpdateRequired> | ||
<MapFileExtensions>true</MapFileExtensions> | ||
<ApplicationRevision>0</ApplicationRevision> | ||
<ApplicationVersion>1.2.0</ApplicationVersion> | ||
<IsWebBootstrapper>false</IsWebBootstrapper> | ||
<UseApplicationTrust>false</UseApplicationTrust> | ||
<BootstrapperEnabled>true</BootstrapperEnabled> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<StartupObject /> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BetterStats.cs" /> | ||
<Compile Include="ACPublic.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<BootstrapperPackage Include=".NETFramework,Version=v4.8"> | ||
<Visible>False</Visible> | ||
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName> | ||
<Install>true</Install> | ||
</BootstrapperPackage> | ||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> | ||
<Visible>False</Visible> | ||
<ProductName>.NET Framework 3.5 SP1</ProductName> | ||
<Install>false</Install> | ||
</BootstrapperPackage> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\core\0Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp_publicized, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath> | ||
</Reference> | ||
<Reference Include="BepInEx"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\core\BepInEx.dll</HintPath> | ||
</Reference> | ||
<Reference Include="BepInEx.Harmony"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\core\BepInEx.Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Mono.Cecil"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\core\Mono.Cecil.dll</HintPath> | ||
</Reference> | ||
<Reference Include="netstandard"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\netstandard.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\DowngradedAssemblies\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.JSONSerializeModule"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TextRenderingModule"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIModule"> | ||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed\UnityEngine.UIModule.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent>copy $(TargetPath) "C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\scripts\$(TargetFileName)"</PostBuildEvent> | ||
</PropertyGroup> | ||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Description>Add more information to the production stats panel</Description> | ||
<AssemblyName>BetterStats</AssemblyName> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Version>1.3.3</Version> | ||
<LangVersion>9</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" /> | ||
<PackageReference Include="BepInEx.Core" Version="5.*" /> | ||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> | ||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-*" /> | ||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'"> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<!-- <Exec Command="COPY $(TargetPath) 'C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\scripts\'" />--> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using BepInEx; | ||
using BepInEx.Configuration; | ||
using UnityEngine; | ||
using static BetterStats.BetterStats; | ||
|
||
namespace BetterStats | ||
{ | ||
public enum ItemCalculationMode | ||
{ | ||
None, | ||
Normal, | ||
ForceSpeed, | ||
ForceProductivity | ||
} | ||
|
||
/// <summary> | ||
/// Manages currently selected proliferator calculation options for each item | ||
/// </summary> | ||
public class ItemCalculationRuntimeSetting | ||
{ | ||
public static readonly ItemCalculationRuntimeSetting None = new(0) | ||
{ | ||
_enabled = false, | ||
_mode = ItemCalculationMode.None, | ||
}; | ||
private ItemCalculationMode _mode = ItemCalculationMode.Normal; | ||
private bool _enabled; | ||
|
||
public readonly int productId; | ||
|
||
private ConfigEntry<string> _configEntry; | ||
private static readonly Dictionary<int, ConfigEntry<string>> ConfigEntries = new(); | ||
private static readonly Dictionary<int, ItemCalculationRuntimeSetting> Pool = new(); | ||
private static ConfigFile configFile; | ||
private readonly ItemProto _itemProto; | ||
private ItemCalculationRuntimeSetting(int productId) | ||
{ | ||
this.productId = productId; | ||
var proto = LDB.items.Select(productId); | ||
if (proto != null) | ||
{ | ||
_itemProto = proto; | ||
} | ||
} | ||
|
||
public ItemCalculationMode Mode | ||
{ | ||
get => _mode; | ||
set | ||
{ | ||
_mode = value; | ||
Pool[productId]._mode = value; | ||
Save(); | ||
} | ||
} | ||
|
||
public bool Enabled | ||
{ | ||
get => _enabled; | ||
set | ||
{ | ||
_enabled = value; | ||
Pool[productId]._enabled = value; | ||
Save(); | ||
} | ||
} | ||
|
||
public bool SpeedSupported => _itemProto is { recipes: { Count: > 0 } }; | ||
|
||
public bool ProductivitySupported | ||
{ | ||
get { return SpeedSupported && _itemProto.recipes.Any(r => r.productive); } | ||
} | ||
|
||
private void Save() | ||
{ | ||
_configEntry.Value = Serialize(); | ||
Log.LogDebug($"saved {productId} entry {_configEntry.Value}"); | ||
} | ||
|
||
private static ItemCalculationRuntimeSetting Deserialize(string strVal) | ||
{ | ||
var serializableRuntimeState = JsonUtility.FromJson<SerializableRuntimeState>(strVal); | ||
|
||
return new ItemCalculationRuntimeSetting(serializableRuntimeState.productId) | ||
{ | ||
_enabled = serializableRuntimeState.enabled, | ||
_mode = (ItemCalculationMode)serializableRuntimeState.mode, | ||
}; | ||
} | ||
|
||
private string Serialize() | ||
{ | ||
return JsonUtility.ToJson(SerializableRuntimeState.From(this)); | ||
} | ||
|
||
public static void InitConfig() | ||
{ | ||
configFile = new ConfigFile($"{Paths.ConfigPath}/{PluginInfo.PLUGIN_NAME}/CustomProductSettings.cfg", true); | ||
|
||
foreach (var itemProto in LDB.items.dataArray) | ||
{ | ||
var defaultValue = new ItemCalculationRuntimeSetting(itemProto.ID) | ||
{ | ||
_enabled = true, | ||
_mode = ItemCalculationMode.Normal | ||
}; | ||
|
||
var configEntry = configFile.Bind("Internal", $"ProliferatorStatsSetting_{itemProto.ID}", | ||
defaultValue.Serialize(), | ||
"For internal use only"); | ||
ConfigEntries[itemProto.ID] = configEntry; | ||
|
||
Pool[itemProto.ID] = Deserialize(ConfigEntries[itemProto.ID].Value); | ||
Pool[itemProto.ID]._configEntry = configEntry; | ||
} | ||
} | ||
|
||
public static ItemCalculationRuntimeSetting ForItemId(int itemId) | ||
{ | ||
if (disableProliferatorCalc.Value) | ||
return None; | ||
if (Pool.ContainsKey(itemId)) | ||
return Pool[itemId]; | ||
|
||
var defaultValue = new ItemCalculationRuntimeSetting(itemId) | ||
{ | ||
_enabled = true, | ||
_mode = ItemCalculationMode.Normal | ||
}; | ||
|
||
var configEntry = configFile.Bind("Internal", $"ProliferatorStatsSetting_{itemId}", | ||
defaultValue.Serialize(), | ||
"For internal use only"); | ||
ConfigEntries[itemId] = configEntry; | ||
|
||
Pool[itemId] = Deserialize(ConfigEntries[itemId].Value); | ||
Pool[itemId]._configEntry = configEntry; | ||
return Pool[itemId]; | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class SerializableRuntimeState | ||
{ | ||
[SerializeField] public int mode; | ||
[SerializeField] public bool enabled; | ||
[SerializeField] public int productId; | ||
|
||
public SerializableRuntimeState(int productId, bool enabled, ItemCalculationMode mode) | ||
{ | ||
this.productId = productId; | ||
this.enabled = enabled; | ||
this.mode = (int)mode; | ||
} | ||
|
||
public static SerializableRuntimeState From(ItemCalculationRuntimeSetting setting) | ||
{ | ||
return new SerializableRuntimeState(setting.productId, setting.Enabled, setting.Mode); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" /> | ||
</packageSources> | ||
</configuration> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package creates a temporary PluginInfo file with the plugin version coming from the csproj file and that can be referenced from the Plugin code.
https://github.com/BepInEx/BepInEx.Templates/tree/master/BepInEx.PluginInfoProps