using HarmonyLib;
using System;
namespace Harmony.EntityDrone
{
///
/// Harmony patches of .
///
public class EntityDronePatches
{
///
/// Harmony patch of
/// so that it will not produce an NRE if the target is null.
///
[HarmonyPatch(typeof(global::EntityDrone))]
[HarmonyPatch("isAlly")]
public class EntityDrone_isAlly
{
///
/// The _target argument was cast to an before this method
/// was called, so it will be null for ranged weapon attacks from any NPC.
/// This will cause a in the original method,
/// so we need to skip it entirely in this case.
///
///
///
///
public static bool Prefix(ref bool __result, global::EntityAlive _target)
{
if (_target == null)
{
// If it's not a player, consider it an ally so it can't damage the drone.
// This is consistent with vanilla zombies not being able to damage it.
__result = true;
return false;
}
return true;
}
}
}
}