summaryrefslogtreecommitdiffstats
path: root/world/chunk
diff options
context:
space:
mode:
Diffstat (limited to 'world/chunk')
-rw-r--r--world/chunk/Chunk.gd2
-rw-r--r--world/chunk/Chunk.tscn1
-rw-r--r--world/chunk/ChunkGen.gd7
-rw-r--r--world/chunk/ChunkLoader.gd3
4 files changed, 6 insertions, 7 deletions
diff --git a/world/chunk/Chunk.gd b/world/chunk/Chunk.gd
index a7d18a2..d1f91f7 100644
--- a/world/chunk/Chunk.gd
+++ b/world/chunk/Chunk.gd
@@ -11,7 +11,7 @@ onready var _collision_enabled = lod_close.collision_layer
func _ready():
lod_update()
- $"%Coords".text = str(ChunkLoader.v2_coords(self.transform.origin))
+ $"Coords".text = str(ChunkLoader.v2_coords(self.transform.origin))
func lod_update():
match lod:
diff --git a/world/chunk/Chunk.tscn b/world/chunk/Chunk.tscn
index 34f40bf..3dbff96 100644
--- a/world/chunk/Chunk.tscn
+++ b/world/chunk/Chunk.tscn
@@ -46,7 +46,6 @@ collision_layer = 8
collision_mask = 0
[node name="Coords" type="Label3D" parent="."]
-unique_name_in_owner = true
pixel_size = 0.3
billboard = 1
double_sided = false
diff --git a/world/chunk/ChunkGen.gd b/world/chunk/ChunkGen.gd
index 994d624..4d0c94d 100644
--- a/world/chunk/ChunkGen.gd
+++ b/world/chunk/ChunkGen.gd
@@ -17,8 +17,9 @@ func _ready():
self.rng.seed = self._seed
func setup_monuments():
- monuments.push_back(DockMonument.new(Transform(Basis().rotated(Vector3.UP,0.0),Vector3(0.0,0.0,-600.0))))
+ monuments.push_back(DockMonument.new(Transform(Basis().scaled(Vector3(2.0,2.0,2.0)),Vector3(0.0,0.0,-600.0))))
monuments.push_back(DockMonument.new(Transform(Basis().rotated(Vector3.UP,PI),Vector3(0.0,0.0,600.0))))
+ monuments.push_back(DockMonument.new(Transform(Basis().scaled(Vector3(1.5,1.5,1.5)).rotated(Vector3.UP,PI/4.0),Vector3(700.0,0.0,0.0))))
func rng_2dv(coords:Vector2):
self.rng.seed = hash(coords)
@@ -41,9 +42,9 @@ func get_monument_at_chunk(chunk_coords:Vector2):
return null
func gen_monument(chunk, monument):
- var offset_to_origin = monument.origin_chunk - ChunkLoader.v2_coords(chunk.transform.origin)
var inst = monument.scene.instance()
- inst.transform.origin = ChunkLoader.v3_coords(offset_to_origin)
+ var offset_to_origin = monument.xform.origin - chunk.transform.origin
+ inst.transform.origin = offset_to_origin
inst.transform.basis = monument.xform.basis
chunk.add_child(inst)
diff --git a/world/chunk/ChunkLoader.gd b/world/chunk/ChunkLoader.gd
index 0ea422a..5b1c2c0 100644
--- a/world/chunk/ChunkLoader.gd
+++ b/world/chunk/ChunkLoader.gd
@@ -126,6 +126,5 @@ func finish_chunk(chunk):
var coords = v2_coords(chunk.transform.origin)
loaded_chunks[coords] = weakref(chunk)
var monument = ChunkGen.get_monument_at_chunk(coords)
- if monument != null:
- if monument.loaded_chunk == null:
+ if monument != null && monument.loaded_chunk == null:
monument.loaded_chunk = coords