Skip to content

Commit

Permalink
Merge pull request #100 from Rim-Of-Madness-Team/dev
Browse files Browse the repository at this point in the history
Hemogen patch, job fix, translation fix, VE skills fix
  • Loading branch information
jecrell authored Nov 18, 2022
2 parents 22d5c0c + f156853 commit 3f426b9
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 33 deletions.
Binary file modified 1.4/Assemblies/Vampire.dll
Binary file not shown.
6 changes: 5 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<li>jecrell.jecstools</li>
<li>Dubwise.DubsBadHygiene</li>
</loadAfter>
<description>1.28.0.0 (10-29-2022)
<description>1.28.0.1 (11-17-2022)

Adds vampires to RimWorld.

Expand All @@ -50,6 +50,10 @@ Darcilyn Lynds (darci.andel), Luke Salinas, RainerWingel , Noisy Koi, Lea Stanna
========================
Changelog
========================
1.28.0.1 (11-17-2022)
========================
Biotech users can feed vampires hemogen packs, fixed job giver bug, fixed translation bug

1.28.0.0 (10-29-2022)
========================
Updates for RimWorld 1.4; Fixes bed coffin coloration issues; Neck wounds are cleaned after biting
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.28.0.1 (11-17-2022)
========================
Biotech users can feed vampires hemogen packs, fixed job giver bug, fixed translation bug

1.28.0.0 (10-29-2022)
========================
Updates for RimWorld 1.4; Fixes bed coffin coloration issues; Neck wounds are cleaned after biting
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.28.0.0</version>
<version>1.28.0.1</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.28.0.0
1.28.0.1
27 changes: 27 additions & 0 deletions Biotech/1.4/Patches/ROMV_pHemogenPacks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Help: XPath Syntax: https://www.w3schools.com/xml/xpath_syntax.asp
-->

<Patch>
<!-- Hemogen packs are considered 'low blood' but better than animal packs -->
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationTest">
<xpath>/Defs/ThingDef[defName='HemogenPack']/comps</xpath>
</li>
<li Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[defName='HemogenPack']/comps</xpath>
<order>Prepend</order>
<value>
<li Class="Vampire.CompProperties_BloodItem">
<bloodType>LowBlood</bloodType>
<bloodPoints>2</bloodPoints>
</li>
</value>
</li>
</operations>
</Operation>

</Patch>
1 change: 1 addition & 0 deletions LoadFolders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<li>/</li>
<li>1.4</li>
<li IfModActive="Ludeon.RimWorld.Ideology">Ideology/1.4</li>
<li IfModActive="Ludeon.RimWorld.Ideology">Biotech/1.4</li>
</v1.4>
</loadFolders>
4 changes: 3 additions & 1 deletion Source/Code/HarmonyPatches/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ static partial class HarmonyPatches

