From 83d447cfc222e865b81910b6e0f341bc82e653a2 Mon Sep 17 00:00:00 2001 From: Nazrin Date: Mon, 26 Jun 2023 22:49:24 -0700 Subject: [PATCH] Update region logic (#2240) --- .../java/emu/grasscutter/scripts/SceneScriptManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 9b21f0e66..ad67fbbc4 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -644,6 +644,7 @@ public class SceneScriptManager { .trace("Call EVENT_ENTER_REGION_{}", region.getMetaRegion().config_id); this.callEvent( new ScriptArgs(region.getGroupId(), EventType.EVENT_ENTER_REGION, region.getConfigId()) + .setEventSource(EntityType.Avatar.getValue()) .setSourceEntityId(region.getId()) .setTargetEntityId(targetId)); @@ -660,6 +661,7 @@ public class SceneScriptManager { if (region.entityHasLeft()) { this.callEvent( new ScriptArgs(region.getGroupId(), EventType.EVENT_LEAVE_REGION, region.getConfigId()) + .setEventSource(EntityType.Avatar.getValue()) .setSourceEntityId(region.getId()) .setTargetEntityId(region.getFirstEntityId())); @@ -810,10 +812,8 @@ public class SceneScriptManager { .stream() .filter( t -> - !t.getCondition().isEmpty() - && t.getCondition().substring(29).equals(String.valueOf(params.param1)) - && (t.getSource().isEmpty() - || t.getSource().equals(params.getEventSource()))) + t.getName().substring(13).equals(String.valueOf(params.param1)) + && (t.getSource().isEmpty() || t.getSource().equals(params.getEventSource()))) .collect(Collectors.toSet()); default -> this.getTriggersByEvent(eventType).stream() .filter(