mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 13:01:03 +00:00
Fix errors in chasm
This commit is contained in:
parent
f2b81a70c8
commit
0175e207af
@ -910,8 +910,8 @@ public final class Scene {
|
|||||||
|
|
||||||
public int loadDynamicGroup(int group_id) {
|
public int loadDynamicGroup(int group_id) {
|
||||||
SceneGroup group = getScriptManager().getGroupById(group_id);
|
SceneGroup group = getScriptManager().getGroupById(group_id);
|
||||||
if (group == null || getScriptManager().getGroupInstanceById(group_id) != null)
|
if (group == null)
|
||||||
return -1; // Group not found or already instanced
|
return -1; // Group not found
|
||||||
|
|
||||||
this.onLoadGroup(new ArrayList<>(List.of(group)));
|
this.onLoadGroup(new ArrayList<>(List.of(group)));
|
||||||
|
|
||||||
|
@ -395,7 +395,11 @@ public class SceneScriptManager {
|
|||||||
var instance = cachedSceneGroupsInstances.getOrDefault(groupId, null);
|
var instance = cachedSceneGroupsInstances.getOrDefault(groupId, null);
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = DatabaseHelper.loadGroupInstance(groupId, scene.getWorld().getHost());
|
instance = DatabaseHelper.loadGroupInstance(groupId, scene.getWorld().getHost());
|
||||||
if (instance != null) cachedSceneGroupsInstances.put(groupId, instance);
|
if (instance != null){
|
||||||
|
cachedSceneGroupsInstances.put(groupId, instance);
|
||||||
|
this.cachedSceneGroupsInstances.get(groupId).setCached(false);
|
||||||
|
this.cachedSceneGroupsInstances.get(groupId).setLuaGroup(getGroupById(groupId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
@ -609,6 +613,8 @@ public class SceneScriptManager {
|
|||||||
var instance = new SceneGroupInstance(group, getScene().getWorld().getHost());
|
var instance = new SceneGroupInstance(group, getScene().getWorld().getHost());
|
||||||
this.sceneGroupsInstances.put(group.id, instance);
|
this.sceneGroupsInstances.put(group.id, instance);
|
||||||
this.cachedSceneGroupsInstances.put(group.id, instance);
|
this.cachedSceneGroupsInstances.put(group.id, instance);
|
||||||
|
this.cachedSceneGroupsInstances.get(group.id).setCached(false);
|
||||||
|
this.cachedSceneGroupsInstances.get(group.id).setLuaGroup(group);
|
||||||
instance.save(); // Save the instance
|
instance.save(); // Save the instance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,6 +658,7 @@ public class SceneScriptManager {
|
|||||||
entities.forEach(region::addEntity);
|
entities.forEach(region::addEntity);
|
||||||
|
|
||||||
for (var targetId : enterEntities) {
|
for (var targetId : enterEntities) {
|
||||||
|
if (EntityIdType.toEntityType(targetId >> 24).getValue() == 19) continue;
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.trace("Call EVENT_ENTER_REGION_{}", region.getMetaRegion().config_id);
|
.trace("Call EVENT_ENTER_REGION_{}", region.getMetaRegion().config_id);
|
||||||
this.callEvent(
|
this.callEvent(
|
||||||
@ -669,6 +676,7 @@ public class SceneScriptManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var targetId : leaveEntities) {
|
for (var targetId : leaveEntities) {
|
||||||
|
if (EntityIdType.toEntityType(targetId >> 24).getValue() == 19) continue;
|
||||||
this.callEvent(
|
this.callEvent(
|
||||||
new ScriptArgs(region.getGroupId(), EventType.EVENT_LEAVE_REGION, region.getConfigId())
|
new ScriptArgs(region.getGroupId(), EventType.EVENT_LEAVE_REGION, region.getConfigId())
|
||||||
.setEventSource(EntityIdType.toEntityType(targetId >> 24).getValue())
|
.setEventSource(EntityIdType.toEntityType(targetId >> 24).getValue())
|
||||||
@ -820,7 +828,8 @@ public class SceneScriptManager {
|
|||||||
.stream()
|
.stream()
|
||||||
.filter(
|
.filter(
|
||||||
t ->
|
t ->
|
||||||
t.getName().substring(13).equals(String.valueOf(params.param1))
|
(t.getName().length() <= 12
|
||||||
|
|| t.getName().substring(13).equals(String.valueOf(params.param1)))
|
||||||
&& (t.getSource().isEmpty()
|
&& (t.getSource().isEmpty()
|
||||||
|| t.getSource().equals(params.getEventSource())))
|
|| t.getSource().equals(params.getEventSource())))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
@ -1241,6 +1241,11 @@ public class ScriptLib {
|
|||||||
return dungeonManager.activateRespawnPoint(var1) ? 0:2;
|
return dungeonManager.activateRespawnPoint(var1) ? 0:2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] GetOpeningDungeonListByRosterId(int var1){
|
||||||
|
logger.warn("[LUA] Call unimplemented GetOpeningDungeonListByRosterId with {}", var1);
|
||||||
|
return new int[] {0,0};
|
||||||
|
}
|
||||||
|
|
||||||
//TODO check
|
//TODO check
|
||||||
public int SetWeatherAreaState(int var1, int var2){
|
public int SetWeatherAreaState(int var1, int var2){
|
||||||
logger.warn("[LUA] Call unimplemented SetWeatherAreaState with {} {}", var1, var2);
|
logger.warn("[LUA] Call unimplemented SetWeatherAreaState with {} {}", var1, var2);
|
||||||
@ -1254,6 +1259,17 @@ public class ScriptLib {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int ModifyClimatePolygonParamTable(int var1, LuaTable var2){
|
||||||
|
logger.warn("[LUA] Call unimplemented ModifyClimatePolygonParamTable with {} {}", var1, printTable(var2));
|
||||||
|
//TODO implement
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SetEnvironmentEffectState(int var1, String var2, int[] var3, int[] var4){
|
||||||
|
logger.warn("[LUA] Call unimplemented SetEnvironmentEffectState with {} {} {} {}", var1, var2, var3, var4);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO check
|
//TODO check
|
||||||
public boolean CheckIsInMpMode(){
|
public boolean CheckIsInMpMode(){
|
||||||
logger.debug("[LUA] Call CheckIsInMpMode");
|
logger.debug("[LUA] Call CheckIsInMpMode");
|
||||||
@ -1523,6 +1539,16 @@ public class ScriptLib {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetRegionConfigId(LuaTable var1){
|
||||||
|
logger.warn("[LUA] Call untested GetRegionConfigId with {}", printTable(var1));
|
||||||
|
var EntityId = var1.get("region_eid").toint();
|
||||||
|
var entity = getSceneScriptManager().getScene().getScriptManager().getRegionById(EntityId);
|
||||||
|
if (entity == null){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return entity.getConfigId();
|
||||||
|
}
|
||||||
|
|
||||||
public int GetGameHour(){
|
public int GetGameHour(){
|
||||||
return getSceneScriptManager().getScene().getWorld().getGameTimeHours();
|
return getSceneScriptManager().getScene().getWorld().getGameTimeHours();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user