Skip to content

Commit

Permalink
fix-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhgithub committed Sep 13, 2023
1 parent 890f06a commit 9cb23e8
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 80 deletions.
8 changes: 7 additions & 1 deletion backup
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ Lz4压缩解压 https://crates.io/crates/lz4
mesh周围添加外边框 https://github.com/komadori/bevy_mod_outline
视觉特效包 https://github.com/torsteingrindvik/bevy-vfx-bag (暂时没有更新到0.11.0)
草的mesh 生成https://github.com/EmiOnGit/warbler_grass
3d的2D精灵 https://github.com/FraserLee/bevy_sprite3d
3d的2D精灵 https://github.com/FraserLee/bevy_sprite3d

运动学 https://github.com/Kurble/bevy_mod_inverse_kinematics
别人的技能整理 https://github.com/NexusSocial/skilltree
载具可能的例子 https://github.com/gavlig/gryazevichki
glrf生成碰撞mesh的库 https://github.com/Defernus/bevy_gltf_collider
画笔工具 https://github.com/eliotbo/bevy_pen_tool
20 changes: 10 additions & 10 deletions src/client/mesh_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use crate::{
tools::get_all_v_chunk,
voxel_world::{
chunk::{
find_chunk_keys_array_by_shpere_y_0, generate_offset_resoure,
generate_offset_resoure_min_1, ChunkKey, NeighbourOffest,
find_chunk_keys_array_by_sphere_y_0, generate_offset_resource,
generate_offset_resource_min_1, ChunkKey, NeighbourOffset,
},
chunk_map::ChunkMap,
compress::uncompress,
Expand Down Expand Up @@ -75,7 +75,7 @@ impl Plugin for ClientMeshPlugin {
app.insert_resource(ChunkMap::new());
app.insert_resource(MeshManager::default());
app.insert_resource(MeshTasks { tasks: Vec::new() });
app.insert_resource(generate_offset_resoure(VIEW_RADIUS));
app.insert_resource(generate_offset_resource(VIEW_RADIUS));
app.insert_resource(ChunkSyncTask { tasks: Vec::new() });
app.insert_resource(ChunkUpdateTask { tasks: Vec::new() });
app.insert_resource(CycleCheckTimer(Timer::new(
Expand Down Expand Up @@ -119,13 +119,13 @@ pub fn gen_mesh_system(
chunk_map: Res<ChunkMap>,
mut mesh_manager: ResMut<MeshManager>,
clip_spheres: Res<ClipSpheres>,
neighbour_offest: Res<NeighbourOffest>,
neighbour_offest: Res<NeighbourOffset>,
mut mesh_task: ResMut<MeshTasks>,
mut client: ResMut<RenetClient>,
) {
let pool = AsyncComputeTaskPool::get();
for key in
find_chunk_keys_array_by_shpere_y_0(clip_spheres.new_sphere, neighbour_offest.0.clone())
find_chunk_keys_array_by_sphere_y_0(clip_spheres.new_sphere, neighbour_offest.0.clone())
.drain(..)
{
if !mesh_manager.entities.contains_key(&key) && !mesh_manager.fast_key.contains(&key) {
Expand Down Expand Up @@ -423,19 +423,19 @@ pub fn update_mesh_system(
pub fn deleter_mesh_system(
mut commands: Commands,
mut mesh_manager: ResMut<MeshManager>,
neighbour_offest: Res<NeighbourOffest>,
neighbour_offest: Res<NeighbourOffset>,
clip_spheres: Res<ClipSpheres>,
) {
let mut chunks_to_remove = HashSet::new();
for key in
find_chunk_keys_array_by_shpere_y_0(clip_spheres.old_sphere, neighbour_offest.0.clone())
find_chunk_keys_array_by_sphere_y_0(clip_spheres.old_sphere, neighbour_offest.0.clone())
.drain(..)
{
chunks_to_remove.insert(key);
}

for key in
find_chunk_keys_array_by_shpere_y_0(clip_spheres.new_sphere, neighbour_offest.0.clone())
find_chunk_keys_array_by_sphere_y_0(clip_spheres.new_sphere, neighbour_offest.0.clone())
.drain(..)
{
chunks_to_remove.remove(&key);
Expand Down Expand Up @@ -468,9 +468,9 @@ fn cycle_check_mesh(
) {
timer.0.tick(time.delta());
if timer.0.finished() {
let need_keys: HashSet<ChunkKey> = find_chunk_keys_array_by_shpere_y_0(
let need_keys: HashSet<ChunkKey> = find_chunk_keys_array_by_sphere_y_0(
clip_spheres.new_sphere,
generate_offset_resoure_min_1(VIEW_RADIUS).0,
generate_offset_resource_min_1(VIEW_RADIUS).0,
)
.iter()
.copied()
Expand Down
2 changes: 1 addition & 1 deletion src/client/message_def/staff_rule_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ use serde::{Deserialize, Serialize};
pub struct StaffRuleMessage {
pub staff_rule_id: u32,
pub need: Vec<(usize, usize, usize)>,
pub times:usize,
pub times: usize,
}
4 changes: 2 additions & 2 deletions src/server/async_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
chunk_map::ChunkMap,
compress::compress,
map_database::{DbSaveTasks, MapDataBase},
player_state::PlayerOntimeState,
player_state::PlayerOnTimeState,
voxel::{BasicStone, Voxel, VoxelMaterial},
},
CHUNK_SIZE, CHUNK_SIZE_U32,
Expand Down Expand Up @@ -46,7 +46,7 @@ pub fn deal_chunk_query_system(
mut fill_event: EventWriter<ObjectFillEvent>,
staff_info_stroge: Res<StaffInfoStroge>,
// 获取玩家当前状态 和处理
mut query_state: Query<&mut PlayerOntimeState>,
mut query_state: Query<&mut PlayerOnTimeState>,
server_lobby: Res<ServerLobby>,
mut other_tree_tasks_map: ResMut<OtherTreeTasksMap>,
) {
Expand Down
8 changes: 4 additions & 4 deletions src/server/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
voxel_world::{
biomes::OtherTreeTasksMap,
chunk::{
find_chunk_keys_by_shpere_to_full_height, generate_offset_resoure, NeighbourOffest,
find_chunk_keys_by_sphere_to_full_height, generate_offset_resource, NeighbourOffset,
},
chunk_map::ChunkMap,
map_database::{save_db_task_system, DbSaveTasks, MapDataBase},
Expand All @@ -18,15 +18,15 @@ use crate::{
*/
pub fn server_chunk_generate_system(
mut chunk_map: ResMut<ChunkMap>,
neighbour_offest: Res<NeighbourOffest>,
neighbour_offest: Res<NeighbourOffset>,
server_clip_spheres: Res<ServerClipSpheres>,
mut db: ResMut<MapDataBase>,
mut db_save_tasks: ResMut<DbSaveTasks>,
mut other_tree_tasks_map: ResMut<OtherTreeTasksMap>,
) {
for (_client_id, clip_spheres) in server_clip_spheres.clip_spheres.iter() {
// 通过球体计算 chunkey
find_chunk_keys_by_shpere_to_full_height(
find_chunk_keys_by_sphere_to_full_height(
clip_spheres.new_sphere,
neighbour_offest.0.clone(),
|key| {
Expand All @@ -52,7 +52,7 @@ impl Plugin for ServerChunkPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
// init MapData
app.insert_resource(MapDataBase::new(WORD_PATH));
app.insert_resource(generate_offset_resoure(VIEW_RADIUS));
app.insert_resource(generate_offset_resource(VIEW_RADIUS));
app.insert_resource(ChunkMap::new());
app.insert_resource(DbSaveTasks { tasks: Vec::new() });

Expand Down
4 changes: 2 additions & 2 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
users::Username,
voxel_world::{
map_database::MapDataBase,
player_state::{PlayerOntimeState, PlayerState, StorgePlayerState},
player_state::{PlayerOnTimeState, PlayerState, StoragePlayerState},
},
};

Expand All @@ -43,7 +43,7 @@ pub fn server_connect_system(
mut commands: Commands,
mut server_events: EventReader<ServerEvent>,
mut visualizer: ResMut<RenetServerVisualizer<200>>,
players: Query<(Entity, &Player, &Transform, &PlayerOntimeState)>,
players: Query<(Entity, &Player, &Transform, &PlayerOnTimeState)>,
mut server: ResMut<RenetServer>,
mut server_lobby: ResMut<ServerLobby>,
transport: Res<NetcodeServerTransport>,
Expand Down
6 changes: 3 additions & 3 deletions src/server/object_filing/follow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
message_def::{tool_bar_message::ToolBarMessage, ServerChannel},
player::Player,
},
voxel_world::player_state::PlayerOntimeState,
voxel_world::player_state::PlayerOnTimeState,
CLOSE_RANGE, NEAR_RANGE, PICK_SPEED,
};

Expand Down Expand Up @@ -211,7 +211,7 @@ fn not_follow_change_type(
fn pick_up_entity(
mut commands: Commands,
// 有状态的角色
mut palyer_states: Query<(Entity, &Player, &mut PlayerOntimeState)>,
mut palyer_states: Query<(Entity, &Player, &mut PlayerOnTimeState)>,
// 被捡起的数据
pick_query: Query<(Entity, &FilledObject, &Picked)>,
mut server: ResMut<RenetServer>,
Expand All @@ -220,7 +220,7 @@ fn pick_up_entity(
// 1. 获取到pick的目标受体
if let Ok((_, player, mut player_state)) = palyer_states.get_mut(picked.target) {
// 2. 检查可以使用的空位 并修改数据
if let Some((index, _, num)) = player_state.0.put_statff(filled_object.staff.id) {
if let Some((index, _, num)) = player_state.0.put_staff(filled_object.staff.id) {
// 找到位置并摆放
// 发送消息销毁对象
let message = bincode::serialize(&ToolBarMessage::SyncToolbar {
Expand Down
6 changes: 3 additions & 3 deletions src/server/object_filing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
staff::{Staff, StaffInfoStroge},
tools::vec3_to_chunk_key_any_xyz,
voxel_world::{
chunk::{find_chunk_keys_array_by_shpere, generate_offset_array, ChunkKey},
chunk::{find_chunk_keys_array_by_sphere, generate_offset_array, ChunkKey},
map_database::MapDataBase,
},
PY_DISTANCE,
Expand Down Expand Up @@ -115,7 +115,7 @@ fn sync_filled_object_to_client(
for (client_id, clip_spheres) in server_clip_spheres.clip_spheres.iter() {
let mut staff_list: Vec<(Entity, usize, [f32; 3])> = Vec::new();
// 对每个球体展开一阶
for chunk_key in find_chunk_keys_array_by_shpere(
for chunk_key in find_chunk_keys_array_by_sphere(
clip_spheres.new_sphere,
generate_offset_array(PY_DISTANCE),
)
Expand Down Expand Up @@ -201,7 +201,7 @@ fn load_filled(
) {
let mut hashed_object = map_chunk_key_filled_object(&query);
for (_, clip_spheres) in server_clip_spheres.clip_spheres.iter() {
for chunk_key in find_chunk_keys_array_by_shpere(
for chunk_key in find_chunk_keys_array_by_sphere(
clip_spheres.new_sphere,
generate_offset_array(PY_DISTANCE),
)
Expand Down
4 changes: 2 additions & 2 deletions src/server/object_filing/put_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use crate::{
message_def::{tool_bar_message::ToolBarMessage, ServerChannel},
player::ServerLobby,
},
voxel_world::player_state::PlayerOntimeState,
voxel_world::player_state::PlayerOnTimeState,
};

/// 放置方块。如果成功修改toolbar并发送消息。如果失败的情况下 直接返回false
pub fn put_object(
client_id: u64,
server_lobby: &ServerLobby,
query: &mut Query<&mut PlayerOntimeState>,
query: &mut Query<&mut PlayerOnTimeState>,
active_index: usize,
staff_id: usize,
server: &mut RenetServer,
Expand Down
4 changes: 2 additions & 2 deletions src/server/object_filing/throw_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
server::{player::ServerLobby, tool_bar_sync::send_all_tool_bar},
staff::StaffInfoStroge,
tools::vec3_to_chunk_key_any_xyz,
voxel_world::player_state::PlayerOntimeState,
voxel_world::player_state::PlayerOnTimeState,
};

use super::gen_filled_object;
Expand All @@ -23,7 +23,7 @@ pub fn deal_with_throw_object(
mut commands: Commands,
mut server: ResMut<RenetServer>,
server_lobby: Res<ServerLobby>,
mut query: Query<(Entity, &Transform, &mut PlayerOntimeState)>,
mut query: Query<(Entity, &Transform, &mut PlayerOnTimeState)>,
staff_info_stroge: Res<StaffInfoStroge>,
) {
for client_id in server.clients_id() {
Expand Down
4 changes: 2 additions & 2 deletions src/server/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy_rapier3d::prelude::{
Ccd, Collider, ColliderMassProperties, CollisionGroups, Group, LockedAxes, RigidBody, Sleeping,
};

use crate::voxel_world::player_state::{PlayerOntimeState, PlayerState};
use crate::voxel_world::player_state::{PlayerOnTimeState, PlayerState};

use super::cross_through_check::CossTroughCheck;

Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn server_create_player(
.insert(Ccd::enabled())
.insert(YawValue::default())
.insert(PitchValue::default())
.insert(PlayerOntimeState(player_state))
.insert(PlayerOnTimeState(player_state))
.insert(CollisionGroups::new(
Group::GROUP_3,
Group::GROUP_1 | Group::GROUP_3,
Expand Down
4 changes: 2 additions & 2 deletions src/server/staff_rule_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
StaffInfoStroge,
},
tools::vec3_to_chunk_key_any_xyz,
voxel_world::player_state::PlayerOntimeState,
voxel_world::player_state::PlayerOnTimeState,
};

use super::{
Expand All @@ -26,7 +26,7 @@ impl Plugin for ServerStaffRulePlugin {
pub fn deal_with_staff_rule(
mut server: ResMut<RenetServer>,
lobby: ResMut<ServerLobby>,
mut query: Query<(Entity, &Transform, &mut PlayerOntimeState)>,
mut query: Query<(Entity, &Transform, &mut PlayerOnTimeState)>,
staff_rules: Res<StaffRules>,
mut fill_event: EventWriter<ObjectFillEvent>,
staff_info_stroge: Res<StaffInfoStroge>,
Expand Down
8 changes: 4 additions & 4 deletions src/server/terrain_physics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use ndshape::{ConstShape, ConstShape3u32};
use crate::{
common::ServerClipSpheres,
voxel_world::{
chunk::{find_chunk_keys_array_by_shpere, generate_offset_array, ChunkKey},
chunk::{find_chunk_keys_array_by_sphere, generate_offset_array, ChunkKey},
chunk_map::ChunkMap,
voxel::Voxel,
},
Expand Down Expand Up @@ -44,7 +44,7 @@ pub fn server_update_collider_task_system(
) {
let pool = AsyncComputeTaskPool::get();
for (_client_id, clip_spheres) in server_clip_spheres.clip_spheres.iter() {
for chunk_key in find_chunk_keys_array_by_shpere(
for chunk_key in find_chunk_keys_array_by_sphere(
clip_spheres.new_sphere,
generate_offset_array(PY_DISTANCE),
)
Expand Down Expand Up @@ -109,14 +109,14 @@ pub fn despawn_collider(
let mut chunks_to_remove = HashSet::new();
for (_client_id, clip_spheres) in server_clip_spheres.clip_spheres.iter() {
for key in
find_chunk_keys_array_by_shpere(clip_spheres.old_sphere, neighbour_offest.clone())
find_chunk_keys_array_by_sphere(clip_spheres.old_sphere, neighbour_offest.clone())
.drain(..)
{
chunks_to_remove.insert(key);
}

for key in
find_chunk_keys_array_by_shpere(clip_spheres.new_sphere, neighbour_offest.clone())
find_chunk_keys_array_by_sphere(clip_spheres.new_sphere, neighbour_offest.clone())
.drain(..)
{
chunks_to_remove.remove(&key);
Expand Down
File renamed without changes.
Loading

0 comments on commit 9cb23e8

Please sign in to comment.