Исправлена возможность пересечения коридоров
This commit is contained in:
parent
2c207b94fb
commit
5b7f1a5ee4
14
tile_map.gd
14
tile_map.gd
@ -123,15 +123,25 @@ func place_way(pos1: Vector2i, pos2: Vector2i) -> bool:
|
||||
if not (tiledata1.get_custom_data("is_center") and tiledata1.get_custom_data("struct_name")=="EMPTY_ROOM"): return false
|
||||
if not (tiledata2.get_custom_data("is_center") and tiledata2.get_custom_data("struct_name")=="EMPTY_ROOM"): return false
|
||||
|
||||
|
||||
#Check place is free
|
||||
if pos1.x != pos2.x:
|
||||
if abs(pos1.x-pos2.x)<=5: return false
|
||||
for x in range(min(pos1.x,pos2.x)+2, max(pos1.x,pos2.x)-1):
|
||||
if get_maxZ(Vector2i(x, pos1.y)) >= structs[StructType.H_WAY][struct_fields.LAYER].z_index:
|
||||
return false
|
||||
if pos1.y != pos2.y:
|
||||
if abs(pos1.y-pos2.y)<=5: return false
|
||||
for y in range(min(pos1.y,pos2.y)+2, max(pos1.y,pos2.y)-1):
|
||||
if get_maxZ(Vector2i(pos1.x, y)) >= structs[StructType.V_WAY][struct_fields.LAYER].z_index:
|
||||
return false
|
||||
|
||||
|
||||
if pos1.x != pos2.x:
|
||||
place_struct(Vector2i(min(pos1.x,pos2.x)+2, pos1.y), StructType.WAY_LEFT)
|
||||
place_struct(Vector2i(max(pos1.x,pos2.x)-2, pos1.y), StructType.WAY_RIGHT)
|
||||
for x in range(min(pos1.x,pos2.x)+3, max(pos1.x,pos2.x)-2):
|
||||
place_struct(Vector2i(x, pos1.y), StructType.H_WAY)
|
||||
if pos1.y != pos2.y:
|
||||
if abs(pos1.y-pos2.y)<=5: return false
|
||||
place_struct(Vector2i(pos1.x, min(pos1.y,pos2.y)+2), StructType.WAY_UP)
|
||||
place_struct(Vector2i(pos1.x, max(pos1.y,pos2.y)-2), StructType.WAY_DOWN)
|
||||
for y in range(min(pos1.y,pos2.y)+3, max(pos1.y,pos2.y)-2):
|
||||
|
12
world.tscn
12
world.tscn
@ -737,8 +737,11 @@ texture = ExtResource("3_hky6b")
|
||||
1:5/0 = 0
|
||||
1:5/0/custom_data_0 = true
|
||||
1:5/0/custom_data_1 = Vector2i(3, 1)
|
||||
1:5/0/custom_data_3 = Vector2i(0, 1)
|
||||
2:5/0 = 0
|
||||
2:5/0/custom_data_3 = Vector2i(-1, 1)
|
||||
3:5/0 = 0
|
||||
3:5/0/custom_data_3 = Vector2i(1, 1)
|
||||
1:6/0 = 0
|
||||
1:6/0/custom_data_0 = true
|
||||
1:6/0/custom_data_1 = Vector2i(3, 1)
|
||||
@ -748,15 +751,21 @@ texture = ExtResource("3_hky6b")
|
||||
3:6/0 = 0
|
||||
3:6/0/custom_data_0 = true
|
||||
3:6/0/custom_data_1 = Vector2i(1, 3)
|
||||
3:6/0/custom_data_3 = Vector2i(1, 0)
|
||||
1:7/0 = 0
|
||||
1:7/0/custom_data_0 = true
|
||||
1:7/0/custom_data_1 = Vector2i(3, 1)
|
||||
1:7/0/custom_data_3 = Vector2i(0, -1)
|
||||
2:7/0 = 0
|
||||
2:7/0/custom_data_3 = Vector2i(-1, -1)
|
||||
3:7/0 = 0
|
||||
3:7/0/custom_data_3 = Vector2i(1, -1)
|
||||
0:5/0 = 0
|
||||
0:5/0/custom_data_3 = Vector2i(1, 1)
|
||||
0:6/0 = 0
|
||||
0:6/0/custom_data_3 = Vector2i(1, 0)
|
||||
0:7/0 = 0
|
||||
0:7/0/custom_data_3 = Vector2i(1, -1)
|
||||
4:7/0 = 0
|
||||
4:7/0/custom_data_3 = Vector2i(0, -1)
|
||||
4:6/0 = 0
|
||||
@ -766,10 +775,13 @@ texture = ExtResource("3_hky6b")
|
||||
4:5/0 = 0
|
||||
4:5/0/custom_data_3 = Vector2i(0, 1)
|
||||
5:5/0 = 0
|
||||
5:5/0/custom_data_3 = Vector2i(-1, 1)
|
||||
5:6/0 = 0
|
||||
5:6/0/custom_data_0 = true
|
||||
5:6/0/custom_data_1 = Vector2i(1, 3)
|
||||
5:6/0/custom_data_3 = Vector2i(-1, 0)
|
||||
5:7/0 = 0
|
||||
5:7/0/custom_data_3 = Vector2i(-1, -1)
|
||||
|
||||
[sub_resource type="TileSet" id="TileSet_twrk0"]
|
||||
terrain_set_0/mode = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user