-
-
Save anonymous/e1a2d761f15139f3c659 to your computer and use it in GitHub Desktop.
Grave Mod for Rimworld. Help pls :)
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using UnityEngine; | |
using RimWorld; | |
using Verse; | |
namespace Graves | |
{ | |
public class Building_Colonist_Grave : RimWorld.Building_Grave | |
{ | |
private static Graphic cachedGraphicFull; | |
private const string name = "Grave for Colonist"; | |
public override string Label | |
{ | |
get | |
{ | |
return name; | |
} | |
} | |
private Graphic GraphicFull | |
{ | |
get | |
{ | |
if (Building_Colonist_Grave.cachedGraphicFull == null) | |
Building_Colonist_Grave.cachedGraphicFull = GraphicDatabase.Get<Graphic_Single>("Things/Building/Misc/GraveFull", ShaderDatabase.Cutout, this.def.size + IntVec2.two, Color.white); | |
return Building_Colonist_Grave.cachedGraphicFull; | |
} | |
} | |
public override Graphic Graphic | |
{ | |
get | |
{ | |
Thing storable = StoreUtility.GetStorable(this.Position); | |
if (storable != null && storable is Corpse) | |
{ | |
return this.GraphicFull; | |
} | |
return this.def.graphic; | |
} | |
} | |
public override void Notify_ReceivedThing(Thing newItem) | |
{ | |
Find.MapDrawer.MapChanged(this.Position, MapChangeType.Things); | |
} | |
public override void Notify_LostThing(Thing newItem) | |
{ | |
Find.MapDrawer.MapChanged(this.Position, MapChangeType.Things); | |
} | |
[DebuggerHidden] | |
public override IEnumerable<IntVec3> AllSlotCells() | |
{ | |
return base.AllSlotCells(); | |
} | |
} | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using UnityEngine; | |
using RimWorld; | |
using Verse; | |
namespace Graves | |
{ | |
public class Building_Stranger_Grave : RimWorld.Building_Grave | |
{ | |
private static Graphic cachedGraphicFull; | |
private const string name = "Grave for Stranger"; | |
public override string Label | |
{ | |
get | |
{ | |
return name; | |
} | |
} | |
private Graphic GraphicFull | |
{ | |
get | |
{ | |
if (Building_Stranger_Grave.cachedGraphicFull == null) | |
Building_Stranger_Grave.cachedGraphicFull = GraphicDatabase.Get<Graphic_Single>("Things/Building/Misc/GraveFull", ShaderDatabase.Cutout, this.def.size + IntVec2.two, Color.white); | |
return Building_Stranger_Grave.cachedGraphicFull; | |
} | |
} | |
public override Graphic Graphic | |
{ | |
get | |
{ | |
Thing storable = StoreUtility.GetStorable(this.Position); | |
if (storable != null && storable is Corpse) | |
{ | |
return this.GraphicFull; | |
} | |
return this.def.graphic; | |
} | |
} | |
public override void Notify_ReceivedThing(Thing newItem) | |
{ | |
Find.MapDrawer.MapChanged(this.Position, MapChangeType.Things); | |
} | |
public override void Notify_LostThing(Thing newItem) | |
{ | |
Find.MapDrawer.MapChanged(this.Position, MapChangeType.Things); | |
} | |
[DebuggerHidden] | |
public override IEnumerable<IntVec3> AllSlotCells() | |
{ | |
return base.AllSlotCells(); | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<Buildings> | |
<ThingDef Name="BuildingBase" Abstract="True"> | |
<category>Building</category> | |
<soundImpactDefault>BulletImpactMetal</soundImpactDefault> | |
<selectable>true</selectable> | |
<drawerType>MapMeshAndRealTime</drawerType> | |
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded> | |
<repairEffect>Repair</repairEffect> | |
<leaveResourcesWhenKilled>true</leaveResourcesWhenKilled> | |
<filthLeaving>BuildingRubble</filthLeaving> | |
</ThingDef> | |
<!-- Grave building definition --> | |
<ThingDef ParentName="BuildingBase"> | |
<defName>Grave</defName> | |
<eType>BuildingInert</eType> | |
<label>Grave</label> | |
<thingClass>Building_Grave</thingClass> | |
<graphicPath>Things/Building/Misc/GraveEmpty</graphicPath> | |
<graphicClass>Graphic_Single</graphicClass> | |
<graphicOverdraw>true</graphicOverdraw> | |
<constructEffect>ConstructDirt</constructEffect> | |
<altitudeLayer>FloorEmplacement</altitudeLayer> | |
<useStandardHealth>false</useStandardHealth> | |
<description>Place the dead in graves to give them a decent final resting place.</description> | |
<size>(1,2)</size> | |
<statBases> | |
<WorkToMake>650</WorkToMake> | |
</statBases> | |
<passability>Standable</passability> | |
<building> | |
<fixedStorageSettings> | |
<allowances> | |
<categories> | |
<li>Corpses</li> | |
</categories> | |
</allowances> | |
</fixedStorageSettings> | |
<defaultStorageSettings> | |
<priority>Important</priority> | |
<allowances> | |
<categories> | |
<li>CorpsesHumanoid</li> | |
</categories> | |
<specialFiltersToAllow> | |
<li>AllowBuried</li> | |
</specialFiltersToAllow> | |
</allowances> | |
</defaultStorageSettings> | |
</building> | |
<inspectorTabs> | |
<li>ITab_Storage</li> | |
</inspectorTabs> | |
<terrainAffordanceNeeded>Diggable</terrainAffordanceNeeded> | |
<designationCategory>Misc</designationCategory> | |
<itemSurface>true</itemSurface> | |
<designationHotkey>G</designationHotkey> | |
</ThingDef> | |
<ThingDef ParentName="BuildingBase"> | |
<defName>ColonistGrave</defName> | |
<eType>BuildingInert</eType> | |
<label>Grave for Colonist</label> | |
<thingClass>Graves.Building_Colonist_Grave</thingClass> | |
<graphicPath>Things/Building/Misc/GraveEmpty</graphicPath> | |
<graphicClass>Graphic_Single</graphicClass> | |
<graphicOverdraw>true</graphicOverdraw> | |
<constructEffect>ConstructDirt</constructEffect> | |
<altitudeLayer>FloorEmplacement</altitudeLayer> | |
<useStandardHealth>false</useStandardHealth> | |
<description>Place the dead in graves to give them a decent final resting place. Preset for Colonists only</description> | |
<size>(1,2)</size> | |
<statBases> | |
<WorkToMake>650</WorkToMake> | |
</statBases> | |
<passability>Standable</passability> | |
<building> | |
<fixedStorageSettings> | |
<allowances> | |
<categories> | |
<li>Corpses</li> | |
</categories> | |
</allowances> | |
</fixedStorageSettings> | |
<defaultStorageSettings> | |
<priority>Important</priority> | |
<allowances> | |
<categories> | |
<li>CorpsesHumanoid</li> | |
</categories> | |
<specialFiltersToAllow> | |
<li>AllowBuried</li> | |
</specialFiltersToAllow> | |
<specialFiltersToDisallow> | |
<li>AllowCorpsesStranger</li> | |
</specialFiltersToDisallow> | |
</allowances> | |
</defaultStorageSettings> | |
</building> | |
<inspectorTabs> | |
<li>ITab_Storage</li> | |
</inspectorTabs> | |
<terrainAffordanceNeeded>Diggable</terrainAffordanceNeeded> | |
<designationCategory>Misc</designationCategory> | |
<itemSurface>true</itemSurface> | |
<designationHotkey>H</designationHotkey> | |
</ThingDef> | |
<ThingDef ParentName="BuildingBase"> | |
<defName>StrangerGrave</defName> | |
<eType>BuildingInert</eType> | |
<label>Grave for Stranger</label> | |
<thingClass>Graves.Building_Stranger_Grave</thingClass> | |
<graphicPath>Things/Building/Misc/GraveEmpty</graphicPath> | |
<graphicClass>Graphic_Single</graphicClass> | |
<graphicOverdraw>true</graphicOverdraw> | |
<constructEffect>ConstructDirt</constructEffect> | |
<altitudeLayer>FloorEmplacement</altitudeLayer> | |
<useStandardHealth>false</useStandardHealth> | |
<description>Place the dead in graves to give them a decent final resting place. Preset for Strangers only</description> | |
<size>(1,2)</size> | |
<statBases> | |
<WorkToMake>650</WorkToMake> | |
</statBases> | |
<passability>Standable</passability> | |
<building> | |
<fixedStorageSettings> | |
<allowances> | |
<categories> | |
<li>Corpses</li> | |
</categories> | |
</allowances> | |
</fixedStorageSettings> | |
<defaultStorageSettings> | |
<priority>Important</priority> | |
<allowances> | |
<categories> | |
<li>CorpsesHumanoid</li> | |
</categories> | |
<specialFiltersToAllow> | |
<li>AllowBuried</li> | |
</specialFiltersToAllow> | |
<specialFiltersToDisallow> | |
<li>AllowCorpsesColonist</li> | |
</specialFiltersToDisallow> | |
</allowances> | |
</defaultStorageSettings> | |
</building> | |
<inspectorTabs> | |
<li>ITab_Storage</li> | |
</inspectorTabs> | |
<terrainAffordanceNeeded>Diggable</terrainAffordanceNeeded> | |
<designationCategory>Misc</designationCategory> | |
<itemSurface>true</itemSurface> | |
<designationHotkey>J</designationHotkey> | |
</ThingDef> | |
</Buildings> |
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
using System; | |
using System.Collections.Generic; | |
using RimWorld; | |
using Verse; | |
namespace Graves | |
{ | |
class MapComponent_Graves : MapComponent | |
{ | |
private int updateCounter = 0; | |
private const int updateInterval = 500; | |
public override void MapComponentOnGUI() | |
{ | |
--this.updateCounter; | |
if (this.updateCounter > 0) | |
return; | |
this.updateCounter = 250; | |
List<Building> buildings = Find.ListerBuildings.allBuildingsColonist; | |
foreach (Building current in buildings) | |
{ | |
if (current.GetType() == typeof(Building_Grave) | |
|| current.GetType() == typeof(Building_Mass_Grave) | |
|| current.GetType() == typeof(Building_Colonist_Grave) | |
|| current.GetType() == typeof(Building_Stranger_Grave)) | |
{ | |
if (current.def != ThingDefOf.Grave) | |
{ | |
current.def = ThingDefOf.Grave; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment