mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Moved back register to a system
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use std::sync::atomic::{AtomicPtr, AtomicU32, AtomicU64, Ordering};
|
||||
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use specs::{shred::Fetch, Entities, ReadStorage};
|
||||
use specs::{Entities, Read, ReadStorage};
|
||||
use wasmer::{Function, Memory, Value};
|
||||
|
||||
use common::{
|
||||
@ -11,17 +11,17 @@ use common::{
|
||||
|
||||
use super::errors::{MemoryAllocationError, PluginModuleError};
|
||||
|
||||
pub struct EcsWorld<'a> {
|
||||
pub entities: Entities<'a>,
|
||||
pub health: ReadStorage<'a, Health>,
|
||||
pub uid: ReadStorage<'a, Uid>,
|
||||
pub struct EcsWorld<'a, 'b> {
|
||||
pub entities: &'b Entities<'a>,
|
||||
pub health: &'b ReadStorage<'a, Health>,
|
||||
pub uid: &'b ReadStorage<'a, Uid>,
|
||||
//pub player: ReadStorage<'a, Player>,
|
||||
pub uid_allocator: Fetch<'a, UidAllocator>,
|
||||
pub uid_allocator: &'b Read<'a, UidAllocator>,
|
||||
}
|
||||
|
||||
/// This structure wraps the ECS pointer to ensure safety
|
||||
pub struct EcsAccessManager {
|
||||
ecs_pointer: AtomicPtr<EcsWorld<'static>>,
|
||||
ecs_pointer: AtomicPtr<EcsWorld<'static, 'static>>,
|
||||
}
|
||||
|
||||
impl Default for EcsAccessManager {
|
||||
|
@ -10,6 +10,7 @@ use common::{
|
||||
terrain::{Block, TerrainChunk, TerrainGrid},
|
||||
time::DayPeriod,
|
||||
trade::Trades,
|
||||
uid::UidAllocator,
|
||||
vol::{ReadVol, WriteVol},
|
||||
};
|
||||
use common_base::span;
|
||||
@ -212,10 +213,10 @@ impl State {
|
||||
ecs.insert(match PluginMgr::from_assets() {
|
||||
Ok(plugin_mgr) => {
|
||||
let ecs_world = EcsWorld {
|
||||
entities: ecs.entities(),
|
||||
health: ecs.read_component(),
|
||||
uid: ecs.read_component(),
|
||||
uid_allocator: ecs.read_resource(),
|
||||
entities: &ecs.entities(),
|
||||
health: &ecs.read_component(),
|
||||
uid: &ecs.read_component(),
|
||||
uid_allocator: &ecs.read_resource::<UidAllocator>().into(),
|
||||
//player: Either::First(ecs.read_component()),
|
||||
};
|
||||
if let Err(e) = plugin_mgr
|
||||
|
Reference in New Issue
Block a user