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"]
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():
add_child(server)
print(server.a)
server.foo()

View File

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