mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Enable plugins by default
This commit is contained in:
parent
8fde002189
commit
47b522e156
@ -14,7 +14,7 @@ pub fn global_state(_args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
static mut PLUGIN_STATE: Option<PLUGIN_STATE_TYPE> = None;
|
static mut PLUGIN_STATE: Option<PLUGIN_STATE_TYPE> = None;
|
||||||
|
|
||||||
static PLUGIN_STATE_GUARD: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
static PLUGIN_STATE_GUARD: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicBool::new(false);
|
||||||
};
|
};
|
||||||
out.into()
|
out.into()
|
||||||
}
|
}
|
||||||
@ -57,15 +57,11 @@ pub fn event_handler(_args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
}
|
}
|
||||||
// Artificially force the event handler to be type-correct
|
// Artificially force the event handler to be type-correct
|
||||||
fn force_event<E: ::veloren_plugin_rt::api::Event>(event: E, inner: fn(E, &mut PLUGIN_STATE_TYPE) -> E::Response) -> E::Response {
|
fn force_event<E: ::veloren_plugin_rt::api::Event>(event: E, inner: fn(E, &mut PLUGIN_STATE_TYPE) -> E::Response) -> E::Response {
|
||||||
//let mut plugin_state = PLUGIN_STATE.lock().unwrap();
|
|
||||||
|
|
||||||
assert_eq!(PLUGIN_STATE_GUARD.swap(true, std::sync::atomic::Ordering::Acquire), false);
|
assert_eq!(PLUGIN_STATE_GUARD.swap(true, std::sync::atomic::Ordering::Acquire), false);
|
||||||
unsafe {
|
let out = inner(
|
||||||
if PLUGIN_STATE.is_none() {
|
event,
|
||||||
PLUGIN_STATE = Some(PLUGIN_STATE_TYPE::default());
|
unsafe { PLUGIN_STATE.get_or_insert_with(core::default::Default::default) },
|
||||||
}
|
);
|
||||||
}
|
|
||||||
let out = inner(event, unsafe {PLUGIN_STATE.as_mut().unwrap()});
|
|
||||||
PLUGIN_STATE_GUARD.store(false, std::sync::atomic::Ordering::Release);
|
PLUGIN_STATE_GUARD.store(false, std::sync::atomic::Ordering::Release);
|
||||||
out
|
out
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ This package includes the official server CLI.
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
worldgen = ["server/worldgen"]
|
worldgen = ["server/worldgen"]
|
||||||
default = ["worldgen"]
|
default = ["worldgen", "plugins"]
|
||||||
tracy = ["common/tracy", "server/tracy", "common-net/tracy", "common-frontend/tracy"]
|
tracy = ["common/tracy", "server/tracy", "common-net/tracy", "common-frontend/tracy"]
|
||||||
plugins = ["server/plugins"]
|
plugins = ["server/plugins"]
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ hot-anim = ["anim/use-dyn-lib"]
|
|||||||
singleplayer = ["server"]
|
singleplayer = ["server"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
simd = ["vek/platform_intrinsics"]
|
||||||
tracy = ["profiling", "profiling/profile-with-tracy", "common/tracy", "common-ecs/tracy", "common-frontend/tracy", "common-net/tracy", "common-systems/tracy", "common-state/tracy", "client/tracy"]
|
tracy = ["profiling", "profiling/profile-with-tracy", "common/tracy", "common-ecs/tracy", "common-frontend/tracy", "common-net/tracy", "common-systems/tracy", "common-state/tracy", "client/tracy"]
|
||||||
plugins = ["client/plugins"]
|
plugins = ["client/plugins", "server/plugins"]
|
||||||
|
|
||||||
default = ["singleplayer", "native-dialog", "plugins", "simd"]
|
default = ["singleplayer", "native-dialog", "plugins", "simd"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user