remade free tiles

This commit is contained in:
leca 2024-05-31 22:46:56 +03:00
parent cba56ef1da
commit 280318b8d3
16 changed files with 240 additions and 153 deletions

View File

@ -74,7 +74,6 @@ run={
LMC={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
"tile type loop"={

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://csfa8wr1fbfb2"]
[ext_resource type="Script" path="res://scripts/ingame_menu.gd" id="1_swq50"]
[ext_resource type="Script" path="res://scripts/menu_button.gd" id="2_ey872"]
[ext_resource type="Script" path="res://scripts/m_button.gd" id="2_cehp5"]
[node name="ingame_menu" type="Control"]
layout_mode = 3
@ -48,7 +48,7 @@ offset_bottom = -14.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save world"
script = ExtResource("2_ey872")
script = ExtResource("2_cehp5")
[node name="save_exit_button" type="Button" parent="Buttons"]
layout_mode = 2
@ -59,7 +59,7 @@ offset_bottom = 53.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save and exit game"
script = ExtResource("2_ey872")
script = ExtResource("2_cehp5")
[node name="exit_nosave_button" type="Button" parent="Buttons"]
layout_mode = 2
@ -70,4 +70,4 @@ offset_bottom = 243.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "exit without saving"
script = ExtResource("2_ey872")
script = ExtResource("2_cehp5")

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://byrk15nhm7h45"]
[ext_resource type="Script" path="res://scripts/menu_button.gd" id="1_48nxl"]
[ext_resource type="Script" path="res://scripts/m_button.gd" id="1_f5n0m"]
[node name="Main menu" type="Control"]
layout_mode = 3
@ -24,7 +24,7 @@ offset_bottom = -42.0
grow_horizontal = 2
grow_vertical = 2
text = "New world"
script = ExtResource("1_48nxl")
script = ExtResource("1_f5n0m")
[node name="load_world_button" type="Button" parent="."]
layout_mode = 1
@ -40,7 +40,7 @@ offset_bottom = 15.5
grow_horizontal = 2
grow_vertical = 2
text = "Load world"
script = ExtResource("1_48nxl")
script = ExtResource("1_f5n0m")
[node name="quit_button" type="Button" parent="."]
layout_mode = 1
@ -56,4 +56,4 @@ offset_bottom = 86.0
grow_horizontal = 2
grow_vertical = 2
text = "Quit"
script = ExtResource("1_48nxl")
script = ExtResource("1_f5n0m")

View File

@ -1,4 +1,7 @@
[gd_scene format=3 uid="uid://bs7ctvbx7xov5"]
[gd_scene load_steps=3 format=3 uid="uid://bs7ctvbx7xov5"]
[ext_resource type="Script" path="res://scripts/ingame_menu.gd" id="1_6fvrf"]
[ext_resource type="Script" path="res://scripts/menu_button.gd" id="2_n0jsa"]
[node name="UI" type="Control"]
layout_mode = 3
@ -9,6 +12,76 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
[node name="ingame_menu" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_6fvrf")
[node name="PanelContainer" type="PanelContainer" parent="ingame_menu"]
modulate = Color(1, 1, 1, 0.501961)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 89.0
offset_top = 93.0
offset_right = -89.0
offset_bottom = -93.0
grow_horizontal = 2
grow_vertical = 2
[node name="Buttons" type="Control" parent="ingame_menu"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="save_world_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = -45.0
offset_top = -45.0
offset_right = 46.0
offset_bottom = -14.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save world"
script = ExtResource("2_n0jsa")
[node name="save_exit_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = -71.0
offset_top = 22.0
offset_right = 87.0
offset_bottom = 53.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save and exit game"
script = ExtResource("2_n0jsa")
[node name="exit_nosave_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = 334.0
offset_top = 212.0
offset_right = 492.0
offset_bottom = 243.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "exit without saving"
script = ExtResource("2_n0jsa")
[node name="velocity_label" type="Label" parent="."]
layout_mode = 1
anchors_preset = 1

View File

@ -1,9 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://b6er1dx11vq1a"]
[gd_scene load_steps=3 format=3 uid="uid://b6er1dx11vq1a"]
[ext_resource type="Script" path="res://scripts/God.gd" id="1_hfa56"]
[ext_resource type="PackedScene" uid="uid://bs7ctvbx7xov5" path="res://scenes/UI/ui.tscn" id="2_tlgt4"]
[ext_resource type="Script" path="res://scripts/ingame_menu.gd" id="3_26rdb"]
[ext_resource type="Script" path="res://scripts/ingame_menu_button.gd" id="4_ggyng"]
[node name="God" type="Node3D"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
@ -17,72 +15,3 @@ target_position = Vector3(100, 0, 0)
collision_mask = 3
[node name="UI" parent="." instance=ExtResource("2_tlgt4")]
[node name="ingame_menu" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("3_26rdb")
[node name="PanelContainer" type="PanelContainer" parent="ingame_menu"]
modulate = Color(1, 1, 1, 0.501961)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 89.0
offset_top = 93.0
offset_right = -89.0
offset_bottom = -93.0
grow_horizontal = 2
grow_vertical = 2
[node name="Buttons" type="Control" parent="ingame_menu"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="save_world_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = -45.0
offset_top = -45.0
offset_right = 46.0
offset_bottom = -14.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save world"
script = ExtResource("4_ggyng")
[node name="save_exit_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = -71.0
offset_top = 22.0
offset_right = 87.0
offset_bottom = 53.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Save and exit game"
script = ExtResource("4_ggyng")
[node name="exit_nosave_button" type="Button" parent="ingame_menu/Buttons"]
layout_mode = 2
offset_left = 334.0
offset_top = 212.0
offset_right = 492.0
offset_bottom = 243.0
size_flags_horizontal = 4
size_flags_vertical = 4
text = "exit without saving"
script = ExtResource("4_ggyng")

View File

@ -1,22 +1,19 @@
[gd_scene load_steps=11 format=3 uid="uid://dj0odn77jplje"]
[gd_scene load_steps=10 format=3 uid="uid://dj0odn77jplje"]
[ext_resource type="Script" path="res://scripts/Tile.gd" id="1_s01tx"]
[ext_resource type="Texture2D" uid="uid://d1k366i5jjtrk" path="res://textures/plus.svg" id="2_cddgt"]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_qnc60"]
data = PackedVector3Array(-5, 2.5, 5, 5, 2.5, 5, -5, -2.5, 5, 5, 2.5, 5, 5, -2.5, 5, -5, -2.5, 5, 5, 2.5, -5, -5, 2.5, -5, 5, -2.5, -5, -5, 2.5, -5, -5, -2.5, -5, 5, -2.5, -5, 5, 2.5, 5, 5, 2.5, -5, 5, -2.5, 5, 5, 2.5, -5, 5, -2.5, -5, 5, -2.5, 5, -5, 2.5, -5, -5, 2.5, 5, -5, -2.5, -5, -5, 2.5, 5, -5, -2.5, 5, -5, -2.5, -5, 5, 2.5, 5, -5, 2.5, 5, 5, 2.5, -5, -5, 2.5, 5, -5, 2.5, -5, 5, 2.5, -5, -5, -2.5, 5, 5, -2.5, 5, -5, -2.5, -5, 5, -2.5, 5, 5, -2.5, -5, -5, -2.5, -5)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f1ys8"]
transparency = 1
albedo_color = Color(1, 1, 1, 0)
[sub_resource type="BoxMesh" id="BoxMesh_3vjuu"]
material = SubResource("StandardMaterial3D_f1ys8")
size = Vector3(10, 5, 10)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_scykg"]
data = PackedVector3Array(-5, 2.5, 5, 5, 2.5, 5, -5, -2.5, 5, 5, 2.5, 5, 5, -2.5, 5, -5, -2.5, 5, 5, 2.5, -5, -5, 2.5, -5, 5, -2.5, -5, -5, 2.5, -5, -5, -2.5, -5, 5, -2.5, -5, 5, 2.5, 5, 5, 2.5, -5, 5, -2.5, 5, 5, 2.5, -5, 5, -2.5, -5, 5, -2.5, 5, -5, 2.5, -5, -5, 2.5, 5, -5, -2.5, -5, -5, 2.5, 5, -5, -2.5, 5, -5, -2.5, -5, 5, 2.5, 5, -5, 2.5, 5, 5, 2.5, -5, -5, 2.5, 5, -5, 2.5, -5, 5, 2.5, -5, -5, -2.5, 5, 5, -2.5, 5, -5, -2.5, -5, 5, -2.5, 5, 5, -2.5, -5, -5, -2.5, -5)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gkcjk"]
transparency = 1
albedo_color = Color(0.203922, 0.458824, 0.113725, 0.337255)
[sub_resource type="BoxMesh" id="BoxMesh_kix7d"]
material = SubResource("StandardMaterial3D_gkcjk")
size = Vector3(10, 5, 10)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0knec"]
albedo_color = Color(0.203922, 0.458824, 0.113725, 1)
@ -33,14 +30,14 @@ size = Vector3(10, 5, 10)
[node name="Tile" type="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.5, 0)
collision_layer = 2
collision_layer = 3
script = ExtResource("1_s01tx")
[node name="Empty_tile" type="CollisionShape3D" parent="."]
shape = SubResource("ConcavePolygonShape3D_qnc60")
shape = SubResource("ConcavePolygonShape3D_scykg")
[node name="VisibleMesh" type="MeshInstance3D" parent="Empty_tile"]
mesh = SubResource("BoxMesh_3vjuu")
mesh = SubResource("BoxMesh_kix7d")
skeleton = NodePath("../..")
[node name="plus_sprite" type="Sprite3D" parent="Empty_tile"]
@ -62,20 +59,3 @@ shape = SubResource("ConcavePolygonShape3D_scykg")
[node name="VisibleMesh" type="MeshInstance3D" parent="Forest_tile"]
mesh = SubResource("BoxMesh_341o5")
skeleton = NodePath("../..")
[node name="ray_north" type="RayCast3D" parent="."]
target_position = Vector3(10, 0, 0)
collision_mask = 3
[node name="ray_south" type="RayCast3D" parent="."]
target_position = Vector3(-10, 0, 0)
collision_mask = 3
[node name="ray_west" type="RayCast3D" parent="."]
target_position = Vector3(0, 0, -10)
collision_mask = 3
[node name="ray_east" type="RayCast3D" parent="."]
target_position = Vector3(0, 0, 10)
collision_mask = 3
collide_with_areas = true

28
scenes/world-back.tscn Normal file
View File

@ -0,0 +1,28 @@
[gd_scene load_steps=6 format=3 uid="uid://ddnlfxwoeywq0"]
[ext_resource type="Script" path="res://scripts/Earth.gd" id="1_u71pd"]
[ext_resource type="PackedScene" uid="uid://b6er1dx11vq1a" path="res://scenes/models/god.tscn" id="2_frpdt"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_01wm3"]
[sub_resource type="Sky" id="Sky_oeb53"]
sky_material = SubResource("ProceduralSkyMaterial_01wm3")
[sub_resource type="Environment" id="Environment_4hkk2"]
background_mode = 2
sky = SubResource("Sky_oeb53")
[node name="World" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.20056, -2.31495, -0.853709)
[node name="Earth" type="Node3D" parent="."]
script = ExtResource("1_u71pd")
[node name="God" parent="." instance=ExtResource("2_frpdt")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -2.77222, 0.906321, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_4hkk2")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment"]
transform = Transform3D(-3.53179e-08, 0.58921, -0.80798, 2.57552e-08, 0.80798, 0.58921, 1, 0, -4.37114e-08, -14.3426, 13.3054, 0)

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://dh52xle0rfx5r"]
[ext_resource type="Script" path="res://scripts/Earth.gd" id="1_u71pd"]
[ext_resource type="PackedScene" uid="uid://b6er1dx11vq1a" path="res://scenes/models/god.tscn" id="2_frpdt"]
[ext_resource type="PackedScene" uid="uid://b6er1dx11vq1a" path="res://scenes/models/god.tscn" id="2_pwuqf"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_01wm3"]
@ -13,13 +13,12 @@ background_mode = 2
sky = SubResource("Sky_oeb53")
[node name="World" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.20056, -2.31495, -0.853709)
[node name="Earth" type="Node3D" parent="."]
script = ExtResource("1_u71pd")
[node name="God" parent="." instance=ExtResource("2_frpdt")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -2.77222, 0.906321, 0)
[node name="God" parent="." instance=ExtResource("2_pwuqf")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -7.55882, 2.65688, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_4hkk2")

View File

@ -13,15 +13,17 @@ func _ready():
start_tile.add_to_group("Persistent")
add_child(start_tile);
func _physics_process(delta):
pass
#func _process(delta):
#mark_free_tiles()
func mark_free_tiles():
var tiles = get_children()
for tile in tiles:
tile.update_tile()
if tile.tile_type == TileType.Empty: continue
var free_dirs = tile.get_free_dirs_around();
var free_dirs = tile.get_free_dirs_around()
for dir in free_dirs:
var free_tile = tile_exemplar.instantiate()
free_tile.tile_type = TileType.Empty
@ -39,3 +41,5 @@ func mark_free_tiles():
pos.z += 10
free_tile.position = pos;
free_tile.update_tile()
#print("Created on " + str(pos) + " by " + str(tile.position))
#tiles = get_children()

View File

@ -49,13 +49,15 @@ func _physics_process(delta):
creating_tile_type = wrap(creating_tile_type + 1, 0, 3)
tile_type_label.text = "Tile type: " + str(TileType.keys()[creating_tile_type])
if Input.is_action_just_pressed("LMC") and eye_raycast.is_colliding():
if Input.is_action_just_pressed("LMC") and eye_raycast.is_colliding() and !get_node("UI/ingame_menu").visible:
var target = eye_raycast.get_collider()
if "TileType" in target:
earth.mark_free_tiles()
target.tile_type = creating_tile_type
target.update_tile()
earth.mark_free_tiles()
if Input.is_action_pressed("run"):
speed = walk * 2
else:

View File

@ -7,31 +7,50 @@ enum TileType {
}
@export var tile_type: TileType = TileType.Empty;
var free_sides = {
"north": false,
"south": false,
"west": false,
"east": false,
}
func update_tile():
var children = find_children("*tile");
for child in children:
if TileType.keys()[tile_type] == child.name.split("_")[0]:
child.visible = true;
child.visible = true
else:
child.visible = false;
child.visible = false
func _ready():
update_tile()
func _physics_process(delta):
var space_state = get_world_3d().direct_space_state
var query_north = PhysicsRayQueryParameters3D.create(self.position + Vector3(0, 2.5, 0), self.position + Vector3(10, 2.5, 0))
var query_south = PhysicsRayQueryParameters3D.create(self.position + Vector3(0, 2.5, 0), self.position + Vector3(-12, 2.5, 0))
var query_west = PhysicsRayQueryParameters3D.create(self.position + Vector3(0, 2.5, 0), self.position + Vector3(0, 2.5, -10))
var query_east = PhysicsRayQueryParameters3D.create(self.position + Vector3(0, 2.5, 0), self.position + Vector3(0, 2.5, 10))
var result_north = space_state.intersect_ray(query_north)
var result_south = space_state.intersect_ray(query_south)
var result_west = space_state.intersect_ray(query_west)
var result_east = space_state.intersect_ray(query_east)
free_sides = {
"north": result_north == {},
"south": result_south == {},
"west": result_west == {},
"east": result_east == {}
}
func get_free_dirs_around():
var free_tiles_around = []
if tile_type == TileType.Empty: return free_tiles_around
var raycasts = find_children("ray*");
for raycast: RayCast3D in raycasts:
raycast.force_raycast_update()
if !raycast.is_colliding():
free_tiles_around.append(raycast.name.split("_")[1])
for side in free_sides.keys():
if free_sides[side]:
free_tiles_around.push_back(side)
return free_tiles_around
func _process(delta):
pass
func save():
if tile_type == TileType.Empty: return {}

View File

@ -1,5 +1,9 @@
extends Control
func _ready():
#visible = false
pass
func _physics_process(delta):
if Input.is_action_just_pressed("ingame_menu"):
self.visible = !self.visible

46
scripts/m_button.gd Normal file
View File

@ -0,0 +1,46 @@
extends Button
@onready var button = $"."
@onready var main_menu = $".."
var world_scene = preload("res://scenes/world.tscn")
func _ready():
enable()
func enable():
$".".pressed.connect(self._button_pressed)
func disable():
$".".pressed.disconnect()
func _button_pressed():
if ("quit" in name):
get_tree().quit()
elif ("new_world" in name):
#get_tree().change_scene_to_packed(world_scene)
var world_scene_instance = world_scene.instantiate();
world_scene_instance.name = "world"
var to_remove = $"/root/Main menu"
get_tree().root.add_child(world_scene_instance)
get_tree().root.remove_child(to_remove)
World.new_world()
elif ("load_world" in name):
var world_scene_instance = world_scene.instantiate();
world_scene_instance.name = "world"
var to_remove = $"/root/Main menu"
get_tree().root.add_child(world_scene_instance)
get_tree().root.remove_child(to_remove)
World.load_world("world")
elif ("save_world" in name):
World.save_world()
elif ("save_exit" in name):
World.save_world()
#get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
var to_remove = $"/root/world"
get_tree().root.add_child(load("res://scenes/UI/main_menu.tscn").instantiate())
get_tree().root.remove_child(to_remove)
elif ("exit_nosave" in name):
#get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
var to_remove = $"/root/world"
get_tree().root.add_child(load("res://scenes/UI/main_menu.tscn").instantiate())
get_tree().root.remove_child(to_remove)

View File

@ -5,12 +5,8 @@ extends Button
var world_scene = preload("res://scenes/world.tscn")
func _ready():
print("ready")
enable()
func test():
print("test")
func enable():
$".".pressed.connect(self._button_pressed)
@ -24,19 +20,22 @@ func _button_pressed():
get_tree().change_scene_to_packed(world_scene)
World.new_world()
elif ("load_world" in name):
#assert(get_tree().change_scene_to_packed(world_scene) == OK)
#get_tree().change_scene_to_packed(world_scene)
var world_scene_instance = world_scene.instantiate();
world_scene_instance.name = "world"
var a = $"/root/Main menu"
print(str(a))
var to_remove = $"/root/Main menu"
get_tree().root.add_child(world_scene_instance)
get_tree().root.remove_child(a)
get_tree().root.remove_child(to_remove)
World.load_world("world")
elif ("save_world" in name):
World.save_world()
elif ("save_exit" in name):
World.save_world()
get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
#get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
var to_remove = $"/root/world"
get_tree().root.add_child(load("res://scenes/UI/main_menu.tscn").instantiate())
get_tree().root.remove_child(to_remove)
elif ("exit_nosave" in name):
get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
#get_tree().change_scene_to_file("res://scenes/UI/main_menu.tscn")
var to_remove = $"/root/world"
get_tree().root.add_child(load("res://scenes/UI/main_menu.tscn").instantiate())
get_tree().root.remove_child(to_remove)

View File

@ -86,23 +86,26 @@ func load_world(save_name):
# Get the data from the JSON object
var node_data = json.get_data()
# Firstly, we need to create the object and add it to the tree and set its position.
#var new_object = load(node_data["filename"]).instantiate()
var new_object
match node_data["node"]:
"tile":
new_object = load("res://scenes/models/tile.tscn").instantiate()
#print(str(get_tree().root.get_node("world/Earth")))
new_object = preload("res://scenes/models/tile.tscn").instantiate()
get_tree().root.get_node("world/Earth").add_child(new_object)
new_object.position = Vector3(node_data["pos_x"], node_data["pos_y"], node_data["pos_z"])
new_object.add_to_group("Persistent")
# Now we set the remaining variables.
for i in node_data.keys():
if i == "node" or "pos" in i:
continue
new_object.set(i, node_data[i])
new_object.call("update_tile")
get_tree().root.get_node("world/Earth").call("mark_free_tiles")
new_object.update_tile()
#get_tree().root.get_node("world/Earth").mark_free_tiles()
#await get_tree().create_timer(1).timeout
#get_tree().root.get_node("world/Earth").call("mark_free_tiles")
# s

2
todo Normal file
View File

@ -0,0 +1,2 @@
Починить кривую загрузку мира, в результате которой плюсики по всему миру
Упростить устройство тайла, сделать единственную модель со сменяемым через скрипт материалом