mirror of
https://github.com/RustySamovar/RustySamovar.git
synced 2024-11-21 18:38:18 +00:00
Now load info about scenes from config
This commit is contained in:
parent
5af44e8900
commit
87781530de
@ -10,6 +10,7 @@ use rand::{seq::IteratorRandom, thread_rng};
|
||||
use crate::jsonmanager::gather::Gather;
|
||||
use crate::jsonmanager::material::Material;
|
||||
use crate::jsonmanager::reliquary::{Reliquary, ReliquaryAffix, ReliquaryMainProp};
|
||||
use crate::jsonmanager::scene::Scene;
|
||||
use crate::jsonmanager::shop_goods::ShopGoods;
|
||||
use crate::jsonmanager::shop_rotate::ShopRotate;
|
||||
use crate::jsonmanager::teleport_point::TeleportPoint;
|
||||
@ -57,6 +58,8 @@ pub struct JsonManager {
|
||||
pub materials: HashMap<u32, Material>,
|
||||
|
||||
pub teleport_points: HashMap<u32, HashMap<u32, TeleportPoint>>,
|
||||
|
||||
pub scenes: HashMap<u32, Scene>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for JsonManager { // TODO: fucking hack!
|
||||
@ -89,6 +92,8 @@ impl JsonManager {
|
||||
|
||||
let teleport_points: Vec<TeleportPoint> = reader.read_json_list_3rdparty("TeleportPoints");
|
||||
|
||||
let scenes: Vec<Scene> = reader.read_json_list_game("Scene");
|
||||
|
||||
return JsonManager {
|
||||
reader: reader,
|
||||
avatar_skill_depot: asd.into_iter().map(|a| (a.id, a)).collect(),
|
||||
@ -115,6 +120,8 @@ impl JsonManager {
|
||||
teleport_points: group_nonconsec_by(teleport_points, |tp| tp.scene_id).into_iter()
|
||||
.map(|(scene_id, tp_list)| (scene_id, tp_list.into_iter().map(|tp| (tp.point_id, tp)).collect()))
|
||||
.collect(),
|
||||
|
||||
scenes: scenes.into_iter().map(|s| (s.id, s)).collect(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ mod weapon;
|
||||
mod reliquary;
|
||||
mod material;
|
||||
mod teleport_point;
|
||||
mod scene;
|
||||
|
||||
pub use entity_curve::{CurveInfo,EntityCurve};
|
||||
pub use shop_goods::ShopGoods;
|
20
src/jsonmanager/scene.rs
Normal file
20
src/jsonmanager/scene.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
#[serde(rename_all="PascalCase")]
|
||||
pub struct Scene {
|
||||
pub id: u32,
|
||||
pub r#type: String, // TODO: that's an enum!
|
||||
pub script_data: String,
|
||||
pub override_default_profile: String,
|
||||
pub level_entity_config: String,
|
||||
#[serde(default)]
|
||||
pub max_specified_avatar_num: u32,
|
||||
pub specified_avatar_list: Vec<u32>,
|
||||
pub comment: String,
|
||||
|
||||
#[serde(default)]
|
||||
pub ignore_nav_mesh: bool,
|
||||
|
||||
pub safe_point: Option<u32>,
|
||||
}
|
@ -172,8 +172,10 @@ impl GameWorld {
|
||||
scene_time: 9000,
|
||||
});
|
||||
|
||||
let level_config = &self.jm.scenes[¤t_scene_info.scene_id].level_entity_config;
|
||||
|
||||
build_and_send!(self, user_id, metadata, SceneDataNotify {
|
||||
level_config_name_list: vec!["Level_BigWorld".to_string()], // TODO
|
||||
level_config_name_list: vec![level_config.to_string()], // TODO: maybe there's more?
|
||||
});
|
||||
|
||||
build_and_send!(self, user_id, metadata, HostPlayerNotify {
|
||||
|
Loading…
Reference in New Issue
Block a user