public static void Postfix(ushort vehicleID, ref Vehicle vehicleData) { if ((vehicleData.m_flags & Vehicle.Flags.GoingBack) != 0) { ushort newTarget = NewFireAI.FindBurningBuilding(vehicleData.GetLastFramePosition(), 500f); if (newTarget != 0) { //// Debug info to solve despawn issue //UnityEngine.Debug.Log(vehicleData.m_flags); //UnityEngine.Debug.Log("Transfer type is: " + vehicleData.m_transferType); // Switch to building extinguishing material if carrying tree extinguishing material // If this is not done, copter will despawn if targeted at a burning building if (vehicleData.m_transferType == 68) { vehicleData.m_transferType = 71; } vehicleData.Info.m_vehicleAI.SetTarget(vehicleID, ref vehicleData, newTarget); //// Debug info to solve despawn issue //UnityEngine.Debug.Log(vehicleData.m_flags); //// Print debug data to log //BuildingManager instance = Singleton<BuildingManager>.instance; //float tempDistance = VectorUtils.LengthXZ(vehicleData.GetLastFramePosition() - instance.m_buildings.m_buffer[newTarget].m_position); //UnityEngine.Debug.Log("FireCopter ID: " + vehicleID + " target set " + newTarget + " distance " + tempDistance); } } }
public static void Postfix(ushort vehicleID, ref Vehicle vehicleData) { if ((vehicleData.m_flags & (Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget)) != 0) { ushort newTarget = NewFireAI.FindBurningBuilding(vehicleData.GetLastFramePosition(), 40f); if (newTarget != 0) { vehicleData.Info.m_vehicleAI.SetTarget(vehicleID, ref vehicleData, newTarget); //// Print debug data to log //BuildingManager instance = Singleton<BuildingManager>.instance; //float tempDistance = VectorUtils.LengthXZ(vehicleData.GetLastFramePosition() - instance.m_buildings.m_buffer[newTarget].m_position); //UnityEngine.Debug.Log("Firetruck ID: " + vehicleID + " target set " + newTarget + " distance " + tempDistance); // If the fire truck is stopped, the new target building is close enough that it will not move again so retarget deployed firefighting cims if ((vehicleData.m_flags & Vehicle.Flags.Stopped) != 0) { NewFireAI.TargetCimsParentVehicleTarget(vehicleID, ref vehicleData); } } } }