Repair highlight

pull/19/head
Valentin Stark 3 years ago
parent 40e25f209c
commit d8ef4f7ca7
  1. 2
      .godot/editor/3DWorld.tscn-folding-5ee7dca069a2497be3bb28c4d56856bf.cfg
  2. 2
      .godot/editor/filesystem_update4
  3. 2
      .godot/editor/project_metadata.cfg
  4. 22
      .godot/editor/script_editor_cache.cfg
  5. BIN
      .godot/shader_cache/SceneForwardClusteredShaderRD/c78728374d98d767dfb15a2ef7b0a55a33e98e82605a8224fb72b41a9816ce22/86f0e50dd1cced740ed4a7a2bd47dfa02bc882b2.cache
  6. BIN
      assets/water.material
  7. 2
      project.godot
  8. 6
      scenes/3DWorld.tscn
  9. 12
      scripts/Board.gd
  10. 7
      scripts/Chunk.gd
  11. 4
      scripts/Ground.gd

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("DirectionalLight3D"), PackedStringArray("Transform", "Light", "Shadow", "Directional Shadow"), NodePath("Highlighter"), PackedStringArray("Transform"), NodePath("WorldEnvironment"), PackedStringArray("camera_attributes", "environment"), NodePath("GridMap"), PackedStringArray("Cell"), NodePath("Ocean"), PackedStringArray("Collision"), NodePath("Ocean/CollisionShape3D"), PackedStringArray("shape")]
node_unfolds=[NodePath("DirectionalLight3D"), PackedStringArray("Transform", "Light", "Shadow", "Directional Shadow"), NodePath("Highlighter"), PackedStringArray("Transform"), NodePath("WorldEnvironment"), PackedStringArray("camera_attributes", "environment"), NodePath("Ocean"), PackedStringArray("Collision"), NodePath("Ocean/CollisionShape3D"), PackedStringArray("shape")]
resource_unfolds=["res://scenes/3DWorld.tscn::CameraAttributesPractical_fwdfs", PackedStringArray("DOF Blur", "Auto Exposure"), "res://scenes/3DWorld.tscn::WorldBoundaryShape3D_iogdu", PackedStringArray("Resource")]
nodes_folded=[]

@ -7,3 +7,5 @@ res://scenes/Water.tscn
res://assets/blocs/blocs.tscn
res://assets/water.gdshader
res://scripts/Chunk.gd
res://scripts/Board.gd
res://scripts/Ground.gd

@ -16,7 +16,7 @@ scripts=["Vector2i", "res://scripts/Map_Cursor.gd", "res://scripts/Map.gd", "res
[color_picker]
recent_presets=PackedColorArray(0.459595, 0.538874, 0.656934, 1, 0.221081, 0.275062, 0.358885, 1, 1.34766e-06, 0.853688, 0.994746, 1, 0, 0.803922, 0.937255, 1, 0.476347, 0.898661, 1, 1, 1, 0, 0, 1, 1, 0.945098, 0, 1, 0.780392, 1, 1, 1, 1, 1, 1, 1)
recent_presets=PackedColorArray(0.221081, 0.275062, 0.358885, 1, 1.34766e-06, 0.853688, 0.994746, 1, 0, 0.803922, 0.937255, 1, 0.476347, 0.898661, 1, 1, 1, 0, 0, 1, 1, 0.945098, 0, 1, 0.780392, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1)
[dialog_bounds]

@ -21,7 +21,7 @@ state={
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 15,
"scroll_position": 0.0,
"scroll_position": 78.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -87,11 +87,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 3,
"column": 41,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 20,
"scroll_position": 8.0,
"row": 31,
"scroll_position": 20.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -104,8 +104,8 @@ state={
"column": 45,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 100,
"scroll_position": 79.5,
"row": 101,
"scroll_position": 89.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -115,11 +115,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 29,
"column": 79,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 69,
"scroll_position": 69.0,
"row": 22,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -145,9 +145,9 @@ state={
"breakpoints": PackedInt32Array(),
"column": 80,
"folded_lines": Array[int]([]),
"h_scroll_position": 540,
"h_scroll_position": 0,
"row": 48,
"scroll_position": 27.0,
"scroll_position": 23.0,
"selection": false,
"syntax_highlighter": "GDScript"
}

Binary file not shown.

@ -21,7 +21,7 @@ Global="*res://scripts/Global.gd"
[display]
window/stretch/mode="viewport"
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[gui]

@ -40,12 +40,6 @@ texture = ExtResource("4_nyumm")
environment = ExtResource("4_dycnn")
camera_attributes = SubResource("CameraAttributesPractical_fwdfs")
[node name="GridMap" type="GridMap" parent="."]
cell_size = Vector3(1, 1, 1)
cell_center_x = false
cell_center_y = false
cell_center_z = false
[node name="Camera" parent="." instance=ExtResource("5_6daj8")]
[node name="Ocean" type="StaticBody3D" parent="."]

@ -3,7 +3,6 @@ extends Node3D
@onready var ground = $Ground
@onready var camera =$Camera
@onready var highlighter = $Highlighter
@onready var gridmap = $GridMap
var highlight = {}
var selection = {}
@ -21,14 +20,15 @@ func _process(delta):
var entity = Global.world.add_entity(Vector2i(highlight.grid_position.x, highlight.grid_position.y))
if Input.is_action_just_pressed("main_command"):
if selection.type == 1:
var path = Global.world.entities[selection.data.id].path_create(Global.world.get_real_coordinates(Vector2i(highlight.data.position.x, highlight.data.position.z)))
Global.world.entities[selection.data.id].path_create(Global.world.get_real_coordinates(Vector2i(round(highlight.data.position.x), round(highlight.data.position.z))))
Global.world.entities[selection.data.id].path_start()
func _unhandled_input(event):
if event is InputEventMouseMotion:
highlight = get_highlight()
if highlight.type == 0:
highlighter.transparency = 0.0
var sprite_position = Vector3(round(highlight.board_position.x), ceil(highlight.board_position.y), round(highlight.board_position.z)) + Vector3(0, 0.01, 0)
# var sprite_position = Vector3(round(highlight.board_position.x), ceil(highlight.board_position.y), round(highlight.board_position.z)) + Vector3(0, 0.01, 0)
var sprite_position = Vector3((highlight.board_position.x), (highlight.board_position.y), (highlight.board_position.z)) + Vector3(0, 0.05, 0)
highlighter.position = sprite_position
else:
highlighter.transparency = 1.0
@ -48,8 +48,10 @@ func get_highlight():
if raycast_result:
var collider = raycast_result.collider
if "Chunk" in raycast_result.collider.name or "Ocean" in raycast_result.collider.name:
var position = gridmap.local_to_map(raycast_result.position)
# var position = collider.get_used_cells()[raycast_result.shape] * Vector3i(collider.x, 1, collider.z)
var position = round(raycast_result.position)
position.y = Global.world.get_height(Vector2i(position.x, position.z))
if "Ocean" in raycast_result.collider.name:
position.y += ground.WATER_HEIGHT
result["type"] = 0
result["board_position"] = position
result["grid_position"] = Global.world.get_real_coordinates(Vector2i(position.x, position.z))

@ -2,18 +2,19 @@ extends GridMap
class_name Chunk
const Pawn = preload("res://scenes/Pawn.tscn")
const WATER_HEIGHT = 0.5
var location: Vector2i
var size = 0
var should_remove = false
var water_height
var chunks_array: Array
func _init(x: int, z: int, size: int, chunks_array: Array):
func _init(x: int, z: int, size: int, chunks_array: Array, water_height: float):
self.location.x = x
self.location.y = z
self.size = size
self.chunks_array = chunks_array
self.water_height = water_height
mesh_library = load("res://assets/blocs/blocs.meshlib")
cell_size = Vector3(1, 1, 1)
cell_center_x = false
@ -98,7 +99,7 @@ func create_water():
var water = OceanTile.instantiate()
water.mesh.size.x = size
water.mesh.size.y = size
water.translate(Vector3(size/2, WATER_HEIGHT, size/2))
water.translate(Vector3(size/2, water_height, size/2))
add_child(water)
func is_inside_chunk(position: Vector2i) :

@ -1,5 +1,7 @@
extends Node3D
const WATER_HEIGHT = 0.5
var thread
var displayed_chunks = {}
var unready_chunks = {}
@ -18,7 +20,7 @@ func init_chunks():
chunks.append([])
for y in Global.world.height / Global.world.chunk_size:
chunks[x].append([])
chunks[x][y] = Chunk.new(x, y, Global.world.chunk_size, chunks)
chunks[x][y] = Chunk.new(x, y, Global.world.chunk_size, chunks, WATER_HEIGHT)
chunks[x][y].set_name("Chunk")
chunks[x][y]

Loading…
Cancel
Save