Skip to content

feat: add WithWorldGuard and HandlerContext system parameters #327

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

Merged
merged 22 commits into from
Feb 27, 2025

Conversation

makspll
Copy link
Owner

@makspll makspll commented Feb 26, 2025

This should allow things like:

fn my_system(mut with_guard: WIthWorldGuard<HandlerContext<LuaScriptingPlugin>>) {
	let (world_guard, handler_ctxt) = with_guard.get_mut();
	handler_ctxt.call("my_script" , ... // etc )
}

In theory it also lets you call scripts in ANY system, however the world guard will know about the other resources/ components being accessed, meaning that it will not be possible to access &mut from scripts if you access ANYTHING else (other than the handler context).

This is a good first step towards #244 , as it demonstrates how systems and WorldGuard should interact.

Also moves tests to assets to make them more discoverable as examples, and adds Default implementations for all the main resources, so they can be std::mem::replaced

@makspll makspll enabled auto-merge (squash) February 26, 2025 23:39
@makspll makspll added the needs documentation For features or changes which still need changes in the book label Feb 27, 2025
@makspll makspll merged commit 249de81 into main Feb 27, 2025
15 checks passed
@makspll makspll deleted the feat/refactor-handler-context-as-system-param branch February 27, 2025 10:00
This was referenced Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs documentation For features or changes which still need changes in the book
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant