Skip to content

Commit

Permalink
1.24.0.0 Additional Robot Support
Browse files Browse the repository at this point in the history
Added support for VexedTree's mods (Robots and Skeletons). Coolant vomit filth added. Chance changed to 95% chance for coolant vomit for non-coolant using creatures. Added patch and edit support. A list of coolant users is available in the Defs folder
  • Loading branch information
jecrell committed Jun 24, 2022
1 parent 0165ee9 commit fc2ed0b
Show file tree
Hide file tree
Showing 26 changed files with 217 additions and 39 deletions.
Binary file modified 1.3/Assemblies/Vampire.dll
Binary file not shown.
26 changes: 26 additions & 0 deletions 1.3/Defs/Effects_Vomit/ROMV_Vomit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,30 @@
</graphicData>
</ThingDef>

<EffecterDef>
<defName>ROMV_CoolantVomit</defName>
<children>
<li>
<subEffecterClass>SubEffecter_SprayerContinuous</subEffecterClass>
<scale>
<min>0.5</min>
<max>0.7</max>
</scale>
<ticksBetweenMotes>20</ticksBetweenMotes>
<positionLerpFactor>0.35</positionLerpFactor>
<positionRadius>0.2</positionRadius>
<moteDef>ROMV_Mote_CoolantVomitBit</moteDef>
</li>
</children>
</EffecterDef>


<ThingDef ParentName="FoodBitBase">
<defName>ROMV_Mote_CoolantVomitBit</defName>
<graphicData>
<texPath>Things/Mote/CoolantVomitBit</texPath>
<shaderType>Mote</shaderType>
</graphicData>
</ThingDef>

</Defs>
27 changes: 27 additions & 0 deletions 1.3/Defs/ThingDefs_Filth/Filth_Coolant.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<!--=================== Fluids etc =================-->

<ThingDef ParentName="BaseFilth">
<defName>ROMV_Filth_Coolant</defName>
<label>coolant</label>
<statBases>
<Beauty>-30</Beauty>
<Cleanliness>-10</Cleanliness>
</statBases>
<graphicData>
<texPath>Things/Filth/Spatter</texPath>
<color>(220, 220, 220, 180)</color>
</graphicData>
<filth>
<ignoreFilthMultiplierStat>true</ignoreFilthMultiplierStat>
<disappearsInDays>35~40</disappearsInDays>
<rainWashes>true</rainWashes>
<cleaningWorkToReduceThickness>70</cleaningWorkToReduceThickness>
<canFilthAttach>true</canFilthAttach>
<cleaningSound>Interact_CleanFilth_Fluid</cleaningSound>
</filth>
</ThingDef>

</Defs>
2 changes: 0 additions & 2 deletions 1.3/Defs/_BloodNeedExceptions/BloodNeedExceptions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?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>
Expand Down
22 changes: 22 additions & 0 deletions 1.3/Defs/_BloodNeedExceptions/CoolantInsteadOfBlood.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<Vampire.CoolantUsers>
<defName>ROMV_CoolantUsers</defName>
<label>Users of coolant instead of Blood Meter in Needs Menu</label>
<description>Put Thing Classes and Race Defs (ThingDefs) for things that you want to have coolant meters instead of blood in the Needs menu.</description>
<!--
<raceThingDefs>
<li>Example</li>
</raceThingDefs>
-->
<hediffGiverDefs>
<li>ChjAndroidStandard</li>
<li>AndroidStandardAtlas</li>
<li>MechanicalStandard</li>
<li>MechanentStandard</li>
<li>PersonaStandard</li>
</hediffGiverDefs>
</Vampire.CoolantUsers>

</Defs>
8 changes: 8 additions & 0 deletions 1.3/Languages/English/Keyed/EngROMV.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>


<!-- 6-24-22 -->
<ROMV_Coolant>Coolant</ROMV_Coolant>
<ROMV_CoolantVitae>Simulacrae</ROMV_CoolantVitae>
<ROMV_CoolantVitaeDesc>After attempting to process newly input coolant and strangely receiving drops of vampire blood, this unit's systems have synthesized a variant of vitae to allow for continued processing and system functionality.</ROMV_CoolantVitaeDesc>
<ROMV_CoolantDesc>Without coolant, this unit will cease to function. Curiously, this behaves very similarly to blood. Organic Vampires that attempt to feed on coolant, however, may have a hard time keeping it down.</ROMV_CoolantDesc>


<!-- 3-9-20-->
<ROMV_VampiresOnly>Vampires only</ROMV_VampiresOnly>
<ROMV_VampiresOnlyDesc>Only vampires can utilize this bed.</ROMV_VampiresOnlyDesc>
Expand Down
8 changes: 6 additions & 2 deletions 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.1.0 (08-17-2021)
<description>1.24.0.0 (06-24-2022)

Adds vampires to RimWorld.

Expand All @@ -44,11 +44,15 @@ Avilable languages: English, Spanish (by Daru), and Russian (by kr33man)
Thank you to my Patrons for supporting me in my efforts. Without you, none of this would be possible.

These are the most excellent rim dwellers who support me:
Michael Cailler, Jigsawjohn , Daniel Schott, Penelope Charli Whitman, Jerome Gonschorek, Genaeve , RainerWingel , Lea Stannard, David Silberstein, 수현 남, Matt Harris, Kiya Nicoll, Paul Fenwick, Matthew Isom, Elodie , Михаил Юрченко, Charlie Garnham, Populous25 , Landon Cash, Marcus Sireanu, Maaxar , logan sheppard-organ, TinyATuin, Don Homer, Sharp Spook, roxxploxx , Dan Jones, Kaz, Justin Andres, Alex Mederer, Justin , iknowdude00, E_T , Alexander , Ken Birdwell, Michael Cailler, Jigsawjohn , Daniel Schott, Penelope Charli Whitman, Jerome Gonschorek, Genaeve , RainerWingel , Lea Stannard, David Silberstein, 수현 남, Matt Harris, Kiya Nicoll, Paul Fenwick, Matthew Isom, Elodie , Михаил Юрченко, Charlie Garnham, Populous25 , Landon Cash, Marcus Sireanu, Maaxar , logan sheppard-organ, TinyATuin, Don Homer, Sharp Spook, roxxploxx , Dan Jones, Kaz, Justin Andres, Alex Mederer, Justin , iknowdude00, E_T , Alexander , Ken Birdwell
Michael Fisher, Storm D Bain, Luke Salinas, WonkyWoo WeebHoo, Daniel Schott, RainerWingel , Lea Stannard, David Silberstein, Matt Harris, Kiya Nicoll, Paul Fenwick, Elodie , Genaeve , David Turner, Populous25 , Matthew Isom, Charlie Garnham, TinyATuin, Michael Cailler, Jimes Tooper, Landon Cash, Sharp Spook, Don Homer, roxxploxx , Alex Mederer, Justin Andres, Dan Jones, Kaz, Michael Whitehead, iknowdude00, Alexander , Ken Birdwell, Michael Fisher, Storm D Bain, Luke Salinas, WonkyWoo WeebHoo, Daniel Schott, RainerWingel , Lea Stannard, David Silberstein, Matt Harris, Kiya Nicoll, Paul Fenwick, Elodie , Genaeve , David Turner, Populous25 , Matthew Isom, Charlie Garnham, TinyATuin, Michael Cailler, Jimes Tooper, Landon Cash, Sharp Spook, Don Homer, roxxploxx , Alex Mederer, Justin Andres, Dan Jones, Kaz, Michael Whitehead, iknowdude00, Alexander , Ken Birdwell

========================
Changelog
========================
1.24.0.0 (06-24-2022)
========================
Added support for VexedTree's mods (Robots and Skeletons). Coolant vomit filth added. Chance changed to 95% chance for coolant vomit for non-coolant using creatures. Added patch and edit support. A list of coolant users is available in the Defs folder

1.23.1.0 (08-17-2021)
========================
Added an exceptions xml file for controlling what races do not provide blood
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.24.0.0 (06-24-2022)
========================
Added support for VexedTree's mods (Robots and Skeletons). Coolant vomit filth added. Chance changed to 95% chance for coolant vomit for non-coolant using creatures. Added patch and edit support. A list of coolant users is available in the Defs folder

1.23.1.0 (08-17-2021)
========================
Added an exceptions xml file for controlling what races do not provide blood
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.1.0</version>
<version>1.24.0.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.1.0
1.24.0.0
8 changes: 6 additions & 2 deletions Source/Vampires/AI_Jobs/JobDriver_BloodVomit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ protected override IEnumerable<Toil> MakeNewToils()
int curTicks = ticksLeft;
if (curTicks % 150 == 149)
{
FilthMaker.TryMakeFilth(pawn.CurJob.targetA.Cell, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelIndefinite());
Pawn sourcePawn = pawn?.VampComp()?.MostRecentVictim != null ? pawn.VampComp()?.MostRecentVictim : pawn;
FilthMaker.TryMakeFilth(pawn.CurJob.targetA.Cell, pawn.Map, BloodUtility.GetBloodFilthDef(sourcePawn), sourcePawn.LabelIndefinite());
if (pawn.BloodNeed() is Need_Blood n && n.CurBloodPoints > 0)
{
n.AdjustBlood(-1);
Expand All @@ -72,7 +73,10 @@ protected override IEnumerable<Toil> MakeNewToils()
}
};
to.defaultCompleteMode = ToilCompleteMode.Never;
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_BloodVomit"), TargetIndex.A);
if (pawn?.VampComp()?.MostRecentVictim != null && pawn?.VampComp()?.MostRecentVictim?.IsCoolantUser() == true)
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_CoolantVomit"), TargetIndex.A);
else
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_BloodVomit"), TargetIndex.A);
to.PlaySustainerOrSound(() => SoundDef.Named("Vomit"));
yield return to;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Vampires/AI_Jobs/JobDriver_Diablerie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override void Notify_Starting()

