This commit is contained in:
zoe 2022-05-03 21:52:38 +02:00
parent f5a5def3e3
commit 47b9179c67
7 changed files with 27 additions and 16 deletions

View File

@ -4,3 +4,6 @@
[node name="StateServer" type="Node"] [node name="StateServer" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )
xsize = 14
ysize = 14
zsize = 14

Binary file not shown.

View File

@ -4,5 +4,4 @@ var server = preload("res://native/StateServer.tscn").instance()
func _ready(): func _ready():
add_child(server) add_child(server)
print(server.a)
server.foo() server.foo()

View File

@ -3,14 +3,9 @@ use lazy_static::lazy_static;
use pathfinding::matrix; use pathfinding::matrix;
use tokio::sync::RwLock; use tokio::sync::RwLock;
mod terrain;
mod pathing; mod pathing;
mod terrain;
enum Tiles { mod tiles;
terrain(terrain::Terrain),
path(pathing::Path)
}
lazy_static! { lazy_static! {
static ref STATE: RwLock<matrix::Matrix<Vec<terrain::Terrain>>> = RwLock::new(matrix![]); static ref STATE: RwLock<matrix::Matrix<Vec<terrain::Terrain>>> = RwLock::new(matrix![]);
@ -20,18 +15,26 @@ lazy_static! {
#[inherit(Node)] #[inherit(Node)]
pub struct StateServer { pub struct StateServer {
#[property] #[property]
a: u8, xsize: u64,
#[property]
ysize: u64,
#[property]
zsize: u64,
} }
#[methods] #[methods]
impl StateServer { impl StateServer {
fn new(_owner: &Node) -> Self { fn new(_owner: &Node) -> Self {
StateServer { a: 9 } StateServer {
xsize: 14,
ysize: 14,
zsize: 14,
}
} }
#[export] #[export]
fn _ready(&self, _owner: &Node) { fn _ready(&self, _owner: &Node) {
godot_print!("hello, uwu") godot_print!("size: {}", self.xsize)
} }
#[export] #[export]

View File

@ -0,0 +1 @@

View File

@ -1,5 +0,0 @@
use pathfinding::prelude::astar;
pub enum Path {
}

View File

@ -0,0 +1,10 @@
use gdnative::derive::{FromVariant, ToVariant};
#[derive(ToVariant, FromVariant)]
pub enum Tiletypes {
Air,
Water,
Grass,
Dirt,
Sand,
}