This commit is contained in:
2025-03-10 15:44:54 +08:00
parent 438eff1f7a
commit 495c9c64a5
97 changed files with 532 additions and 32 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{
"godotTools.editorPath.godot4": "c:\\Program Files\\Godot_v4.3-stable_win64\\Godot_v4.3-stable_win64.exe"
"godotTools.editorPath.godot4": "c:\\Users\\danchie\\Documents\\Godot 4.4\\Godot_v4.4-stable_win64.exe"
}
+1
View File
@@ -0,0 +1 @@
uid://dtev3hcobhh3v
+1
View File
@@ -0,0 +1 @@
uid://c4f1tr8nox531
@@ -0,0 +1 @@
uid://7gg8su7l7adr
+1
View File
@@ -0,0 +1 @@
uid://b4dd5cgag3gmj
@@ -0,0 +1 @@
uid://dsq1f7h88mp4m
+1
View File
@@ -0,0 +1 @@
uid://cr6a7f0fr1ik7
@@ -0,0 +1 @@
uid://cw7vqce212j2l
@@ -0,0 +1 @@
uid://c88jpe7sk8ood
@@ -0,0 +1 @@
uid://bqny8r14mh7ut
+1
View File
@@ -0,0 +1 @@
uid://7o2r5guwuf60
@@ -0,0 +1 @@
uid://con6dkacbux3
@@ -0,0 +1 @@
uid://b4l2tfd0asx38
+1
View File
@@ -0,0 +1 @@
uid://cq6m4hib5jnje
@@ -0,0 +1 @@
uid://ois12pcskdb3
+1
View File
@@ -0,0 +1 @@
uid://bg04ak3vbgask
+1
View File
@@ -0,0 +1 @@
uid://c5q0j8uujs8k1
@@ -0,0 +1 @@
uid://caj56bhuit8y1
@@ -0,0 +1 @@
uid://bw88prwmrywoa
@@ -0,0 +1 @@
uid://dtctf507t71tj
@@ -0,0 +1 @@
uid://c74iyjawmc3nt
@@ -0,0 +1 @@
uid://7q4xte38jyq7
@@ -0,0 +1 @@
uid://t6e8rtdiqhg5
@@ -0,0 +1 @@
uid://b2v7q8n5rsucr
@@ -0,0 +1 @@
uid://bt7kp7k128gw4
@@ -0,0 +1 @@
uid://22e1jnayd6d2
@@ -0,0 +1 @@
uid://bkd78br36f22s
@@ -0,0 +1 @@
uid://npam8q0cckw4
@@ -0,0 +1 @@
uid://ee7t7mdnh7wf
@@ -0,0 +1 @@
uid://ch31ebso22wxa
@@ -0,0 +1 @@
uid://bm0vay28ba7dj
@@ -0,0 +1 @@
uid://bvbkudic8q2p1
@@ -0,0 +1 @@
uid://bsla11d2hsl4f
@@ -0,0 +1 @@
uid://b1tox1lfjp85u
@@ -0,0 +1 @@
uid://dc4wovsitw6ds
@@ -0,0 +1 @@
uid://cx68vwulwsmbh
@@ -0,0 +1 @@
uid://c0agipyurkehb
@@ -0,0 +1 @@
uid://b3lhrf7h086f2
@@ -0,0 +1 @@
uid://gnyeilxt2l0o
@@ -0,0 +1 @@
uid://wj8886yb62i3
@@ -0,0 +1 @@
uid://blbjrtid0i0vk
@@ -0,0 +1 @@
uid://c82bmefi5j38r
@@ -0,0 +1 @@
uid://2wnl5h3m16gh
+1
View File
@@ -0,0 +1 @@
uid://bybthnj000p24
+1
View File
@@ -0,0 +1 @@
uid://brq0oniu7r0o6
+1
View File
@@ -0,0 +1 @@
uid://0pxtgaf20nnl
+83 -2
View File
@@ -23,11 +23,20 @@ var grid_data: Array = [] # 3D array [floor][row][column]
var astar_by_floor = {} # Dictionary of AStar2D instances per floor
var path = []
# Update the obstacle items array to use your specified item indices
@export var obstacle_items: Array[int] = [12, 13, 14, 15] # Updated mesh library indices
@export var obstacle_directions: Array[Direction] = [] # Store the directions of placed obstacles
# Direction and movement systems
enum Direction {
NORTHWEST, NORTH, NORTHEAST,
WEST, CENTER, EAST,
SOUTHWEST, SOUTH, SOUTHEAST
SOUTHWEST, SOUTH, SOUTHEAST,
BLOCKED_NORTH = 10,
BLOCKED_EAST = 11,
BLOCKED_SOUTH = 12,
BLOCKED_WEST = 13
}
var diagonal_movement: bool = false
@@ -299,7 +308,9 @@ func get_neighbors(current_pos: Vector2i, floor_index: int) -> Array[NeighborInf
is_walkable = is_walkable and \
is_position_valid(adjacent1) and is_cell_walkable(adjacent1, floor_index) and \
is_position_valid(adjacent2) and is_cell_walkable(adjacent2, floor_index)
is_position_valid(adjacent2) and is_cell_walkable(adjacent2, floor_index) and \
not is_blocked_by_obstacle(current_pos, adjacent1, floor_index) and \
not is_blocked_by_obstacle(current_pos, adjacent2, floor_index)
if diagonal_movement or not is_diagonal_direction(dir):
neighbors.append(NeighborInfo.new(neighbor_pos, dir, is_walkable))
@@ -461,3 +472,73 @@ func _set(property, value):
func set_diagonal_movement(enable: bool):
diagonal_movement = enable
initialize_astar()
# Add this function to check if a movement is blocked by an obstacle
func is_blocked_by_obstacle(from_pos: Vector2i, to_pos: Vector2i, floor_index: int = 0) -> bool:
# Check if there's a horizontal obstacle
if from_pos.y == to_pos.y: # Moving horizontally
# Check for vertical obstacles that would block horizontal movement
var min_x = min(from_pos.x, to_pos.x)
var max_x = max(from_pos.x, to_pos.x)
for x in range(min_x, max_x + 1):
var cell_index = get_cell_item(Vector3i(x, floor_index, from_pos.y))
if cell_index in obstacle_items:
var obstacle_idx = obstacle_items.find(cell_index)
if obstacle_idx != -1 and obstacle_idx < obstacle_directions.size():
var dir = obstacle_directions[obstacle_idx]
if dir == Direction.BLOCKED_NORTH or dir == Direction.BLOCKED_SOUTH:
return true
# Check if there's a vertical obstacle
if from_pos.x == to_pos.x: # Moving vertically
# Check for horizontal obstacles that would block vertical movement
var min_y = min(from_pos.y, to_pos.y)
var max_y = max(from_pos.y, to_pos.y)
for y in range(min_y, max_y + 1):
var cell_index = get_cell_item(Vector3i(from_pos.x, floor_index, y))
if cell_index in obstacle_items:
var obstacle_idx = obstacle_items.find(cell_index)
if obstacle_idx != -1 and obstacle_idx < obstacle_directions.size():
var dir = obstacle_directions[obstacle_idx]
if dir == Direction.BLOCKED_EAST or dir == Direction.BLOCKED_WEST:
return true
return false
func place_obstacle(pos: Vector3i, obstacle_item: int, direction: Direction) -> bool:
# Always place on floor 3
pos.y = 3
if get_cell_item(pos) != -1:
return false # Cell is already occupied
set_cell_item(pos, obstacle_item)
# Store the direction of the obstacle
var item_index = obstacle_items.find(obstacle_item)
if item_index == -1:
item_index = 0 # Default to first item if not found
while obstacle_directions.size() <= item_index:
obstacle_directions.append(Direction.CENTER) # Default
obstacle_directions[item_index] = direction
# Update the cell's orientation based on direction
var orientation = 0
match direction:
Direction.BLOCKED_NORTH:
orientation = 0 # Default orientation
Direction.BLOCKED_EAST:
orientation = 1 # 90 degrees clockwise
Direction.BLOCKED_SOUTH:
orientation = 2 # 180 degrees
Direction.BLOCKED_WEST:
orientation = 3 # 270 degrees clockwise
set_cell_item(pos, obstacle_item, orientation)
# Re-initialize A* pathfinding to account for the new obstacle
initialize_astar()
return true
@@ -0,0 +1 @@
uid://bja8ixryvthu0
@@ -0,0 +1 @@
uid://fmgdfwvicktv
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bnkcae3aoavgh"]
[ext_resource type="Script" path="res://addons/enhanced_gridmap/enhanced_gridmap_dock.gd" id="1_abcde"]
[ext_resource type="Script" uid="uid://fmgdfwvicktv" path="res://addons/enhanced_gridmap/enhanced_gridmap_dock.gd" id="1_abcde"]
[node name="Enhanced GridMap" type="ScrollContainer"]
anchors_preset = 15
@@ -1,8 +1,9 @@
[gd_resource type="MeshLibrary" load_steps=11 format=3 uid="uid://54tpx8cmksfc"]
[gd_resource type="MeshLibrary" load_steps=12 format=3 uid="uid://54tpx8cmksfc"]
[ext_resource type="ArrayMesh" uid="uid://dqguomxd16u0i" path="res://assets/models/meshes/start.res" id="1_xdwel"]
[ext_resource type="ArrayMesh" uid="uid://dspusnbkr74hg" path="res://assets/models/meshes/hover.res" id="2_5gp4i"]
[ext_resource type="Material" uid="uid://bsyh0x4cy5qyr" path="res://assets/models/meshes/end.tres" id="3_qi66w"]
[ext_resource type="ArrayMesh" uid="uid://dtr46jmckif0p" path="res://assets/models/meshes/block.res" id="4_8v5xv"]
[ext_resource type="ArrayMesh" uid="uid://d4himvyb81in8" path="res://assets/models/meshes/non-walkable.res" id="4_h83ju"]
[ext_resource type="ArrayMesh" uid="uid://bgvropltcot0q" path="res://assets/models/meshes/normal.res" id="5_san4u"]
[ext_resource type="ArrayMesh" uid="uid://36tgon3b60db" path="res://assets/models/tiles/tile_heart.tres" id="6_r6sve"]
@@ -18,65 +19,103 @@ size = Vector2(1, 1)
item/0/name = "normal"
item/0/mesh = ExtResource("1_xdwel")
item/0/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/mesh_cast_shadow = 1
item/0/shapes = []
item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/navigation_layers = 1
item/1/name = "hover"
item/1/mesh = ExtResource("2_5gp4i")
item/1/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/1/mesh_cast_shadow = 1
item/1/shapes = []
item/1/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/1/navigation_layers = 1
item/2/name = "start"
item/2/mesh = ExtResource("1_xdwel")
item/2/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/2/mesh_cast_shadow = 1
item/2/shapes = []
item/2/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/2/navigation_layers = 1
item/3/name = "end"
item/3/mesh = SubResource("PlaneMesh_ti6kf")
item/3/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/3/mesh_cast_shadow = 1
item/3/shapes = []
item/3/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/3/navigation_layers = 1
item/4/name = "non-walkable"
item/4/mesh = ExtResource("4_h83ju")
item/4/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/4/mesh_cast_shadow = 1
item/4/shapes = []
item/4/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/4/navigation_layers = 1
item/6/name = "grass"
item/6/mesh = ExtResource("5_san4u")
item/6/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/6/mesh_cast_shadow = 1
item/6/shapes = []
item/6/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/6/navigation_layers = 1
item/7/name = "tile_heart"
item/7/mesh = ExtResource("6_r6sve")
item/7/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
item/7/mesh_cast_shadow = 1
item/7/shapes = []
item/7/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/7/navigation_layers = 1
item/8/name = "tile_diamond"
item/8/mesh = ExtResource("8_rj3ss")
item/8/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
item/8/mesh_cast_shadow = 1
item/8/shapes = []
item/8/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/8/navigation_layers = 1
item/9/name = "tile_star"
item/9/mesh = ExtResource("9_y8bbi")
item/9/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
item/9/mesh_cast_shadow = 1
item/9/shapes = []
item/9/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/9/navigation_layers = 1
item/10/name = "tile_coin"
item/10/mesh = ExtResource("9_44311")
item/10/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
item/10/mesh_cast_shadow = 1
item/10/shapes = []
item/10/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/10/navigation_layers = 1
item/11/name = ""
item/11/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/11/name = "obstacle_block"
item/11/mesh = ExtResource("4_8v5xv")
item/11/mesh_transform = Transform3D(1.65, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0.5)
item/11/mesh_cast_shadow = 1
item/11/shapes = []
item/11/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/11/navigation_mesh_transform = Transform3D(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0)
item/11/navigation_layers = 1
item/12/name = "obstacle_block_h"
item/12/mesh = ExtResource("4_8v5xv")
item/12/mesh_transform = Transform3D(1.65, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0.5)
item/12/mesh_cast_shadow = 1
item/12/shapes = []
item/12/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/12/navigation_layers = 1
item/13/name = "obstacle_block_v"
item/13/mesh = ExtResource("4_8v5xv")
item/13/mesh_transform = Transform3D(1.65, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0.5)
item/13/mesh_cast_shadow = 1
item/13/shapes = []
item/13/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/13/navigation_layers = 1
item/14/name = ""
item/14/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/14/mesh_cast_shadow = 1
item/14/shapes = []
item/14/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/14/navigation_layers = 1
item/15/name = ""
item/15/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/15/mesh_cast_shadow = 1
item/15/shapes = []
item/15/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/15/navigation_layers = 1
+1
View File
@@ -0,0 +1 @@
uid://fcdsysbyx6pt
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
Binary file not shown.
+48
View File
@@ -0,0 +1,48 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bwg5ntn1xa8o"
path="res://.godot/imported/block.glb-fb6bc8a4474a482c37edd6c5ac8ce3c9.scn"
[deps]
source_file="res://assets/models/meshes/block.glb"
dest_files=["res://.godot/imported/block.glb-fb6bc8a4474a482c37edd6c5ac8ce3c9.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"meshes": {
"block_Plane_093": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"save_to_file/enabled": true,
"save_to_file/path": "res://assets/models/meshes/block.res"
}
}
}
gltf/naming_version=1
gltf/embedded_image_handling=1
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b6n6cxcffkg7s"
path.s3tc="res://.godot/imported/block_Block3.png-529ed6c98d1f6a034bc687571a41ed5d.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/models/meshes/block_Block3.png"
dest_files=["res://.godot/imported/block_Block3.png-529ed6c98d1f6a034bc687571a41ed5d.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bslcvqu835at5"
path.s3tc="res://.godot/imported/block_1.png-6b8ced44f05f806f44a7a813843484f3.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/models/meshes/block_texture/block_1.png"
dest_files=["res://.godot/imported/block_1.png-6b8ced44f05f806f44a7a813843484f3.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c0e3o1bfwb4dq"
path.s3tc="res://.godot/imported/block_2.png-412f753f19be298d13d0f199fdd970a5.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/models/meshes/block_texture/block_2.png"
dest_files=["res://.godot/imported/block_2.png-412f753f19be298d13d0f199fdd970a5.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6oe6hwm2a8j1"
path.s3tc="res://.godot/imported/block_3.png-a61521fcb1bdbdec39cb720b2b8601e6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/models/meshes/block_texture/block_3.png"
dest_files=["res://.godot/imported/block_3.png-a61521fcb1bdbdec39cb720b2b8601e6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
+1
View File
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
Binary file not shown.
@@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -12,7 +12,7 @@ config_version=5
config/name="tekton-local"
run/main_scene="res://scenes/main_scene.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
+90 -2
View File
@@ -9,7 +9,7 @@
# [x] Grab tile is working, you can grab the tile from gridmap to playerboard
# -------------------------------------------------------------------------------------
# [ ] Implement the Boosts tile, that can be used to boost player movement to next tile
# [ ] Implement the Obstacle tile, that can be used to block player movement to next tile
# [x] Implement the Obstacle tile, that can be used to block player movement to next tile
# -------------------------------------------------------------------------------------
# [x] Added multiplayer support - with act as server and client
# [x] Added UPnP support for automatic port forwarding, for android and desktop
@@ -62,7 +62,18 @@ enum ActionState {
GRABBING,
PUTTING,
RANDOMIZING,
ARRANGING
ARRANGING,
PLACING_OBSTACLE
}
# Obstacle
var current_obstacle_direction = ObstacleDirection.VERTICAL
var obstacle_item_index = 12 # Default obstacle item index in mesh library
var current_obstacle_item = 12 # Starting with first obstacle item (12)
enum ObstacleDirection {
VERTICAL,
HORIZONTAL
}
var current_action_state = ActionState.NONE
@@ -88,6 +99,8 @@ func _ready():
multiplayer_peer.peer_disconnected.connect(_on_peer_disconnected)
setup_action_buttons()
setup_playerboard_ui()
# Obstacles
setup_obstacle_ui()
func _process(delta):
if multiplayer.is_server() and game_started:
@@ -206,6 +219,47 @@ func set_action_state(new_state):
ActionState.ARRANGING:
show_arrangement_ui()
local_player_character.highlight_occupied_playerboard_slots()
ActionState.PLACING_OBSTACLE:
local_player_character.highlight_valid_obstacle_cells()
# Update the place_obstacle function for floor 3
func place_obstacle(grid_position: Vector2i):
if not local_player_character or local_player_character.action_points < 1:
return false
var floor_index = 3 # Always place on floor 3
var direction = EnhancedGridMap.Direction.BLOCKED_NORTH
match current_obstacle_direction:
ObstacleDirection.VERTICAL:
direction = EnhancedGridMap.Direction.BLOCKED_NORTH # Block movement along east-west axis
ObstacleDirection.HORIZONTAL:
direction = EnhancedGridMap.Direction.BLOCKED_EAST # Block movement along north-south axis
var success = $EnhancedGridMap.place_obstacle(
Vector3i(grid_position.x, floor_index, grid_position.y),
current_obstacle_item,
direction
)
if success:
local_player_character.action_points -= 1
local_player_character.clear_highlights()
# Don't exit the obstacle placement mode to allow multiple placements
local_player_character.highlight_valid_obstacle_cells()
# Sync the obstacle with other clients
if is_multiplayer_authority():
rpc("sync_place_obstacle", grid_position.x, grid_position.y, floor_index, current_obstacle_item, direction)
return true
return false
# Update the RPC for obstacle synchronization
@rpc("any_peer", "call_local")
func sync_place_obstacle(x: int, y: int, floor_index: int, item_index: int, direction: int):
$EnhancedGridMap.place_obstacle(Vector3i(x, floor_index, y), item_index, direction)
func update_button_states():
if not local_player_character or local_player_character.is_in_group("Bots"):
@@ -932,6 +986,40 @@ func sync_playerboard(player_id: int, new_playerboard: Array):
for slot_idx in range(25):
update_board_slot(board_ui, slot_idx, new_playerboard[slot_idx])
# Update the obstacle UI setup function
func setup_obstacle_ui():
# Create the obstacle button
var obstacle_button = Button.new()
obstacle_button.text = "Place Obstacle"
obstacle_button.pressed.connect(func(): set_action_state(ActionState.PLACING_OBSTACLE))
$ActionMenu/ActionButtonContainer.add_child(obstacle_button)
# Create the direction toggle button
var direction_button = Button.new()
direction_button.text = "Direction: Vertical"
direction_button.pressed.connect(func():
current_obstacle_direction = ObstacleDirection.HORIZONTAL if current_obstacle_direction == ObstacleDirection.VERTICAL else ObstacleDirection.VERTICAL
direction_button.text = "Direction: " + ("Horizontal" if current_obstacle_direction == ObstacleDirection.HORIZONTAL else "Vertical")
)
$ActionMenu/ActionButtonContainer.add_child(direction_button)
# Create the type cycle button
var type_button = Button.new()
type_button.text = "Type: 1"
type_button.pressed.connect(func():
type_button.text = cycle_obstacle_type()
)
$ActionMenu/ActionButtonContainer.add_child(type_button)
# Add a function to cycle through obstacle types
func cycle_obstacle_type():
var obstacle_types = [12, 13, 14, 15]
var current_index = obstacle_types.find(current_obstacle_item)
current_index = (current_index + 1) % obstacle_types.size()
current_obstacle_item = obstacle_types[current_index]
return "Type: " + str(current_index + 1)
func update_board_slot(board_ui: Node, slot_idx: int, value: int):
var slot_node = board_ui.get_node_or_null("Slot%d" % (slot_idx + 1))
if slot_node:
+1
View File
@@ -0,0 +1 @@
uid://co1ads72by6na
+7 -6
View File
@@ -1,8 +1,8 @@
[gd_scene load_steps=26 format=3 uid="uid://dxn87yj8qnfpp"]
[ext_resource type="MeshLibrary" uid="uid://54tpx8cmksfc" path="res://addons/enhanced_gridmap/meshlibrary/default.tres" id="1_110wo"]
[ext_resource type="Script" path="res://scenes/main.gd" id="1_xcpe3"]
[ext_resource type="Script" path="res://addons/enhanced_gridmap/enhanced_gridmap.gd" id="2_hbe1v"]
[ext_resource type="Script" uid="uid://co1ads72by6na" path="res://scenes/main.gd" id="1_xcpe3"]
[ext_resource type="Script" uid="uid://bja8ixryvthu0" path="res://addons/enhanced_gridmap/enhanced_gridmap.gd" id="2_hbe1v"]
[ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://assets/main-environment.tres" id="4_ky38j"]
[ext_resource type="StyleBox" uid="uid://dlw1ogamn741n" path="res://assets/styles/box_flat.tres" id="5_dvx6y"]
[ext_resource type="Texture2D" uid="uid://2yrc6rl4dmd8" path="res://assets/textures/player_board_and_blue_print/tile_null.tres" id="6_2vy7d"]
@@ -44,8 +44,9 @@ data = {
script = ExtResource("2_hbe1v")
columns = 14
rows = 12
floors = 2
metadata/_editor_floor_ = Vector3(0, 1, 0)
obstacle_items = Array[int]([12])
obstacle_directions = Array[int]([11, 10, 12, 13])
metadata/_editor_floor_ = Vector3(0, 2, 0)
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.422618, 0.906308, 0, -0.906308, 0.422618, 7, 26, 17)
@@ -935,8 +936,8 @@ anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -145.0
offset_top = -218.0
offset_left = -160.0
offset_top = -384.0
grow_horizontal = 0
grow_vertical = 0
+35
View File
@@ -225,6 +225,9 @@ func handle_grid_click(grid_position: Vector2i):
main.ActionState.RANDOMIZING:
if grid_position in highlighted_cells:
main.randomize_item_at_position(grid_position)
main.ActionState.PLACING_OBSTACLE:
if grid_position in highlighted_cells:
main.place_obstacle(grid_position)
func is_position_occupied(pos: Vector2i) -> bool:
for player in get_tree().get_nodes_in_group("Players"):
@@ -1215,3 +1218,35 @@ func sync_position(pos: Vector2i):
cell_size.y,
current_position.y * cell_size.z + cell_size.z * 0.5
) + cell_offset
func highlight_valid_obstacle_cells():
if not is_multiplayer_authority() or is_bot or is_in_group("Bots"):
return
clear_highlights()
var cells_to_highlight = []
# Highlight all empty cells on the grid except those occupied by players or obstacles
for x in range(enhanced_gridmap.columns):
for z in range(enhanced_gridmap.rows):
var pos = Vector2i(x, z)
var cell = Vector3i(x, 3, z) # Check floor 3 for occupancy
var occupied_by_player = false
var occupied_by_obstacle = false
# Check if cell is occupied by any player
for player in get_tree().get_nodes_in_group("Players"):
if player.current_position == pos:
occupied_by_player = true
break
# Check if cell is occupied by an obstacle
if enhanced_gridmap.get_cell_item(cell) in enhanced_gridmap.obstacle_items:
occupied_by_obstacle = true
# Only add to highlights if not occupied by player or obstacle
if not occupied_by_player and not occupied_by_obstacle:
cells_to_highlight.append(pos)
highlight_cells_if_authorized(cells_to_highlight)
+1
View File
@@ -0,0 +1 @@
uid://c78jcadupsdro
+15 -15
View File
@@ -1,25 +1,25 @@
[gd_scene load_steps=25 format=3 uid="uid://1dbdbg3q5778"]
[ext_resource type="Script" path="res://scenes/player.gd" id="1_qecr4"]
[ext_resource type="Script" uid="uid://c78jcadupsdro" path="res://scenes/player.gd" id="1_qecr4"]
[ext_resource type="PackedScene" uid="uid://ejeamn0pyey4" path="res://assets/characters/Bob.glb" id="2_3e0d5"]
[ext_resource type="Texture2D" uid="uid://b4y41h16q6m34" path="res://assets/textures/bub.png" id="2_5w327"]
[ext_resource type="PackedScene" uid="uid://1vk0mjnwkngi" path="res://assets/characters/Masbro.glb" id="2_mjsl8"]
[ext_resource type="PackedScene" uid="uid://d4cul3w3wem5w" path="res://assets/characters/Gatot.glb" id="4_3tlf6"]
[ext_resource type="PackedScene" uid="uid://bmln7v6v5kvxg" path="res://assets/characters/Oldpop.glb" id="5_alfd1"]
[ext_resource type="AnimationLibrary" uid="uid://c3pyopnwibckj" path="res://assets/characters/animations/animation-pack.res" id="6_5oq5w"]
[ext_resource type="Script" path="res://scripts/bot_behavior.gd" id="8_1o2fn"]
[ext_resource type="Script" path="res://addons/beehave/nodes/composites/selector.gd" id="9_jspru"]
[ext_resource type="Script" path="res://addons/beehave/nodes/composites/sequence.gd" id="10_hv4ee"]
[ext_resource type="Script" path="res://scripts/behaviors/conditions/has_ap.gd" id="11_7fhpq"]
[ext_resource type="Script" path="res://scripts/behaviors/actions/do_arrange.gd" id="12_1ppih"]
[ext_resource type="Script" path="res://scripts/behaviors/conditions/can_arrange.gd" id="12_hr248"]
[ext_resource type="Script" path="res://scripts/behaviors/conditions/can_grab.gd" id="13_41jsv"]
[ext_resource type="Script" path="res://scripts/behaviors/actions/do_grab.gd" id="15_5h472"]
[ext_resource type="Script" path="res://scripts/behaviors/conditions/can_put.gd" id="16_ac2sy"]
[ext_resource type="Script" path="res://scripts/behaviors/actions/do_put.gd" id="17_e03nk"]
[ext_resource type="Script" path="res://scripts/behaviors/conditions/should_move.gd" id="18_2ghcp"]
[ext_resource type="Script" path="res://scripts/behaviors/actions/do_move.gd" id="19_dl4fn"]
[ext_resource type="Script" path="res://scripts/bot_blackboard.gd" id="20_24ja6"]
[ext_resource type="Script" uid="uid://6g75rh3nj2s6" path="res://scripts/bot_behavior.gd" id="8_1o2fn"]
[ext_resource type="Script" uid="uid://dtctf507t71tj" path="res://addons/beehave/nodes/composites/selector.gd" id="9_jspru"]
[ext_resource type="Script" uid="uid://t6e8rtdiqhg5" path="res://addons/beehave/nodes/composites/sequence.gd" id="10_hv4ee"]
[ext_resource type="Script" uid="uid://b17qem72laaeb" path="res://scripts/behaviors/conditions/has_ap.gd" id="11_7fhpq"]
[ext_resource type="Script" uid="uid://b4fxorcb1yq17" path="res://scripts/behaviors/actions/do_arrange.gd" id="12_1ppih"]
[ext_resource type="Script" uid="uid://b25qg75d0xgkh" path="res://scripts/behaviors/conditions/can_arrange.gd" id="12_hr248"]
[ext_resource type="Script" uid="uid://cui40g7qjf1y3" path="res://scripts/behaviors/conditions/can_grab.gd" id="13_41jsv"]
[ext_resource type="Script" uid="uid://cuyorbwefmh0y" path="res://scripts/behaviors/actions/do_grab.gd" id="15_5h472"]
[ext_resource type="Script" uid="uid://b7y30e5mxygj0" path="res://scripts/behaviors/conditions/can_put.gd" id="16_ac2sy"]
[ext_resource type="Script" uid="uid://bdw5bwmr32h63" path="res://scripts/behaviors/actions/do_put.gd" id="17_e03nk"]
[ext_resource type="Script" uid="uid://bc7jpc1bwy4dg" path="res://scripts/behaviors/conditions/should_move.gd" id="18_2ghcp"]
[ext_resource type="Script" uid="uid://cireifbxafgf2" path="res://scripts/behaviors/actions/do_move.gd" id="19_dl4fn"]
[ext_resource type="Script" uid="uid://d2cr28ak2s1rr" path="res://scripts/bot_blackboard.gd" id="20_24ja6"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xqgey"]
albedo_color = Color(0.85, 0.085, 0.238, 1)
@@ -56,7 +56,7 @@ visible = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Masbro")
libraries = {
"animation-pack": ExtResource("6_5oq5w")
&"animation-pack": ExtResource("6_5oq5w")
}
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
@@ -0,0 +1 @@
uid://b4fxorcb1yq17
+1
View File
@@ -0,0 +1 @@
uid://cuyorbwefmh0y
+1
View File
@@ -0,0 +1 @@
uid://cireifbxafgf2
+1
View File
@@ -0,0 +1 @@
uid://bdw5bwmr32h63
@@ -0,0 +1 @@
uid://b25qg75d0xgkh
@@ -0,0 +1 @@
uid://cui40g7qjf1y3
@@ -0,0 +1 @@
uid://b7y30e5mxygj0
@@ -0,0 +1 @@
uid://b17qem72laaeb
@@ -0,0 +1 @@
uid://bc7jpc1bwy4dg
+1
View File
@@ -0,0 +1 @@
uid://6g75rh3nj2s6
+1
View File
@@ -0,0 +1 @@
uid://d2cr28ak2s1rr
Binary file not shown.