[Refactoring] Moved the SceneBLocks group info into its own object and added some missing fields

* Also cache the group and block data in the SceneMeta objects
* Added the Position interface for working with Positions in Scriptlib
This commit is contained in:
hartie95 2023-11-06 02:53:59 +01:00
parent 824f1e23f9
commit e27eb82c95
13 changed files with 304 additions and 208 deletions

View File

@ -1,9 +1,11 @@
package org.anime_game_servers.gi_lua.models;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Data
@Getter @EqualsAndHashCode @ToString
public class DummyPoint {
private Position pos;
private Position rot;
private PositionImpl pos;
private PositionImpl rot;
}

View File

@ -1,58 +1,27 @@
package org.anime_game_servers.gi_lua.models;
import com.github.davidmoten.rtreemulti.geometry.Point;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
public interface Position {
float getX();
float getY();
float getZ();
public class Position implements Serializable {
@Getter @Setter private float x;
@Getter @Setter private float y;
@Getter @Setter private float z;
public Position() {}
public Position(float x, float y) {
this.x = x;
this.y = y;
}
public Position(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public Position(List<Float> xyz) {
switch (xyz.size()) {
default: // Might want to error on excess elements, but maybe we want to extend to 3+3 representation later.
case 3:
this.z = xyz.get(2); // Fall-through
case 2:
this.y = xyz.get(1); // Fall-through
case 1:
this.x = xyz.get(0); // pointless fall-through
case 0:
break;
}
}
public Point toPoint() {
return Point.create(x,y,z);
default Point toPoint() {
return Point.create(getX(),getY(),getZ());
}
/**
* To XYZ array for Spatial Index
*/
public double[] toDoubleArray() {
return new double[]{ x, y, z};
default double[] toDoubleArray() {
return new double[]{ getX(),getY(),getZ()};
}
/**
* To XZ array for Spatial Index (Blocks)
*/
public double[] toXZDoubleArray() {
return new double[]{x, z};
default double[] toXZDoubleArray() {
return new double[]{getX(),getZ()};
}
}

View File

@ -0,0 +1,41 @@
package org.anime_game_servers.gi_lua.models;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
@Getter
public class PositionImpl implements Serializable, Position {
@Setter private float x;
@Setter private float y;
@Setter private float z;
public PositionImpl() {}
public PositionImpl(float x, float y) {
this.x = x;
this.y = y;
}
public PositionImpl(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public PositionImpl(List<Float> xyz) {
switch (xyz.size()) {
default: // Might want to error on excess elements, but maybe we want to extend to 3+3 representation later.
case 3:
this.z = xyz.get(2); // Fall-through
case 2:
this.y = xyz.get(1); // Fall-through
case 1:
this.x = xyz.get(0); // pointless fall-through
case 0:
break;
}
}
}

View File

@ -2,15 +2,14 @@ package org.anime_game_servers.gi_lua.models;
import lombok.Getter;
import lombok.ToString;
import org.anime_game_servers.gi_lua.models.Position;
@ToString
@Getter
public class SceneConfig {
private Position vision_anchor;
private Position born_pos;
private Position born_rot;
private Position begin_pos;
private Position size;
private PositionImpl vision_anchor;
private PositionImpl born_pos;
private PositionImpl born_rot;
private PositionImpl begin_pos;
private PositionImpl size;
private float die_y;
}

View File

@ -1,69 +1,106 @@
package org.anime_game_servers.gi_lua.models;
import com.github.davidmoten.rtreemulti.RTree;
import com.github.davidmoten.rtreemulti.geometry.Geometry;
import io.github.oshai.kotlinlogging.KLogger;
import io.github.oshai.kotlinlogging.KotlinLogging;
import lombok.Getter;
import lombok.ToString;
import lombok.val;
import org.anime_game_servers.gi_lua.SceneIndexManager;
import org.anime_game_servers.gi_lua.models.scene.block.SceneBlock;
import org.anime_game_servers.gi_lua.utils.GIScriptLoader;
import org.anime_game_servers.gi_lua.models.scene.block.SceneGroupInfo;
import org.anime_game_servers.gi_lua.models.scene.group.SceneGroup;
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
import org.anime_game_servers.lua.engine.LuaScript;
import org.anime_game_servers.lua.models.ScriptType;
import javax.script.ScriptException;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ToString
@Getter
public class SceneMeta {
private static KLogger logger = KotlinLogging.INSTANCE.logger(SceneMeta.class.getName());
private int sceneId;
private SceneConfig config;
private List<Integer> blockIds;
private Map<Integer, SceneBlock> blocks;
private Map<Integer, SceneGroupInfo> groupsInfos;
private Map<Integer, SceneGroup> groups;
private Map<String, DummyPoint> dummyPoints;
private LuaScript context;
private RTree<SceneBlock, Geometry> sceneBlockIndex;
//private RTree<SceneBlock, Geometry> sceneBlockIndex;
public static SceneMeta of(int sceneId, GIScriptLoader scriptLoader) {
return new SceneMeta().load(sceneId, scriptLoader);
return new SceneMeta(sceneId).load(scriptLoader);
}
public SceneMeta load(int sceneId, GIScriptLoader scriptLoader) {
// Get compiled script if cached
val cs = scriptLoader.getSceneScript(sceneId, "scene"+sceneId+".lua", ScriptType.DATA_STORAGE);
private SceneMeta(int sceneId) {
this.sceneId = sceneId;
}
if (cs == null) {
//Grasscutter.getLogger().warn("No script found for scene " + sceneId);
public SceneMeta load(GIScriptLoader scriptLoader) {
if(!loadSceneMeta(scriptLoader)){
return null;
}
loadDummyPoints(scriptLoader);
loadBlocks(scriptLoader);
prepareGroups();
return this;
}
// Eval script
try {
cs.evaluate();
private boolean loadSceneMeta(GIScriptLoader scriptLoader){
return scriptLoader.loadSceneMetaScript(sceneId, (cs -> {
this.config = cs.getGlobalVariable("scene_config", SceneConfig.class);
// TODO optimize later
// Create blocks
List<Integer> blockIds = cs.getGlobalVariableList("blocks", Integer.class);
List<SceneBlock> blocks = cs.getGlobalVariableList("block_rects", SceneBlock.class);
this.blockIds = cs.getGlobalVariableList("blocks", Integer.class);
for (int i = 0; i < blocks.size(); i++) {
SceneBlock block = blocks.get(i);
block.setId(blockIds.get(i));
}
this.blocks = blocks.stream().collect(Collectors.toMap(b -> b.getId(), b -> b, (a, b) -> a));
this.sceneBlockIndex = SceneIndexManager.buildIndex(2, blocks, SceneBlock::toRectangle);
} catch (ScriptException exception) {
//Grasscutter.getLogger().error("An error occurred while running a script.", exception);
return null;
}
//Grasscutter.getLogger().debug("Successfully loaded metadata in scene {}.", sceneId);
return this;
// block reckt is not really used, should we still load it?
//val blockList = cs.getGlobalVariableList("block_rects", SceneBlock.class);
//this.blocks = blockList.stream().collect(Collectors.toMap(b -> b.getId(), b -> b, (a, b) -> a));
//this.sceneBlockIndex = SceneIndexManager.buildIndex(2, blockList, SceneBlock::toRectangle);
}));
}
private void loadDummyPoints(GIScriptLoader scriptLoader){
scriptLoader.loadSceneDummyPoints(sceneId, (cs -> {
this.dummyPoints = cs.getGlobalVariableMap("dummy_points", DummyPoint.class);
}));
}
private void loadBlocks(GIScriptLoader scriptLoader){
this.blocks = new HashMap<>(blockIds.size());
this.groupsInfos = new HashMap<>();
for(val blockId : blockIds){
val block = SceneBlock.of(this, 0, blockId, scriptLoader);
this.blocks.put(blockId, block);
}
}
private void prepareGroups(){
this.groups = new HashMap<>(groupsInfos.size());
for(val groupInfo : groupsInfos.values()){
val group = SceneGroup.of(groupInfo);
this.groups.put(groupInfo.getId(), group);
}
}
@Nullable
public SceneGroup getGroup(int id) {
return groups.get(id);
}
@Nullable
public SceneGroupInfo getGroupInfo(int id) {
return groupsInfos.get(id);
}
@Nullable
public SceneBlock getBlock(int id) {
return blocks.get(id);
}
}

View File

@ -1,64 +1,71 @@
package org.anime_game_servers.gi_lua.models.scene.block;
import com.github.davidmoten.rtreemulti.RTree;
import com.github.davidmoten.rtreemulti.geometry.Geometry;
import com.github.davidmoten.rtreemulti.geometry.Rectangle;
import io.github.oshai.kotlinlogging.KLogger;
import io.github.oshai.kotlinlogging.KotlinLogging;
import lombok.*;
import org.anime_game_servers.gi_lua.SceneIndexManager;
import org.anime_game_servers.gi_lua.models.Position;
import org.anime_game_servers.gi_lua.models.scene.group.SceneGroup;
import org.anime_game_servers.gi_lua.utils.GIScriptLoader;
import org.anime_game_servers.lua.models.ScriptType;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.SceneMeta;
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
import javax.script.ScriptException;
import java.util.Map;
import java.util.stream.Collectors;
@ToString
@Getter
public class SceneBlock {
@Setter(AccessLevel.PUBLIC)
private int id;
private Position max;
private Position min;
private static KLogger logger = KotlinLogging.INSTANCE.logger(SceneBlock.class.getName());
private int sceneId;
private Map<Integer, SceneGroup> groups;
private RTree<SceneGroup, Geometry> sceneGroupIndex;
private PositionImpl max;
private PositionImpl min;
private Map<Integer, SceneGroupInfo> groupInfo;
//private RTree<SceneGroupInfo, Geometry> sceneGroupIndex;
// internal only
private transient boolean loaded; // Not an actual variable in the scripts either
private transient SceneMeta meta; // Not an actual variable in the scripts either
private int sceneId;
private int activityId;
private int id;
public static SceneBlock of(SceneMeta sceneMeta, int activityId, int blockId, GIScriptLoader scriptLoader) {
val block = new SceneBlock(sceneMeta.getSceneId(), activityId, blockId, sceneMeta);
block.load(scriptLoader);
return block;
}
private SceneBlock(int sceneId, int activityId, int blockId, SceneMeta meta) {
this.id = blockId;
this.sceneId = sceneId;
this.activityId = activityId;
this.meta = meta;
}
public void setLoaded(boolean loaded) {
this.loaded = loaded;
}
public SceneBlock load(int sceneId, GIScriptLoader scriptLoader) {
public SceneBlock load(GIScriptLoader scriptLoader) {
if (this.loaded) {
return this;
}
this.sceneId = sceneId;
this.setLoaded(true);
val cs = scriptLoader.getSceneScript(sceneId, "scene" + sceneId + "_block" + this.id + ".lua", ScriptType.DATA_STORAGE);
if (cs == null) {
return null;
}
// Eval script
try {
cs.evaluate();
if( !scriptLoader.loadSceneBlockScript(sceneId, id, (cs -> {
// Set groups
this.groups = cs.getGlobalVariableList("groups", SceneGroup.class).stream()
this.groupInfo = cs.getGlobalVariableList("groups", SceneGroupInfo.class).stream()
.collect(Collectors.toMap(x -> x.getId(), y -> y, (a, b) -> a));
this.groups.values().forEach(g -> g.block_id = this.id);
this.sceneGroupIndex = SceneIndexManager.buildIndex(3, this.groups.values(), g -> g.getPos().toPoint());
} catch (ScriptException exception) {
//Grasscutter.getLogger().error("An error occurred while loading block " + this.id + " in scene " + sceneId, exception);
this.groupInfo.values().forEach(g -> {
g.blockId = this.id;
g.sceneMeta = meta;
g.activityId = activityId;
});
//this.sceneGroupIndex = SceneIndexManager.buildIndex(3, this.groupInfo.values(), g -> g.getPos().toPoint());
}))){
return null;
}
//Grasscutter.getLogger().debug("Successfully loaded block {} in scene {}.", this.id, sceneId);
meta.getGroupsInfos().putAll(this.groupInfo);
logger.debug(() -> "Successfully loaded block " + this.id + " in scene "+sceneId+".");
return this;
}

View File

@ -7,4 +7,5 @@ import lombok.ToString;
@Getter
public class SceneBusiness {
private int type;
private int sub_type;
}

View File

@ -0,0 +1,52 @@
package org.anime_game_servers.gi_lua.models.scene.block;
import lombok.Getter;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.SceneMeta;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
@Getter
public class SceneGroupInfo {
private int id;
private int refresh_id;
private int area;
@Nullable
private PositionImpl pos;
@Nullable
private SceneReplaceable is_replaceable;
private final boolean dynamic_load = false;
@Nullable
private SceneBusiness business;
@Nullable
private GroupLifecycle life_cycle = GroupLifecycle.FULL_TIME__CYCLE;
private int activity_revise_level_grow_id;
private int rely_start_world_level_limit_activity_id; // SceneScriptConfig LuaConfigMgr
private int vision_type;
private boolean across_block = false;
private boolean unload_when_disconnect = false;
private boolean ignore_world_level_revise = false;
private boolean force_unload_nodelay = false;
private boolean force_clean_sub_entity = false;
private boolean is_load_by_vision_type = false;
private int load_strategy;
private Set<String> forbid_monster_die; //todo find enum values
private List<Integer> related_level_tag_series_list;
private List<Integer> group_tag_list;
private List<Integer> weathers;
// internal variables
transient int blockId;
transient int activityId;
transient SceneMeta sceneMeta;
public int getBusinessType() {
return this.business == null ? 0 : this.business.getType();
}
public boolean isReplaceable() {
return this.is_replaceable != null && this.is_replaceable.isValue();
}
}

View File

@ -1,16 +1,15 @@
package org.anime_game_servers.gi_lua.models.scene.group;
import io.github.oshai.kotlinlogging.KLogger;
import io.github.oshai.kotlinlogging.KotlinLogging;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.val;
import org.anime_game_servers.gi_lua.models.*;
import org.anime_game_servers.gi_lua.models.scene.block.GroupLifecycle;
import org.anime_game_servers.gi_lua.models.scene.block.SceneBusiness;
import org.anime_game_servers.gi_lua.models.scene.block.SceneReplaceable;
import org.anime_game_servers.gi_lua.utils.GIScriptLoader;
import org.anime_game_servers.gi_lua.models.SceneMeta;
import org.anime_game_servers.gi_lua.models.loader.ScriptSource;
import org.anime_game_servers.gi_lua.models.scene.block.SceneGroupInfo;
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
import org.anime_game_servers.lua.engine.LuaScript;
import org.anime_game_servers.lua.models.ScriptType;
import javax.annotation.Nullable;
import java.util.*;
@ -20,36 +19,7 @@ import java.util.stream.Collectors;
@ToString
@Getter
public class SceneGroup {
public transient int block_id; // Not an actual variable in the scripts but we will keep it here for reference
@Setter
private int id;
// from block
private int refresh_id;
private int area;
@Nullable
private Position pos;
@Nullable
private SceneReplaceable is_replaceable;
private final boolean dynamic_load = false;
@Nullable
private SceneBusiness business;
@Nullable
private GroupLifecycle life_cycle = GroupLifecycle.FULL_TIME__CYCLE;
private int activity_revise_level_grow_id;
private int rely_start_world_level_limit_activity_id;
private int vision_type;
private boolean across_block = false;
private boolean unload_when_disconnect = false;
private boolean ignore_world_level_revise = false;
private boolean force_unload_nodelay = false;
private boolean force_clean_sub_entity = false;
private boolean is_load_by_vision_type = false;
private int load_strategy;
private Set<String> forbid_monster_die; //todo find enum values
private List<Integer> related_level_tag_series_list;
private List<Integer> group_tag_list;
private List<Integer> weathers;
private static KLogger logger = KotlinLogging.INSTANCE.logger(SceneGroup.class.getName());
// from group script
@Nullable
@ -80,17 +50,19 @@ public class SceneGroup {
// internal
private transient SceneGroupInfo groupInfo;
private transient SceneMeta sceneMeta;
private transient boolean loaded; // Not an actual variable in the scripts either
private transient LuaScript script;
public static SceneGroup of(int groupId) {
var group = new SceneGroup();
group.id = groupId;
public static SceneGroup of(SceneGroupInfo groupInfo) {
var group = new SceneGroup(groupInfo);
return group;
}
public int getBusinessType() {
return this.business == null ? 0 : this.business.getType();
protected SceneGroup(SceneGroupInfo groupInfo) {
this.groupInfo = groupInfo;
this.sceneMeta = groupInfo.getSceneMeta();
}
public boolean hasGarbages() {
@ -102,9 +74,6 @@ public class SceneGroup {
return this.garbages == null ? null : this.garbages.getGadgets();
}
public boolean isReplaceable() {
return this.is_replaceable != null && this.is_replaceable.isValue();
}
public SceneSuite getSuiteByIndex(int index) {
if (index < 1 || index > suites.size()) {
@ -113,46 +82,62 @@ public class SceneGroup {
return this.suites.get(index - 1);
}
public synchronized SceneGroup load(int sceneId, GIScriptLoader scriptLoader) {
public synchronized SceneGroup load(GIScriptLoader scriptLoader) {
if (this.loaded) {
return this;
}
// Set flag here so if there is no script, we don't call this function over and over again.
this.loaded = true;
val sceneId = sceneMeta.getSceneId();
val groupId = groupInfo.getId();
val blockId = groupInfo.getBlockId();
val activityId = groupInfo.getActivityId();
val cs = scriptLoader.getSceneScript(sceneId, "scene" + sceneId + "_group" + this.id + ".lua", ScriptType.EXECUTABLE);
if (cs == null) {
return this;
}
this.script = cs;
// Eval script
try {
cs.evaluate();
val scriptType = activityId == 0 ? ScriptSource.SCENE : ScriptSource.ACTIVITY;
val typeId = activityId == 0 ? sceneId : activityId;
if (!scriptLoader.loadSceneGroupScript(scriptType, typeId, groupId, cs -> {
this.script = cs;
// Set
this.monsters = cs.getGlobalVariableList("monsters", SceneMonster.class).stream()
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.monsters.values().forEach(m -> m.group = this);
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.monsters.values().forEach(m -> {
m.groupId = groupId;
m.blockId = blockId;
m.sceneMeta = sceneMeta;
});
this.npcs = cs.getGlobalVariableList("npcs", SceneNPC.class).stream()
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.npcs.values().forEach(m -> m.group = this);
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.npcs.values().forEach(m -> {
m.groupId = groupId;
m.blockId = blockId;
m.sceneMeta = sceneMeta;
});
this.gadgets = cs.getGlobalVariableList("gadgets", SceneGadget.class).stream()
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.gadgets.values().forEach(m -> m.group = this);
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.gadgets.values().forEach(m -> {
m.groupId = groupId;
m.blockId = blockId;
m.sceneMeta = sceneMeta;
});
this.triggers = cs.getGlobalVariableList("triggers", SceneTrigger.class).stream()
.collect(Collectors.toMap(SceneTrigger::getName, y -> y, (a, b) -> a));
this.triggers.values().forEach(t -> t.setCurrentGroup(this));
.collect(Collectors.toMap(SceneTrigger::getName, y -> y, (a, b) -> a));
this.triggers.values().forEach(t -> {
t.setGroupId(groupId);
t.setBlockId(blockId);
t.setSceneMeta(sceneMeta);
});
this.suites = cs.getGlobalVariableList("suites", SceneSuite.class);
this.regions = cs.getGlobalVariableList("regions", SceneRegion.class).stream()
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.regions.values().forEach(m -> m.group = this);
.collect(Collectors.toMap(x -> x.config_id, y -> y, (a, b) -> a));
this.regions.values().forEach(m -> {
m.groupId = groupId;
m.blockId = blockId;
m.sceneMeta = sceneMeta;
});
this.init_config = cs.getGlobalVariable("init_config", SceneInitConfig.class);
@ -169,14 +154,16 @@ public class SceneGroup {
// Add variables to suite
this.variables = cs.getGlobalVariableList("variables", SceneVar.class);
this.monster_pools = cs.getGlobalVariableList("monster_pools", SceneMonsterPool.class);
//this.sight_groups = cs.getGlobalVariableList("sight_groups", List<Integer>.class);
// Add monsters and gadgets to suite
this.suites.forEach(i -> i.init(this));
} catch (Exception e) {
//Grasscutter.getLogger().error("An error occurred while loading group " + this.id + " in scene " + sceneId + ".", e);
})) {
return null;
}
//Grasscutter.getLogger().debug("Successfully loaded group {} in scene {}.", this.id, sceneId);
logger.debug(() -> "Successfully loaded group " + groupId + " in scene " + sceneId + ".");
return this;
}
@ -202,8 +189,8 @@ public class SceneGroup {
public Optional<SceneBossChest> searchBossChestInGroup() {
return this.gadgets.values().stream().map(g -> g.getBoss_chest()).filter(Objects::nonNull)
.filter(bossChest -> bossChest.getMonster_config_id() > 0)
.findFirst();
.filter(bossChest -> bossChest.getMonster_config_id() > 0)
.findFirst();
}
/*public List<SceneGroup> getReplaceableGroups(Collection<SceneGroup> loadedGroups) {

View File

@ -2,9 +2,9 @@ package org.anime_game_servers.gi_lua.models.scene.group;
import lombok.Getter;
import lombok.ToString;
import org.anime_game_servers.gi_lua.models.Position;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.SceneMeta;
import org.anime_game_servers.gi_lua.models.constants.EntityType;
import org.anime_game_servers.gi_lua.models.scene.group.SceneGroup;
@ToString
@Getter
@ -20,12 +20,14 @@ public abstract class SceneObject {
protected int sight_group_index;
// server_global_value_config, might be group only
protected Position pos;
protected Position rot;
protected PositionImpl pos;
protected PositionImpl rot;
/**
* not set by lua
*/
protected transient SceneGroup group;
protected transient int groupId;
protected transient int blockId;
protected transient SceneMeta sceneMeta;
public abstract EntityType getType();
}

View File

@ -2,6 +2,7 @@ package org.anime_game_servers.gi_lua.models.scene.group;
import lombok.Getter;
import org.anime_game_servers.gi_lua.models.Position;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.constants.EntityType;
import org.anime_game_servers.gi_lua.models.constants.ScriptRegionShape;
@ -13,12 +14,12 @@ import java.util.List;
public class SceneRegion extends SceneObject{
private int shape;
// for CUBIC
private Position size;
private PositionImpl size;
// for SPHERE AND CYLINDER
private int radius;
// for CYLINDER and POLYGON
private float height;
private List<Position> point_array;
private List<PositionImpl> point_array;
private List<String> ability_group_list;
private List<String> team_ability_group;
private boolean is_trigger_reload_group = false;
@ -39,10 +40,6 @@ public class SceneRegion extends SceneObject{
return false;
}
public int getGroupId() {
return group.getId();
}
@Override
public EntityType getType() {
return EntityType.REGION;

View File

@ -2,6 +2,7 @@ package org.anime_game_servers.gi_lua.models.scene.group;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.anime_game_servers.gi_lua.models.SceneMeta;
import org.anime_game_servers.gi_lua.models.scene.group.SceneGroup;
@Data
@ -23,5 +24,7 @@ public class SceneTrigger {
private String tlog_tag;
private boolean forbid_guest = true;
private transient SceneGroup currentGroup;
private transient int groupId;
private transient int blockId;
private transient SceneMeta sceneMeta;
}

View File

@ -2,11 +2,10 @@ package org.anime_game_servers.gi_lua.utils;
import lombok.val;
import org.anime_game_servers.gi_lua.models.Position;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.lua.engine.LuaEngine;
import org.anime_game_servers.lua.engine.LuaTable;
import java.util.HashMap;
public class ScriptUtils {
public static LuaTable posToLua(Position position, LuaEngine engine){
@ -25,7 +24,7 @@ public class ScriptUtils {
}
public static Position luaToPos(LuaTable position){
val result = new Position();
val result = new PositionImpl();
if(position != null){
result.setX(position.optInt("x", 0));
result.setY(position.optInt("y", 0));