static bool Prefix(EntityAlive __instance) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } // Check if there's a door in our way, then open it. if (__instance.GetAttackTarget() == null) { // If it's an animal, don't let them attack blocks EntityAliveFarmingAnimalSDX animal = __instance as EntityAliveFarmingAnimalSDX; if (animal) { if (__instance.GetAttackTarget() == null) { return(false); } } } if (__instance.GetAttackTarget() != null) { __instance.RotateTo(__instance.GetAttackTarget(), 30f, 30f); } return(true); }
public override void OnUpdateLive() { // AdjustSizeForStage(); if (this.Buffs.HasCustomVar("Herd")) { EntityAliveFarmingAnimalSDX temp = this.world.GetEntity((int)this.Buffs.GetCustomVar("Herd")) as EntityAliveFarmingAnimalSDX; if (temp) { this.Buffs.SetCustomVar("CurrentOrder", (float)EntityUtilities.Orders.None, true); this.setHomeArea(temp.GetBlockPosition(), 10); } } base.OnUpdateLive(); }
static bool Prefix(EntityAlive __instance) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } // Check if there's a door in our way, then open it. if (__instance.GetAttackTarget() == null) { // If it's an animal, don't let them attack blocks EntityAliveFarmingAnimalSDX animal = __instance as EntityAliveFarmingAnimalSDX; if (animal) { if (__instance.GetAttackTarget() == null) { return(false); } } //// If a door is found, try to open it. If it returns false, start attacking it. //EntityAliveSDX myEntity = __instance as EntityAliveSDX; //if (myEntity) //{ // if (myEntity.OpenDoor()) // return true; //} } if (__instance.GetAttackTarget() != null) { __instance.RotateTo(__instance.GetAttackTarget(), 30f, 30f); } return(true); }