2022-05-01 20:23:01 +00:00
|
|
|
extends Node
|
2022-05-04 14:46:58 +00:00
|
|
|
|
2022-05-04 12:10:28 +00:00
|
|
|
onready var server = $StateServer
|
2022-05-01 22:20:37 +00:00
|
|
|
|
2022-05-05 13:54:49 +00:00
|
|
|
export var xsize = 124
|
|
|
|
export var ysize = 124
|
|
|
|
export var zsize = 12
|
2022-05-04 14:46:58 +00:00
|
|
|
|
|
|
|
var Tilemap = preload("res://world/Tilemap.tscn")
|
|
|
|
var tilemaps = []
|
|
|
|
|
2022-05-01 20:23:01 +00:00
|
|
|
func _ready():
|
2022-05-04 14:46:58 +00:00
|
|
|
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)
|
2022-05-05 09:13:29 +00:00
|
|
|
|
|
|
|
func _on_StateServer_request_init():
|
|
|
|
respawn_tilemaps(zsize - 1)
|
|
|
|
|
2022-05-05 13:54:49 +00:00
|
|
|
func _on_StateServer_changed_tiletypes(tile_positions: Array):
|
|
|
|
print(tile_positions[2])
|
|
|
|
print(server.get_tile_at(0,0,0))
|