Skip to content

Commit

Permalink
Now with 10% more C#
Browse files Browse the repository at this point in the history
  • Loading branch information
XeoNovaDan committed Sep 8, 2018
1 parent 1fe16ce commit 9b90946
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 0 deletions.
Binary file added Assemblies/0Harmony.dll
Binary file not shown.
Binary file added Assemblies/VisiblePants.dll
Binary file not shown.
Binary file added Source/VisiblePants/.vs/VisiblePants/v15/.suo
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35 changes: 35 additions & 0 deletions Source/VisiblePants/HarmonyPatches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
using RimWorld;
using Harmony;

namespace VisiblePants
{
[StaticConstructorOnStartup]
static class HarmonyPatches
{

private static readonly Type patchType = typeof(HarmonyPatches);

static HarmonyPatches()
{
HarmonyInstance h = HarmonyInstance.Create("XeoNovaDan.VisiblePants");

h.Patch(AccessTools.Method(typeof(Pawn_ApparelTracker), "SortWornApparelIntoDrawOrder"),
new HarmonyMethod(patchType, nameof(Prefix_SortWornApparelIntoDrawOrder)));
}

public static bool Prefix_SortWornApparelIntoDrawOrder(Pawn_ApparelTracker __instance, ref ThingOwner<Apparel> ___wornApparel)
{
___wornApparel.InnerListForReading.Sort((Apparel a, Apparel b) => (a.IsPants() ? 99 : a.def.apparel.LastLayer.drawOrder).CompareTo(b.def.apparel.LastLayer.drawOrder));
return false;
}

private static bool IsPants(this Apparel a) => a.def == VP_ThingDefOf.Apparel_Pants || a.def == VP_ThingDefOf.Apparel_FlakPants;

}
}
36 changes: 36 additions & 0 deletions Source/VisiblePants/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VisiblePants")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VisiblePants")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e774ea52-14e4-4b87-b610-be7fb0eb1f01")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
20 changes: 20 additions & 0 deletions Source/VisiblePants/VP_ThingDefOf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
using RimWorld;

namespace VisiblePants
{
[DefOf]
public static class VP_ThingDefOf
{

public static ThingDef Apparel_Pants;

public static ThingDef Apparel_FlakPants;

}
}
58 changes: 58 additions & 0 deletions Source/VisiblePants/VisiblePants.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VisiblePants</RootNamespace>
<AssemblyName>VisiblePants</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Assemblies\</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="0Harmony">
<HintPath>..\..\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</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>C:\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="HarmonyPatches.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VP_ThingDefOf.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions Source/VisiblePants/VisiblePants.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisiblePants", "VisiblePants.csproj", "{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E774EA52-14E4-4B87-B610-BE7FB0EB1F01}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D77A4714-DECB-4897-A35C-37E55B46C48D}
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a24d83ca0464d401015163c75148ce2ad97b0736
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
E:\Documents\GitHub\VisiblePants\Assemblies\VisiblePants.dll
E:\Documents\GitHub\VisiblePants\Source\VisiblePants\obj\Debug\VisiblePants.csprojAssemblyReference.cache
E:\Documents\GitHub\VisiblePants\Source\VisiblePants\obj\Debug\VisiblePants.csproj.CoreCompileInputs.cache
E:\Documents\GitHub\VisiblePants\Source\VisiblePants\obj\Debug\VisiblePants.dll
Binary file not shown.
Binary file added Source/VisiblePants/obj/Debug/VisiblePants.dll
Binary file not shown.

0 comments on commit 9b90946

Please sign in to comment.