diff --git a/About/About.xml b/About/About.xml new file mode 100644 index 0000000..85f80ba --- /dev/null +++ b/About/About.xml @@ -0,0 +1,8 @@ + + + Mass Graves + NoImageAvailable + 0.17.1546 + Version: 1.0\n\nAdds mass graves to allow easier disposing of raider corpses. + + diff --git a/About/preview.png b/About/preview.png new file mode 100644 index 0000000..f05907e Binary files /dev/null and b/About/preview.png differ diff --git a/Assemblies/0Harmony.dll b/Assemblies/0Harmony.dll new file mode 100644 index 0000000..a95b6df Binary files /dev/null and b/Assemblies/0Harmony.dll differ diff --git a/Assemblies/MassGraves.dll b/Assemblies/MassGraves.dll new file mode 100644 index 0000000..f027ac1 Binary files /dev/null and b/Assemblies/MassGraves.dll differ diff --git a/Defs/Buildings_MassGrave.xml b/Defs/Buildings_MassGrave.xml new file mode 100644 index 0000000..c16ae71 --- /dev/null +++ b/Defs/Buildings_MassGrave.xml @@ -0,0 +1,97 @@ + + + + + Building + Building + BulletImpactMetal + true + MapMeshAndRealTime + Light + Repair + true + BuildingRubble + + + + + MassGraves.Building_MassGrave + ConstructDirt + FloorEmplacement + false + A large hole for dumping bodies. It's not pretty but sometimes you have to make do. + Rare + + 1300 + + PassThroughOnly + + false + true + true + + + +
  • Corpses
  • +
    +
    +
    + + + +
  • CorpsesHumanlike
  • +
    + +
  • AllowCorpsesColonist
  • +
    +
    +
    +
    + +
  • ITab_Storage
  • +
    + Diggable + Misc +
    + + + MassGrave + + Things/MassGrave/MassGraveEmpty + Graphic_Single + (3,3) + + (3,3) + false + + + Things/MassGrave/MassGraveFull + Graphic_Single + (3,3) + + + + + + MassGraveAlt + + Things/MassGraveAlt/GraveEmpty + Graphic_Multi + (6,3) + + (5,2) + + + Things/MassGraveAlt/GraveFull + Graphic_Multi + (6,3) + + + +
  • ITab_Storage
  • +
    + Diggable + Misc +
    + +
    \ No newline at end of file diff --git a/Languages/English/Keyed/MassGrave.xml b/Languages/English/Keyed/MassGrave.xml new file mode 100644 index 0000000..894525e --- /dev/null +++ b/Languages/English/Keyed/MassGrave.xml @@ -0,0 +1,6 @@ + + + Mass Graves + Use alternate graphic (only new graves) + Capacity + diff --git a/Patches/Grave.xml b/Patches/Grave.xml new file mode 100644 index 0000000..4c3fe76 --- /dev/null +++ b/Patches/Grave.xml @@ -0,0 +1,12 @@ + + + + */ThingDef[defName="Grave"]/building/defaultStorageSettings/filter + + +
  • AllowCorpsesStranger
  • +
    +
    +
    +
    + diff --git a/Source/MassGraves.sln b/Source/MassGraves.sln new file mode 100644 index 0000000..e0270a7 --- /dev/null +++ b/Source/MassGraves.sln @@ -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 diff --git a/Source/MassGraves/Building_MassGrave.cs b/Source/MassGraves/Building_MassGrave.cs new file mode 100644 index 0000000..d23112d --- /dev/null +++ b/Source/MassGraves/Building_MassGrave.cs @@ -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 GetGizmos() + { + var gizmos = base.GetGizmos(); + foreach(Gizmo giz in gizmos) + { + if((giz as Command_Action)?.defaultLabel!= "CommandGraveAssignColonistLabel".Translate()) + { + yield return giz; + } + } + } + } +} diff --git a/Source/MassGraves/Controller.cs b/Source/MassGraves/Controller.cs new file mode 100644 index 0000000..d870479 --- /dev/null +++ b/Source/MassGraves/Controller.cs @@ -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(); + HarmonyInstance.Create("MassGraves.Harmony").PatchAll(Assembly.GetExecutingAssembly()); + } + + public override string SettingsCategory() + { + return "MassGrave_Settings".Translate(); + } + + public override void DoSettingsWindowContents(Rect inRect) + { + settings.DoWindowContents(inRect); + } + } +} diff --git a/Source/MassGraves/GraveDefOf.cs b/Source/MassGraves/GraveDefOf.cs new file mode 100644 index 0000000..7c22d0a --- /dev/null +++ b/Source/MassGraves/GraveDefOf.cs @@ -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; + } +} diff --git a/Source/MassGraves/Harmony-Designator_Build.cs b/Source/MassGraves/Harmony-Designator_Build.cs new file mode 100644 index 0000000..ca79887 --- /dev/null +++ b/Source/MassGraves/Harmony-Designator_Build.cs @@ -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; + } + } +} diff --git a/Source/MassGraves/MassGraves.csproj b/Source/MassGraves/MassGraves.csproj new file mode 100644 index 0000000..5a837a4 --- /dev/null +++ b/Source/MassGraves/MassGraves.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {FA1972A2-44E7-4991-A7A8-43BC9223ED5C} + Library + Properties + MassGraves + MassGraves + v3.5 + 512 + + + + false + none + false + ..\..\Assemblies\ + + + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\Assemblies\0Harmony.dll + False + + + ..\..\..\..\RimWorld1546Win_Data\Managed\Assembly-CSharp.dll + False + + + + + + + + + + + ..\..\..\..\RimWorld1546Win_Data\Managed\UnityEngine.dll + False + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/MassGraves/Properties/AssemblyInfo.cs b/Source/MassGraves/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8ba7572 --- /dev/null +++ b/Source/MassGraves/Properties/AssemblyInfo.cs @@ -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")] diff --git a/Source/MassGraves/Settings.cs b/Source/MassGraves/Settings.cs new file mode 100644 index 0000000..e58438e --- /dev/null +++ b/Source/MassGraves/Settings.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RimWorld; +using Verse; +using UnityEngine; + +namespace MassGraves +{ + public class Settings : ModSettings + { + private int corpseCapacity = 20; + private bool useAlt = false; + + public int CorpseCapacity => corpseCapacity; + public bool UseAlt => useAlt; + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref corpseCapacity, "corpseCapacity", 20); + Scribe_Values.Look(ref useAlt, "useAlt", false); + } + + public void DoWindowContents(Rect canvas) + { + Listing_Standard list = new Listing_Standard(); + list.ColumnWidth = canvas.width / 3; + list.Begin(canvas); + Text.Font = GameFont.Medium; + list.Label("MassGrave_Capacity".Translate()); + Text.Font = GameFont.Small; + string str = corpseCapacity.ToString(); + list.TextFieldNumeric(ref corpseCapacity, ref str, 1); + list.Gap(); + list.CheckboxLabeled("MassGrave_UseAlt".Translate(), ref useAlt); + list.End(); + } + } +} diff --git a/Textures/Things/MassGrave/MassGraveEmpty.png b/Textures/Things/MassGrave/MassGraveEmpty.png new file mode 100644 index 0000000..81ced58 Binary files /dev/null and b/Textures/Things/MassGrave/MassGraveEmpty.png differ diff --git a/Textures/Things/MassGrave/MassGraveFull.png b/Textures/Things/MassGrave/MassGraveFull.png new file mode 100644 index 0000000..ff33066 Binary files /dev/null and b/Textures/Things/MassGrave/MassGraveFull.png differ diff --git a/Textures/Things/MassGraveAlt/GraveEmpty_back.png b/Textures/Things/MassGraveAlt/GraveEmpty_back.png new file mode 100644 index 0000000..9baf17d Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveEmpty_back.png differ diff --git a/Textures/Things/MassGraveAlt/GraveEmpty_front.png b/Textures/Things/MassGraveAlt/GraveEmpty_front.png new file mode 100644 index 0000000..9baf17d Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveEmpty_front.png differ diff --git a/Textures/Things/MassGraveAlt/GraveEmpty_side.png b/Textures/Things/MassGraveAlt/GraveEmpty_side.png new file mode 100644 index 0000000..4c28cc9 Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveEmpty_side.png differ diff --git a/Textures/Things/MassGraveAlt/GraveFull_back.png b/Textures/Things/MassGraveAlt/GraveFull_back.png new file mode 100644 index 0000000..f40b042 Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveFull_back.png differ diff --git a/Textures/Things/MassGraveAlt/GraveFull_front.png b/Textures/Things/MassGraveAlt/GraveFull_front.png new file mode 100644 index 0000000..f40b042 Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveFull_front.png differ diff --git a/Textures/Things/MassGraveAlt/GraveFull_side.png b/Textures/Things/MassGraveAlt/GraveFull_side.png new file mode 100644 index 0000000..f46817f Binary files /dev/null and b/Textures/Things/MassGraveAlt/GraveFull_side.png differ