Upload from upload_mods.ps1
This commit is contained in:
48
Harmony/Harmony_EntityTurret.cs
Normal file
48
Harmony/Harmony_EntityTurret.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user