mirror of
https://github.com/Steffo99/pineapple-surf.git
synced 2024-11-21 23:34:21 +00:00
👩🏻🔧 Add check to only shoot peas on free slots
This commit is contained in:
parent
a9a0c76cd6
commit
56993e3d1d
5 changed files with 11 additions and 4 deletions
|
@ -32,8 +32,8 @@ script = ExtResource("2_jejoo")
|
||||||
|
|
||||||
[node name="Plant" type="Area3D" parent="."]
|
[node name="Plant" type="Area3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0.5)
|
||||||
collision_layer = 0
|
collision_layer = 16
|
||||||
collision_mask = 16
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="PlantableArea" type="CollisionShape3D" parent="Plant"]
|
[node name="PlantableArea" type="CollisionShape3D" parent="Plant"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
|
||||||
|
|
|
@ -25,6 +25,7 @@ mesh = SubResource("ArrayMesh_s0thi")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||||
|
collision_layer = 9
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
||||||
shape = SubResource("ConcavePolygonShape3D_0ox82")
|
shape = SubResource("ConcavePolygonShape3D_0ox82")
|
||||||
|
|
|
@ -24,6 +24,7 @@ mesh = SubResource("ArrayMesh_nmvk4")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||||
|
collision_layer = 9
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
||||||
shape = SubResource("ConcavePolygonShape3D_o3dws")
|
shape = SubResource("ConcavePolygonShape3D_o3dws")
|
||||||
|
|
|
@ -53,11 +53,14 @@ func shoot() -> void:
|
||||||
func try_placing_seed(ray: RayCast3D) -> bool:
|
func try_placing_seed(ray: RayCast3D) -> bool:
|
||||||
var point = ray.get_collision_point() as Vector3
|
var point = ray.get_collision_point() as Vector3
|
||||||
var normal = ray.get_collision_normal() as Vector3
|
var normal = ray.get_collision_normal() as Vector3
|
||||||
var obj = ray.get_collider() as Node3D
|
var coll = ray.get_collider() as CollisionObject3D
|
||||||
print(point, normal, obj.name)
|
|
||||||
if normal != Vector3(0,1,0):
|
if normal != Vector3(0,1,0):
|
||||||
print("Not horizontal, no plant for you :<")
|
print("Not horizontal, no plant for you :<")
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
if coll.collision_layer == 0b10000:
|
||||||
|
print("Colliding with planted seed, not planting again")
|
||||||
|
return false
|
||||||
|
|
||||||
var correct_point = point.floor()
|
var correct_point = point.floor()
|
||||||
var crop = croptile.instantiate() as CropTile
|
var crop = croptile.instantiate() as CropTile
|
||||||
|
|
|
@ -8,3 +8,5 @@ script = ExtResource("1_bl35a")
|
||||||
|
|
||||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||||
target_position = Vector3(1000, 0, 0)
|
target_position = Vector3(1000, 0, 0)
|
||||||
|
collision_mask = 24
|
||||||
|
collide_with_areas = true
|
||||||
|
|
Loading…
Reference in a new issue