Skip to content

Adds position and entity selectors as command arguments#327

Merged
Sweattypalms merged 21 commits into
masterfrom
feature/better-command-args
Jan 26, 2026
Merged

Adds position and entity selectors as command arguments#327
Sweattypalms merged 21 commits into
masterfrom
feature/better-command-args

Conversation

@ReCore-sys

Copy link
Copy Markdown
Contributor

Adds position and entities as command args so you can now kill your friends.

Description

Adding entities as command args lets you target players and entities with you commands, and the position arg lets you take in a position that can either be absolute or relative to another given position, usually the player running the command.

Motivation and Context

I want to murder my friends :)

How has this been tested?

Units tests added for parsing and resolving, teleports tested with multiple players in game

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (restructuring code, without changing its behavior)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Clippy passes with no warnings.

@Sweattypalms Sweattypalms left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why edition = "2024" only for some crates and 2021 for rest?

And what's the plan with the @p selector? Merge broken or remove?

And why MORE_GLOBAL_STATE? Sounds like a stupid bandage solution.

let Ok(mut tracker) = query.get_mut(eid) else {
continue;
};
tracker.waiting_for_confirm = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why ignore teleport_id from client? Malicious client could send fake confirmations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sending malicious confirmations doesn't really do anything, the vanilla server doesn't even handle them.

Comment thread src/lib/default_commands/src/tp.rs Outdated
Comment thread src/lib/commands/src/arg/entities/mod.rs Outdated
Comment thread src/lib/core/state/src/lib.rs Outdated
Comment thread src/lib/default_commands/src/tp.rs Outdated
Comment thread src/bin/src/systems/listeners/player_tp.rs Outdated
Comment thread src/lib/commands/src/arg/position.rs
Comment thread src/bin/src/packet_handlers/play_packets/set_player_rotation.rs Outdated

@Sweattypalms Sweattypalms left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't address the crate's edition inconsistency.

And are you sure the tilda parsing is valid?

Comment thread src/lib/commands/src/arg/position.rs Outdated
@ReCore-sys

ReCore-sys commented Jan 25, 2026

Copy link
Copy Markdown
Contributor Author

Doesn't address the crate's edition inconsistency.

I remembered what it was, if-let chains are a 2024 edition thing, but 2024 edition also changes some temporary lifetimes stuff which makes other code much less readable, have a look at #322 to see what i mean

@Sweattypalms Sweattypalms left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@Sweattypalms Sweattypalms merged commit bb3db9c into master Jan 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants