wicked-waifus-rs/game-server/src/logic/role/formation.rs
xavo95 c6b66eacb4
[PATCH] feat: implement formation and switch roles functionality
- Add support for multi-character formations and role switching
- Refactor entity management system to handle multiple entities per map
- Update attribute component to use a map-based approach for properties
- Implement formation-related handlers and notifications
- Add world entity management per map instance
- Update player save/load logic to handle formations
- Add visibility controls for active character display
2024-10-24 13:15:50 +02:00

28 lines
736 B
Rust

use shorekeeper_protocol::RoleFormationData;
pub struct RoleFormation {
pub id: i32,
pub cur_role: i32,
pub role_ids: Vec<i32>,
pub is_current: bool,
}
impl RoleFormation {
pub fn load_from_save(data: RoleFormationData) -> Self {
Self {
id: data.formation_id,
cur_role: data.cur_role,
role_ids: data.role_id_list,
is_current: data.is_current,
}
}
pub fn build_save_data(&self) -> RoleFormationData {
RoleFormationData {
formation_id: self.id,
cur_role: self.cur_role,
role_id_list: self.role_ids.iter().map(|&role_id| role_id).collect(),
is_current: self.is_current,
}
}
}