mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 15:24:44 +01:00
Fix debris in MoC
This commit is contained in:
@@ -10,4 +10,5 @@ public class MonsterInfo extends ObjectInfo {
|
|||||||
private int NPCMonsterID;
|
private int NPCMonsterID;
|
||||||
private int EventID;
|
private int EventID;
|
||||||
private int FarmElementID;
|
private int FarmElementID;
|
||||||
|
private boolean IsClientOnly;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
public class NpcInfo extends ObjectInfo {
|
public class NpcInfo extends ObjectInfo {
|
||||||
private int NPCID;
|
private int NPCID;
|
||||||
|
private boolean IsClientOnly;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class PropInfo extends ObjectInfo {
|
|||||||
private int EventID;
|
private int EventID;
|
||||||
private int CocoonID;
|
private int CocoonID;
|
||||||
private int FarmElementID;
|
private int FarmElementID;
|
||||||
|
private boolean IsClientOnly;
|
||||||
private PropValueSource ValueSource;
|
private PropValueSource ValueSource;
|
||||||
|
|
||||||
@Setter private String InitLevelGraph;
|
@Setter private String InitLevelGraph;
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import emu.lunarcore.data.GameData;
|
|||||||
import emu.lunarcore.data.config.GroupInfo;
|
import emu.lunarcore.data.config.GroupInfo;
|
||||||
import emu.lunarcore.data.config.MonsterInfo;
|
import emu.lunarcore.data.config.MonsterInfo;
|
||||||
import emu.lunarcore.data.config.NpcInfo;
|
import emu.lunarcore.data.config.NpcInfo;
|
||||||
import emu.lunarcore.data.config.PropInfo;
|
import emu.lunarcore.data.config.GroupInfo.GroupLoadSide;
|
||||||
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
||||||
import emu.lunarcore.data.excel.ChallengeExcel.ChallengeMonsterInfo;
|
import emu.lunarcore.data.excel.ChallengeExcel.ChallengeMonsterInfo;
|
||||||
import emu.lunarcore.game.scene.Scene;
|
import emu.lunarcore.game.scene.Scene;
|
||||||
import emu.lunarcore.game.scene.SceneEntityLoader;
|
import emu.lunarcore.game.scene.SceneEntityLoader;
|
||||||
import emu.lunarcore.game.scene.entity.EntityMonster;
|
import emu.lunarcore.game.scene.entity.EntityMonster;
|
||||||
import emu.lunarcore.game.scene.entity.EntityNpc;
|
import emu.lunarcore.game.scene.entity.EntityNpc;
|
||||||
import emu.lunarcore.game.scene.entity.EntityProp;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
|
||||||
public class ChallengeEntityLoader extends SceneEntityLoader {
|
public class ChallengeEntityLoader extends SceneEntityLoader {
|
||||||
@@ -24,6 +23,19 @@ public class ChallengeEntityLoader extends SceneEntityLoader {
|
|||||||
|
|
||||||
// Setup first stage
|
// Setup first stage
|
||||||
scene.loadGroup(instance.getExcel().getMazeGroupID1());
|
scene.loadGroup(instance.getExcel().getMazeGroupID1());
|
||||||
|
|
||||||
|
// Load all groups with props
|
||||||
|
for (var group : scene.getFloorInfo().getGroups().values()) {
|
||||||
|
// Skip non-server groups
|
||||||
|
if (group.getLoadSide() != GroupLoadSide.Server) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dont load the groups that have monsters in them
|
||||||
|
if (group.getPropList().size() > 0 && group.getMonsterList().size() == 0) {
|
||||||
|
scene.loadGroup(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,11 +70,6 @@ public class ChallengeEntityLoader extends SceneEntityLoader {
|
|||||||
return monster;
|
return monster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) {
|
public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ public class SceneEntityLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityMonster loadMonster(Scene scene, GroupInfo group, MonsterInfo monsterInfo) {
|
public EntityMonster loadMonster(Scene scene, GroupInfo group, MonsterInfo monsterInfo) {
|
||||||
// Don't spawn entity if they have the IsDelete flag in group info
|
// Don't spawn entity if they have certain flags in their info
|
||||||
if (monsterInfo.isIsDelete()) return null;
|
if (monsterInfo.isIsDelete() || monsterInfo.isIsClientOnly()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Get excels from game data
|
// Get excels from game data
|
||||||
NpcMonsterExcel npcMonsterExcel = GameData.getNpcMonsterExcelMap().get(monsterInfo.getNPCMonsterID());
|
NpcMonsterExcel npcMonsterExcel = GameData.getNpcMonsterExcelMap().get(monsterInfo.getNPCMonsterID());
|
||||||
@@ -46,8 +48,10 @@ public class SceneEntityLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) {
|
public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) {
|
||||||
// Don't spawn entity if they have the IsDelete flag in group info
|
// Don't spawn entity if they have certain flags in their info
|
||||||
if (propInfo.isIsDelete()) return null;
|
if (propInfo.isIsDelete() || propInfo.isIsClientOnly()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Get prop excel to make sure prop exists
|
// Get prop excel to make sure prop exists
|
||||||
PropExcel propExcel = GameData.getPropExcelMap().get(propInfo.getPropID());
|
PropExcel propExcel = GameData.getPropExcelMap().get(propInfo.getPropID());
|
||||||
@@ -84,20 +88,25 @@ public class SceneEntityLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) {
|
public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) {
|
||||||
// Don't spawn entity if they have the IsDelete flag in group info
|
// Don't spawn entity if they have certain flags in their info
|
||||||
if (npcInfo.isIsDelete() || !GameData.getNpcExcelMap().containsKey(npcInfo.getNPCID())) {
|
if (npcInfo.isIsDelete() || npcInfo.isIsClientOnly()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check npc id
|
||||||
|
if (!GameData.getNpcExcelMap().containsKey(npcInfo.getNPCID())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dont spawn duplicate NPCs
|
// Dont spawn duplicate NPCs
|
||||||
boolean haseDuplicateNpcId = false;
|
boolean hasDuplicateNpcId = false;
|
||||||
for (GameEntity entity : scene.getEntities().values()) {
|
for (GameEntity entity : scene.getEntities().values()) {
|
||||||
if (entity instanceof EntityNpc eNpc && eNpc.getNpcId() == npcInfo.getNPCID()) {
|
if (entity instanceof EntityNpc eNpc && eNpc.getNpcId() == npcInfo.getNPCID()) {
|
||||||
haseDuplicateNpcId = true;
|
hasDuplicateNpcId = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (haseDuplicateNpcId) return null;
|
if (hasDuplicateNpcId) return null;
|
||||||
|
|
||||||
// Create npc from group and npc info
|
// Create npc from group and npc info
|
||||||
return new EntityNpc(scene, group, npcInfo);
|
return new EntityNpc(scene, group, npcInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user