mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
32 lines
777 B
GDScript
32 lines
777 B
GDScript
extends Node
|
|
|
|
onready var server = $StateServer
|
|
|
|
export var xsize = 124
|
|
export var ysize = 124
|
|
export var zsize = 12
|
|
|
|
var Tilemap = preload("res://world/Tilemap.tscn")
|
|
var tilemaps = []
|
|
|
|
func _ready():
|
|
server.generate_world(xsize, ysize, zsize)
|
|
|
|
func respawn_tilemaps(amount):
|
|
tilemaps = []
|
|
for tile in range(0, amount + 1):
|
|
add_child(Tilemap.instance())
|
|
tilemaps.push_back(tile)
|
|
|
|
func get_tile_at(pos: Vector3) -> String:
|
|
return server.get_tile_at(int(pos.x), int(pos.y), int(pos.z))
|
|
|
|
func update_tiles(tile_positions: Array):
|
|
print(tile_positions[1])
|
|
print(get_tile_at(Vector3(0,0,0)))
|
|
|
|
func _on_StateServer_request_init():
|
|
respawn_tilemaps(zsize - 1)
|
|
|
|
func _on_StateServer_changed_tiletypes(tile_positions: Array):
|
|
call_deferred("update_tiles", tile_positions)
|