summaryrefslogtreecommitdiff
path: root/godot/scripts/World.gd
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2022-09-07 14:07:30 -0400
committerAnson Bridges <bridges.anson@gmail.com>2022-09-07 14:07:30 -0400
commitc232b92e2dde1277324d1f89d0e75ae641e4ac3b (patch)
treee11a5dd52f259c1cc7345baa40b372b304417f00 /godot/scripts/World.gd
parenta0967ebe815cd229b69fb9578f2288b95b2ddb28 (diff)
reorganized, ladders, vehicle control
Diffstat (limited to 'godot/scripts/World.gd')
-rw-r--r--godot/scripts/World.gd51
1 files changed, 51 insertions, 0 deletions
diff --git a/godot/scripts/World.gd b/godot/scripts/World.gd
new file mode 100644
index 0000000..fa5a306
--- /dev/null
+++ b/godot/scripts/World.gd
@@ -0,0 +1,51 @@
+extends Spatial
+
+
+var m = SpatialMaterial.new()
+var winddir = Vector3(1,0,0)
+onready var pathfinder = get_node("PLAYERS/Player2")
+var path = []
+var map_rid
+var client_id
+var player_char
+var players_info = {}
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+ map_rid = NavigationServer.get_maps()
+ for rid in map_rid:
+ NavigationServer.map_set_edge_connection_margin(rid,1)
+ m.flags_unshaded = true
+ m.flags_use_point_size = true
+ m.albedo_color = Color.white
+
+remotesync func update_players_info(info):
+ players_info = info
+
+remote func _call_on_server(function, arguments):
+ print('Remote server call: ' + function)
+ $Server.call(function, arguments)
+
+func find_path(to):
+ pathfinder.nav.set_target_location(to)
+ var t_path = pathfinder.nav.get_next_location()
+ pathfinder.should_move = true
+ t_path = pathfinder.nav.get_nav_path()
+ print(to)
+ print(t_path)
+ draw_path(t_path)
+ pass
+
+func draw_path(path_array):
+ var im = get_node("Draw")
+ im.set_material_override(m)
+ im.clear()
+ im.begin(Mesh.PRIMITIVE_POINTS, null)
+ im.add_vertex(path_array[0])
+ im.add_vertex(path_array[path_array.size() - 1])
+ im.end()
+ im.begin(Mesh.PRIMITIVE_LINE_STRIP, null)
+ for x in path_array:
+ im.add_vertex(x)
+ im.end()
+