Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NoImageAvailable committed May 31, 2017
0 parents commit e7809c8
Show file tree
Hide file tree
Showing 23 changed files with 417 additions and 0 deletions.
8 changes: 8 additions & 0 deletions About/About.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Mass Graves</name>
<author>NoImageAvailable</author>
<targetVersion>0.17.1546</targetVersion>
<description>Version: 1.0\n\nAdds mass graves to allow easier disposing of raider corpses.
</description>
</ModMetaData>
Binary file added About/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assemblies/0Harmony.dll
Binary file not shown.
Binary file added Assemblies/MassGraves.dll
Binary file not shown.
97 changes: 97 additions & 0 deletions Defs/Buildings_MassGrave.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<thingClass>Building</thingClass>
<soundImpactDefault>BulletImpactMetal</soundImpactDefault>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<repairEffect>Repair</repairEffect>
<leaveResourcesWhenKilled>true</leaveResourcesWhenKilled>
<filthLeaving>BuildingRubble</filthLeaving>
</ThingDef>

<ThingDef Name="MassGraveBase" ParentName="BuildingBase" Abstract="True">
<label>mass grave</label>
<thingClass>MassGraves.Building_MassGrave</thingClass>
<constructEffect>ConstructDirt</constructEffect>
<altitudeLayer>FloorEmplacement</altitudeLayer>
<useHitPoints>false</useHitPoints>
<description>A large hole for dumping bodies. It's not pretty but sometimes you have to make do.</description>
<tickerType>Rare</tickerType>
<statBases>
<WorkToBuild>1300</WorkToBuild>
</statBases>
<passability>PassThroughOnly</passability>
<building>
<ai_chillDestination>false</ai_chillDestination>
<isInert>true</isInert>
<preventDeterioration>true</preventDeterioration>
<fixedStorageSettings>
<filter>
<categories>
<li>Corpses</li>
</categories>
</filter>
</fixedStorageSettings>
<defaultStorageSettings>
<filter>
<categories>
<li>CorpsesHumanlike</li>
</categories>
<specialFiltersToDisallow>
<li>AllowCorpsesColonist</li>
</specialFiltersToDisallow>
</filter>
</defaultStorageSettings>
</building>
<inspectorTabs>
<li>ITab_Storage</li>
</inspectorTabs>
<terrainAffordanceNeeded>Diggable</terrainAffordanceNeeded>
<designationCategory>Misc</designationCategory>
</ThingDef>

<ThingDef ParentName="MassGraveBase">
<defName>MassGrave</defName>
<graphicData>
<texPath>Things/MassGrave/MassGraveEmpty</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3,3)</drawSize>
</graphicData>
<size>(3,3)</size>
<rotatable>false</rotatable>
<building>
<fullGraveGraphicData>
<texPath>Things/MassGrave/MassGraveFull</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3,3)</drawSize>
</fullGraveGraphicData>
</building>
</ThingDef>

<ThingDef ParentName="MassGraveBase">
<defName>MassGraveAlt</defName>
<graphicData>
<texPath>Things/MassGraveAlt/GraveEmpty</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(6,3)</drawSize>
</graphicData>
<size>(5,2)</size>
<building>
<fullGraveGraphicData>
<texPath>Things/MassGraveAlt/GraveFull</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(6,3)</drawSize>
</fullGraveGraphicData>
</building>
<inspectorTabs>
<li>ITab_Storage</li>
</inspectorTabs>
<terrainAffordanceNeeded>Diggable</terrainAffordanceNeeded>
<designationCategory>Misc</designationCategory>
</ThingDef>

</Buildings>
6 changes: 6 additions & 0 deletions Languages/English/Keyed/MassGrave.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<LanguageData>
<MassGrave_Settings>Mass Graves</MassGrave_Settings>
<MassGrave_UseAlt>Use alternate graphic (only new graves)</MassGrave_UseAlt>
<MassGrave_Capacity>Capacity</MassGrave_Capacity>
</LanguageData>
12 changes: 12 additions & 0 deletions Patches/Grave.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Grave"]/building/defaultStorageSettings/filter</xpath>
<value>
<specialFiltersToDisallow>
<li>AllowCorpsesStranger</li>
</specialFiltersToDisallow>
</value>
</Operation>
</Patch>

22 changes: 22 additions & 0 deletions Source/MassGraves.sln
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.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MassGraves", "MassGraves\MassGraves.csproj", "{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
45 changes: 45 additions & 0 deletions Source/MassGraves/Building_MassGrave.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse;
using UnityEngine;

namespace MassGraves
{
public class Building_MassGrave : Building_Grave
{
private int CorpseCount => innerContainer.Count;

private bool CanAcceptCorpses => CorpseCount < Controller.settings.CorpseCapacity;

public override bool Accepts(Thing thing)
{
return innerContainer.CanAcceptAnyOf(thing) && CanAcceptCorpses && GetStoreSettings().AllowedToAccept(thing);
}

public override string GetInspectString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(InspectStringPartsFromComps());
stringBuilder.Append("MassGrave_Capacity".Translate() + ": " + CorpseCount.ToString() + "/" + Controller.settings.CorpseCapacity.ToString());
return stringBuilder.ToString();
}

/* Kind of a hack, because we don't want the assign owner gizmo that simply using base.GetGizmos() would give us. Instead iterate through all the gizmos
* produced by base classes of Building_Grave and only return them if they're not labeled 'Assign colonist'.
*/
public override IEnumerable<Gizmo> GetGizmos()
{
var gizmos = base.GetGizmos();
foreach(Gizmo giz in gizmos)
{
if((giz as Command_Action)?.defaultLabel!= "CommandGraveAssignColonistLabel".Translate())
{
yield return giz;
}
}
}
}
}
33 changes: 33 additions & 0 deletions Source/MassGraves/Controller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using RimWorld;
using Verse;
using UnityEngine;
using Harmony;

namespace MassGraves
{
public class Controller : Mod
{
public static Settings settings;

public Controller(ModContentPack content) : base(content)
{
settings = GetSettings<Settings>();
HarmonyInstance.Create("MassGraves.Harmony").PatchAll(Assembly.GetExecutingAssembly());
}

public override string SettingsCategory()
{
return "MassGrave_Settings".Translate();
}

public override void DoSettingsWindowContents(Rect inRect)
{
settings.DoWindowContents(inRect);
}
}
}
17 changes: 17 additions & 0 deletions Source/MassGraves/GraveDefOf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse;
using UnityEngine;

namespace MassGraves
{
[DefOf]
public class GraveDefOf
{
public static ThingDef MassGrave;
public static ThingDef MassGraveAlt;
}
}
27 changes: 27 additions & 0 deletions Source/MassGraves/Harmony-Designator_Build.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse;
using UnityEngine;
using Harmony;

namespace MassGraves
{
[HarmonyPatch(typeof(Designator_Build))]
[HarmonyPatch("Visible", PropertyMethod.Getter)]
public static class Harmony_Designator_Build
{
public static bool Prefix(Designator_Build __instance, ref bool __result)
{
if ((__instance.PlacingDef == GraveDefOf.MassGrave && Controller.settings.UseAlt)
|| (__instance.PlacingDef == GraveDefOf.MassGraveAlt && !Controller.settings.UseAlt))
{
__result = false;
return false;
}
return true;
}
}
}
73 changes: 73 additions & 0 deletions Source/MassGraves/MassGraves.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{FA1972A2-44E7-4991-A7A8-43BC9223ED5C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MassGraves</RootNamespace>
<AssemblyName>MassGraves</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Assemblies\</OutputPath>
<DefineConstants>
</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, Version=1.0.9.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\RimWorld1546Win_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="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\RimWorld1546Win_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Building_MassGrave.cs" />
<Compile Include="Controller.cs" />
<Compile Include="GraveDefOf.cs" />
<Compile Include="Harmony-Designator_Build.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
</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>
36 changes: 36 additions & 0 deletions Source/MassGraves/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("MassGraves")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MassGraves")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("fa1972a2-44e7-4991-a7a8-43bc9223ed5c")]

// 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")]
Loading

0 comments on commit e7809c8

Please sign in to comment.