/// <summary> /// Simple Prefix patch to toggle excecution of game method based on current settings. /// </summary> /// <param name="__instance">Harmony original instance reference</param> /// <returns>False if the base method shouldn't be called (collapse has been prevented), true otherwise</returns> public static bool Prefix(ref bool __result, CommonBuildingAI __instance) { if (ModSettings.noCollapse && RICOUtils.IsRICOPloppableAI(__instance as PrivateBuildingAI)) { __result = false; // Don't call base method after this. return(false); } // Continue on to base method return(true); }
/// <summary> /// Checks to see whether or not the specified building is a Ploppable RICO non-growable building. /// </summary> /// <param name="buildingID">Building instance ID</param> /// <returns>True if this is a Ploppable RICO non-growable building, false otherwise</returns> private bool IsRICOPloppable(ushort buildingID) => RICOUtils.IsRICOPloppableAI(Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID].Info.GetAI() as PrivateBuildingAI);