internal InvasionManager(CustomNpcsPlugin plugin) { _plugin = plugin; BasePath = "npcs"; ConfigPath = Path.Combine(BasePath, "invasions.json"); AssemblyNamePrefix = "Invasion_"; LoadDefinitions(); GeneralHooks.ReloadEvent += OnReload; // Register OnGameUpdate with priority 1 to guarantee that InvasionManager runs before NpcManager. ServerApi.Hooks.GameUpdate.Register(_plugin, OnGameUpdate, 1); ServerApi.Hooks.NpcKilled.Register(_plugin, OnNpcKilled); }
internal NpcManager(CustomNpcsPlugin plugin) { _plugin = plugin; BasePath = "npcs"; ConfigPath = Path.Combine(BasePath, "npcs.json"); AssemblyNamePrefix = "Npc_"; LoadDefinitions(); GeneralHooks.ReloadEvent += OnReload; ServerApi.Hooks.GameUpdate.Register(_plugin, OnGameUpdate); ServerApi.Hooks.NpcAIUpdate.Register(_plugin, OnNpcAiUpdate); ServerApi.Hooks.NpcKilled.Register(_plugin, OnNpcKilled); ServerApi.Hooks.NpcLootDrop.Register(_plugin, OnNpcLootDrop); ServerApi.Hooks.NpcSetDefaultsInt.Register(_plugin, OnNpcSetDefaults); ServerApi.Hooks.NpcSpawn.Register(_plugin, OnNpcSpawn); ServerApi.Hooks.NpcStrike.Register(_plugin, OnNpcStrike); //ServerApi.Hooks.NpcTransform.Register(_plugin, OnNpcTransform); OTAPI.Hooks.Npc.PostTransform = OnNpcTransform; }
public ProjectileManager(CustomNpcsPlugin plugin) { this.plugin = plugin; BasePath = "npcs"; ConfigPath = Path.Combine(BasePath, "projectiles.json"); AssemblyNamePrefix = "Projectile_"; customProjectiles = new ConditionalWeakTable <Projectile, CustomProjectile>(); LoadDefinitions(); GeneralHooks.ReloadEvent += OnReload; //ServerApi.Hooks.GameUpdate.Register(plugin, onGameUpdate); //ServerApi.Hooks.ProjectileSetDefaults.Register(plugin, onProjectileSetDefaults); //ServerApi.Hooks.ProjectileAIUpdate.Register(plugin, onProjectileAiUpdate); OTAPI.Hooks.Projectile.PreUpdate = OnProjectilePreUpdate; OTAPI.Hooks.Projectile.PreAI = OnProjectilePreAi; OTAPI.Hooks.Projectile.PreKill = OnProjectilePreKill; }