new layer model
This commit is contained in:
@@ -2,7 +2,7 @@ use rhai::Engine;
|
||||
use crate::api::board::BoardRef;
|
||||
use crate::player::PlayerRef;
|
||||
use crate::script::Registerable;
|
||||
use crate::utils::ErrorSink;
|
||||
use crate::utils::LogSink;
|
||||
|
||||
/// GameState stores player state but Board stores its position, and we want one
|
||||
/// object to register with Rhai
|
||||
@@ -10,7 +10,7 @@ use crate::utils::ErrorSink;
|
||||
pub struct PlayerWithPos(pub PlayerRef, pub BoardRef);
|
||||
|
||||
impl Registerable for PlayerWithPos {
|
||||
fn register(engine: &mut Engine, _error_sink: ErrorSink) {
|
||||
fn register(engine: &mut Engine, _log_sink: LogSink) {
|
||||
engine.register_type_with_name::<PlayerWithPos>("Player")
|
||||
.register_get("gems", |player: &mut PlayerWithPos| player.0.borrow().gems)
|
||||
.register_get("health", |player: &mut PlayerWithPos| player.0.borrow().health)
|
||||
|
||||
Reference in New Issue
Block a user