static HarmonyPatches()
{
var harmony = new Harmony("rimworld.jecrell.vampire");
Harmony.DEBUG = false;

var harmony = new Harmony("rimworld.jecrell.vampire");

HarmonyPatches_Needs(harmony);

HarmonyPatches_Ingestion(harmony);
Expand Down
42 changes: 23 additions & 19 deletions Source/Code/HarmonyPatches/HarmonyPatches_Ingestion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,51 @@ public partial class HarmonyPatches
{
public static void HarmonyPatches_Ingestion(Harmony harmony)
{
//Log.Message("Ingestion: 1");
//Float Menus: Adds vampire blood consumption/consume buttons and hide regular consumption/consume
harmony.Patch(AccessTools.Method(typeof(FloatMenuMakerMap), "AddHumanlikeOrders"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(Vamp_FloatMenus_Consume)));


//Log.Message("Ingestion: 2");
//Vampires should not try to do drugs when idle.
harmony.Patch(AccessTools.Method(typeof(JobGiver_IdleJoy), "TryGiveJob"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(Vamps_DontDoIdleDrugs)));


//Log.Message("Ingestion: 3");
//Vampires should not be given food by wardens.
harmony.Patch(AccessTools.Method(typeof(Pawn_GuestTracker), "get_CanBeBroughtFood"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(Vamps_DontWantGuestFood)));


//Log.Message("Ingestion: 4");
harmony.Patch(AccessTools.Method(typeof(FoodUtility), "InappropriateForTitle"),
new HarmonyMethod(typeof(HarmonyPatches), nameof(WhoNeeds___Titles)));

//Log.Message("Ingestion: 5");
harmony.Patch(
AccessTools.Method(typeof(FoodUtility), "WillEat",
new[] { typeof(Pawn), typeof(Thing), typeof(Pawn), typeof(bool) }),
new[] { typeof(Pawn), typeof(Thing), typeof(Pawn),
//typeof(bool), RW1.4 unstable
typeof(bool) }),
new HarmonyMethod(typeof(HarmonyPatches), nameof(WillEat_Nothing)));

//Log.Message("Ingestion: 6");
harmony.Patch(
AccessTools.Method(typeof(FoodUtility), "WillEat",
new[] { typeof(Pawn), typeof(ThingDef), typeof(Pawn), typeof(bool) }),
new[] { typeof(Pawn), typeof(ThingDef), typeof(Pawn),
//typeof(bool), RW1.4 unstable
typeof(bool) }),
new HarmonyMethod(typeof(HarmonyPatches), nameof(WillEat_NothingDef)));


//Log.Message("Ingestion: 7");
harmony.Patch(AccessTools.Method(typeof(Toils_Ingest), "FinalizeIngest"),
new HarmonyMethod(typeof(HarmonyPatches), nameof(VampiresDontIngestFood)));


//Log.Message("Ingestion: 8");
//Fixes random red errors relating to food need checks in this method (WillIngestStackCountOf).
harmony.Patch(AccessTools.Method(typeof(FoodUtility), "WillIngestStackCountOf"),
new HarmonyMethod(typeof(HarmonyPatches), nameof(Vamp_WillIngestStackCountOf)));
//Log.Message("04");

//Log.Message("Ingestion: 9");
//Prevents restful times.
harmony.Patch(AccessTools.Method(typeof(JoyGiver_SocialRelax), "TryFindIngestibleToNurse"),
new HarmonyMethod(typeof(HarmonyPatches), nameof(INeverDrink___Wine)));
Expand Down Expand Up @@ -120,7 +128,8 @@ public static bool WhoNeeds___Titles(ThingDef food, Pawn p, bool allowIfStarving


// RimWorld.FoodUtility.WillEat (Thing)
public static bool WillEat_Nothing(Pawn p, Thing food, Pawn getter, bool careIfNotAcceptableForTitle,
public static bool WillEat_Nothing(Pawn p, Thing food, Pawn getter, bool careIfNotAcceptableForTitle,
//bool allowVenerated, RW 1.4 unstable
ref bool __result)
{
if (p.IsVampire(true))
Expand All @@ -140,7 +149,8 @@ public static bool WillEat_Nothing(Pawn p, Thing food, Pawn getter, bool careIfN


// RimWorld.FoodUtility.WillEat (ThingDef)
public static bool WillEat_NothingDef(Pawn p, ThingDef food, Pawn getter, bool careIfNotAcceptableForTitle,
public static bool WillEat_NothingDef(Pawn p, ThingDef food, Pawn getter, bool careIfNotAcceptableForTitle,
//bool allowVenerated, RW1.4 unstable
ref bool __result)
{
if (p.IsVampire(true))
Expand Down Expand Up @@ -180,7 +190,7 @@ private static void Vamp_FloatMenus_Consume(Vector3 clickPos, Pawn pawn, ref Lis

if (food?.def?.ingestible?.ingestCommandString == null ||
food.def.ingestible.ingestCommandString == "")
text = "ConsumeThing".Translate(food.LabelShort);
text = "ConsumeThing".Translate(food.LabelShort, food);
else
text = string.Format(food.def.ingestible.ingestCommandString, food.LabelShort);

Expand All @@ -194,10 +204,7 @@ private static void Vamp_FloatMenus_Consume(Vector3 clickPos, Pawn pawn, ref Lis
{
string text;
if (corpse.def.ingestible.ingestCommandString.NullOrEmpty())
text = "ConsumeThing".Translate(new object[]
{
corpse.LabelShort
});
text = "ConsumeThing".Translate(corpse.LabelShort, corpse);
else
text = string.Format(corpse.def.ingestible.ingestCommandString, corpse.LabelShort);

Expand All @@ -212,10 +219,7 @@ private static void Vamp_FloatMenus_Consume(Vector3 clickPos, Pawn pawn, ref Lis
{
var text = "";
if (bloodItem.def.ingestible.ingestCommandString.NullOrEmpty())
text = "ConsumeThing".Translate(new object[]
{
bloodItem.LabelShort
});
text = "ConsumeThing".Translate(bloodItem.LabelShort, bloodItem);
else
text = string.Format(bloodItem.def.ingestible.ingestCommandString, bloodItem.LabelShort);

Expand Down
2 changes: 2 additions & 0 deletions Source/Code/HarmonyPatches/HarmonyPatches_UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public static void Vamp_DrawCharacterCard(Rect rect, Pawn pawn, Action randomize
{
var guilty = pawn.guilt.IsGuilty;
var royalty = pawn.royalty.AllTitlesForReading.Count > 0;
var veSkills = ModsConfig.IsActive("vanillaexpanded.skills");
var distance = guilty ? 174 : 140;
distance += royalty ? 34 : 0;
distance += veSkills ? 41 : 0;
var rect7 = new Rect(CharacterCardUtility.BasePawnCardSize.x - distance, 14f, 30f, 30f);
TooltipHandler.TipRegion(rect7,
new TipSignal(
Expand Down
2 changes: 1 addition & 1 deletion Source/Code/Utilities/VampSunlightPathUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static bool TryGoingToHomePoint(Pawn pawn, out Job gotoJob)
{
gotoJob = null;
if (pawn.Faction == Faction.OfPlayerSilentFail && pawn.VampComp().VampLastHomePoint is { } homePoint &&
homePoint.IsValid)
homePoint.IsValid && pawn.CurJobDef != VampDefOf.ROMV_GotoSafety)
{
//Log.Message("VSPU :: Going home");
gotoJob = new Job(VampDefOf.ROMV_GotoSafety, homePoint) { locomotionUrgency = LocomotionUrgency.Sprint };
Expand Down
42 changes: 42 additions & 0 deletions Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,48 @@

</ItemGroup>
</When>
<When Condition=" '$(Configuration)' == 'RW1.4Unstable' ">
<PropertyGroup>
<OutputPath>..\1.4\Assemblies\</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.2.*" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.*-*" /> <!-- -* suffix allows beta/prerelease versions -->
</ItemGroup>

<!-- Note, all 'condition' hint paths will use the 'last' one in the list it finds -->
<!-- The order for these are:
- workshop (one directory up, two directories up)
- mod folder (one directory up, two directories up)
The reason for two directories up is that I (jecrell) normally mod in a seperate 'Workspace' directory
-->
<ItemGroup>
<Reference Include="DubsBadHygiene">
<HintPath>..\..\..\..\..\workshop\content\294100\836308268\1.4\Assemblies\BadHygiene.dll</HintPath>
<Private>false</Private>
</Reference>

<Reference Include="JecsTools">
<!-- Get a copy from the workshop directory if it exists... -->
<HintPath>..\..\JecsTools\1.4\Assemblies\0JecsTools.dll</HintPath>
<Private>false</Private>
</Reference>

<Reference Include="AbilityUser">
<HintPath>..\..\JecsTools\1.4\Assemblies\AbilityUser.dll</HintPath>
<Private>false</Private>
</Reference>

<Reference Include="CompAnimated">
<HintPath>..\..\JecsTools\1.4\Assemblies\CompAnimated.dll</HintPath>
<Private>false</Private>
</Reference>

</ItemGroup>
</When>
</Choose>

</Project>
7 changes: 5 additions & 2 deletions Source/Vampire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ Global
Release|Any CPU = Release|Any CPU
RW1.3|Any CPU = RW1.3|Any CPU
RW1.4|Any CPU = RW1.4|Any CPU
RW1.4Unstable|Any CPU = RW1.4Unstable|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4|Any CPU.ActiveCfg = RW1.4|Any CPU
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4|Any CPU.Build.0 = RW1.4|Any CPU
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4|Any CPU.ActiveCfg = RW1.4Unstable|Any CPU
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4|Any CPU.Build.0 = RW1.4Unstable|Any CPU
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4Unstable|Any CPU.ActiveCfg = RW1.4Unstable|Any CPU
{3A4FB893-1148-4E16-B548-867647DF1724}.RW1.4Unstable|Any CPU.Build.0 = RW1.4Unstable|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 7 additions & 7 deletions updateinfo
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
==============================

Rim of Madness - Vampires Update
v1.27.0.0 (08-08-2022)
v1.28.0.0 (10-29-2022)
====================

Meditation has been fixed. Vampire fangs now are added hediffs on tongues due to an underlying RimWorld issue that removes tongues if jaws are modified. Existing saves will have fangs moved to the new position. New settings for sun damage and rest added
Updates for RimWorld 1.4; Fixes bed coffin coloration issues; Neck wounds are cleaned after biting
--------------------

Download now on...
- Patreon: https://www.patreon.com/posts/rim-of-madness-1-54281813
- Patreon: https://www.patreon.com/posts/73953554
- GitHub: https://github.com/Rim-Of-Madness-Team/Rim-of-Madness---Vampires
- Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=1187010034
Discuss the mod on...
Expand All @@ -25,12 +25,12 @@ Discuss the mod on...
[img width=260]https://raw.githubusercontent.com/Rim-Of-Madness-Team/Rim-of-Madness---Vampires/master/About/Preview.png[/img]
[hr]
[b]Rim of Madness - Vampires
Version: 1.27.0.0
Updated: 08-08-2022
Description: [color=orange]Meditation has been fixed. Vampire fangs now are added hediffs on tongues due to an underlying RimWorld issue that removes tongues if jaws are modified. Existing saves will have fangs moved to the new position. New settings for sun damage and rest added[/color]
Version: 1.28.0.0
Updated: 10-29-2022
Description: [color=orange]Updates for RimWorld 1.4; Fixes bed coffin coloration issues; Neck wounds are cleaned after biting[/color]
[hr]
[b]Download now on...[/b]
[url=https://www.patreon.com/posts/rim-of-madness-1-54281813]Patreon[/url]
[url=https://www.patreon.com/posts/73953554]Patreon[/url]
[url=https://github.com/Rim-Of-Madness-Team/Rim-of-Madness---Vampires]GitHub[/url]
[url=https://steamcommunity.com/sharedfiles/filedetails/?id=1187010034]Steam[/url]
[b]Discuss the mod on...[/b]
Expand Down

0 comments on commit 3f426b9

Please sign in to comment.