add pipe spawner thing
This commit is contained in:
parent
7af091a2ce
commit
55c988dddc
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://oyvhcwq60v2"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://oyvhcwq60v2"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ingame/ingame.gd" id="1_akuuj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cs8c570bxh6u" path="res://src/ingame/player.tscn" id="2_w1gjc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bysgtksvovyur" path="res://src/ingame/sprout.tscn" id="3_2xvqq"]
|
||||
[ext_resource type="PackedScene" uid="uid://enukqx63dh2l" path="res://src/ingame/pipe.tscn" id="4_mltw3"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_l0cfx"]
|
||||
size = Vector3(8, 0.2, 17)
|
||||
@ -257,5 +258,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.39598, 1.39617, -1.62022)
|
||||
[node name="Sprout15" parent="Plants" instance=ExtResource("3_2xvqq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.59598, 1.39617, -1.62022)
|
||||
|
||||
[node name="Pipe" parent="." instance=ExtResource("4_mltw3")]
|
||||
transform = Transform3D(0.999929, -0.0119378, 0, -0.0119378, -0.999929, 8.74228e-08, -1.04363e-09, -8.74165e-08, -1, -7, 6.79123, 7)
|
||||
|
||||
[connection signal="text_submitted" from="UI/ChatPanel/ChatInput" to="." method="_on_chat_message_submitted"]
|
||||
[connection signal="pressed" from="UI/ChatPanel/ChatSendButton" to="." method="_on_chat_message_submitted"]
|
||||
|
28
src/ingame/pipe.gd
Normal file
28
src/ingame/pipe.gd
Normal file
@ -0,0 +1,28 @@
|
||||
extends Node3D
|
||||
|
||||
@export var _projectile_scene: PackedScene
|
||||
@export var _projectile_holder: Node
|
||||
@export var _production_timer: Timer
|
||||
|
||||
var _bomb_counter: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_multiplayer_authority(1)
|
||||
|
||||
|
||||
@rpc("authority", "call_local", "reliable")
|
||||
func _drop_water() -> void:
|
||||
var new_projectile: Node3D = _projectile_scene.instantiate()
|
||||
new_projectile.name = "WaterBomb" + str(_bomb_counter)
|
||||
_projectile_holder.add_child(new_projectile, true)
|
||||
new_projectile.set_multiplayer_authority(1)
|
||||
new_projectile.body.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
new_projectile.set_global_pos(global_position)
|
||||
_bomb_counter += 1
|
||||
|
||||
|
||||
func _on_drop_timer_timeout() -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
_drop_water.rpc()
|
32
src/ingame/pipe.tscn
Normal file
32
src/ingame/pipe.tscn
Normal file
@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://enukqx63dh2l"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/ingame/pipe.gd" id="1_ckmpn"]
|
||||
[ext_resource type="PackedScene" uid="uid://tdsbo3e5ic86" path="res://src/ingame/water_bomb.tscn" id="2_3sfu2"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bgwg2"]
|
||||
cull_mode = 2
|
||||
albedo_color = Color(0.0313726, 1, 1, 1)
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_g3bb5"]
|
||||
lightmap_size_hint = Vector2i(12, 12)
|
||||
material = SubResource("StandardMaterial3D_bgwg2")
|
||||
|
||||
[node name="Pipe" type="Node3D" node_paths=PackedStringArray("_projectile_holder", "_production_timer")]
|
||||
script = ExtResource("1_ckmpn")
|
||||
_projectile_scene = ExtResource("2_3sfu2")
|
||||
_projectile_holder = NodePath("ProjectileHolder")
|
||||
_production_timer = NodePath("DropTimer")
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
spawn_path = NodePath("../ProjectileHolder")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("PlaneMesh_g3bb5")
|
||||
|
||||
[node name="ProjectileHolder" type="Node" parent="."]
|
||||
|
||||
[node name="DropTimer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="DropTimer" to="." method="_on_drop_timer_timeout"]
|
@ -43,6 +43,7 @@ func _on_body_entered(p_body: Node3D) -> void:
|
||||
|
||||
is_dead = true
|
||||
_model.hide()
|
||||
if is_multiplayer_authority():
|
||||
_disable_body.rpc()
|
||||
|
||||
await _splash_small_sound.finished
|
||||
|
Loading…
Reference in New Issue
Block a user