Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
trim_trailing_whitespace = true
insert_final_newline = true

[*.ts]
indent_size = 2
Expand All @@ -18,4 +18,4 @@ indent_size = 2
indent_size = 2

[*.yml]
indent_size = 2
indent_size = 2
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/locales/en-US/debug-tools.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ show-world-inspector = Show World Inspector
show-frame-time-diagnostics = Show Frame Time Diagnostics
show-network-visualizer = Show Network Visualizer
show-profiler = Show Profiler
show-pathfinding-lines = Show Pathfinding Lines

profiler = Profiler

Expand Down
7 changes: 5 additions & 2 deletions assets/locales/en-US/player-select.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ player-select-ready = Ready!
player-select-title = Player Select
player-select-unready = Pres { $button } to unready

waiting-for-more-players = Waiting for more players...
press-button-to-join = Press { $button } to Join
press-button-to-lock-in = Press { $button } to Lock In
press-button-to-remove = Press { $button } to Remove
press-button-to-remove = Press { $button } to Remove

add-ai-player = Add AI Player
remove-ai-player = Remove AI Player
ai-player = AI Player
16 changes: 8 additions & 8 deletions assets/map/levels/level_10.map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -770,37 +770,37 @@ layers:
- 1
- 10
idx: 58
collision: Solid
collision: JumpThrough
- pos:
- 2
- 10
idx: 60
collision: Solid
collision: JumpThrough
- pos:
- 12
- 10
idx: 56
collision: Solid
collision: JumpThrough
- pos:
- 13
- 10
idx: 58
collision: Solid
collision: JumpThrough
- pos:
- 14
- 10
idx: 60
collision: Solid
collision: JumpThrough
- pos:
- 24
- 10
idx: 56
collision: Solid
collision: JumpThrough
- pos:
- 25
- 10
idx: 58
collision: Solid
collision: JumpThrough
- pos:
- 26
- 10
Expand Down Expand Up @@ -1335,7 +1335,7 @@ layers:
- 25
- 21
idx: 8
collision: Solid
collision: JumpThrough
- pos:
- 26
- 21
Expand Down
9 changes: 5 additions & 4 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name = "jumpy_core"
version = "0.1.0"

[dependencies]
bones_bevy_asset = "0.1.0"
bones_lib = { version = "0.1.0", features = ["serde"] }
type_ulid = "0.1.0"
bones_bevy_asset = "0.1"
bones_lib = { version = "0.1", features = ["serde"] }
type_ulid = "0.1"

bytemuck = { version = "1.12.3", features = ["derive"] }
csscolorparser = "0.6.2"
Expand All @@ -20,11 +20,12 @@ puffin = "0.14.3"
rapier2d = { version = "0.17.1", features = ["enhanced-determinism", "debug-render"] }
serde = { version = "1.0.152", features = ["derive"] }
tracing = "0.1.37"
petgraph = { version = "0.6", features = ["graphmap"], default-features = false }

[dependencies.bevy]
default-features = false
features = ["bevy_asset"]
version = "0.9.0"
version = "0.9"

[dependencies.turborand]
features = ["atomic"]
Expand Down
2 changes: 2 additions & 0 deletions core/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct DebugSettings {
pub show_kinematic_colliders: bool,
/// Whether or not to render damage region collider shapes.
pub show_damage_regions: bool,
/// Whether or not to show the pathfinding lines.
pub show_pathfinding_lines: bool,
}

/// Resource containing the physics debug line entity.
Expand Down
10 changes: 4 additions & 6 deletions core/src/elements/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,10 @@ fn update_crabs(
};

let get_scared_of_pos = |scared_of: Entity| {
let scared_of_transform = transforms.get(scared_of).unwrap();

Vec2::new(
scared_of_transform.translation.x,
scared_of_transform.translation.y,
)
transforms
.get(scared_of)
.map(|x| x.translation.xy())
.unwrap_or_default()
};

if crab.state_count >= crab.state_count_max {
Expand Down
26 changes: 26 additions & 0 deletions core/src/elements/sproinger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ fn hydrate(
mut sproingers: CompMut<Sproinger>,
mut atlas_sprites: CompMut<AtlasSprite>,
mut bodies: CompMut<KinematicBody>,
mut nav_graph: ResMut<NavGraph>,
transforms: Comp<Transform>,
map: Res<LoadedMap>,
) {
let mut not_hydrated_bitset = hydrated.bitset().clone();
not_hydrated_bitset.bit_not();
not_hydrated_bitset.bit_and(element_handles.bitset());

let mut new_sproingers = Vec::new();
for entity in entities.iter_with_bitset(&not_hydrated_bitset) {
let element_handle = element_handles.get(entity).unwrap();
let Some(element_meta) = element_assets.get(&element_handle.get_bevy_handle()) else {
Expand All @@ -37,6 +41,7 @@ fn hydrate(
atlas, body_size, ..
} = &element_meta.builtin
{
new_sproingers.push(entity);
hydrated.insert(entity, MapElementHydrated);
atlas_sprites.insert(entity, AtlasSprite::new(atlas.clone()));
bodies.insert(
Expand All @@ -50,6 +55,27 @@ fn hydrate(
sproingers.insert(entity, sproinger::default());
}
}

// Update the navigation graph with the new sproingers
if !new_sproingers.is_empty() {
let mut new_graph = nav_graph.as_ref().clone();

for ent in new_sproingers {
let pos = transforms.get(ent).unwrap().translation;
let node = NavNode((pos.truncate() / map.tile_size).as_ivec2());
let sproing_to = node.above().above().above().above().above().above();

new_graph.add_edge(
node,
sproing_to,
NavGraphEdge {
inputs: [PlayerControl::default()].into(),
distance: node.distance(&sproing_to),
},
);
}
**nav_graph = Arc::new(new_graph);
}
}

fn update(
Expand Down
2 changes: 2 additions & 0 deletions core/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub struct PlayerInput {
pub previous_control: PlayerControl,
/// The editor inputs the player is making, if any.
pub editor_input: Option<EditorInput>,
/// Whether or not this is an AI player.
pub is_ai: bool,
}

/// Player control input state
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod bevy_prelude {
crate::{
input::EditorInput,
metadata::*,
session::{GameSession, GameSessionInfo},
session::{GameSession, GameSessionInfo, GameSessionPlayerInfo},
MAX_PLAYERS,
},
bones_lib::prelude as bones,
Expand Down
Loading