Ignore SceneGroups that shouldn't be loaded by server (fixes loading stuck for some maps)

This commit is contained in:
xeon 2024-05-14 21:06:00 +03:00
parent 7b4479b191
commit 6c3e82adec
2 changed files with 22 additions and 2 deletions

View file

@ -27,11 +27,20 @@ pub struct RuntimeGroupInstanceInfo {
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
#[serde(default)] #[serde(default)]
pub struct RuntimeGroupInfo { pub struct RuntimeGroupInfo {
pub load_on_initial: bool,
pub load_side: GroupLoadSide,
pub group_name: Option<String>, pub group_name: Option<String>,
pub anchor_list: Option<Vec<LevelAnchorInfo>>, pub anchor_list: Option<Vec<LevelAnchorInfo>>,
pub prop_list: Option<Vec<LevelPropInfo>>, pub prop_list: Option<Vec<LevelPropInfo>>,
} }
#[derive(Default, Deserialize, PartialEq, Eq)]
pub enum GroupLoadSide {
#[default]
Client,
Server,
}
#[derive(Default, Deserialize)] #[derive(Default, Deserialize)]
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
#[serde(default)] #[serde(default)]

View file

@ -5,7 +5,10 @@ pub use group::SceneGroup;
use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::atomic::{AtomicU32, Ordering};
use common::data::{level::LevelAnchorInfo, LEVEL_TABLE}; use common::data::{
level::{GroupLoadSide, LevelAnchorInfo},
LEVEL_TABLE,
};
use proto::{AvatarType, VectorBin}; use proto::{AvatarType, VectorBin};
use self::entity::{EntityType, SceneActor, SceneEntity, SceneProp}; use self::entity::{EntityType, SceneActor, SceneEntity, SceneProp};
@ -87,11 +90,19 @@ impl GameWorld {
pub fn init_groups(&mut self) { pub fn init_groups(&mut self) {
let floor = LEVEL_TABLE.level_floors.get(&self.floor_id).unwrap(); let floor = LEVEL_TABLE.level_floors.get(&self.floor_id).unwrap();
for group_instance in &floor.group_instance_list { for group_instance in floor
.group_instance_list
.iter()
.filter(|inst| !inst.is_delete)
{
let level_group = LEVEL_TABLE let level_group = LEVEL_TABLE
.get_level_group(self.floor_id, group_instance.id) .get_level_group(self.floor_id, group_instance.id)
.unwrap(); .unwrap();
if !level_group.load_on_initial || level_group.load_side == GroupLoadSide::Client {
continue;
}
let mut prop_entity_list = Vec::new(); let mut prop_entity_list = Vec::new();
if let Some(prop_list) = level_group.prop_list.as_ref() { if let Some(prop_list) = level_group.prop_list.as_ref() {
for level_prop in prop_list { for level_prop in prop_list {