Skip to content

Commit

Permalink
Merge branch 'hotfix-1.16.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
dymanoid committed Sep 5, 2018
2 parents c8d6389 + c6fd38b commit 5530257
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/RealTime/CustomAI/RealTimeResidentAI.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ private ScheduleAction UpdateCitizenState(ref TCitizen citizen, ref CitizenSched
CitizenInstance.Flags.OnTour | CitizenInstance.Flags.TargetIsNode,
true))
{
// Guided tours are treated as visits
schedule.Hint = ScheduleHint.OnTour;
}

Expand Down
15 changes: 7 additions & 8 deletions src/RealTime/GameConnection/Patches/ResidentAIPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal static class ResidentAIPatch
public static IPatch StartMoving { get; } = new ResidentAI_StartMoving();

/// <summary>Gets the patch object for the simulation step method (for citizens instances).</summary>
public static IPatch InstanceSimulationStep { get; } = new HumanAI_SimulationStep();
public static IPatch InstanceSimulationStep { get; } = new ResidentAI_SimulationStep();

/// <summary>Gets the patch object for the update age method.</summary>
public static IPatch UpdateAge { get; } = new ResidentAI_UpdateAge();
Expand Down Expand Up @@ -207,31 +207,30 @@ private static void Postfix(uint citizenID, bool __result)
}
}

private sealed class HumanAI_SimulationStep : PatchBase
private sealed class ResidentAI_SimulationStep : PatchBase
{
protected override MethodInfo GetMethod()
{
return typeof(HumanAI).GetMethod(
return typeof(ResidentAI).GetMethod(
"SimulationStep",
BindingFlags.Instance | BindingFlags.Public,
null,
new[] { typeof(ushort), typeof(CitizenInstance).MakeByRefType(), typeof(Vector3) },
new[] { typeof(ushort), typeof(CitizenInstance).MakeByRefType(), typeof(CitizenInstance.Frame).MakeByRefType(), typeof(bool) },
new ParameterModifier[0]);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1213", Justification = "Harmony patch")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming Rules", "SA1313", Justification = "Harmony patch")]
private static void Postfix(ushort instanceID, ref CitizenInstance data)
private static void Postfix(ushort instanceID, ref CitizenInstance citizenData, ResidentAI __instance)
{
if (RealTimeAI == null || instanceID == 0)
{
return;
}

if ((data.m_flags & (CitizenInstance.Flags.WaitingTaxi | CitizenInstance.Flags.WaitingTransport)) != 0
&& data.Info.m_citizenAI is ResidentAI residentAI)
if ((citizenData.m_flags & (CitizenInstance.Flags.WaitingTaxi | CitizenInstance.Flags.WaitingTransport)) != 0)
{
RealTimeAI.ProcessWaitingForTransport(residentAI, data.m_citizen, instanceID);
RealTimeAI.ProcessWaitingForTransport(__instance, citizenData.m_citizen, instanceID);
}
}
}
Expand Down

0 comments on commit 5530257

Please sign in to comment.