sprout picking
This commit is contained in:
parent
21ba71373c
commit
cb07298c8a
@ -3,6 +3,7 @@ extends Node3D
|
|||||||
@export var _need_water_drop: Sprite3D
|
@export var _need_water_drop: Sprite3D
|
||||||
@export var _production_timer: Timer
|
@export var _production_timer: Timer
|
||||||
@export var _mesh: MeshInstance3D
|
@export var _mesh: MeshInstance3D
|
||||||
|
@export var _area: Area3D
|
||||||
|
|
||||||
var needs_water := true
|
var needs_water := true
|
||||||
var stage: int = 1
|
var stage: int = 1
|
||||||
@ -27,6 +28,8 @@ func _water_shared(sender_id: int) -> void:
|
|||||||
_mesh.material_override.set("shader_parameter/albedo_texture", load("res://assets/sprout%s.png" % stage))
|
_mesh.material_override.set("shader_parameter/albedo_texture", load("res://assets/sprout%s.png" % stage))
|
||||||
if sender_id != 0:
|
if sender_id != 0:
|
||||||
GameState.fetch().player_data[sender_id].chain_water_combo(1)
|
GameState.fetch().player_data[sender_id].chain_water_combo(1)
|
||||||
|
if stage == final_stage:
|
||||||
|
_area.collision_layer |= 1 << 4
|
||||||
|
|
||||||
|
|
||||||
@rpc("any_peer", "call_local", "reliable")
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
@ -38,3 +41,20 @@ func water(sender_id: int) -> void:
|
|||||||
if stage != final_stage:
|
if stage != final_stage:
|
||||||
needs_water = false
|
needs_water = false
|
||||||
_production_timer.start()
|
_production_timer.start()
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func get_picked_up() -> void:
|
||||||
|
stage = 1
|
||||||
|
_mesh.material_override.set("shader_parameter/albedo_texture", load("res://assets/sprout%s.png" % stage))
|
||||||
|
_area.collision_layer ^= 1 << 4
|
||||||
|
needs_water = true
|
||||||
|
_need_water_drop.show()
|
||||||
|
|
||||||
|
|
||||||
|
func mark_interactive() -> void:
|
||||||
|
_mesh.material_override.set("shader_parameter/outline_color", Color.WHITE)
|
||||||
|
|
||||||
|
|
||||||
|
func mark_non_interactive() -> void:
|
||||||
|
_mesh.material_override.set("shader_parameter/outline_color", Color.BLACK)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://bysgtksvovyur"]
|
[gd_scene load_steps=10 format=3 uid="uid://bysgtksvovyur"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/ingame/sprout.gd" id="1_snma1"]
|
[ext_resource type="Script" path="res://src/ingame/sprout.gd" id="1_snma1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d35y5ckne72qe" path="res://assets/sprout1.png" id="2_ipgad"]
|
[ext_resource type="Texture2D" uid="uid://d35y5ckne72qe" path="res://assets/sprout1.png" id="2_ipgad"]
|
||||||
[ext_resource type="Shader" path="res://scenes/interactivity_outline2.gdshader" id="2_oa2it"]
|
[ext_resource type="Shader" path="res://scenes/interactivity_outline2.gdshader" id="2_oa2it"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cwbl0r1e26eja" path="res://assets/drop.png" id="3_kghdv"]
|
[ext_resource type="Texture2D" uid="uid://cwbl0r1e26eja" path="res://assets/drop.png" id="3_kghdv"]
|
||||||
|
[ext_resource type="Script" path="res://src/lib/item_component.gd" id="4_w5b5s"]
|
||||||
|
|
||||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_rs2qp"]
|
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_rs2qp"]
|
||||||
properties/0/path = NodePath(".:needs_water")
|
properties/0/path = NodePath(".:needs_water")
|
||||||
@ -28,12 +29,13 @@ size = Vector2(0.5, 1)
|
|||||||
radius = 0.3
|
radius = 0.3
|
||||||
height = 0.8
|
height = 0.8
|
||||||
|
|
||||||
[node name="Sprout" type="Node3D" node_paths=PackedStringArray("_need_water_drop", "_production_timer", "_mesh")]
|
[node name="Sprout" type="Node3D" node_paths=PackedStringArray("_need_water_drop", "_production_timer", "_mesh", "_area")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00401986, -0.00383317, 0.00119042)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00401986, -0.00383317, 0.00119042)
|
||||||
script = ExtResource("1_snma1")
|
script = ExtResource("1_snma1")
|
||||||
_need_water_drop = NodePath("NeedWaterDrop")
|
_need_water_drop = NodePath("NeedWaterDrop")
|
||||||
_production_timer = NodePath("ProductionTimer")
|
_production_timer = NodePath("ProductionTimer")
|
||||||
_mesh = NodePath("Mesh")
|
_mesh = NodePath("Mesh")
|
||||||
|
_area = NodePath("Area3D")
|
||||||
|
|
||||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||||
replication_config = SubResource("SceneReplicationConfig_rs2qp")
|
replication_config = SubResource("SceneReplicationConfig_rs2qp")
|
||||||
@ -63,4 +65,8 @@ shape = SubResource("CapsuleShape3D_cwbye")
|
|||||||
wait_time = 5.0
|
wait_time = 5.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="Harvest" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_w5b5s")
|
||||||
|
id = "sprout"
|
||||||
|
|
||||||
[connection signal="timeout" from="ProductionTimer" to="." method="_on_production_timer_timeout"]
|
[connection signal="timeout" from="ProductionTimer" to="." method="_on_production_timer_timeout"]
|
||||||
|
Loading…
Reference in New Issue
Block a user