diff --git a/build/libroutes_native.so b/build/libroutes_native.so new file mode 100644 index 0000000..de4a071 Binary files /dev/null and b/build/libroutes_native.so differ diff --git a/build/routes.x86_64 b/build/routes.x86_64 new file mode 100755 index 0000000..a6b8b1c Binary files /dev/null and b/build/routes.x86_64 differ diff --git a/godot/export_presets.cfg b/godot/export_presets.cfg new file mode 100644 index 0000000..96ff950 --- /dev/null +++ b/godot/export_presets.cfg @@ -0,0 +1,24 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../build/routes.x86_64" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +binary_format/64_bits=true +binary_format/embed_pck=true +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true diff --git a/godot/native/libroutes_native.so b/godot/native/libroutes_native.so index de4a071..0d04cc2 100755 Binary files a/godot/native/libroutes_native.so and b/godot/native/libroutes_native.so differ diff --git a/godot/world/StateApi.gd b/godot/world/StateApi.gd index b9a840f..f7a232d 100644 --- a/godot/world/StateApi.gd +++ b/godot/world/StateApi.gd @@ -2,9 +2,9 @@ extends Node onready var server = $StateServer -export var xsize = 512 -export var ysize = 512 -export var zsize = 124 +export var xsize = 124 +export var ysize = 124 +export var zsize = 12 var Tilemap = preload("res://world/Tilemap.tscn") var tilemaps = [] @@ -21,5 +21,6 @@ func respawn_tilemaps(amount): func _on_StateServer_request_init(): respawn_tilemaps(zsize - 1) -func _on_StateServer_changed_tiletypes(tile_positions): - pass +func _on_StateServer_changed_tiletypes(tile_positions: Array): + print(tile_positions[2]) + print(server.get_tile_at(0,0,0)) diff --git a/godot/world/World.tscn b/godot/world/World.tscn new file mode 100644 index 0000000..2dc61a6 --- /dev/null +++ b/godot/world/World.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://world/StateApi.gd" type="Script" id=1] +[ext_resource path="res://native/StateServer.gdns" type="Script" id=2] +[ext_resource path="res://native/StateServer.tscn" type="PackedScene" id=3] + +[node name="World" type="Node"] +script = ExtResource( 1 ) + +[node name="StateServer" type="Node" parent="." instance=ExtResource( 3 )] +script = ExtResource( 2 ) + +[connection signal="changed_tiletypes" from="StateServer" to="." method="_on_StateServer_changed_tiletypes"] +[connection signal="request_init" from="StateServer" to="." method="_on_StateServer_request_init"] diff --git a/godot/world/world.tscn b/godot/world/world.tscn index 925365b..3d8dae3 100644 --- a/godot/world/world.tscn +++ b/godot/world/world.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://native/StateServer.tscn" type="PackedScene" id=2] +[ext_resource path="res://world/World.tscn" type="PackedScene" id=1] [ext_resource path="res://world/worldcam.gd" type="Script" id=3] -[ext_resource path="res://world/StateApi.gd" type="Script" id=5] [node name="Main" type="Node2D"] @@ -11,10 +10,4 @@ current = true zoom = Vector2( 0.4, 0.4 ) script = ExtResource( 3 ) -[node name="World" type="Node" parent="."] -script = ExtResource( 5 ) - -[node name="StateServer" parent="World" instance=ExtResource( 2 )] - -[connection signal="changed_tiletypes" from="World/StateServer" to="World" method="_on_StateServer_changed_tiletypes"] -[connection signal="request_init" from="World/StateServer" to="World" method="_on_StateServer_request_init"] +[node name="World" parent="." instance=ExtResource( 1 )] diff --git a/godot/world/worldcam.gd b/godot/world/worldcam.gd index bad76d6..9c2a935 100644 --- a/godot/world/worldcam.gd +++ b/godot/world/worldcam.gd @@ -3,6 +3,7 @@ export var min_zoom = 0.4 export var speed = 200 var zoomlevel = 0.4 + func _process(delta): move_around(delta) handle_zoom() diff --git a/routes-native/src/stateserver.rs b/routes-native/src/stateserver.rs index 78302f8..8089a10 100644 --- a/routes-native/src/stateserver.rs +++ b/routes-native/src/stateserver.rs @@ -41,7 +41,7 @@ impl StateServer { } #[export] - fn get_tile_at(&mut self, _owner: &Node, x: usize, y: usize, z: usize) -> &str { + fn get_tile_at(&self, _owner: &Node, x: usize, y: usize, z: usize) -> &str { self.world.get_tile_at(x, y, z).kind_to_string() } }