private void DoEffect()
{
pawn.VampComp().MostRecentVictim = Victim;
BloodVictim.TransferBloodTo(1, BloodFeeder, false);
if (!Victim.InAggroMentalState)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Vampires/AI_Jobs/JobDriver_Embrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public override void Notify_Starting()

private void DoEffect()
{
pawn.VampComp().MostRecentVictim = Victim;
BloodVictim.TransferBloodTo(1, BloodFeeder);
}

Expand Down
7 changes: 5 additions & 2 deletions Source/Vampires/AI_Jobs/JobDriver_Feed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class JobDriver_Feed : JobDriver
{
private float workLeft = -1f;
public static float BaseFeedTime = 320f;
public static float BaseCoolantThrowupChance = 0.25f;
public static float BaseCoolantThrowupChance = 0.95f;

protected Pawn Victim => job.targetA.Thing as Pawn;
protected CompVampire CompVictim => Victim.GetComp<CompVampire>();
Expand All @@ -23,11 +23,14 @@ public class JobDriver_Feed : JobDriver

public virtual void DoEffect()
{
if (BloodFeeder == null || Victim == null || BloodVictim == null) return;

BloodVictim.TransferBloodTo(1, BloodFeeder);
if (Victim.IsAndroid() && !pawn.IsAndroid())
if (Victim.IsCoolantUser() && !pawn.IsCoolantUser())
{
if (Rand.Value <= BaseCoolantThrowupChance)
{
pawn.VampComp().MostRecentVictim = Victim;
EndJobWith(JobCondition.Incompletable);
pawn.jobs.StartJob(new Job(JobDefOf.Vomit, pawn.PositionHeld));
}
Expand Down
1 change: 1 addition & 0 deletions Source/Vampires/AI_Jobs/JobDriver_FeedAndDestroy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected Pawn Master

private void DoEffect()
{
pawn.VampComp().MostRecentVictim = Victim;
BloodVictim.TransferBloodTo(1, Master.BloodNeed());
if (Victim.health.hediffSet.GetNotMissingParts().ToList().FindAll(x => x.depth == BodyPartDepth.Inside) is List<BodyPartRecord> parts)
{
Expand Down
10 changes: 9 additions & 1 deletion Source/Vampires/Components/CompVampire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class CompVampire : CompAbilityUser
#region Variables

private Pawn sire = null;
private Pawn mostRecentVictim = null;
private List<Pawn> childer = null;
private List<Pawn> ghouls = null;
private List<Pawn> souls = new List<Pawn>();
Expand Down Expand Up @@ -180,6 +181,12 @@ public Pawn Sire
set => sire = value;
}

public Pawn MostRecentVictim
{
get => mostRecentVictim;
set => mostRecentVictim = value;
}

public ThrallData ThrallData
{
get => thrallData;
Expand Down Expand Up @@ -704,14 +711,15 @@ public override IEnumerable<Gizmo> CompGetGizmosExtra()

public override void PostExposeData()
{
Scribe_References.Look(ref sire, "sire");
Scribe_Defs.Look(ref bloodline, "bloodline");
Scribe_Values.Look(ref beenGhoulBefore, "beenGhoulBefore", false);
Scribe_Values.Look(ref generation, "generation");
Scribe_Values.Look(ref level, "level");
Scribe_Values.Look(ref xp, "xp");
Scribe_Values.Look(ref abilityPoints, "abilityPoints");
Scribe_Values.Look(ref curSunlightPolicy, "curSunlightPolicy", SunlightPolicy.Restricted);
Scribe_References.Look(ref sire, "sire");

Scribe_Collections.Look(ref souls, "souls", LookMode.Reference);
Scribe_Deep.Look(ref sheet, "sheet", new object[] { AbilityUser });
Scribe_Deep.Look(ref thrallData, "thrallData", new object[] { AbilityUser });
Expand Down
15 changes: 15 additions & 0 deletions Source/Vampires/Defs/CoolantUsers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Verse;
using UnityEngine;
using RimWorld;

namespace Vampire
{
public class CoolantUsers : Def
{
public List<string> thingClasses = null;
public List<string> raceThingDefs = null;
public List<string> hediffGiverDefs = null;
}
}
8 changes: 7 additions & 1 deletion Source/Vampires/Disciplines/Blood/DisciplineEffect_Hunger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public virtual void Effect()
{
CasterPawn.Drawer.Notify_DebugAffected();
MoteMaker.ThrowText(CasterPawn.DrawPos, CasterPawn.Map, AbilityUser.StringsToTranslate.AU_CastSuccess);
bool coolantUser = VampireUtility.IsCoolantUser(CasterPawn);
int num = GenRadial.NumCellsInRadius(3.9f);
for (int i = 0; i < num; i++)
{
Expand All @@ -18,7 +19,12 @@ public virtual void Effect()
{
List<Thing> temp = new List<Thing>(things);
foreach (Thing t in temp)
{
{
if (coolantUser && t.def.defName == "ROMV_Filth_Coolant" )
{
CasterPawn.BloodNeed().AdjustBlood(1);
t.Destroy();
}
if (t.def.defName == "Filth_Blood")
{
CasterPawn.BloodNeed().AdjustBlood(1);
Expand Down
9 changes: 7 additions & 2 deletions Source/Vampires/HarmonyPatches/HarmonyPatches_Needs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ public static bool MakeNewToils_VampVomit(JobDriver_Vomit __instance, ref IEnume
int curTicks = Traverse.Create(__instance).Field("ticksLeft").GetValue<int>();
if (curTicks % 150 == 149)
{
Pawn sourcePawn = __instance.pawn?.VampComp().MostRecentVictim != null ? __instance.pawn.VampComp().MostRecentVictim : __instance.pawn;
ThingDef vomitFilthDef = BloodUtility.GetBloodFilthDef(sourcePawn);
FilthMaker.TryMakeFilth(__instance.pawn.CurJob.targetA.Cell, __instance.pawn.Map,
ThingDefOf.Filth_Blood, __instance.pawn.LabelIndefinite());
vomitFilthDef, __instance.pawn.LabelIndefinite());
if (__instance.pawn.BloodNeed() is Need_Blood n && n.CurBloodPoints > 0)
{
n.AdjustBlood(-1);
Expand All @@ -165,7 +167,10 @@ public static bool MakeNewToils_VampVomit(JobDriver_Vomit __instance, ref IEnume
}
};
to.defaultCompleteMode = ToilCompleteMode.Never;
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_BloodVomit"), TargetIndex.A);
if (__instance.pawn?.VampComp()?.MostRecentVictim != null && __instance.pawn?.VampComp()?.MostRecentVictim?.IsCoolantUser() == true)
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_CoolantVomit"), TargetIndex.A);
else
to.WithEffect(DefDatabase<EffecterDef>.GetNamed("ROMV_BloodVomit"), TargetIndex.A);
to.PlaySustainerOrSound(() => SoundDef.Named("Vomit"));
__result = __result.AddItem(to);

Expand Down
Loading

0 comments on commit fc2ed0b

Please sign in to comment.