Skip to content

Commit

Permalink
Added blood need exception list
Browse files Browse the repository at this point in the history
Added blood need exception list, so that players and modders can add races that do not need the blood meter in the needs menu.
  • Loading branch information
jecrell committed Aug 18, 2021
1 parent c4f969e commit 0165ee9
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 7 deletions.
Binary file modified 1.3/Assemblies/Vampire.dll
Binary file not shown.
25 changes: 25 additions & 0 deletions 1.3/Defs/_BloodNeedExceptions/BloodNeedExceptions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<!-- New as of 5-7-18 -->

<Vampire.BloodNeedExceptions>
<defName>ExceptionsList</defName>
<label>Exceptions List for Blood Meter in Needs Menu</label>
<description>Put Thing Classes and Race Defs (ThingDefs) for things that you do not want to have blood meters in this exception list definition.</description>
<thingClasses>
<li>ProjectJedi.PawnGhost</li> <!-- Ghosts should not bleed. -->
</thingClasses>
<raceThingDefs>
<li>Mech_Centipede</li>
<li>Mech_Lancer</li>
<li>Mech_Scyther</li>
<li>Mech_Pikeman</li>
<li>Mech_Termite</li>
<li>Megascarab</li>
<li>Spelopede</li>
<li>Megaspider</li>
</raceThingDefs>
</Vampire.BloodNeedExceptions>

</Defs>
6 changes: 5 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<li>jecrell.jecstools</li>
<li>Dubwise.DubsBadHygiene</li>
</loadAfter>
<description>1.23.0.2 (08-09-2021)
<description>1.23.1.0 (08-17-2021)

Adds vampires to RimWorld.

Expand All @@ -49,6 +49,10 @@ Michael Cailler, Jigsawjohn , Daniel Schott, Penelope Charli Whitman, Jerome Gon
========================
Changelog
========================
1.23.1.0 (08-17-2021)
========================
Added an exceptions xml file for controlling what races do not provide blood

1.23.0.2 (08-09-2021)
========================
Small fix to prevent red errors relating to Advanced Animal Framework
Expand Down
4 changes: 4 additions & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.23.1.0 (08-17-2021)
========================
Added an exceptions xml file for controlling what races do not provide blood

1.23.0.2 (08-09-2021)
========================
Small fix to prevent red errors relating to Advanced Animal Framework
Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RimOfMadness-Vampires</identifier>
<version>1.23.0.2</version>
<version>1.23.1.0</version>
<dependencies>
<li>jecrell.jecstools</li>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion About/Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.0.2
1.23.1.0
13 changes: 13 additions & 0 deletions Source/Vampires/Defs/BloodNeedExceptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using Verse;
using UnityEngine;

namespace Vampire
{
public class BloodNeedExceptions : Def
{
public List<string> thingClasses = null;
public List<ThingDef> raceThingDefs = null;
}
}
21 changes: 18 additions & 3 deletions Source/Vampires/HarmonyPatches/HarmonyPatches_Needs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,25 @@ public static void ShouldHaveNeed_Vamp(Pawn_NeedsTracker __instance, NeedDef nd,

string typeString = p.GetType().ToString();
//////Log.Message(typeString);
if (p.GetType().ToString() == "ProjectJedi.PawnGhost")
///
if (DefDatabase<BloodNeedExceptions>.GetNamedSilentFail("ExceptionsList") is Vampire.BloodNeedExceptions exceptionList)
{
__result = false;
return;
foreach (string s in exceptionList.thingClasses)
{
if (p?.GetType()?.ToString() == s)
{
__result = false;
return;
}
}
foreach (ThingDef d in exceptionList.raceThingDefs)
{
if (p?.def == d)
{
__result = false;
return;
}
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Vampires/Vampire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<Private>False</Private>
</Reference>
<Reference Include="BadHygiene">
<HintPath>..\..\..\..\BadHygiene.dll</HintPath>
<HintPath>..\..\..\BadHygiene.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CompAnimated">
Expand All @@ -73,6 +73,7 @@
<Compile Include="Components\MapComponent_HiddenTracker.cs" />
<Compile Include="Components\ThrallData.cs" />
<Compile Include="Components\TransformationDef.cs" />
<Compile Include="Defs\BloodNeedExceptions.cs" />
<Compile Include="Defs\VampDefOfTwo.cs" />
<Compile Include="Defs\VitaeAbilityDef.cs" />
<Compile Include="Dialog_VampireSetup.cs" />
Expand Down

0 comments on commit 0165ee9

Please sign in to comment.