optimizations and minor improvements

This commit is contained in:
leca 2024-06-04 01:32:46 +03:00
parent 24621dfb3b
commit 57c7c23c2a
7 changed files with 34 additions and 4 deletions

View File

@ -6,4 +6,3 @@
resource_name = "Material" resource_name = "Material"
cull_mode = 2 cull_mode = 2
albedo_texture = ExtResource("1_nijc4") albedo_texture = ExtResource("1_nijc4")
roughness = 0.5

View File

@ -11,7 +11,6 @@ material = ExtResource("2_6ssja")
size = Vector3(10, 5, 10) size = Vector3(10, 5, 10)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_t334j"] [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_t334j"]
load_path = "res://.godot/imported/plus.svg-fa9840203ca82cc4696e02bad07ef61f.s3tc.ctex"
[node name="Tile" type="StaticBody3D"] [node name="Tile" type="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.5, 0)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://ddnlfxwoeywq0"] [gd_scene load_steps=6 format=3 uid="uid://cao75w3xdkup3"]
[ext_resource type="Script" path="res://scripts/Earth.gd" id="1_u71pd"] [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_frpdt"]
@ -25,3 +25,4 @@ environment = SubResource("Environment_4hkk2")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment"] [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) 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)
shadow_enabled = true

View File

@ -0,0 +1,28 @@
[gd_scene load_steps=6 format=3 uid="uid://dgnq54ix2bdv2"]
[ext_resource type="Script" path="res://scripts/Earth.gd" id="1_bry4w"]
[ext_resource type="PackedScene" uid="uid://b6er1dx11vq1a" path="res://scenes/models/god.tscn" id="2_mujaw"]
[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"]
[node name="Earth" type="Node3D" parent="."]
script = ExtResource("1_bry4w")
[node name="God" parent="." instance=ExtResource("2_mujaw")]
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)
shadow_enabled = true

View File

@ -20,7 +20,8 @@ func mark_empty_tiles():
var tiles = get_children() var tiles = get_children()
var available = [] var available = []
for tile in tiles: for tile in tiles:
tile.update_tile() #tile.update_tile()
tile.request_ready()
if tile.tile_type == TileType.Empty: continue if tile.tile_type == TileType.Empty: continue
var free_dirs = tile.get_empty_dirs_around() var free_dirs = tile.get_empty_dirs_around()
for dir in free_dirs: for dir in free_dirs:

View File

@ -38,6 +38,7 @@ func generate_decoration_objects():
decoration.position = pos decoration.position = pos
decoration.add_to_group("Decoration") decoration.add_to_group("Decoration")
add_child(decoration) add_child(decoration)
func update_tile(): func update_tile():
for decoration in get_children(): for decoration in get_children():
if(decoration.is_in_group("Decoration")): if(decoration.is_in_group("Decoration")):

View File

@ -78,5 +78,6 @@ func load_world(save_name):
if i == "node" or "pos" in i: if i == "node" or "pos" in i:
continue continue
new_object.set(i, node_data[i]) new_object.set(i, node_data[i])
new_object._ready() #request ready don't work /shrug
await get_tree().physics_frame await get_tree().physics_frame
earth.mark_empty_tiles() earth.mark_empty_tiles()