-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7f348ee
Showing
24 changed files
with
278 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/Source/*/Source-DLLs/* | ||
Thumbs.db |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ModMetaData> | ||
<name>ReclaimFabric</name> | ||
<author>Skullywag</author> | ||
<targetVersion>Alpha 13</targetVersion> | ||
<description>Allows tailors to reclaim fabric from clothing.</description> | ||
</ModMetaData> |
Binary file not shown.
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Defs> | ||
|
||
<ModHelperDef> | ||
<defName>ReclaimFabric</defName> | ||
<ModName>ReclaimFabric</ModName> | ||
<minCCLVersion>0.13.0</minCCLVersion> | ||
<SpecialInjectors> | ||
<li>ReclaimFabric.DetourInjector</li> | ||
</SpecialInjectors> | ||
</ModHelperDef> | ||
|
||
</Defs> |
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,52 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<RecipeDefs> | ||
|
||
|
||
<RecipeDef> | ||
<defName>ReclaimFabric</defName> | ||
<label>Reclaim Fabric</label> | ||
<description>Reclaims fabrics and leathers from clothing, the amount returned is based on the items condition and tailor skill.</description> | ||
<jobString>Reclaiming fabrics.</jobString> | ||
<workAmount>1200</workAmount> | ||
<workSpeedStat>TailoringSpeed</workSpeedStat> | ||
<effectWorking>Tailor</effectWorking> | ||
<soundWorking>Recipe_Tailor</soundWorking> | ||
<recipeUsers> | ||
<li>ElectricTailoringBench</li> | ||
<li>HandTailoringBench</li> | ||
</recipeUsers> | ||
<ingredients> | ||
<li> | ||
<filter> | ||
<categories> | ||
<li>Apparel</li> | ||
</categories> | ||
</filter> | ||
<count>1</count> | ||
</li> | ||
</ingredients> | ||
<specialProducts> | ||
<li>Smelted</li> | ||
</specialProducts> | ||
<fixedIngredientFilter> | ||
<categories> | ||
<li>Apparel</li> | ||
</categories> | ||
<exceptedThingDefs> | ||
<li>Apparel_PowerArmor</li> | ||
<li>Apparel_PowerArmorMKII</li> | ||
<li>Apparel_PersonalShield</li> | ||
<li>Apparel_PsychicFoilHelmet</li> | ||
<li>Apparel_KevlarHelmet</li> | ||
<li>Apparel_PowerArmorHelmet</li> | ||
<li>Apparel_PowerArmorHelmetMKII</li> | ||
<li>Apparel_PersonalShield</li> | ||
<li>PersonalShieldMKII</li> | ||
<li>Apparel_VestPlate</li> | ||
</exceptedThingDefs> | ||
</fixedIngredientFilter> | ||
<workSkill>Crafting</workSkill> | ||
</RecipeDef> | ||
|
||
|
||
</RecipeDefs> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.23107.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Odyssey", "ReclaimFabric\ReclaimFabric.csproj", "{A36BEEB2-7379-475B-B537-827E34571962}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A36BEEB2-7379-475B-B537-827E34571962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A36BEEB2-7379-475B-B537-827E34571962}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A36BEEB2-7379-475B-B537-827E34571962}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A36BEEB2-7379-475B-B537-827E34571962}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
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,28 @@ | ||
using CommunityCoreLibrary; | ||
using CommunityCoreLibrary.Controller; | ||
using CommunityCoreLibrary.Detour; | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using Verse; | ||
|
||
namespace ReclaimFabric | ||
{ | ||
public class DetourInjector : SpecialInjector | ||
{ | ||
public override bool Inject() | ||
{ | ||
MethodInfo method1 = typeof(Thing).GetMethod("SmeltProducts", BindingFlags.Instance | BindingFlags.Public); | ||
MethodInfo method2 = typeof(_Thing).GetMethod("_SmeltProducts", BindingFlags.Static | BindingFlags.NonPublic); | ||
Detours.TryDetourFromTo(method1, method2); | ||
if (!Detours.TryDetourFromTo(method1, method2)) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} |
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,19 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("ReclaimFabric")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ReclaimFabric")] | ||
[assembly: AssemblyCopyright("Copyright © 2016 (skullywag)")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("a8e081b6-8768-4fe9-817f-f0ee42cf13ef")] | ||
|
||
[assembly: AssemblyVersion("0.6.0.0")] | ||
[assembly: AssemblyFileVersion("0.6.0.0")] |
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,72 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{A36BEEB2-7379-475B-B537-827E34571962}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>ReclaimFabric</RootNamespace> | ||
<AssemblyName>ReclaimFabric</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<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' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>Source-DLLs\Assembly-CSharp.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Community Core Library, Version=0.13.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>Source-DLLs\Community Core Library.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>Source-DLLs\UnityEngine.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="DetourInjector.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="_Thing.cs" /> | ||
</ItemGroup> | ||
<ItemGroup /> | ||
<ItemGroup> | ||
<Content Include="Source-DLLs\Assembly-CSharp.dll" /> | ||
<Content Include="Source-DLLs\Community Core Library.dll" /> | ||
<Content Include="Source-DLLs\UnityEngine.dll" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ProjectView>ShowAllFiles</ProjectView> | ||
</PropertyGroup> | ||
</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,51 @@ | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using UnityEngine; | ||
using Verse.AI; | ||
using Verse; | ||
|
||
namespace ReclaimFabric | ||
{ | ||
public static class _Thing | ||
{ | ||
internal static IEnumerable<Thing> _SmeltProducts(this Thing _this, Pawn crafter, float efficiency) | ||
{ | ||
if (_this.def.smeltProducts != null) | ||
{ | ||
foreach (var counter in _this.def.smeltProducts) | ||
{ | ||
do | ||
{ | ||
var thing = ThingMaker.MakeThing(counter.thingDef); | ||
thing.stackCount = Mathf.Min(thing.def.stackLimit, counter.count); | ||
counter.count -= thing.stackCount; | ||
yield return thing; | ||
} while (counter.count > 0); | ||
} | ||
} | ||
if (_this.def.costStuffCount >= 0) | ||
{ | ||
float skillPerc = ((float)crafter.skills.GetSkill(SkillDefOf.Crafting).level / 20); | ||
float num = Mathf.Lerp(0.5f, 1.5f, skillPerc); | ||
float healthPerc = ((float)_this.HitPoints / (float)_this.MaxHitPoints); | ||
float num1 = Mathf.Lerp(0f, 0.4f, healthPerc); | ||
var mainSmeltProductCount = (_this.def.costStuffCount * num1 / _this.Stuff.VolumePerUnit) * num; | ||
var adjustedCount = GenMath.RoundRandom(mainSmeltProductCount); | ||
if (adjustedCount > 0) | ||
{ | ||
do | ||
{ | ||
var thing = ThingMaker.MakeThing(_this.Stuff); | ||
thing.stackCount = Mathf.Min(thing.def.stackLimit, adjustedCount); | ||
adjustedCount -= thing.stackCount; | ||
yield return thing; | ||
} while (adjustedCount > 0); | ||
} | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+7.28 KB
Source/ReclaimFabric/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
Source/ReclaimFabric/obj/Debug/ReclaimFabric.csproj.FileListAbsolute.txt
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 @@ | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\bin\Debug\ReclaimFabric.dll | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\bin\Debug\ReclaimFabric.pdb | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\bin\Debug\Community Core Library.dll | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\obj\Debug\ReclaimFabric.csprojResolveAssemblyReference.cache | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\obj\Debug\ReclaimFabric.dll | ||
C:\Users\mjsku\Desktop\RimWorldAlpha13Win\RimWorld1135Win\Mods\ReclaimFabric\Source\ReclaimFabric\obj\Debug\ReclaimFabric.pdb |
Binary file added
BIN
+15.5 KB
Source/ReclaimFabric/obj/Debug/ReclaimFabric.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file not shown.
Binary file not shown.