c# rewrite
This commit is contained in:
parent
2e21724572
commit
80e1d9666d
|
@ -0,0 +1,7 @@
|
|||
.idea/
|
||||
.vs/
|
||||
*.user
|
||||
/local
|
||||
|
||||
bin/
|
||||
obj/
|
Binary file not shown.
Before Width: | Height: | Size: 94 KiB |
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoppingBottles", "PoppingBottles\PoppingBottles.csproj", "{1A273855-C2D0-40BB-B22C-CE17AA4D0A9B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1A273855-C2D0-40BB-B22C-CE17AA4D0A9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1A273855-C2D0-40BB-B22C-CE17AA4D0A9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1A273855-C2D0-40BB-B22C-CE17AA4D0A9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1A273855-C2D0-40BB-B22C-CE17AA4D0A9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,7 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace PoppingBottles;
|
||||
|
||||
public class Config {
|
||||
[JsonInclude] public bool SomeSetting = true;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
using GDWeave;
|
||||
using GDWeave.Godot;
|
||||
using GDWeave.Godot.Variants;
|
||||
using GDWeave.Modding;
|
||||
|
||||
namespace PoppingBottles;
|
||||
|
||||
public class Mod : IMod {
|
||||
public Config Config;
|
||||
|
||||
public Mod(IModInterface modInterface) {
|
||||
this.Config = modInterface.ReadConfig<Config>();
|
||||
modInterface.Logger.Information("Loaded PoppingBottles!");
|
||||
|
||||
modInterface.RegisterScriptMod(new Patch());
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
// Cleanup anything you do here
|
||||
}
|
||||
}
|
||||
|
||||
public class Patch : IScriptMod
|
||||
{
|
||||
public bool ShouldRun(string path) => path == "res://Scenes/Entities/Player/player.gdc";
|
||||
|
||||
public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
|
||||
{
|
||||
var functionWaiter = new FunctionWaiter("_consume_item");
|
||||
|
||||
var growthWaiter = new MultiTokenWaiter([
|
||||
t => t is ConstantToken { Value: StringVariant { Value: "growth" } },
|
||||
t => t.Type is TokenType.Colon,
|
||||
t => t is IdentifierToken { Name: "player_scale" },
|
||||
t => t.Type is TokenType.OpAssign,
|
||||
t => t.Type is TokenType.BuiltInFunc,
|
||||
t => t.Type is TokenType.ParenthesisOpen,
|
||||
t => t is IdentifierToken { Name: "player_scale" },
|
||||
t => t.Type is TokenType.OpAdd,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 0.1 } },
|
||||
t => t.Type is TokenType.Comma,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 0.7 } },
|
||||
t => t.Type is TokenType.Comma,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 1.3 } },
|
||||
], true, true);
|
||||
|
||||
var shrinkWaiter = new MultiTokenWaiter([
|
||||
t => t is ConstantToken { Value: StringVariant { Value: "shrink" } },
|
||||
t => t.Type is TokenType.Colon,
|
||||
t => t is IdentifierToken { Name: "player_scale" },
|
||||
t => t.Type is TokenType.OpAssign,
|
||||
t => t.Type is TokenType.BuiltInFunc,
|
||||
t => t.Type is TokenType.ParenthesisOpen,
|
||||
t => t is IdentifierToken { Name: "player_scale" },
|
||||
t => t.Type is TokenType.OpSub,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 0.1 } },
|
||||
t => t.Type is TokenType.Comma,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 0.7 } },
|
||||
t => t.Type is TokenType.Comma,
|
||||
t => t is ConstantToken { Value: RealVariant { Value: 1.3 } },
|
||||
], true, true);
|
||||
|
||||
foreach (var token in tokens)
|
||||
{
|
||||
if (functionWaiter.Check(token))
|
||||
{
|
||||
growthWaiter.SetReady();
|
||||
shrinkWaiter.SetReady();
|
||||
}
|
||||
|
||||
if (growthWaiter.Check(token) || shrinkWaiter.Check(token))
|
||||
{
|
||||
yield return new ConstantToken(new RealVariant(100.0));
|
||||
}
|
||||
else yield return token;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblySearchPaths>$(AssemblySearchPaths);$(GDWeavePath)/core</AssemblySearchPaths>
|
||||
<Version>1.0.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="GDWeave" Private="false"/>
|
||||
<Reference Include="Serilog" Private="false"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(GDWeavePath)' != ''">
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'">true</IsWindows>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec
|
||||
Command="xcopy /Y /I "$(TargetDir)" "$(GDWeavePath)/mods/$(AssemblyName)""
|
||||
Condition="'$(IsWindows)' == 'true'"
|
||||
/>
|
||||
|
||||
<Exec
|
||||
Command="cp -r $(TargetDir) '$(GDWeavePath)/mods/$(AssemblyName)/'"
|
||||
Condition="'$(IsLinux)' == 'true'"
|
||||
/>
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Id": "PoppingBottles",
|
||||
"AssemblyPath": "PoppingBottles.dll",
|
||||
"Metadata": {
|
||||
"Name": "PoppingBottles",
|
||||
"Author": "uncreativeCultist",
|
||||
"Version": "1.0.0",
|
||||
"Description": "Mod that uncaps the limit on size sodas."
|
||||
}
|
||||
}
|
20
README.md
20
README.md
|
@ -1,16 +1,14 @@
|
|||
# PoppingBottles
|
||||
PoppingBottles is a mod for WEBFISHING that modifies the player script uncap the limit on size sodas! Script created by serenekerosene on the WEBFISHING Community Discord. Code used with permission.
|
||||
![oh dear god](https://git.lainiwakura.xyz/uncreativecultist/PoppingBottles/raw/branch/main/20241022214610_1.jpg)
|
||||
# GDWeave.Sample
|
||||
|
||||
Downloads can be found on the [Releases tab](https://git.lainiwakura.xyz/uncreativecultist/PoppingBottles/releases)
|
||||
## Notes
|
||||
To use this mod with [Nyoom!!!](https://git.lainiwakura.xyz/uncreativecultist/NyoomMod), modify the manifest.json file to change `"PackPath": "poppinbottles.pck"` to `"PackPath": "poppinbottles-nyoom.pck"`
|
||||
A sample for C# [GDWeave](https://github.com/NotNite/GDWeave) mods.
|
||||
|
||||
**This mod was created using hard-patching. It will cause conflicts with any mod that modifies the following files:**
|
||||
- player.gd
|
||||
## Acknowledgements
|
||||
## Setup
|
||||
|
||||
- serenekerosene - Created script tht allows unlimited drinking.
|
||||
- [GDWeave](https://github.com/NotNite/GDWeave) - PoppingBottles requires GDWeave
|
||||
Clone/fork/whatever this repository. Pick an ID for your project (people like to do `Username.ProjectName`, but there is no enforced naming scheme). Rename the following:
|
||||
|
||||
- Solution name, project name, and project namespace to your project ID
|
||||
- Various fields in the manifest.json to your project ID and name
|
||||
|
||||
## Building
|
||||
|
||||
To build the project, you need to set the `GDWeavePath` environment variable to your game install's GDWeave directory (e.g. `G:\games\steam\steamapps\common\WEBFISHING\GDWeave`). This can also be done in Rider with `File | Settings | Build, Execution, Deployment | Toolset and Build | MSBuild global properties` or with a .user file in Visual Studio.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue