Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: arrow entity handling and damage. #772

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft

feat: arrow entity handling and damage. #772

wants to merge 24 commits into from

Conversation

andrewgazelka
Copy link
Collaborator

Arrow Entity handling and damage.

Arrow hitting blocks and damaging entities

Despawn Arrow and clamp velocity properly :)

hand animations 👍

fix bow?

first_collision rewrite. somewhat fixed arrow through floor

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

if owner.entity == event.client {
return (0.0, owner.entity, I16Vec2::ZERO);
}
let chunck_pos = event.client.entity_view(world).get::<&Position>(|pos| {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable chunck_pos contains a typo and should be renamed to chunk_pos to maintain consistent spelling throughout the codebase.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

if owner.entity == event.client {
return (0.0, owner.entity, I16Vec2::ZERO);
}
let chunck_pos = event
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable chunck_pos contains a typo and should be renamed to chunk_pos to maintain consistent spelling throughout the codebase.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@andrewgazelka
Copy link
Collaborator Author

So I have a couple thoughts. Mainly, if the ray code doesn't have an issue right now, let's not change it. Or let's try to at least move it to a separate PR if you think it's an optimization and won't break anything. I don't want to have this PR have too many separate changes in it.

I also added benchmarking (#781). So if you're making a change like this, beyond the test passing, we should also see a big change in how long it takes to run the benchmarks, the micro benchmarks. Which will be pretty interesting.

Also, okay, I suppose you can move spatial in, but in the future let's try to make modules separate. We should put some effort to making them separate in the future.

@andrewgazelka andrewgazelka changed the title Arrow Entity handling and damage. feat: arrow entity handling and damage. Dec 22, 2024
@github-actions github-actions bot added the feat label Dec 22, 2024
Comment on lines 29 to 39
world.get::<&AsyncRuntime>(|runtime| {
const URL: &str = "https://github.com/andrewgazelka/maps/raw/main/GenMap.tar.gz";

let f = hyperion_utils::cached_save(&world, URL);

let save = runtime.block_on(f).unwrap_or_else(|e| {
panic!("failed to download map {URL}: {e}");
});

world.set(Blocks::new(&world, &save).unwrap());
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
world.get::<&AsyncRuntime>(|runtime| {
const URL: &str = "https://github.com/andrewgazelka/maps/raw/main/GenMap.tar.gz";
let f = hyperion_utils::cached_save(&world, URL);
let save = runtime.block_on(f).unwrap_or_else(|e| {
panic!("failed to download map {URL}: {e}");
});
world.set(Blocks::new(&world, &save).unwrap());
});
world.import::<hyperion_genmap::GenMapModule>();

@@ -55,6 +55,6 @@ fn arrow() {
// gravity! drag! this is what was returned from the test but I am unsure if it actually
// what we should be getting
// todo: make a bunch more tests and compare to the vanilla velocity and positions
assert_eq!(*position, Position::new(0.0, 21.947_525, 0.0));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment why this is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants