mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Make the transpiler noisier when it hits an error. Hopefully it'll make breakages more obvious.
This commit is contained in:
parent
c0041947d3
commit
e377f01a7d
2 changed files with 6 additions and 2 deletions
Binary file not shown.
|
@ -229,7 +229,7 @@ namespace RJW_Menstruation
|
|||
private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
object pawn_index = null;
|
||||
LocalBuilder pawn_index = null;
|
||||
// Like in the last one, we're only interested in the first of each
|
||||
bool found_first_attractiveness = false;
|
||||
bool found_first_relationship = false;
|
||||
|
@ -238,11 +238,13 @@ namespace RJW_Menstruation
|
|||
// Get where the compiler decided to index the pawn at
|
||||
if (pawn_index is null && instruction.opcode == OpCodes.Stloc_S) // the first stloc.s in the IL is the pawn being loaded out of the list
|
||||
{ // a future RJW or compiler update might change this, or maybe another mod's patch
|
||||
pawn_index = instruction.operand;
|
||||
pawn_index = (LocalBuilder)instruction.operand;
|
||||
yield return instruction;
|
||||
}
|
||||
else if (!found_first_attractiveness && instruction.LoadsField(MinimumAttractivenessToHookup))
|
||||
{
|
||||
if (pawn_index?.LocalType != typeof(Pawn))
|
||||
throw new System.InvalidOperationException($"pawn_index is not a Pawn ({pawn_index?.LocalType})");
|
||||
found_first_attractiveness = true;
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_S, pawn_index);
|
||||
|
@ -250,6 +252,8 @@ namespace RJW_Menstruation
|
|||
}
|
||||
else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup))
|
||||
{
|
||||
if (pawn_index?.LocalType != typeof(Pawn))
|
||||
throw new System.InvalidOperationException($"pawn_index is not a Pawn ({pawn_index?.LocalType})");
|
||||
found_first_relationship = true;
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_S, pawn_index);
|
||||
|
|
Loading…
Reference in a new issue