49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
namespace Harmony.EntityTurretPatches
|
|
{
|
|
[HarmonyPatch(typeof(EntityTurret))]
|
|
[HarmonyPatch("OnUpdateEntity")]
|
|
public class OnUpdateEntityPatch
|
|
{
|
|
public static void Postfix(EntityTurret __instance,
|
|
global::EntityAlive ___Owner
|
|
)
|
|
{
|
|
if (__instance.EntityClass.entityClassName.Contains("FuriousRamsayJunkTurret"))
|
|
{
|
|
//Log.Out("__instance.belongsPlayerId: " + __instance.belongsPlayerId);
|
|
__instance.ForceOn = true;
|
|
__instance.IsOn = true;
|
|
__instance.Laser.gameObject.SetActive(__instance.IsOn);
|
|
}
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(EntityTurret))]
|
|
[HarmonyPatch("CanInteract")]
|
|
public class CanInteractPatch
|
|
{
|
|
private static bool Prefix(EntityTurret __instance,
|
|
ref bool __result,
|
|
int _interactingEntityId,
|
|
bool ___isFalling
|
|
)
|
|
{
|
|
bool canInteract = !___isFalling &&
|
|
!__instance.PickedUpWaitingToDelete &&
|
|
__instance.OriginalItemValue.type != 0 &&
|
|
(__instance.belongsPlayerId == _interactingEntityId || __instance.Health <= 1);
|
|
|
|
|
|
if (__instance.Buffs.GetCustomVar("$FR_Turret_Temp") == 1)
|
|
{
|
|
canInteract = false;
|
|
}
|
|
|
|
__result = canInteract;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|