All global NPC scripts are now called before local NPC scripts

Fixed event NPC scripts not running after erroring, and not outputting to the console
This commit is contained in:
Luis C.M committed 2023-03-16 16:43:05 -05:00
1 parent 57bd628357
commit e58b494979
4 files changed
+26 -13

No files matched your search

+3 -1
View File
@@ -247,13 +247,14 @@ public class EventHooks {
return;
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
npc.script.callScript(EnumScriptType.TIMER, event);
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TIMER, event);
npc.script.callScript(EnumScriptType.TIMER, event);
NpcAPI.EVENT_BUS.post(event);
}
public static void onProjectileTick(EntityProjectile projectile) {
ProjectileEvent.UpdateEvent event = new ProjectileEvent.UpdateEvent((IProjectile) NpcAPI.Instance().getIEntity(projectile));
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_TICK, event);
for(ScriptContainer script : projectile.scripts) {
if(script.isValid()) {
script.run(EnumScriptType.PROJECTILE_TICK, event);
@@ -263,6 +264,7 @@ public class EventHooks {
}
public static void onProjectileImpact(EntityProjectile projectile, ProjectileEvent.ImpactEvent event) {
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
for(ScriptContainer script : projectile.scripts) {
if(script.isValid()) {
script.run(EnumScriptType.PROJECTILE_IMPACT, event);