Only send entity refresh packet if scene info has been sent to the client

This commit is contained in:
Melledy
2023-10-29 23:38:44 -07:00
parent e5d7eefea5
commit bb08f7dd05

View File

@@ -89,9 +89,6 @@ public class Scene {
if (getExcel().getPlaneType() != PlaneType.Challenge && getExcel().getPlaneType() != PlaneType.Rogue) { if (getExcel().getPlaneType() != PlaneType.Challenge && getExcel().getPlaneType() != PlaneType.Rogue) {
this.initSpawns(); this.initSpawns();
} }
// Done
this.loaded = true;
} }
public PlaneType getPlaneType() { public PlaneType getPlaneType() {
@@ -123,7 +120,7 @@ public class Scene {
for (MonsterInfo monsterInfo : group.getMonsterList()) { for (MonsterInfo monsterInfo : group.getMonsterList()) {
try { try {
EntityMonster monster = this.getEntityLoader().loadMonster(this, group, monsterInfo); EntityMonster monster = this.getEntityLoader().loadMonster(this, group, monsterInfo);
this.addEntity(monster); this.addEntity(monster, this.isLoaded());
} catch (Exception e) { } catch (Exception e) {
// Ignored // Ignored
} }
@@ -135,7 +132,7 @@ public class Scene {
for (PropInfo propInfo : group.getPropList()) { for (PropInfo propInfo : group.getPropList()) {
try { try {
EntityProp prop = this.getEntityLoader().loadProp(this, group, propInfo); EntityProp prop = this.getEntityLoader().loadProp(this, group, propInfo);
this.addEntity(prop); this.addEntity(prop, this.isLoaded());
} catch (Exception e) { } catch (Exception e) {
// Ignored // Ignored
} }
@@ -147,7 +144,7 @@ public class Scene {
for (NpcInfo npcInfo : group.getNPCList()) { for (NpcInfo npcInfo : group.getNPCList()) {
try { try {
EntityNpc npc = this.getEntityLoader().loadNpc(this, group, npcInfo); EntityNpc npc = this.getEntityLoader().loadNpc(this, group, npcInfo);
this.addEntity(npc); this.addEntity(npc, this.isLoaded());
} catch (Exception e) { } catch (Exception e) {
// Ignored // Ignored
} }
@@ -306,6 +303,9 @@ public class Scene {
} }
public synchronized SceneInfo toProto() { public synchronized SceneInfo toProto() {
// Set loaded flag
this.loaded = true;
// Proto // Proto
var proto = SceneInfo.newInstance() var proto = SceneInfo.newInstance()
.setWorldId(this.getExcel().getWorldID()) .setWorldId(this.getExcel().getWorldID())
@@ -352,7 +352,6 @@ public class Scene {
.setIsDefault(true); .setIsDefault(true);
proto.addGroupStateList(state); proto.addGroupStateList(state);
proto.addJBDDBBAMMNH(entry.getIntKey());
} }
// Done // Done