having a correct selection of units
should resolve the first step of #4
This commit is contained in:
parent
50973fa1c0
commit
be9772a4f3
18 changed files with 575 additions and 95 deletions
207
Maps/gym.tscn
207
Maps/gym.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=30 format=3 uid="uid://dnmetcwb14svi"]
|
||||
[gd_scene load_steps=31 format=3 uid="uid://dnmetcwb14svi"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://chag8j6kyegq0" path="res://packs/Kaykit-Proto/materials/floor.tres" id="1_b53sv"]
|
||||
[ext_resource type="PackedScene" uid="uid://qbceryqqfoum" path="res://packs/Kaykit-Proto/obj/dummy.tscn" id="2_40027"]
|
||||
|
@ -21,6 +21,7 @@
|
|||
[ext_resource type="ArrayMesh" uid="uid://b368b7vyej1fk" path="res://packs/Kaykit-Proto/obj/table_medium_Decorated.obj" id="19_fypju"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://wcyh5hwirci" path="res://packs/Kaykit-Proto/obj/Wall_Doorway.obj" id="20_j11kn"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://di584vn1afti7" path="res://packs/Kaykit-Proto/obj/Primitive_Floor.obj" id="21_unwmg"]
|
||||
[ext_resource type="AudioStream" uid="uid://c4fw6xlaqpred" path="res://audio/music/forested.ogg" id="22_qx0ut"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_vkxe1"]
|
||||
sky_top_color = Color(0.299981, 0.701967, 0.743086, 1)
|
||||
|
@ -43,15 +44,6 @@ glow_enabled = true
|
|||
volumetric_fog_enabled = true
|
||||
volumetric_fog_density = 0.0065
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_afokq"]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "floor_mesh"
|
||||
lightmap_size_hint = Vector2i(103, 59)
|
||||
uv2_padding = 0.0
|
||||
size = Vector3(10, 0.3, 10)
|
||||
subdivide_width = 5
|
||||
subdivide_depth = 5
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mqp7f"]
|
||||
albedo_texture = ExtResource("6_anror")
|
||||
|
||||
|
@ -66,6 +58,15 @@ albedo_texture = ExtResource("6_anror")
|
|||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_afokq"]
|
||||
points = PackedVector3Array(-0.953959, 0.0770701, -0.923111, 0.995482, 1.90217, 0.902347, 0.953931, 1.92294, 0.923125, 0.902243, 1.90211, -0.99565, -0.902341, 1.99532, 0.902338, 0.902311, 0.00466377, 0.902352, -0.902272, 0.097907, 0.995635, 0.995482, 0.0978295, -0.902347, -0.99551, 1.90216, -0.902333, 0.902311, 1.99534, -0.902352, -0.99551, 0.0978435, 0.902333, 0.902243, 1.90211, 0.99565, -0.902272, 0.097907, -0.995635, -0.902341, 0.00467924, -0.902338, 0.902243, 0.097893, -0.99565, -0.902272, 1.90209, -0.995635, 0.902243, 0.097893, 0.99565, -0.902272, 1.90209, 0.995635, 0.902311, 0.00466377, -0.902352, -0.902341, 1.99532, -0.902338, -0.902341, 0.00467924, 0.902338, 0.995482, 0.0978295, 0.902347, 0.995482, 1.90217, -0.902347, -0.99551, 1.90216, 0.902333, 0.902311, 1.99534, 0.902352, -0.99551, 0.0978435, -0.902333)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_afokq"]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "floor_mesh"
|
||||
lightmap_size_hint = Vector2i(103, 59)
|
||||
uv2_padding = 0.0
|
||||
size = Vector3(10, 0.3, 10)
|
||||
subdivide_width = 5
|
||||
subdivide_depth = 5
|
||||
|
||||
[node name="Gym" type="Node"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
|
@ -77,49 +78,6 @@ light_energy = 1.3
|
|||
shadow_enabled = true
|
||||
directional_shadow_max_distance = 500.0
|
||||
|
||||
[node name="CSGMesh3D" type="CSGMesh3D" parent="."]
|
||||
transform = Transform3D(5.015, 0, 0, 0, 1, 0, 0, 0, 6.05, 0, -0.125, 0)
|
||||
material_override = ExtResource("1_b53sv")
|
||||
use_collision = true
|
||||
mesh = SubResource("BoxMesh_afokq")
|
||||
|
||||
[node name="dummy" parent="." instance=ExtResource("2_40027")]
|
||||
transform = Transform3D(0.232937, 0, -0.869333, 0, 0.9, 0, 0.869333, 0, 0.232937, 1.63629, 0, 5.28206)
|
||||
|
||||
[node name="BarrelA" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.46089, 0.469088, -5.67514)
|
||||
material_override = SubResource("StandardMaterial3D_mqp7f")
|
||||
mesh = ExtResource("3_afokq")
|
||||
|
||||
[node name="BoxA" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 4.69587, 0, 0.473738)
|
||||
mesh = ExtResource("4_mqp7f")
|
||||
|
||||
[node name="BoxB" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1.54555, 0, -1.70331, 0, 2.3, 0, 1.70331, 0, 1.54555, 6.56136, 0, -3.45931)
|
||||
mesh = ExtResource("5_ipipj")
|
||||
|
||||
[node name="CubePrototypeSmall2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.712541, 0, -0.701631, 0, 1, 0, 0.701631, 0, 0.712541, 0.193116, 0.14412355, 6.76326)
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
|
||||
[node name="CubePrototypeSmall3" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.712541, 0, -0.701631, 0, 1, 0, 0.701631, 0, 0.712541, 0.193116, 3.8178167, 12.751448)
|
||||
material_override = SubResource("StandardMaterial3D_uesmb")
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
|
||||
[node name="RigidBody3D2" type="RigidBody3D" parent="."]
|
||||
|
||||
[node name="CubePrototypeSmall" type="MeshInstance3D" parent="RigidBody3D2"]
|
||||
transform = Transform3D(0.949321, 0, 0.314307, -0.169926, 0.841256, 0.513238, -0.264413, -0.540637, 0.798622, -5.197, 6.3825, -12.265)
|
||||
material_override = SubResource("StandardMaterial3D_aq7w3")
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D2"]
|
||||
transform = Transform3D(0.949321, 0, 0.314307, -0.169926, 0.841256, 0.513238, -0.264413, -0.540637, 0.798622, -5.197, 6.3825, -12.265)
|
||||
shape = SubResource("ConvexPolygonShape3D_afokq")
|
||||
|
||||
[node name="player_root" parent="." instance=ExtResource("8_mqp7f")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.528881, 0, 0)
|
||||
|
||||
|
@ -128,70 +86,145 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16.0969, 9.95703, 31.1327)
|
|||
size = Vector3(92.7308, 66.6152, 140.037)
|
||||
data = ExtResource("9_ipipj")
|
||||
|
||||
[node name="BoxC" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.7566984, 0, 0.65376407, 0, 1, 0, -0.65376407, 0, 0.7566984, 0.17067528, 0.024999619, -6.5876083)
|
||||
[node name="Env" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.7530127, 0.39157277, -11.776872)
|
||||
|
||||
[node name="BarrelA" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.707877, 0.077515215, 6.101732)
|
||||
material_override = SubResource("StandardMaterial3D_mqp7f")
|
||||
mesh = ExtResource("3_afokq")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="BoxA" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 8.448883, -0.39157277, 12.250609)
|
||||
mesh = ExtResource("4_mqp7f")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="BoxB" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1.54555, 0, -1.70331, 0, 2.3, 0, 1.70331, 0, 1.54555, 10.314373, -0.39157277, 8.317562)
|
||||
mesh = ExtResource("5_ipipj")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="CubePrototypeSmall2" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.712541, 0, -0.701631, 0, 1, 0, 0.701631, 0, 0.712541, 3.9461286, -0.24744922, 18.54013)
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="CubePrototypeSmall3" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.712541, 0, -0.701631, 0, 1, 0, 0.701631, 0, 0.712541, 3.9461286, 3.426244, 24.52832)
|
||||
material_override = SubResource("StandardMaterial3D_uesmb")
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="RigidBody3D2" type="RigidBody3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.7530127, -0.39157277, 11.776872)
|
||||
|
||||
[node name="CubePrototypeSmall" type="MeshInstance3D" parent="Env/RigidBody3D2"]
|
||||
transform = Transform3D(0.949321, 0, 0.314307, -0.169926, 0.841256, 0.513238, -0.264413, -0.540637, 0.798622, -5.197, 6.3825, -12.265)
|
||||
material_override = SubResource("StandardMaterial3D_aq7w3")
|
||||
mesh = ExtResource("7_f8cpb")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Env/RigidBody3D2"]
|
||||
transform = Transform3D(0.949321, 0, 0.314307, -0.169926, 0.841256, 0.513238, -0.264413, -0.540637, 0.798622, -5.197, 6.3825, -12.265)
|
||||
shape = SubResource("ConvexPolygonShape3D_afokq")
|
||||
|
||||
[node name="BoxC" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.7566984, 0, 0.65376407, 0, 1, 0, -0.65376407, 0, 0.7566984, 3.923688, -0.36657315, 5.1892633)
|
||||
mesh = ExtResource("10_iyjuv")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="DoorADecorated" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -15.584036, 0.024999619, -19.843891)
|
||||
[node name="DoorADecorated" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -11.831023, -0.36657315, -8.067019)
|
||||
mesh = ExtResource("11_gfgny")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PalletLarge" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.6037169, 0.025000572, -21.528067)
|
||||
[node name="PalletLarge" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.3567295, -0.3665722, -9.751195)
|
||||
mesh = ExtResource("12_aw2pe")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PalletLarge2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.99956816, 0, -0.029387116, 0, 1, 0, 0.029387116, 0, 0.99956816, 3.1583347, 0.52046394, -20.519901)
|
||||
[node name="PalletLarge2" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.99956816, 0, -0.029387116, 0, 1, 0, 0.029387116, 0, 0.99956816, 6.9113474, 0.12889117, -8.74303)
|
||||
mesh = ExtResource("12_aw2pe")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PalletLarge3" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.99656403, 0, 0.0828256, 0, 1, 0, -0.0828256, 0, 0.99656403, 4.4024363, 0.9654, -22.039927)
|
||||
[node name="PalletLarge3" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.99656403, 0, 0.0828256, 0, 1, 0, -0.0828256, 0, 0.99656403, 8.155449, 0.5738272, -10.263055)
|
||||
mesh = ExtResource("12_aw2pe")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PalletSmall" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.91708094, 0, -0.39870104, 0, 1, 0, 0.39870104, 0, 0.91708094, 8.676193, 0.025000095, -21.06688)
|
||||
[node name="PalletSmall" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.91708094, 0, -0.39870104, 0, 1, 0, 0.39870104, 0, 0.91708094, 12.429206, -0.36657268, -9.290008)
|
||||
mesh = ExtResource("13_t4e8t")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveSlope" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16.317268, 0.024999619, -16.646858)
|
||||
[node name="PrimitiveSlope" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.070282, -0.36657315, -4.8699865)
|
||||
mesh = ExtResource("14_86fmv")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveStairs" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.237097, 0.024998665, -18.559904)
|
||||
[node name="PrimitiveStairs" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.4840841, -0.3665741, -6.7830324)
|
||||
mesh = ExtResource("15_v6mjl")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveStairsHalf" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.8438319, 0, -0.53660756, 0, 1, 0, 0.53660756, 0, 0.8438319, -7.3606834, -3.35709, 12.253401)
|
||||
[node name="PrimitiveStairsHalf" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(0.8438319, 0, -0.53660756, 0, 1, 0, 0.53660756, 0, 0.8438319, -3.6076708, -3.7486627, 24.030273)
|
||||
mesh = ExtResource("16_kvtwj")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveWall" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.851445, 0.024999619, -21.031487)
|
||||
[node name="PrimitiveWall" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.0984325, -0.36657315, -9.254615)
|
||||
mesh = ExtResource("17_26j3w")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveWall2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.080717, 0.024999619, -17.017313)
|
||||
[node name="PrimitiveWall2" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.3277044, -0.36657315, -5.2404413)
|
||||
mesh = ExtResource("17_26j3w")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveWindow" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, -13.528359, 0.024998665, -21.07315)
|
||||
[node name="PrimitiveWindow" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, -9.775347, -0.3665741, -9.296279)
|
||||
mesh = ExtResource("18_kjqju")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="TableMediumDecorated" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -14)
|
||||
[node name="TableMediumDecorated" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.2469873, -0.39157277, -2.2231283)
|
||||
mesh = ExtResource("19_fypju")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveWall3" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14, 0, -17)
|
||||
[node name="PrimitiveWall3" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.246987, -0.39157277, -5.2231283)
|
||||
mesh = ExtResource("17_26j3w")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="WallDoorway" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-0.07428251, 0, -0.99723727, 0, 1, 0, 0.99723727, 0, -0.07428251, -15.431596, 0.024999619, -19.047731)
|
||||
[node name="WallDoorway" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(-0.07428251, 0, -0.99723727, 0, 1, 0, 0.99723727, 0, -0.07428251, -11.678583, -0.36657315, -7.2708597)
|
||||
mesh = ExtResource("20_j11kn")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveFloor" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.287403, 3.0981884, -19.006363)
|
||||
[node name="PrimitiveFloor" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5343904, 2.7066157, -7.229491)
|
||||
mesh = ExtResource("21_unwmg")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="PrimitiveFloor2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13.469146, 3.0981884, -19.006363)
|
||||
[node name="PrimitiveFloor2" type="MeshInstance3D" parent="Env"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.716133, 2.7066157, -7.229491)
|
||||
mesh = ExtResource("21_unwmg")
|
||||
skeleton = NodePath("../../root/@EditorNode@20441/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10870/@VSplitContainer@10515/@HSplitContainer@10517/@HSplitContainer@10519/@Control@10520/@SubViewportContainer@10521/@SubViewport@10522/Gym")
|
||||
|
||||
[node name="dummy" parent="Env" instance=ExtResource("2_40027")]
|
||||
transform = Transform3D(0.232937, 0, -0.869333, 0, 0.9, 0, 0.869333, 0, 0.232937, 5.3893027, -0.39157277, 17.058931)
|
||||
|
||||
[node name="CSGMesh3D" type="CSGMesh3D" parent="Env"]
|
||||
transform = Transform3D(5.015, 0, 0, 0, 1, 0, 0, 0, 6.05, 3.7530127, -0.5165728, 11.776872)
|
||||
material_override = ExtResource("1_b53sv")
|
||||
use_collision = true
|
||||
mesh = SubResource("BoxMesh_afokq")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("22_qx0ut")
|
||||
volume_db = -20.0
|
||||
autoplay = true
|
||||
parameters/looping = true
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://qbceryqqfoum"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://qbceryqqfoum"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bsnc11pwypbny" path="res://packs/Kaykit-Proto/obj/prototypebits_texture.png" id="1_6oykk"]
|
||||
[ext_resource type="Script" uid="uid://b8p60y4eo8w2n" path="res://core/scripts/entity.gd" id="1_w0ui8"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dgyh6f2qlgeet" path="res://packs/Kaykit-Proto/obj/Dummy_Base.obj" id="2_4axxu"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://bt6xf5p7f1u2h" path="res://packs/Kaykit-Proto/obj/Dummy_Base_Dummy_Body.obj" id="3_8cgx2"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://mxsum6t20wyy" path="res://packs/Kaykit-Proto/obj/Dummy_Base_Dummy_Body_Dummy_ArmLeft.obj" id="4_nslv2"]
|
||||
|
@ -8,11 +9,25 @@
|
|||
[ext_resource type="ArrayMesh" uid="uid://6h2lg4h0y0ea" path="res://packs/Kaykit-Proto/obj/Dummy_Base_Dummy_Body_Dummy_Head.obj" id="6_5dfyn"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://b7cky6rmvhxl8" path="res://packs/Kaykit-Proto/obj/Dummy_Base_Dummy_Body_Dummy_Target.obj" id="7_d3okb"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_w0ui8"]
|
||||
size = Vector3(1, 2, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_th4ew"]
|
||||
albedo_texture = ExtResource("1_6oykk")
|
||||
|
||||
[node name="dummy" type="Node3D"]
|
||||
transform = Transform3D(0.9, 0, 0, 0, 0.9, 0, 0, 0, 0.9, 0, 0, 0)
|
||||
script = ExtResource("1_w0ui8")
|
||||
metadata/_custom_type_script = "uid://b8p60y4eo8w2n"
|
||||
|
||||
[node name="SelectionArea" type="Area3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0267677, 0)
|
||||
collision_layer = 32768
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="SelectionArea"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.11408532, 0)
|
||||
shape = SubResource("BoxShape3D_w0ui8")
|
||||
|
||||
[node name="DummyBase" type="MeshInstance3D" parent="."]
|
||||
material_override = SubResource("StandardMaterial3D_th4ew")
|
||||
|
|
44
UI/player interface.tscn
Normal file
44
UI/player interface.tscn
Normal file
|
@ -0,0 +1,44 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c7hu51a2omayl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c6xp0y6y0gnjt" path="res://core/scripts/player_interface.gd" id="1_nbn0p"]
|
||||
[ext_resource type="Texture2D" uid="uid://dtnvfhpg0fmlk" path="res://packs/Kenney-cursors/Outline/steps.svg" id="1_ur0rc"]
|
||||
[ext_resource type="Script" uid="uid://bxo7f7f1th34m" path="res://core/scripts/player_selection_manager.gd" id="3_u7fvt"]
|
||||
[ext_resource type="StyleBox" uid="uid://nn1eq5h68x1b" path="res://ui/selection_rect_style.tres" id="4_u7fvt"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_ur0rc"]
|
||||
|
||||
[node name="PlayerInterface" type="Control"]
|
||||
modulate = Color(0.6745098, 1, 1, 1)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(960, 540)
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_nbn0p")
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 35.0
|
||||
offset_top = -62.559998
|
||||
offset_right = 169.0
|
||||
offset_bottom = -22.559937
|
||||
grow_vertical = 0
|
||||
pivot_offset = Vector2(0, 40)
|
||||
theme = SubResource("Theme_ur0rc")
|
||||
text = "Test Button"
|
||||
icon = ExtResource("1_ur0rc")
|
||||
|
||||
[node name="SelectionManager" type="Control" parent="."]
|
||||
process_mode = 3
|
||||
process_priority = -1
|
||||
anchors_preset = 0
|
||||
mouse_filter = 2
|
||||
script = ExtResource("3_u7fvt")
|
||||
rect_style = ExtResource("4_u7fvt")
|
13
UI/selection_rect_style.tres
Normal file
13
UI/selection_rect_style.tres
Normal file
|
@ -0,0 +1,13 @@
|
|||
[gd_resource type="StyleBoxFlat" format=3 uid="uid://nn1eq5h68x1b"]
|
||||
|
||||
[resource]
|
||||
bg_color = Color(0, 0.7176471, 0.38039216, 0.09411765)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 1, 0, 0.49019608)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
full_path=false
|
||||
sort_alphabetical=true
|
||||
script_colour=Color(0.8, 0.80784315, 0.827451, 1)
|
||||
script_colour=Color(0.8, 0.807843, 0.827451, 1)
|
||||
ignore_paths=Array[String]([])
|
||||
|
||||
[patterns]
|
||||
|
||||
patterns=[["\\bTODO\\b", Color(0.5882353, 0.94509804, 0.6784314, 1), 0], ["\\bHACK\\b", Color(0.8352941, 0.7372549, 0.4392157, 1), 0], ["\\bFIXME\\b", Color(0.8352941, 0.4392157, 0.4392157, 1), 0]]
|
||||
patterns=[["\\bTODO\\b", Color(0.588235, 0.945098, 0.678431, 1), 0], ["\\bHACK\\b", Color(0.835294, 0.737255, 0.439216, 1), 0], ["\\bFIXME\\b", Color(0.835294, 0.439216, 0.439216, 1), 0], ["\\bBUG\\b", Color(0.9607843, 0.48682597, 0.4509804, 1), 0]]
|
||||
|
||||
[config]
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://djj1fc8qm10t6"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://djj1fc8qm10t6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c23s1syo7wjm8" path="res://core/scripts/player.gd" id="1_e571r"]
|
||||
[ext_resource type="Script" uid="uid://d2f3kt810ncsa" path="res://core/scripts/cursor_behaviour.gd" id="2_ipmo0"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7hu51a2omayl" path="res://ui/player interface.tscn" id="3_8c7bm"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e571r"]
|
||||
blend_mode = 1
|
||||
|
@ -36,4 +37,6 @@ mesh = SubResource("SphereMesh_ipmo0")
|
|||
[node name="CursorComponent" type="Node" parent="."]
|
||||
script = ExtResource("2_ipmo0")
|
||||
|
||||
[node name="PlayerInterface" parent="." instance=ExtResource("3_8c7bm")]
|
||||
|
||||
[connection signal="cursor_edge_scrolling" from="." to="CursorComponent" method="_on_player_root_cursor_edge_scrolling"]
|
||||
|
|
75
core/scripts/entity.gd
Normal file
75
core/scripts/entity.gd
Normal file
|
@ -0,0 +1,75 @@
|
|||
@icon('uid://br8ndde8qty32')
|
||||
extends Node3D
|
||||
class_name Entity
|
||||
|
||||
|
||||
## Base entity class for everything not static.
|
||||
##
|
||||
## Should be the parent of every units, buildings,
|
||||
## npc, loot, and everything that the player can interact with
|
||||
##
|
||||
## Is a node, because we want to deactivate rendering when out of camera and only simulating the world.
|
||||
## Plus, only the entity is replicated in multiplayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group('selectable-entity')
|
||||
|
||||
|
||||
## Check if the entity is contained in the [Rect2] [param selection_box] of the player.
|
||||
## Need the [Camera3D] of the player to work
|
||||
func is_in_selection(selection_box:Rect2,player_cam:Camera3D) -> bool:
|
||||
if selection_box.size: # Checking if size is 0,0
|
||||
var p = player_cam.unproject_position(global_position)
|
||||
return selection_box.has_point(p)
|
||||
|
||||
return false
|
||||
|
||||
|
||||
## Calculate the node bouding box
|
||||
## @deprecated
|
||||
func get_entity_aabb(node: Node3D = self, ignore_top_level: bool = true, bounds_transform: Transform3D = Transform3D()) -> AABB:
|
||||
if node == null: return AABB()
|
||||
var box: AABB
|
||||
var node_transform: Transform3D
|
||||
|
||||
# we are going down the child chain, we want the aabb of each subsequent node to be on the same axis as the parent
|
||||
if bounds_transform.is_equal_approx(Transform3D()):
|
||||
node_transform = node.global_transform
|
||||
else:
|
||||
node_transform = bounds_transform
|
||||
|
||||
# no more nodes. return default aabb
|
||||
if node == null:
|
||||
return AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4))
|
||||
|
||||
# makes sure the transform we get isn't distorted
|
||||
var top_xform : Transform3D = node_transform.affine_inverse() * node.global_transform
|
||||
|
||||
# convert the node into visualinstance3D to access get_aabb() function.
|
||||
var visual_result : VisualInstance3D = node as VisualInstance3D
|
||||
if visual_result != null:
|
||||
box = visual_result.get_aabb()
|
||||
else:
|
||||
box = AABB()
|
||||
|
||||
# xforms the transform with the box aabb for proper alignment I believe?
|
||||
box = top_xform * box
|
||||
# recursion
|
||||
for i : int in node.get_child_count():
|
||||
var child : Node3D = node.get_child(i) as Node3D
|
||||
if child && !(ignore_top_level && child.top_level):
|
||||
var child_box : AABB = get_entity_aabb(child, ignore_top_level, transform)
|
||||
box = box.merge(child_box)
|
||||
|
||||
return box
|
||||
|
||||
|
||||
func select():
|
||||
add_to_group('selected-by-'+str(get_tree().get_multiplayer().get_unique_id()))
|
||||
print(self.name," selected"," by "+str(get_tree().get_multiplayer().get_unique_id()))
|
||||
|
||||
|
||||
func deselect():
|
||||
remove_from_group('selected-by-'+str(get_tree().get_multiplayer().get_unique_id()))
|
||||
print(self.name," unselected")
|
1
core/scripts/entity.gd.uid
Normal file
1
core/scripts/entity.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b8p60y4eo8w2n
|
|
@ -22,7 +22,10 @@ var zoom_disabled:bool = false
|
|||
var edge_scroll_disabled:bool = ProjectSettings.get_setting("game/controls/edge_scrolling_disabled",false)
|
||||
var invert_rotation_x:bool = ProjectSettings.get_setting("game/controls/invert_cam_rotation_x",false)
|
||||
var invert_rotation_y:bool = ProjectSettings.get_setting("game/controls/invert_cam_rotation_y",false)
|
||||
var default_mouse_mode:= Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
var rotation_mode:bool = false
|
||||
|
||||
@export_range(0,1,0.01) var rotation_speed_x:float = ProjectSettings.get_setting("game/controls/cam_rotation_speed_x",0.5)
|
||||
@export_range(0,1,0.01) var rotation_speed_y:float = ProjectSettings.get_setting("game/controls/cam_rotation_speed_y",0.5)
|
||||
|
||||
|
@ -36,7 +39,7 @@ const quit_screen_load = preload("uid://hne6njnc23ur")
|
|||
|
||||
|
||||
func _ready():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CONFINED # Maybe should be moved in a better script
|
||||
Input.mouse_mode = default_mouse_mode # Maybe should be moved in a better script
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
@ -47,15 +50,16 @@ func _process(delta: float) -> void:
|
|||
|
||||
|
||||
func _notification(what: int):
|
||||
if edge_scroll_disabled:return
|
||||
if what == NOTIFICATION_APPLICATION_FOCUS_OUT:
|
||||
print("focus out!")
|
||||
#get_tree().paused = true
|
||||
edge_scroll_disabled = true
|
||||
#edge_scroll_disabled = true
|
||||
move_disabled = true
|
||||
if what == NOTIFICATION_APPLICATION_FOCUS_IN:
|
||||
print("focus in!")
|
||||
#get_tree().paused = false
|
||||
edge_scroll_disabled = false
|
||||
#edge_scroll_disabled = false
|
||||
move_disabled = false
|
||||
if what == NOTIFICATION_WM_MOUSE_ENTER:
|
||||
print("focus in!")
|
||||
|
@ -81,7 +85,7 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
|
||||
if event.is_action_released("rotation_mode"):
|
||||
rotation_mode = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
|
||||
Input.mouse_mode = default_mouse_mode
|
||||
if event.is_action_pressed("DEBUG-quit"):
|
||||
quit_game()
|
||||
|
||||
|
|
11
core/scripts/player_interface.gd
Normal file
11
core/scripts/player_interface.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
1
core/scripts/player_interface.gd.uid
Normal file
1
core/scripts/player_interface.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://c6xp0y6y0gnjt
|
129
core/scripts/player_selection_manager.gd
Normal file
129
core/scripts/player_selection_manager.gd
Normal file
|
@ -0,0 +1,129 @@
|
|||
extends Control
|
||||
class_name SelectionManager
|
||||
|
||||
var draw_selection := false
|
||||
var drag_start: Vector2
|
||||
var select_box: Rect2
|
||||
var perform_selection := false # Flag to trigger selection in _physics_process
|
||||
|
||||
@onready var box_color: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color", Color("#00ff0066"))
|
||||
@onready var box_color_outline: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color_outline", Color("#00ff00"))
|
||||
@onready var optimized_rect: bool = ProjectSettings.get_setting("game/interface/optimized_rectangle", false)
|
||||
@export var rect_style: StyleBoxFlat
|
||||
@onready var cam = get_viewport().get_camera_3d()
|
||||
@onready var hovercontrol:Button = $"../Button"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if optimized_rect:return
|
||||
|
||||
|
||||
func _unhandled_input(e: InputEvent) -> void:
|
||||
if e is InputEventMouseButton and e.button_index == MOUSE_BUTTON_LEFT:
|
||||
if e.pressed:
|
||||
draw_selection = true
|
||||
drag_start = e.position
|
||||
else:
|
||||
# When button is released
|
||||
draw_selection = false
|
||||
if drag_start.is_equal_approx(e.position):
|
||||
# Single click: set a zero-sized selection box
|
||||
select_box = Rect2(e.position, Vector2.ZERO)
|
||||
print("one click")
|
||||
else:
|
||||
# Drag: calculate the final selection box
|
||||
var x_min = min(drag_start.x, e.position.x)
|
||||
var y_min = min(drag_start.y, e.position.y)
|
||||
select_box = Rect2(x_min, y_min,
|
||||
max(drag_start.x, e.position.x) - x_min,
|
||||
max(drag_start.y, e.position.y) - y_min)
|
||||
|
||||
perform_selection = true # Trigger selection in _physics_process
|
||||
queue_redraw()
|
||||
elif draw_selection and e is InputEventMouseMotion:
|
||||
# Update selection box for drawing during drag
|
||||
var x_min = min(drag_start.x, e.position.x)
|
||||
var y_min = min(drag_start.y, e.position.y)
|
||||
select_box = Rect2(x_min, y_min,
|
||||
max(drag_start.x, e.position.x) - x_min,
|
||||
max(drag_start.y, e.position.y) - y_min)
|
||||
|
||||
queue_redraw()
|
||||
if !draw_selection and e is InputEventMouseMotion:
|
||||
check_hover()
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if perform_selection:
|
||||
update_selected_units()
|
||||
perform_selection = false
|
||||
|
||||
|
||||
func check_hover():
|
||||
# TODO: Hovering and display names
|
||||
var selected = get_selected()
|
||||
if selected.size() > 0:
|
||||
hovercontrol.text = selected[0].name
|
||||
else:
|
||||
hovercontrol.text = ""
|
||||
|
||||
hovercontrol.queue_redraw()
|
||||
pass
|
||||
|
||||
|
||||
func get_selected() -> Array[Entity]:
|
||||
var selected: Array[Node] = get_tree().get_nodes_in_group('selected-by-'+str(get_tree().get_multiplayer().get_unique_id()))
|
||||
var selected_entity: Array[Entity]
|
||||
selected_entity.assign(selected)
|
||||
return selected_entity
|
||||
|
||||
|
||||
## [param collision_mask] is 32768 by default, so the collision channel 16
|
||||
func check_raycast(mouse_pos: Vector2, collision_mask: int = 32768) -> Dictionary:
|
||||
var from = cam.project_ray_origin(mouse_pos)
|
||||
var to = from + cam.project_ray_normal(mouse_pos) * 1000 # Magic number
|
||||
var query = PhysicsRayQueryParameters3D.create(from,to,collision_mask)
|
||||
query.collide_with_areas = true
|
||||
query.collide_with_bodies = false
|
||||
var space_state = cam.get_world_3d().direct_space_state
|
||||
#DebugTools.DrawLine(from,to,25.0)
|
||||
return space_state.intersect_ray(query)
|
||||
|
||||
|
||||
func deselect_all() -> void:
|
||||
var selected = get_selected()
|
||||
for entity:Entity in selected:
|
||||
entity.deselect()
|
||||
|
||||
|
||||
func update_selected_units() -> void:
|
||||
var units_array = get_tree().get_nodes_in_group("selectable-entity")
|
||||
var raycast = {}
|
||||
# Only perform raycast if it's a single click (zero-sized select_box)
|
||||
if select_box.size == Vector2.ZERO:
|
||||
raycast = check_raycast(select_box.position,)
|
||||
if raycast and raycast.collider:
|
||||
# select entity under mouse
|
||||
# maybe can be extracted from hover instead?
|
||||
var entity = raycast.collider.get_parent()
|
||||
deselect_all()
|
||||
entity.select()
|
||||
# BUG: Deselect previous selection
|
||||
return
|
||||
for entity: Entity in units_array:
|
||||
# TODO: Optimize by searching only in spawned chunks
|
||||
# select entities within the selection/draggin box
|
||||
if entity.is_in_selection(select_box, cam):
|
||||
entity.select()
|
||||
else:
|
||||
entity.deselect()
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
if not (draw_selection or perform_selection):return
|
||||
if select_box and rect_style:
|
||||
if optimized_rect:
|
||||
draw_rect(select_box,box_color)
|
||||
draw_rect(select_box,box_color_outline,false,2.0,true)
|
||||
elif rect_style:
|
||||
draw_style_box(rect_style,select_box)
|
1
core/scripts/player_selection_manager.gd.uid
Normal file
1
core/scripts/player_selection_manager.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://bxo7f7f1th34m
|
|
@ -1,8 +1,117 @@
|
|||
extends Control
|
||||
@export var MouseOverlay: Node
|
||||
@onready var Cam = get_viewport().get_camera_3d()
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
if !OS.is_debug_build():
|
||||
self.queue_free()
|
||||
|
||||
|
||||
class Line:
|
||||
var Start:Vector3
|
||||
var End:Vector3
|
||||
var LineColor:Color
|
||||
var time
|
||||
|
||||
|
||||
func _init(Start:Vector3, End:Vector3, LineColor, time):
|
||||
self.Start = Start
|
||||
self.End = End
|
||||
self.LineColor = LineColor
|
||||
self.time = time
|
||||
|
||||
var Lines = []
|
||||
var RemovedLine = false
|
||||
|
||||
|
||||
func _process(delta):
|
||||
for i in range(len(Lines)):
|
||||
Lines[i].time -= delta
|
||||
|
||||
if (len(Lines) > 0 || RemovedLine):
|
||||
queue_redraw() #Calls _draw
|
||||
RemovedLine = false
|
||||
|
||||
|
||||
func _draw():
|
||||
|
||||
for i in range(len(Lines)):
|
||||
if Lines[i].Start.length() == 0:return
|
||||
var ScreenPointStart = Cam.unproject_position(Lines[i].Start)
|
||||
var ScreenPointEnd = Cam.unproject_position(Lines[i].End)
|
||||
|
||||
#Dont draw line if either start or end is considered behind the camera
|
||||
#this causes the line to not be drawn sometimes but avoids a bug where the
|
||||
#line is drawn incorrectly
|
||||
if (Cam.is_position_behind(Lines[i].Start) ||
|
||||
Cam.is_position_behind(Lines[i].End)):
|
||||
continue
|
||||
|
||||
draw_line(ScreenPointStart, ScreenPointEnd, Lines[i].LineColor)
|
||||
|
||||
#Remove lines that have timed out
|
||||
var i = Lines.size() - 1
|
||||
while (i >= 0):
|
||||
if (Lines[i].time < 0.0):
|
||||
Lines.remove_at(i)
|
||||
RemovedLine = true
|
||||
|
||||
i -= 1
|
||||
|
||||
|
||||
## start point, end point, color, time (optional)
|
||||
func DrawLine(Start, End, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||
Lines.append(Line.new(Start, End, LineColor, time))
|
||||
|
||||
|
||||
## start point, velocity (direction and magnitude), color, time (optional)
|
||||
func DrawRay(Start, Ray, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||
Lines.append(Line.new(Start, Start + Ray, LineColor, time))
|
||||
|
||||
|
||||
## start point, half extents (float), color, time (optional)
|
||||
func DrawCube(Center, HalfExtents, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||
#Start at the 'top left'
|
||||
var LinePointStart = Center
|
||||
LinePointStart.x -= HalfExtents
|
||||
LinePointStart.y += HalfExtents
|
||||
LinePointStart.z -= HalfExtents
|
||||
|
||||
#Draw top square
|
||||
var LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
|
||||
#Draw bottom square
|
||||
LinePointStart = LinePointEnd + Vector3(0, -HalfExtents * 2.0, 0)
|
||||
LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
LinePointStart = LinePointEnd
|
||||
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
||||
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||
|
||||
#Draw vertical lines
|
||||
LinePointStart = LinePointEnd
|
||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||
LinePointStart += Vector3(0, 0, HalfExtents * 2.0)
|
||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||
LinePointStart += Vector3(HalfExtents * 2.0, 0, 0)
|
||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||
LinePointStart += Vector3(0, 0, -HalfExtents * 2.0)
|
||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||
|
|
|
@ -25,6 +25,8 @@ grow_vertical = 2
|
|||
pivot_offset = Vector2(960, 540)
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
mouse_behavior_recursive = 2
|
||||
script = ExtResource("1_xqln8")
|
||||
MouseOverlay = NodePath("MouseCursorOverlay")
|
||||
|
||||
|
@ -36,12 +38,15 @@ offset_right = 32.0
|
|||
offset_bottom = 32.0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_xqln8")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MouseCursorOverlay/PanelContainer"]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
stretch_mode = 2
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HotSpotMarker" type="ColorRect" parent="MouseCursorOverlay/PanelContainer/TextureRect"]
|
||||
custom_minimum_size = Vector2(1, 1)
|
||||
|
@ -50,3 +55,4 @@ offset_right = 4.0
|
|||
offset_bottom = 4.0
|
||||
pivot_offset = Vector2(2, 2)
|
||||
color = Color(1, 0.3137255, 1, 1)
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
|
1
dev/icon_entity.svg
Normal file
1
dev/icon_entity.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill="#fff" d="m4.1 11q0-0.3 0.3-0.5 0.2-0.2 0.6-0.2h0.2v-4.5l-1.4-1.4q-0.1-0.1-0.1-0.3v-2.7q0-0.1 0.1-0.3 0.1-0.1 0.3-0.1h1.3q0.2 0 0.3 0.1 0.2 0.2 0.2 0.3v1.4h0.8v-1.4q0-0.1 0.2-0.3 0.1-0.1 0.3-0.1h1.3q0.2 0 0.3 0.1 0.2 0.2 0.2 0.3v1.4h0.8v-1.4q0-0.1 0.2-0.3 0.1-0.1 0.3-0.1h1.3q0.2 0 0.3 0.1 0.1 0.2 0.1 0.3v2.7q0 0.2-0.1 0.3l-1.4 1.4v4.5h0.2q0.4 0 0.6 0.2 0.3 0.2 0.3 0.5v0.8h-7.5zm7.7 3.2h-7.9q-0.4 0-0.6-0.3-0.3-0.2-0.3-0.6v-0.5q0-0.3 0.3-0.5v-0.1h9.1v0.1q0.3 0.2 0.3 0.5v0.5q0 0.4-0.3 0.6-0.2 0.3-0.6 0.3z"/><!---Created/distributed by Kenney (www.kenney.nl) - License: (Creative Commons Zero, CC0) - This content is free to use in personal, educational and commercial projects.---> </svg>
|
After Width: | Height: | Size: 799 B |
20
dev/icon_entity.svg.import
Normal file
20
dev/icon_entity.svg.import
Normal file
|
@ -0,0 +1,20 @@
|
|||
[remap]
|
||||
|
||||
importer="svg"
|
||||
type="SVGTexture"
|
||||
uid="uid://br8ndde8qty32"
|
||||
path="res://.godot/imported/icon_entity.svg-01905eaa18586f65865a03cf66ea85d7.svgtex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://dev/icon_entity.svg"
|
||||
dest_files=["res://.godot/imported/icon_entity.svg-01905eaa18586f65865a03cf66ea85d7.svgtex"]
|
||||
|
||||
[params]
|
||||
|
||||
base_scale=1.0
|
||||
saturation=1.0
|
||||
color_map={
|
||||
Color(1, 1, 1, 1): Color(1, 0.33333334, 0.33333334, 1)
|
||||
}
|
||||
compress=false
|
|
@ -50,6 +50,7 @@ controls/cam_rotation_speed_x=0.2
|
|||
controls/cam_rotation_speed_y=0.2
|
||||
controls/invert_cam_rotation_x=false
|
||||
controls/invert_cam_rotation_y=true
|
||||
controls/edge_scrolling_disabled=true
|
||||
|
||||
[input]
|
||||
|
||||
|
@ -93,6 +94,7 @@ rotation_mode={
|
|||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(98, 12),"global_position":Vector2(107, 60),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(71, 18),"global_position":Vector2(80, 64),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
DEBUG-quit={
|
||||
|
@ -101,6 +103,17 @@ DEBUG-quit={
|
|||
]
|
||||
}
|
||||
|
||||
[internationalization]
|
||||
|
||||
locale/locale_filter_mode=1
|
||||
locale/language_filter=["en", "fr"]
|
||||
locale/country_filter=["FR"]
|
||||
|
||||
[layer_names]
|
||||
|
||||
3d_physics/layer_1="Static"
|
||||
3d_physics/layer_16="Selection"
|
||||
|
||||
[physics]
|
||||
|
||||
3d/run_on_separate_thread=true
|
||||
|
@ -108,4 +121,5 @@ DEBUG-quit={
|
|||
|
||||
[rendering]
|
||||
|
||||
global_illumination/voxel_gi/quality=1
|
||||
anti_aliasing/quality/msaa_3d=2
|
||||
|
|
Loading…
Reference in a new issue