JilloSlug Init!!!!

This commit is contained in:
Jill 2023-03-06 04:13:08 +03:00
commit d731d65bb7
Signed by: oat
GPG Key ID: 33489AA58A955108
43 changed files with 5470 additions and 0 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*.cs]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

400
.gitignore vendored Normal file
View File

@ -0,0 +1,400 @@
mod/plugins/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml

25
JilloSlug.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlugTest", "src\JilloSlug.csproj", "{C8AF8B79-0A9F-435F-BC0C-FDA563ECCDB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8AF8B79-0A9F-435F-BC0C-FDA563ECCDB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8AF8B79-0A9F-435F-BC0C-FDA563ECCDB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8AF8B79-0A9F-435F-BC0C-FDA563ECCDB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8AF8B79-0A9F-435F-BC0C-FDA563ECCDB9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5238A1CD-19BE-4617-BAF6-3143D8064838}
EndGlobalSection
EndGlobal

Binary file not shown.

BIN
lib/BepInEx.dll Normal file

Binary file not shown.

1657
lib/BepInEx.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
lib/Mono.Cecil.Rocks.dll Normal file

Binary file not shown.

BIN
lib/Mono.Cecil.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,178 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>MonoMod.RuntimeDetour</name>
</assembly>
<members>
<member name="T:MonoMod.RuntimeDetour.Detour">
<summary>
A fully managed detour.
Multiple Detours for a method to detour from can exist at any given time. Detours can be layered.
If you're writing your own detour manager or need to detour native functions, it's better to create instances of NativeDetour instead.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.Apply">
<summary>
Mark the detour as applied in the detour chain. This can be done automatically when creating an instance.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.Undo">
<summary>
Undo the detour without freeing it, allowing you to reapply it later.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.Free">
<summary>
Free the detour, while also permanently undoing it. This makes any further operations on this detour invalid.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.Dispose">
<summary>
Undo and free this temporary detour.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.GenerateTrampoline(System.Reflection.MethodBase)">
<summary>
Generate a new DynamicMethod with which you can invoke the previous state.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Detour.GenerateTrampoline``1">
<summary>
Generate a new DynamicMethod with which you can invoke the previous state.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.Hook.GenerateTrampoline``1">
<summary>
Generate a new DynamicMethod with which you can invoke the previous state.
</summary>
</member>
<member name="T:MonoMod.RuntimeDetour.NativeDetour">
<summary>
A "raw" native detour, acting as a wrapper around NativeDetourData with a few helpers.
Only one NativeDetour for a method to detour from can exist at any given time. NativeDetours cannot be layered.
If you don't need the trampoline generator or any of the management helpers, use DetourManager.Native directly.
Unless you're writing your own detour manager or need to detour native functions, it's better to create instances of Detour instead.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.Apply">
<summary>
Apply the native detour. This can be done automatically when creating an instance.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.Undo">
<summary>
Undo the native detour without freeing the detour native data, allowing you to reapply it later.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.ChangeSource(System.IntPtr)">
<summary>
Changes the source of this native detour to a new source address. This does not repair the old source location.
This also assumes that <paramref name="newSource"/> is simply a new address for the same method as this was constructed with.
</summary>
<param name="newSource">The new source location.</param>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.ChangeTarget(System.IntPtr)">
<summary>
Changed the target of this native detour to a new target.
</summary>
<param name="newTarget">The new target address.</param>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.Free">
<summary>
Free the detour's data without undoing it. This makes any further operations on this detour invalid.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.Dispose">
<summary>
Undo and free this temporary detour.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.GenerateTrampoline(System.Reflection.MethodBase)">
<summary>
Generate a new DynamicMethod with which you can invoke the previous state.
If the NativeDetour holds a reference to a managed method, a copy of the original method is returned.
If the NativeDetour holds a reference to a native function, an "undo-call-redo" trampoline with a matching signature is returned.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.NativeDetour.GenerateTrampoline``1">
<summary>
Generate a new delegate with which you can invoke the previous state.
If the NativeDetour holds a reference to a managed method, a copy of the original method is returned.
If the NativeDetour holds a reference to a native function, an "undo-call-redo" trampoline with a matching signature is returned.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.Write(System.IntPtr,System.Int32@,System.Byte)">
<summary>
Write the given value at the address to + offs, afterwards advancing offs by sizeof(byte).
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.Write(System.IntPtr,System.Int32@,System.UInt16)">
<summary>
Write the given value at the address to + offs, afterwards advancing offs by sizeof(ushort).
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.Write(System.IntPtr,System.Int32@,System.UInt32)">
<summary>
Write the given value at the address to + offs, afterwards advancing offs by sizeof(ushort).
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.Write(System.IntPtr,System.Int32@,System.UInt64)">
<summary>
Write the given value at the address to + offs, afterwards advancing offs by sizeof(ulong).
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.GenerateNativeProxy(System.IntPtr,System.Reflection.MethodBase)">
<summary>
Generate a DynamicMethod to easily call the given native function from another DynamicMethod.
</summary>
<param name="target">The pointer to the native function to call.</param>
<param name="signature">A MethodBase with the target function's signature.</param>
<returns>The detoured DynamicMethod.</returns>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.StubCriticalDetour(MonoMod.Utils.DynamicMethodDefinition)">
<summary>
Fill the DynamicMethodDefinition with a throw.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.EmitDetourCopy(Mono.Cecil.Cil.ILProcessor,System.IntPtr,System.IntPtr,System.Byte)">
<summary>
Emit a call to DetourManager.Native.Copy using the given parameters.
</summary>
</member>
<member name="M:MonoMod.RuntimeDetour.DetourHelper.EmitDetourApply(Mono.Cecil.Cil.ILProcessor,MonoMod.RuntimeDetour.NativeDetourData)">
<summary>
Emit a call to DetourManager.Native.Apply using a copy of the given data.
</summary>
</member>
<member name="T:MonoMod.RuntimeDetour.NativeDetourData">
<summary>
The data forming a "raw" native detour, created and consumed by DetourManager.Native.
</summary>
</member>
<member name="F:MonoMod.RuntimeDetour.NativeDetourData.Method">
<summary>
The method to detour from. Set when the structure is created by the IDetourNativePlatform.
</summary>
</member>
<member name="F:MonoMod.RuntimeDetour.NativeDetourData.Target">
<summary>
The target method to be called instead. Set when the structure is created by the IDetourNativePlatform.
</summary>
</member>
<member name="F:MonoMod.RuntimeDetour.NativeDetourData.Type">
<summary>
The type of the detour. Determined when the structure is created by the IDetourNativePlatform.
</summary>
</member>
<member name="F:MonoMod.RuntimeDetour.NativeDetourData.Size">
<summary>
The size of the detour. Calculated when the structure is created by the IDetourNativePlatform.
</summary>
</member>
<member name="F:MonoMod.RuntimeDetour.NativeDetourData.Extra">
<summary>
DetourManager.Native-specific data.
</summary>
</member>
</members>
</doc>

