mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
28 lines
756 B
GDScript
28 lines
756 B
GDScript
extends Node
|
|
|
|
onready var server = $StateServer
|
|
|
|
export var xsize = 256
|
|
export var ysize = 256
|
|
export var zsize = 6
|
|
|
|
func _ready():
|
|
server.generate_world(xsize, ysize, zsize)
|
|
print(server.get_tile_at(0,0,0))
|
|
|
|
func respawn_tilemaps(amount: int):
|
|
$Tilemaps.respawn_tilemaps(amount)
|
|
|
|
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: PoolVector3Array):
|
|
for tile in tile_positions:
|
|
$Tilemaps.tilemaps[tile.z].set_tile_graphics(Vector2(tile.x, tile.y),
|
|
get_tile_at(tile))
|
|
|
|
func _on_StateServer_request_init():
|
|
respawn_tilemaps(zsize - 1)
|
|
|
|
func _on_StateServer_changed_tiletypes(tile_positions: PoolVector3Array):
|
|
call_deferred("update_tiles", tile_positions)
|