Skip to content

Commit c6c9de6

Browse files
committed
Initial commit
0 parents  commit c6c9de6

14 files changed

+254
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

SplitLogs/.vs/SplitLogs/v17/.suo

37 KB
Binary file not shown.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using UnityEngine;
7+
using HarmonyLib;
8+
using BepInEx.Configuration;
9+
10+
namespace SplitLogs
11+
{
12+
[HarmonyPatch(typeof(ItemDepositAndChanger), "ejectItemOnCycle")]
13+
public static class Patch_EjectItemOnCycle
14+
{
15+
public static ConfigEntry<int> PlankQuantity { get; set; }
16+
17+
public static ConfigEntry<bool> CanSplitMetal { get; set; }
18+
19+
public static ConfigEntry<int> SheetQuantity { get; set; }
20+
21+
public static void Postfix(ItemDepositAndChanger __instance, int xPos, int yPos, HouseDetails inside = null)
22+
{
23+
int num = PlankQuantity.Value;
24+
if (num < 0)
25+
{
26+
num = 2;
27+
}
28+
num--;
29+
ItemChange itemChange = Inventory.Instance.allItems[(inside != null) ? inside.houseMapOnTileStatus[xPos, yPos] : WorldManager.Instance.onTileStatusMap[xPos, yPos]].itemChange;
30+
ItemChangeType[] changesAndTheirChanger = itemChange.changesAndTheirChanger;
31+
int num2 = ((inside != null) ? inside.houseMapOnTile[xPos, yPos] : WorldManager.Instance.onTileMap[xPos, yPos]);
32+
ItemChangeType[] array = changesAndTheirChanger;
33+
foreach (ItemChangeType val in array)
34+
{
35+
if (val.depositInto.tileObjectId == num2)
36+
{
37+
InventoryItem item = Inventory.Instance.allItems[inside != null ? inside.houseMapOnTileStatus[xPos, yPos] : WorldManager.Instance.onTileStatusMap[xPos, yPos]];
38+
if (val.taskType == DailyTaskGenerator.genericTaskType.CutPlanks)
39+
{
40+
NetworkMapSharer.Instance.spawnAServerDropToSave(item.itemChange.getChangerResultId(inside != null ? inside.houseMapOnTile[xPos, yPos] : WorldManager.Instance.onTileMap[xPos, yPos]), num, __instance.ejectPos.position, inside, false, -1);
41+
DailyTaskGenerator.generate.doATask(DailyTaskGenerator.genericTaskType.CutPlanks, num);
42+
break;
43+
}
44+
else if (CanSplitMetal.Value && item.itemName == "Tin Bar")
45+
{
46+
NetworkMapSharer.Instance.spawnAServerDropToSave(item.itemChange.getChangerResultId(inside != null ? inside.houseMapOnTile[xPos, yPos] : WorldManager.Instance.onTileMap[xPos, yPos]), num, __instance.ejectPos.position, inside, false, -1);
47+
break;
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("RimWorld_1._4_Template")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RimWorld_1._4_Template")]
13+
[assembly: AssemblyCopyright("Copyright © 2021")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("0f1bf8dd-568d-4a4b-974f-1b5f4baeeaba")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.*")]

SplitLogs/SplitLogs.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using BepInEx;
2+
using BepInEx.Configuration;
3+
using HarmonyLib;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Reflection;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
using UnityEngine;
11+
12+
namespace SplitLogs
13+
{
14+
[BepInPlugin("neronix17.dinkum.splitlogs", "Split Logs", "1.0.0")]
15+
public class SplitLogs : BaseUnityPlugin
16+
{
17+
public const string pluginGuid = "neronix17.dinkum.splitlogs";
18+
19+
public const string pluginName = "Split Logs";
20+
21+
public const string pluginVersion = "1.0.0";
22+
23+
public ConfigEntry<int> PlankQuantity;
24+
25+
public ConfigEntry<bool> CanSplitMetal { get; set; }
26+
27+
public ConfigEntry<int> SheetQuantity { get; set; }
28+
29+
public void Awake()
30+
{
31+
Config.Bind("!Developer", "NexusID", 340, "Nexus Mod ID, automatically generated, changing it will do nothing.");
32+
PlankQuantity = Config.Bind("Mod General", "Planks Quantity", 2, "Quantity of planks to drop when cutting a log on the table saw (including the one dropped by default)");
33+
CanSplitMetal = Config.Bind("Mod General", "Can Split Metal", false, "If true, tin ingots can be split into multiple sheets.");
34+
SheetQuantity = Config.Bind("Mod General", "Sheets Quantity", 2, "Quantity of sheets to drop when cutting a tin ingot on the table saw (including the one dropped by default)");
35+
Logger.LogInfo(":: Split Logs :: Successfully Loaded ::");
36+
Harmony harmony = new Harmony("neronix17.dinkum.splitlogs");
37+
harmony.PatchAll();
38+
Patch_EjectItemOnCycle.PlankQuantity = PlankQuantity;
39+
Patch_EjectItemOnCycle.CanSplitMetal = CanSplitMetal;
40+
Patch_EjectItemOnCycle.SheetQuantity = SheetQuantity;
41+
}
42+
}
43+
}

SplitLogs/SplitLogs.csproj

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SplitLogs</RootNamespace>
11+
<AssemblyName>SplitLogs</AssemblyName>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
13+
<LangVersion>Latest</LangVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<Deterministic>false</Deterministic>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>false</DebugSymbols>
19+
<DebugType>none</DebugType>
20+
<Optimize>true</Optimize>
21+
<OutputPath>..\..\..\plugins\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="0Harmony">
37+
<HintPath>..\..\..\core\0Harmony.dll</HintPath>
38+
<Private>False</Private>
39+
</Reference>
40+
<Reference Include="Assembly-CSharp">
41+
<HintPath>..\..\..\..\Dinkum_Data\Managed\Assembly-CSharp.dll</HintPath>
42+
<Private>False</Private>
43+
</Reference>
44+
<Reference Include="BepInEx.Core">
45+
<HintPath>..\..\..\core\BepInEx.Core.dll</HintPath>
46+
<Private>False</Private>
47+
</Reference>
48+
<Reference Include="BepInEx.Unity">
49+
<HintPath>..\..\..\core\BepInEx.Unity.dll</HintPath>
50+
<Private>False</Private>
51+
</Reference>
52+
<Reference Include="Mirror">
53+
<HintPath>..\..\..\..\Dinkum_Data\Managed\Mirror.dll</HintPath>
54+
<Private>False</Private>
55+
</Reference>
56+
<Reference Include="MonoMod.Utils">
57+
<HintPath>..\..\..\core\MonoMod.Utils.dll</HintPath>
58+
<Private>False</Private>
59+
</Reference>
60+
<Reference Include="System" />
61+
<Reference Include="System.Core" />
62+
<Reference Include="System.Xml.Linq" />
63+
<Reference Include="System.Data.DataSetExtensions" />
64+
<Reference Include="Microsoft.CSharp" />
65+
<Reference Include="System.Data" />
66+
<Reference Include="System.Net.Http" />
67+
<Reference Include="System.Xml" />
68+
<Reference Include="UnityEngine">
69+
<HintPath>..\..\..\..\Dinkum_Data\Managed\UnityEngine.dll</HintPath>
70+
<Private>False</Private>
71+
</Reference>
72+
<Reference Include="UnityEngine.CoreModule">
73+
<HintPath>..\..\..\..\Dinkum_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
74+
<Private>False</Private>
75+
</Reference>
76+
</ItemGroup>
77+
<ItemGroup>
78+
<Compile Include="Patch_EjectItemOnCycle.cs" />
79+
<Compile Include="Properties\AssemblyInfo.cs" />
80+
<Compile Include="SplitLogs.cs" />
81+
</ItemGroup>
82+
<ItemGroup />
83+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
84+
</Project>

SplitLogs/SplitLogs.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32414.318
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SplitLogs", "SplitLogs.csproj", "{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{0F1BF8DD-568D-4A4B-974F-1B5F4BAEEABA}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {017323AA-9EF3-4D7F-9188-3A98C2077996}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// <autogenerated />
2+
using System;
3+
using System.Reflection;
4+
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)