Skip to content

Commit

Permalink
fix: fix CI errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Oct 14, 2023
1 parent f459100 commit 7fb2fdc
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 27 deletions.
3 changes: 2 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ allow = [
"CC0-1.0",
"ISC",
"BSD-2-Clause",
"MPL-2.0", # TODO(zicklag): I believe MPL is fine for us, but maybe double-check this.
"BSD-2-Clause-Patent",
"MPL-2.0",
"OpenSSL",
]
default = "deny"
Expand Down
45 changes: 45 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Jumpy

Jumpy is a pixel-style, tactical 2D shooter with a fishy theme.

This is the project's internal developer API and architecture documentation. We want these docs to
be the go-to place for understanding how Jumpy works, so you'll find much more than the comments on
various types and functions.

#### 🚧 Under Construction

Jumpy is still under heavy development and the docs as well as the code will be changing and
incomplete. If you want to help out, feel free to fill in some missing docs or clarify something we
didn't explain very well. We're glad to answer any questions you might have along the way!

#### Diagrams

Throughout the docs there are diagrams to explain certain topics. These may contain clickable links,
highlighted in blue, that will bring you to the relevant module or struct. We also use a convention to
indicate what kind of code object it links to, based on the shape of the box.

<pre class="mermaid">
graph LR
ex("Example Link ( Note )"):::dotted -.-> sm(GameMeta):::code
click sm call docLink(jumpy/struct.GameMeta.html)

crate:::code --> module([module]):::code --> struct(struct):::code --> concept>Concept]
</pre>

You can pan the diagram by clicking and dragging or zoom by holding `ctrl` and scrolling.

[gh_issue]: https://github.com/fishfolk/jumpy/issues/new

## Overall Architecture

Jumpy has just finished a migration to the new [`bones_framework`] and some of the docs might not
be up-to-date yet.

The good news is that everything is simpler now! All of jumpy has been moved to one crate with many
of it's more foundational features being moved into [`bones_framework`]. Additionally, Jumpy no longer
uses Bevy or the Bevy ECS directly. The game is fully built on Bones with Bevy being used in the
background, but only for rendering.

An explanation post and more up-to-date docs are comming soon!

[`bones_framework`]: https://fishfolk.github.io/bones/rustdoc/bones_framework/index.html
2 changes: 1 addition & 1 deletion src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl SessionRunner for JumpyDefaultMatchRunner {
let Some(source) = &player_input.control_source else {
return;
};
player_input.control = input.get(source).unwrap().clone();
player_input.control = *input.get(source).unwrap();
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl_system_param! {
/// running. This can be used both for manual map editing, and by algorithms for generating or
/// randomizing maps.
///
/// Map generators implement the [`MapConstructor`][crate::map_constructor::MapConstructor]
/// Map generators implement the [`MapConstructor`][crate::core::map_constructor::MapConstructor]
/// trait, which is given a [`MapManager`] to make its changes with.
pub struct MapManager<'a> {
commands: Commands<'a>,
Expand Down
14 changes: 7 additions & 7 deletions src/core/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ impl From<NavNode> for IVec2 {
}
impl std::cmp::Ord for NavNode {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other).unwrap()
}
}
impl std::cmp::PartialOrd for NavNode {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
let xcmp = self.0.x.cmp(&other.0.x);
Some(if xcmp == std::cmp::Ordering::Equal {
if xcmp == std::cmp::Ordering::Equal {
self.0.y.cmp(&other.0.y)
} else {
xcmp
})
}
}
}
impl std::cmp::PartialOrd for NavNode {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod player;
pub use map::*;
pub use player::*;

/// Extension trait for the bones [`AssetServer`][bones_asset::AssetServer].
/// Extension trait for the bones [`AssetServer`].
pub trait MatchAssetServerExt {
/// Register the default assets from `bones_framework`.
fn register_match_assets(self) -> Self;
Expand Down
14 changes: 7 additions & 7 deletions src/core/physics/collisions/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,15 @@ impl std::hash::Hash for ColliderShape {

impl PartialOrd for ColliderShape {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ColliderShape {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
use ordered_float::OrderedFloat as F;
use std::cmp::Ordering::*;

Some(match self {
match self {
ColliderShape::Circle { diameter: r1 } => match other {
ColliderShape::Circle { diameter: r2 } => F(*r1).cmp(&F(*r2)),
ColliderShape::Rectangle { .. } => Less,
Expand All @@ -113,11 +118,6 @@ impl PartialOrd for ColliderShape {
}
ColliderShape::Circle { .. } => Greater,
},
})
}
}
impl Ord for ColliderShape {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other).unwrap()
}
}
}
4 changes: 2 additions & 2 deletions src/core/player/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pub struct PlayerState {
pub last: Ustr,
}
impl PlayerState {
/// Adds a system to the appropriate stage in a [`CoreSession`] for a player state transition.
/// Adds a system to the appropriate stage in a [`Session`] for a player state transition.
pub fn add_player_state_transition_system<Args>(
session: &mut Session,
system: impl IntoSystem<Args, (), (), Sys = StaticSystem<(), ()>>,
) {
session.stages.add_system_to_stage(PlayerStateStage, system);
}

/// Adds a system to the appropriate stage in a [`CoreSession`] for a player state update.
/// Adds a system to the appropriate stage in a [`Session`] for a player state update.
pub fn add_player_state_update_system<Args>(
session: &mut Session,
system: impl IntoSystem<Args, (), (), Sys = StaticSystem<(), ()>>,
Expand Down
2 changes: 1 addition & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct EguiInputSettings {

/// Game system that takes the raw input events and converts it to player controls based on the
/// player input map.
fn handle_egui_input(game: &mut Game, egui_input: &mut egui::RawInput) {
pub fn handle_egui_input(game: &mut Game, egui_input: &mut egui::RawInput) {
// We collect the global player controls here in the egui input hoook so that it will be
// available immediately to egui, and then available to the rest of the systems that run after.
collect_player_controls(game);
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// This is temporarily disabled while migrating to the new bones.
#![allow(dead_code)]
#![allow(ambiguous_glob_reexports)]
#![doc = include_str!("./README.md")]

use bones_bevy_renderer::BonesBevyRenderer;
use bones_framework::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn load_settings(game: &mut Game) {
}
}

/// Global settings, stored and accessed through [`crate::platform::Storage`]
/// Global settings, stored and accessed through [`Storage`].
#[derive(HasSchema, Debug, Clone, Default)]
#[repr(C)]
pub struct Settings {
Expand Down
10 changes: 5 additions & 5 deletions src/ui/main_menu/player_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ fn player_select_panel(
// If the handle is empty
if *player_handle == default() {
// Select the first player
*player_handle = meta.core.players[0].clone();
*player_handle = meta.core.players[0];
}

// Handle player joining
Expand Down Expand Up @@ -390,7 +390,7 @@ fn player_select_panel(
.map(|x| if x == 0 { None } else { Some(x - 1) })
.unwrap_or(Some(meta.core.player_hats.len() - 1))
};
slot.selected_hat = next_idx.map(|idx| meta.core.player_hats.get(idx).unwrap().clone());
slot.selected_hat = next_idx.map(|idx| *meta.core.player_hats.get(idx).unwrap());

// #[cfg(not(target_arch = "wasm32"))]
// if let Some(socket) = &params.network_socket {
Expand Down Expand Up @@ -418,7 +418,7 @@ fn player_select_panel(
.players
.get(current_player_handle_idx + 1)
.cloned()
.unwrap_or_else(|| meta.core.players[0].clone());
.unwrap_or_else(|| meta.core.players[0]);
} else if direction.x <= 0.0 {
if current_player_handle_idx > 0 {
*player_handle = meta
Expand All @@ -428,7 +428,7 @@ fn player_select_panel(
.cloned()
.unwrap();
} else {
*player_handle = meta.core.players.iter().last().unwrap().clone();
*player_handle = *meta.core.players.iter().last().unwrap();
}
}

Expand Down Expand Up @@ -607,7 +607,7 @@ fn player_select_panel(
slot.active = true;
let rand_idx =
THREAD_RNG.with(|rng| rng.usize(0..meta.core.players.len()));
slot.selected_player = meta.core.players[rand_idx].clone();
slot.selected_player = meta.core.players[rand_idx];
}
}
});
Expand Down

0 comments on commit 7fb2fdc

Please sign in to comment.