BIN
lib/MonoMod.Utils.dll Normal file

Binary file not shown.

1465
lib/MonoMod.Utils.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
lib/MonoMod.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/SlugBase.dll Normal file

Binary file not shown.

1344
lib/SlugBase.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
lib/UnityEngine.dll Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

9
mod/modinfo.json Normal file
View File

@ -0,0 +1,9 @@
{
"id": "zone.oat.jilloslug",
"name": "Jillo",
"version": "0.1.0",
"authors": "oatmealine",
"description": "gelatin...",
"requirements": [ "slime-cubed.slugbase" ],
"requirements_names": [ "SlugBase" ]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

42
mod/slugbase/jillo.json Normal file
View File

@ -0,0 +1,42 @@
{
"id": "Jillo",
"name": "Jillo",
"description": "jillo :)",
"features": {
"color": "f9b08f",
"weight": 0.86,
"loudness": 1.4,
"alignments": {
"Scavengers": { "like": 1, "strength": 0.1, "locked": false }
},
"diet": {
"corpses": 0,
"meat": 0.5,
"plants": 1,
"overrides": {
}
},
"custom_colors": [
{ "name": "Body", "story": { "r": 0.9764705882, "g": 0.6901960784, "b": 0.5607843137, "a": 0.5 } },
{ "name": "Eyes", "story": "ffffff" }
],
"start_room": "SI_A07",
"food_min": 3,
"food_max": 7,
"select_menu_scene": "Slugcat_Jillo",
"select_menu_scene_ascended": "Ghost_Jillo",
"world_state": "Spear",
"jillo/bounce": 0.6,
"jillo/immune_to_dart_maggots": true
}
}

View File

@ -0,0 +1,15 @@
{
"id": "Ghost_Jillo",
"scene_folder": "scenes/slugcat - jillo",
"images": [
{ "name": "Background", "pos": [492, 297], "depth": 3.7, "shader": "Basic" },
{ "name": "Grass 3", "pos": [602, 264], "depth": 2.2, "shader": "Basic" },
{ "name": "Grass 2", "pos": [446, 283], "depth": 2.0, "shader": "Basic" },
{ "name": "Grass 1", "pos": [515, 265], "depth": 1.8, "shader": "Basic" }
],
"idle_depths": [ 2.8 ],
"glow_pos": [688, 484],
"mark_pos": [689, 583],
"select_menu_pos": [0, 0],
"slugcat_depth": 2.8
}

View File

@ -0,0 +1,16 @@
{
"id": "Slugcat_Jillo",
"scene_folder": "scenes/slugcat - jillo",
"images": [
{ "name": "Background", "pos": [492, 297], "depth": 3.7, "shader": "Basic" },
{ "name": "Slugcat", "pos": [605, 427], "depth": 2.8, "shader": "Basic" },
{ "name": "Grass 3", "pos": [602, 264], "depth": 2.2, "shader": "Basic" },
{ "name": "Grass 2", "pos": [446, 283], "depth": 2.0, "shader": "Basic" },
{ "name": "Grass 1", "pos": [515, 265], "depth": 1.8, "shader": "Basic" }
],
"idle_depths": [ 2.8 ],
"glow_pos": [688, 484],
"mark_pos": [689, 583],
"select_menu_pos": [0, 0],
"slugcat_depth": 2.8
}

BIN
mod/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

41
src/Extras.cs Normal file
View File

@ -0,0 +1,41 @@
using System;
using System.Security.Permissions;
using UnityEngine;
/*
* This file contains fixes to some common problems when modding Rain World.
* Unless you know what you're doing, you shouldn't modify anything here.
*/
// Allows access to private members
#pragma warning disable CS0618
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
#pragma warning restore CS0618
internal static class Extras
{
private static bool _initialized;
// Ensure resources are only loaded once and that failing to load them will not break other mods
public static On.RainWorld.hook_OnModsInit WrapInit(Action<RainWorld> loadResources)
{
return (orig, self) =>
{
orig(self);
try
{
if (!_initialized)
{
_initialized = true;
loadResources(self);
}
}
catch (Exception e)
{
Debug.LogException(e);
}
};
}
}

26
src/JilloSlug.csproj Normal file
View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="../lib/*.dll">
<Private>false</Private>
</Reference>
</ItemGroup>
<Target Name="GenerateMod" AfterTargets="PostBuildEvent">
<ItemGroup>
<RemovePlugins Include="../mod/plugins/*.dll" />
</ItemGroup>
<ItemGroup>
<CopyPlugins Include="$(TargetPath)" />
</ItemGroup>
<Delete Files="@(RemovePlugins)" />
<Copy SourceFiles="@(CopyPlugins)" DestinationFolder="../mod/plugins/" />
</Target>
</Project>

31
src/Plugin.cs Normal file
View File

@ -0,0 +1,31 @@
using System;
using BepInEx;
using BepInEx.Logging;
namespace JilloSlug;
[BepInPlugin(MOD_ID, "Jillo", "0.1.0")]
class Plugin : BaseUnityPlugin {
private const string MOD_ID = "zone.oat.jilloslug";
internal static ManualLogSource Log;
// Add hooks
public void OnEnable() {
Plugin.Log = base.Logger;
try {
On.RainWorld.OnModsInit += Extras.WrapInit(LoadResources);
BounceFeature.AddHooks();
ImmuneToDartMaggotsFeature.AddHooks();
} catch (Exception err) {
Logger.LogError($"error initializing: {err}");
}
Logger.LogInfo("initialized!");
}
// Load any resources, such as sprites or sounds
private void LoadResources(RainWorld rainWorld) {
}
}

View File

@ -0,0 +1,133 @@
using System;
using UnityEngine;
using SlugBase.Features;
using static SlugBase.Features.FeatureTypes;
using MonoMod.Cil;
using Mono.Cecil.Cil;
using RWCustom;
namespace JilloSlug;
internal static class BounceFeature {
// 0 = no bounce
// 1 = preserve all velocity upon bouncing
public static readonly PlayerFeature<float> Bounce = PlayerFloat("jillo/bounce");
public static void AddHooks() {
IL.Player.TerrainImpact += Player_TerrainImpact;
}
private static bool PlayerHandleBounce(Player player, IntVector2 direction, float speed) {
float bounce;
Bounce.TryGet(player, out bounce);
bool shouldBounce = !player.dead && bounce >= 0;
if (!shouldBounce) return true;
if (speed > 0.5f) {
player.room.PlaySound(SoundID.Slime_Mold_Terrain_Impact, player.mainBodyChunk, false, 0.7f + Mathf.Clamp(speed / 60f, 0f, 1f), 1f);
}
if (speed > 8f) {
// handle bouncing
foreach (var chunk in player.bodyChunks) {
chunk.vel.x = Mathf.Lerp(chunk.vel.x, -chunk.vel.x * bounce, Mathf.Abs((float) direction.x));
chunk.vel.y = Mathf.Lerp(chunk.vel.y, -chunk.vel.y * bounce, Mathf.Abs((float) direction.y));
}
}
return false; // skip everything
}
private static void ILInsertHandleBounce(ILCursor c, ILLabel skipLabel) {
c.Emit(OpCodes.Ldarg_0);
c.Emit(OpCodes.Ldarg_2); // direction
c.Emit(OpCodes.Ldarg_3); // speed
c.EmitDelegate<Func<Player, IntVector2, float, bool>>((player, direction, speed) => {
return PlayerHandleBounce(player, direction, speed);
});
c.Emit(OpCodes.Brfalse, skipLabel);
}
private static void Player_TerrainImpact(ILContext il) {
ILCursor c = new ILCursor(il);
// patch high speed impact (death condition)
// matching for `speed > num && direction.y < 0`
c.GotoNext(MoveType.After,
// speed > num
i => i.MatchLdarg(3),
i => i.MatchLdloc(0),
i => i.Match(OpCodes.Ble_Un_S),
// direction.y < 0
i => i.MatchLdarg(2),
i => i.MatchLdfld<IntVector2>("y"),
i => i.Match(OpCodes.Ldc_I4_0),
i => i.Match(OpCodes.Bge_S)
);
// retrieve the label the end of the if would skip to
// (illegal bytecode crimes)
ILCursor endC = c.Clone();
endC.GotoNext(MoveType.After, i => i.MatchCallOrCallvirt<Creature>("Die"));
ILLabel skipLabel = endC.Next.Operand as ILLabel;
ILInsertHandleBounce(c, skipLabel);
// patch mid speed impact (stun condition)
// matching for `speed > num2`
c.GotoNext(MoveType.After,
// speed > num2
i => i.MatchLdarg(3),
i => i.MatchLdloc(1),
i => i.Match(OpCodes.Ble_Un)
);
ILInsertHandleBounce(c, skipLabel);
// patch low speed impacts
// matching for `direction.y < 0 && base.Consious`
c.GotoNext(MoveType.After,
i => i.MatchLdarg(2),
i => i.MatchLdfld<IntVector2>("y"),
i => i.Match(OpCodes.Ldc_I4_0),
i => i.Match(OpCodes.Bge_S),
i => i.MatchLdarg(0),
i => i.MatchCallOrCallvirt<Creature>("get_Consious"),
i => i.Match(OpCodes.Brfalse_S)
);
ILInsertHandleBounce(c, skipLabel);
// matching for `this.room.PlaySound(SoundID.Slugcat_Terrain_Impact_Light, ...);`
c.GotoNext(MoveType.Before,
i => i.MatchLdarg(0),
i => i.MatchLdfld<UpdatableAndDeletable>("room"),
i => i.MatchLdsfld<SoundID>("Slugcat_Terrain_Impact_Light")
);
ILInsertHandleBounce(c, skipLabel);
// matching for `this.room.PlaySound(SoundID.Slugcat_Terrain_Impact_Medium, ...);`
c.GotoNext(MoveType.Before,
i => i.MatchLdarg(0),
i => i.MatchLdfld<UpdatableAndDeletable>("room"),
i => i.MatchLdsfld<SoundID>("Slugcat_Terrain_Impact_Medium")
);
ILInsertHandleBounce(c, skipLabel);
// matching for `this.room.PlaySound(SoundID.Slugcat_Terrain_Impact_Hard, ...;`
c.GotoNext(MoveType.Before,
i => i.MatchLdarg(0),
i => i.MatchLdfld<UpdatableAndDeletable>("room"),
i => i.MatchLdsfld<SoundID>("Slugcat_Terrain_Impact_Hard")
);
ILInsertHandleBounce(c, skipLabel);
}
}

View File

@ -0,0 +1,77 @@
using System;
using SlugBase.Features;
using static SlugBase.Features.FeatureTypes;
using MonoMod.Cil;
using Mono.Cecil.Cil;
namespace JilloSlug;
internal static class ImmuneToDartMaggotsFeature {
public static readonly PlayerFeature<bool> ImmuneToDartMaggots = PlayerBool("jillo/immune_to_dart_maggots");
public static void AddHooks() {
IL.DartMaggot.Update += DartMaggot_Update;
}
private static bool DartMaggotCanStun(DartMaggot maggot) {
if (maggot.stuckInChunk.owner is Player && ImmuneToDartMaggots.TryGet(maggot.stuckInChunk.owner as Player, out var immune) && immune) {
return false; // skip
}
return true; // proceed as normal
}
private static void ILInsertHandleDartMaggotStun(ILCursor c, ILLabel skipLabel) {
c.Emit(OpCodes.Ldarg_0);
c.EmitDelegate<Func<DartMaggot, bool>>(maggot => {
return DartMaggotCanStun(maggot);
});
c.Emit(OpCodes.Brfalse, skipLabel);
}
private static void DartMaggot_Update(ILContext il) {
ILCursor c = new ILCursor(il);
// matching for `stuckInChunk.owner is Creature && ...`
c.GotoNext(MoveType.After,
i => i.MatchLdarg(0),
i => i.MatchLdfld<DartMaggot>("stuckInChunk"),
i => i.MatchCallOrCallvirt<BodyChunk>("get_owner"),
i => i.MatchIsinst<Creature>(),
i => i.Match(OpCodes.Brfalse_S)
);
// last instruction will be a brfalse.s; capture the label it goes to
ILLabel skipLabel = c.Prev.Operand as ILLabel;
// we're now ready to write another condition
ILInsertHandleDartMaggotStun(c, skipLabel);
// comments will be unrepeated; same functionality
// matching for `stuckInChunk.owner is Player && ...`
c.GotoNext(MoveType.After,
i => i.MatchLdarg(0),
i => i.MatchLdfld<DartMaggot>("stuckInChunk"),
i => i.MatchCallOrCallvirt<BodyChunk>("get_owner"),
i => i.MatchIsinst<Player>(),
i => i.Match(OpCodes.Brfalse_S)
);
skipLabel = c.Prev.Operand as ILLabel;
ILInsertHandleDartMaggotStun(c, skipLabel);
// matching for `stuckInChunk.owner is Creature`
c.GotoNext(MoveType.After,
i => i.MatchLdarg(0),
i => i.MatchLdfld<DartMaggot>("stuckInChunk"),
i => i.MatchCallOrCallvirt<BodyChunk>("get_owner"),
i => i.MatchIsinst<Creature>(),
i => i.Match(OpCodes.Brfalse) // watch out! this one isn't _S
);
skipLabel = c.Prev.Operand as ILLabel;
ILInsertHandleDartMaggotStun(c, skipLabel);
}
}