Port to C# dotNET 4.7.2, impl OnlyNegative responses

main
Tulpen 2023-07-02 17:24:35 +02:00
parent 2dfb600b57
commit 3de50b63b0
No known key found for this signature in database
GPG Key ID: 12294D73B907E784
4 changed files with 30 additions and 10 deletions

View File

@ -11,4 +11,4 @@ Anything in `{arguments}` depends on the command being used.<br>
Place `UltraShellMommy.dll` in the `BepInEx/plugins` folder in your ULTRAKILL installation folder.
# Building
Create a file called UltraShellMommy.csproj.user and fill in the data from the template then place it next to UltraShellMommy.<br>
Then, run `dotnet build` in the directory with UltraShellMommy.csproj.
Then, run `msbuild` in the directory with UltraShellMommy.csproj (note: official builds use mono-msbuild).

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<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>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>v4.7.2</TargetFramework>
<RootNamespace>UltraShellMommy</RootNamespace>
<AssemblyName>UltraShellMommy</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
@ -74,7 +74,7 @@
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>$(ULTRAKILLPath)\ULTRAKILL_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
</Reference>
<Reference Include="UnityEngine.Addressables">
<HintPath>$(ULTRAKILLPath)\ULTRAKILL_Data\Managed\Unity.Addressables.dll</HintPath>
</Reference>
@ -93,6 +93,11 @@
<Reference Include="NewtonsoftJson">
<HintPath>$(ULTRAKILLPath)\ULTRAKILL_Data\Managed\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(ManagedDir)\netstandard.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<PropertyGroup>
<ManagedDir>$(ULTRAKILLPath)\ULTRAKILL_Data\Managed\</ManagedDir>
@ -105,8 +110,13 @@
<ModDlls Include="$(OutDir)/$(AssemblyName).dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="src/plugin.cs" />
<Compile Include="src/commands/mommy.cs" />
</ItemGroup>
<Target Name="WarnBeforeBuild" BeforeTargets="BeforeBuild">
<Error Condition="!Exists($(ULTRAKILLPath))" Text="ULTRAKILLPath not set, create a ultrashell-mommy.csproj.user file that sets this property to compile" />
<Error Condition="!Exists($(ULTRAKILLPath))" Text="ULTRAKILLPath not set, create a UltraShellMommy.csproj.user file that sets this property to compile" />
</Target>
<Target Name="CopyModDlls" AfterTargets="AfterBuild">
@ -116,4 +126,5 @@
<ItemGroup>
<None Include="LICENSE" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
using GameConsole;
using System;
using System.Collections.Generic;
using System.Linq;
namespace UltraShellMommy {
public class ShellMommy : ICommand {
@ -41,7 +43,7 @@ namespace UltraShellMommy {
cmd.Execute(con, newArgs.ToArray<string>());
DoResponse(con, true);
} else {
UnityEngine.Debug.LogWarning("Unrecognized command: \"CMD\"".Replace("CMD", args[0]));
UnityEngine.Debug.LogWarning("Unrecognized command: '%CMD'".Replace("%CMD", args[0]));
DoResponse(con, false);
}
}
@ -57,7 +59,7 @@ namespace UltraShellMommy {
string mommyRole = _mommy.MommysRole[random.Next(_mommy.MommysRole.Length)];
string response;
if (isPositive) response = _mommy.MommyPositiveResponses[random.Next(_mommy.MommyPositiveResponses.Length)];
if (isPositive && !_mommy.MommyOnlyNegative) response = _mommy.MommyPositiveResponses[random.Next(_mommy.MommyPositiveResponses.Length)];
else response = _mommy.MommyNegativeResponses[random.Next(_mommy.MommyNegativeResponses.Length)];
// Replace text in the response
@ -65,7 +67,7 @@ namespace UltraShellMommy {
response = response.Replace("MOMMYS_PRONOUN", mommyPronoun);
response = response.Replace("MOMMYS_ROLE", mommyRole);
if (isPositive) con.PrintLine(response);
if (isPositive && !_mommy.MommyOnlyNegative) con.PrintLine(response);
else UnityEngine.Debug.LogWarning(response);
}

View File

@ -24,6 +24,8 @@ using System.Collections;
using GameConsole;
using BepInEx.Configuration;
using System.Collections.Generic;
namespace UltraShellMommy {
[BepInPlugin("UltraShellMommy", "Ultra Shell Mommy", "1.0.0")]
[BepInProcess("ULTRAKILL.exe")]
@ -35,10 +37,12 @@ namespace UltraShellMommy {
private ConfigEntry<String> CfgMommysPronouns;
private ConfigEntry<String> CfgMommysPositiveResponses;
private ConfigEntry<String> CfgMommysNegativeResponses;
private ConfigEntry<Boolean> CfgMommyOnlyNegative;
public String[] MommysLittle;
public String[] MommysRole;
public String[] MommysPronouns;
public Boolean MommyOnlyNegative;
public String[] MommyPositiveResponses;
public String[] MommyNegativeResponses;
@ -57,6 +61,8 @@ namespace UltraShellMommy {
CfgMommysRole = Config.Bind("Mommy", "MommysRole", "mommy",
"Sets the role that mommy will have.");
CfgMommyOnlyNegative = Config.Bind("Mommy", "MommyOnlyNegative", false, "If set to true, mommy will provide encouragement (on non-fail status) but not praise.");
CfgMommysPositiveResponses = Config.Bind("Mommy", "MommysPositiveResponses", "*pets your head*/awe, what a good AFFECTIONATE_TERM~\nMOMMYS_ROLE knew you could do it~ ❤️/good AFFECTIONATE_TERM~\nMOMMYS_ROLE's so proud of you~ ❤️/Keep up the good work, my love~ ❤️/MOMMYS_ROLE is proud of the progress you've made~ ❤️/MOMMYS_ROLE is so grateful to have you as MOMMYS_PRONOUN little AFFECTIONATE_TERM~ ❤️/I'm so proud of you, my love~ ❤️/MOMMYS_ROLE is so proud of you~ ❤️/MOMMYS_ROLE loves seeing MOMMYS_PRONOUN little AFFECTIONATE_TERM succeed~ ❤️/MOMMYS_ROLE thinks MOMMYS_PRONOUN little AFFECTIONATE_TERM earned a big hug~ ❤️/that's a good AFFECTIONATE_TERM~ ❤️/you did an amazing job, my dear~ ❤️/you're such a smart cookie~ ❤️",
"Sets the possible negative responses that mommy will use. ");
@ -67,6 +73,7 @@ namespace UltraShellMommy {
MommysLittle = CfgMommysLittle.Value.Split('/');
MommysPronouns = CfgMommysPronouns.Value.Split('/');
MommysRole = CfgMommysRole.Value.Split('/');
MommyOnlyNegative = CfgMommyOnlyNegative.Value;
MommyPositiveResponses = CfgMommysPositiveResponses.Value.Split('/');
MommyNegativeResponses = CfgMommysNegativeResponses.Value.Split('/');