mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
call deferred to prevent reentry into atmosphere
This commit is contained in:
parent
aa07bdd798
commit
0b9ca2ebe5
3 changed files with 21 additions and 11 deletions
|
@ -2,8 +2,8 @@ extends Node
|
|||
|
||||
onready var server = $StateServer
|
||||
|
||||
export var xsize = 124
|
||||
export var ysize = 124
|
||||
export var xsize = 1048
|
||||
export var ysize = 1048
|
||||
export var zsize = 12
|
||||
|
||||
var Tilemap = preload("res://world/Tilemap.tscn")
|
||||
|
@ -12,21 +12,22 @@ var tilemaps = []
|
|||
func _ready():
|
||||
server.generate_world(xsize, ysize, zsize)
|
||||
|
||||
func respawn_tilemaps(amount):
|
||||
func respawn_tilemaps(amount: int):
|
||||
tilemaps = []
|
||||
for tile in range(0, amount + 1):
|
||||
add_child(Tilemap.instance())
|
||||
tilemaps.push_back(tile)
|
||||
for i in range(0, amount + 1):
|
||||
var map = Tilemap.instance()
|
||||
map.id = i
|
||||
add_child(map)
|
||||
tilemaps.push_back(map)
|
||||
|
||||
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 update_tiles(tile_positions: PoolVector3Array):
|
||||
print(get_tile_at(tile_positions[1]))
|
||||
|
||||
func _on_StateServer_request_init():
|
||||
respawn_tilemaps(zsize - 1)
|
||||
|
||||
func _on_StateServer_changed_tiletypes(tile_positions: Array):
|
||||
func _on_StateServer_changed_tiletypes(tile_positions: PoolVector3Array):
|
||||
call_deferred("update_tiles", tile_positions)
|
||||
|
|
7
godot/world/Tilemap.gd
Normal file
7
godot/world/Tilemap.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends TileMap
|
||||
|
||||
var id: int
|
||||
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://world/terrain/terrain.tres" type="TileSet" id=1]
|
||||
[ext_resource path="res://world/Tilemap.gd" type="Script" id=2]
|
||||
|
||||
[node name="Tilemap" type="TileMap"]
|
||||
position = Vector2( -2, 0 )
|
||||
|
@ -8,3 +9,4 @@ mode = 1
|
|||
tile_set = ExtResource( 1 )
|
||||
cell_size = Vector2( 32, 16 )
|
||||
format = 1
|
||||
script = ExtResource( 2 )
|
||||
|
|
Loading…
Reference in a new issue