Skip to content

Commit

Permalink
Changes here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
jecrell committed May 1, 2018
1 parent d450bad commit 5be4f43
Show file tree
Hide file tree
Showing 23 changed files with 1,119 additions and 1,420 deletions.
Binary file modified Assemblies/0JecsTools.dll
Binary file not shown.
Binary file modified Assemblies/AbilityUser.dll
Binary file not shown.
Binary file modified Assemblies/AbilityUserAI.dll
Binary file not shown.
Binary file modified Assemblies/CompActivatableEffect.dll
Binary file not shown.
Binary file modified Assemblies/CompAnimated.dll
Binary file not shown.
Binary file modified Assemblies/CompDeflector.dll
Binary file not shown.
Binary file modified Assemblies/CompDelayedSpawner.dll
Binary file not shown.
Binary file modified Assemblies/CompExtraSounds.dll
Binary file not shown.
Binary file modified Assemblies/CompInstalledPart.dll
Binary file not shown.
Binary file modified Assemblies/CompLumbering.dll
Binary file not shown.
Binary file modified Assemblies/CompOverlays.dll
Binary file not shown.
Binary file modified Assemblies/CompOversizedWeapon.dll
Binary file not shown.
Binary file modified Assemblies/CompSlotLoadable.dll
Binary file not shown.
Binary file modified Assemblies/CompToggleDef.dll
Binary file not shown.
Binary file modified Assemblies/CompVehicle.dll
Binary file not shown.
8 changes: 5 additions & 3 deletions Source/.idea/.idea.JecsTools/.idea/contentModel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,445 changes: 1,051 additions & 1,394 deletions Source/.idea/.idea.JecsTools/.idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions Source/AllModdingComponents/CompVehicle/HarmonyCompVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ static HarmonyCompVehicle()
///

//harmony.Patch(AccessTools.)
harmony.Patch(AccessTools.Method(typeof(PawnUtility), "IsTravelingInTransportPodWorldObject"), null,
new HarmonyMethod(typeof(HarmonyCompVehicle),
nameof(PreventAssigningRandomFaction)));
// harmony.Patch(AccessTools.Method(typeof(PawnUtility), "IsTravelingInTransportPodWorldObject"), null,
// new HarmonyMethod(typeof(HarmonyCompVehicle),
// nameof(PreventAssigningRandomFaction)));
harmony.Patch(AccessTools.Method(typeof(SocialCardUtility), "Recache"), new HarmonyMethod(
typeof(HarmonyCompVehicle),
nameof(SocialTabNullHandling)), null);
Expand Down Expand Up @@ -703,12 +703,6 @@ public static IEnumerable<CodeInstruction> FightActionTranspiler(IEnumerable<Cod
// J This patch allows colonists to freely join vehicles
// without having their factions randomly switched around.
// RimWorld.PawnUtility
public static void PreventAssigningRandomFaction(ref bool __result, Pawn pawn)
{
var prevResult = __result;
//Check for vehicles...
__result = prevResult || ThingOwnerUtility.AnyParentIs<VehicleHandlerGroup>(pawn);
}


//S Bug fixes social tab issue with vehicles
Expand Down
10 changes: 10 additions & 0 deletions Source/AllModdingComponents/JecsTools/ApparelExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using Verse;

namespace JecsTools
{
public class ApparelExtension : DefModExtension
{
public List<string> coverage = new List<string>();
}
}
55 changes: 45 additions & 10 deletions Source/AllModdingComponents/JecsTools/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,54 @@ static HarmonyPatches()
new HarmonyMethod(typeof(HarmonyPatches), nameof(Post_GetPostArmorDamage)));
harmony.Patch(AccessTools.Method(typeof(PawnGenerator), "GeneratePawnInternal"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(Post_GeneratePawnInternal)));
harmony.Patch(AccessTools.Method(typeof(ApparelUtility), "CanWearTogether"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(Post_CanWearTogether)));


/* harmony.Patch(
AccessTools.Method(typeof(DamageWorker_AddInjury), "FinalizeAndAddInjury",
new[]
{
typeof(Pawn), typeof(Hediff_Injury), typeof(DamageInfo),
AccessTools.TypeByName("DamageResult").MakeByRefType()
}),
new HarmonyMethod(typeof(HarmonyPatches),
nameof(ApplyProperDamage)), null);*/
}

/// <summary>
/// Using the new ApparelExtension, we can have a string based apparel check.
/// </summary>
/// <param name="A"></param>
/// <param name="B"></param>
/// <param name="body"></param>
/// <param name="__result"></param>
public static void Post_CanWearTogether(ThingDef A, ThingDef B, BodyDef body, ref bool __result)
{
var aHasExt = A.HasModExtension<ApparelExtension>();
var bHasExt = B.HasModExtension<ApparelExtension>();
if (aHasExt && bHasExt)
{
var aExt = A.GetModExtension<ApparelExtension>();
var bExt = B.GetModExtension<ApparelExtension>();
var check = new Dictionary<string, int>();
for (int i = 0; i < aExt.coverage.Count; i++)
{
if (!check.ContainsKey(aExt.coverage[i]))
check.Add(aExt.coverage[i].ToLowerInvariant(), 1);
else
{
Log.Warning("JecsTools :: ApparelExtension :: Warning:: " + A.label + " has multiple of the same tags.");
return;
}
}
for (int j = 0; j < bExt.coverage.Count; j++)
{
if (!check.ContainsKey(bExt.coverage[j]))
check.Add(bExt.coverage[j].ToLowerInvariant(), 1);
else
{
__result = false;
break;
}
}
}
else if ((aHasExt && !bHasExt) || (!aHasExt && bHasExt))
{
__result = true;
}
}

public static void Post_GeneratePawnInternal(PawnGenerationRequest request, ref Pawn __result)
{
var hediffGiverSet = __result?.def?.race?.hediffGiverSets?.FirstOrDefault(
Expand Down
4 changes: 2 additions & 2 deletions Source/AllModdingComponents/JecsTools/HediffExpandedDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class HediffExpandedDef : HediffDef
//public string description;

/// <summary>
/// Text that appears before the list of modifiers.
/// Text key that appears before the list of modifiers.
/// </summary>
public string preListText;

/// <summary>
/// Text that appears after the list of modifiers.
/// Text key that appears after the list of modifiers.
/// </summary>
public string postListText;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public override string TipStringExtra
{
s.AppendLine(def.description);
}
if (!string.IsNullOrEmpty(Def.preListText)) s.AppendLine(Def.preListText);
if (!string.IsNullOrEmpty(Def.preListText)) s.AppendLine(Def.preListText.Translate());
s.AppendLine(base.TipStringExtra);
if (!string.IsNullOrEmpty(Def.postListText)) s.AppendLine(Def.postListText);
if (!string.IsNullOrEmpty(Def.postListText)) s.AppendLine(Def.postListText.Translate());
return s.ToString();
}
}
Expand Down
1 change: 1 addition & 0 deletions Source/AllModdingComponents/JecsTools/JecsTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ApparelExtension.cs" />
<Compile Include="CaravanJobs\CaravanJob.cs" />
<Compile Include="CaravanJobs\CaravanJobDef.cs" />
<Compile Include="CaravanJobs\CaravanJobDriver.cs" />
Expand Down

0 comments on commit 5be4f43

Please sign in to comment.