namespace Harmony.EntityPatches { internal class EntityPatches { [HarmonyPatch(typeof(Entity))] [HarmonyPatch("OnEntityActivated")] public class OnEntityActivatedPatch { private static bool Prefix(Entity __instance, ref bool __result, int _indexInBlockActivationCommands, Vector3i _tePos, global::EntityAlive _entityFocusing) { //Log.Out("EntityPatches-OnEntityActivated _indexInBlockActivationCommands: " + _indexInBlockActivationCommands); if (_indexInBlockActivationCommands == 0) { //Log.Out("EntityPatches-OnEntityActivated 1"); if (__instance is EntitySupplyCrate) { //Log.Out("EntityPatches-OnEntityActivated 1"); EntitySupplyCrate entitySupplyCrate = (EntitySupplyCrate)__instance; if (entitySupplyCrate != null) { //Log.Out("EntityPatches-OnEntityActivated 1"); if (!entitySupplyCrate.onGround) { //Log.Out("EntityPatches-OnEntityActivated 1"); __result = false; return false; } } } } return true; } } [HarmonyPatch(typeof(global::Entity))] [HarmonyPatch("HasAnyTags")] public class HasAnyTagsPatch { private static bool Prefix(global::Entity __instance, ref bool __result, FastTags tags) { __result = __instance.EntityTags.Test_AnySet(tags); return false; } } [HarmonyPatch(typeof(global::Entity))] [HarmonyPatch("HasAllTags")] public class HasAllTagsPatch { private static bool Prefix(global::Entity __instance, ref bool __result, FastTags tags) { __result = __instance.EntityTags.Test_AllSet(tags); return false; } } [HarmonyPatch(typeof(Entity))] [HarmonyPatch("EntityTags")] [HarmonyPatch(MethodType.Getter)] public static class EntityTagsPatch { public static void Postfix(Entity __instance, ref FastTags __result, ref FastTags ___cachedTags) { if (__instance is EntityZombieSDX) { EntityZombieSDX entity = (EntityZombieSDX)__instance; __result = FastTags.Parse(___cachedTags.ToString() + entity.otherTags); //Log.Out("====================================== TAGS ======================================"); //Log.Out(__result.ToString()); } else if (__instance is EntityNPCRebirth) { EntityNPCRebirth entity = (EntityNPCRebirth)__instance; __result = FastTags.Parse(___cachedTags.ToString() + entity.otherTags); } /*else if (__instance is EntityMeleeCyborgRebirth) { EntityMeleeCyborgRebirth entity = (EntityMeleeCyborgRebirth)__instance; __result = FastTags.Parse(___cachedTags.ToString() + entity.otherTags); } else if (__instance is EntityMeleeRangedBanditSDX) { EntityMeleeRangedBanditSDX entity = (EntityMeleeRangedBanditSDX)__instance; __result = FastTags.Parse(___cachedTags.ToString() + entity.otherTags); } else if (__instance is EntityMeleeWerewolfSDX) { EntityMeleeWerewolfSDX entity = (EntityMeleeWerewolfSDX)__instance; __result = FastTags.Parse(___cachedTags.ToString() + entity.otherTags); }*/ else { __result = ___cachedTags; } } } [HarmonyPatch(typeof(global::Entity))] [HarmonyPatch("OnPushEntity")] public class OnPushEntityPatch { private static bool Prefix(global::Entity __instance, Entity _entity) { if (__instance is EntityAnimalChickenRebirth) { //Log.Out("EntityPatches-OnPushEntity START"); return false; } return true; } } } }