Sites
This commit is contained in:
parent
bd16f01192
commit
6422ffb13c
13 changed files with 142 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://cqrh2cc7m2i7f"]
|
[gd_scene load_steps=17 format=3 uid="uid://cqrh2cc7m2i7f"]
|
||||||
|
|
||||||
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
|
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
|
||||||
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="4_pi0y7"]
|
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="4_pi0y7"]
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
[ext_resource type="Script" uid="uid://dncldab5y4yod" path="res://scripts/item_spawner.gd" id="6_61ure"]
|
[ext_resource type="Script" uid="uid://dncldab5y4yod" path="res://scripts/item_spawner.gd" id="6_61ure"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://scenes/weapons/droppable_bomb.tscn" id="6_bno23"]
|
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://scenes/weapons/droppable_bomb.tscn" id="6_bno23"]
|
||||||
[ext_resource type="Script" uid="uid://bqjv6l7hh0lix" path="res://scripts/multiplayer/spawn_system/dyn_objects_spawner.gd" id="6_oujx2"]
|
[ext_resource type="Script" uid="uid://bqjv6l7hh0lix" path="res://scripts/multiplayer/spawn_system/dyn_objects_spawner.gd" id="6_oujx2"]
|
||||||
|
[ext_resource type="Script" uid="uid://dk1gjbuydemmb" path="res://scripts/multiplayer/plant_site/plant_site.gd" id="8_oujx2"]
|
||||||
|
[ext_resource type="Script" uid="uid://b4cpux52fmx5o" path="res://scripts/multiplayer/plant_site/plant_deadzone.gd" id="9_1wlgq"]
|
||||||
|
[ext_resource type="Material" uid="uid://c6xa4phihtya2" path="res://materials/Redmat.tres" id="9_ysk2e"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_y6i55"]
|
[sub_resource type="Animation" id="Animation_y6i55"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
|
|
@ -22,6 +25,15 @@ _data = {
|
||||||
&"main": SubResource("Animation_pi0y7")
|
&"main": SubResource("Animation_pi0y7")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
|
||||||
|
size = Vector3(15.324341, 1.4935913, 21.381592)
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_1wlgq"]
|
||||||
|
size = Vector3(34.28946, 8.172485, 33.813843)
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_5uqia"]
|
||||||
|
size = Vector3(9.06966, 8.172485, 13.86731)
|
||||||
|
|
||||||
[node name="PrototypeScene" type="Node3D"]
|
[node name="PrototypeScene" type="Node3D"]
|
||||||
|
|
||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
|
@ -224,3 +236,43 @@ script = ExtResource("6_oujx2")
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.858309, 4.6431036, 12.873563)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.858309, 4.6431036, 12.873563)
|
||||||
script = ExtResource("6_61ure")
|
script = ExtResource("6_61ure")
|
||||||
item = ExtResource("6_bno23")
|
item = ExtResource("6_bno23")
|
||||||
|
|
||||||
|
[node name="PlantA" type="Area3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8366356, 1.4274807, -21.45604)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 16
|
||||||
|
script = ExtResource("8_oujx2")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlantA"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.484192, 0.24679565, 3.1519775)
|
||||||
|
shape = SubResource("BoxShape3D_ysk2e")
|
||||||
|
|
||||||
|
[node name="PlantADeadzone" type="Area3D" parent="." node_paths=PackedStringArray("bound_plant")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.00709, -26.598661)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 2
|
||||||
|
script = ExtResource("9_1wlgq")
|
||||||
|
bound_plant = NodePath("../PlantA")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlantADeadzone"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.292345, -7.2330484, 1.2828445)
|
||||||
|
shape = SubResource("BoxShape3D_1wlgq")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D2" type="CollisionShape3D" parent="PlantADeadzone"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.8295212, -7.2330484, 25.29969)
|
||||||
|
shape = SubResource("BoxShape3D_5uqia")
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.8463913, 0.33205223, -18.39247)
|
||||||
|
size = Vector3(0.49205017, 0.6567383, 21.270905)
|
||||||
|
material = ExtResource("9_ysk2e")
|
||||||
|
|
||||||
|
[node name="CSGBox3D2" type="CSGBox3D" parent="."]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 8.300152, 0.33205223, -28.774506)
|
||||||
|
size = Vector3(0.49205017, 0.6567383, 15.680862)
|
||||||
|
material = ExtResource("9_ysk2e")
|
||||||
|
|
||||||
|
[node name="CSGBox3D3" type="CSGBox3D" parent="."]
|
||||||
|
transform = Transform3D(-1.0000001, 0, 0, 0, 1, 0, 0, 0, -1.0000001, 15.965797, 0.33205223, -18.300764)
|
||||||
|
size = Vector3(0.49205017, 0.6567383, 21.278908)
|
||||||
|
material = ExtResource("9_ysk2e")
|
||||||
|
|
|
||||||
4
materials/Redmat.tres
Normal file
4
materials/Redmat.tres
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
[gd_resource type="ORMMaterial3D" format=3 uid="uid://c6xa4phihtya2"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
albedo_color = Color(0.9671871, 0, 0.44024095, 1)
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://dtbpyfdawb02b"]
|
[gd_scene load_steps=4 format=3 uid="uid://dtbpyfdawb02b"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://boftqgpgqf56g" path="res://scripts/weapon_system/bomb/active_bomb.gd" id="1_avh0g"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="1_yh58y"]
|
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="1_yh58y"]
|
||||||
|
|
||||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_yh58y"]
|
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_yh58y"]
|
||||||
|
|
@ -8,9 +9,15 @@ properties/0/spawn = true
|
||||||
properties/0/replication_mode = 2
|
properties/0/replication_mode = 2
|
||||||
|
|
||||||
[node name="ActiveBomb" type="Node3D"]
|
[node name="ActiveBomb" type="Node3D"]
|
||||||
|
script = ExtResource("1_avh0g")
|
||||||
|
|
||||||
[node name="Bomb" parent="." instance=ExtResource("1_yh58y")]
|
[node name="Bomb" parent="." instance=ExtResource("1_yh58y")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0)
|
||||||
|
|
||||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||||
replication_config = SubResource("SceneReplicationConfig_yh58y")
|
replication_config = SubResource("SceneReplicationConfig_yh58y")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 45.0
|
||||||
|
one_shot = true
|
||||||
|
autostart = true
|
||||||
|
|
|
||||||
9
scripts/multiplayer/plant_site/plant_deadzone.gd
Normal file
9
scripts/multiplayer/plant_site/plant_deadzone.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
extends Area3D
|
||||||
|
|
||||||
|
@export var bound_plant: Area3D
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if multiplayer.is_server():
|
||||||
|
Session.plant_deadzones[bound_plant.name] = self
|
||||||
|
else:
|
||||||
|
queue_free()
|
||||||
1
scripts/multiplayer/plant_site/plant_deadzone.gd.uid
Normal file
1
scripts/multiplayer/plant_site/plant_deadzone.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b4cpux52fmx5o
|
||||||
23
scripts/multiplayer/plant_site/plant_site.gd
Normal file
23
scripts/multiplayer/plant_site/plant_site.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
extends Area3D
|
||||||
|
|
||||||
|
class_name PlantSite
|
||||||
|
|
||||||
|
var players_on_site: Array[int]
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
body_entered.connect(on_body_entered)
|
||||||
|
body_exited.connect(on_body_exited)
|
||||||
|
|
||||||
|
Session.plants.append(self)
|
||||||
|
|
||||||
|
func on_body_entered(body: Node3D):
|
||||||
|
if body is Player:
|
||||||
|
players_on_site.append(int(body.name))
|
||||||
|
|
||||||
|
func on_body_exited(body: Node3D):
|
||||||
|
if body is Player:
|
||||||
|
players_on_site.erase(int(body.name))
|
||||||
|
|
||||||
|
func is_player_on_site(id: int):
|
||||||
|
return players_on_site.has(id)
|
||||||
1
scripts/multiplayer/plant_site/plant_site.gd.uid
Normal file
1
scripts/multiplayer/plant_site/plant_site.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dk1gjbuydemmb
|
||||||
|
|
@ -12,6 +12,8 @@ const DEFENCE_LAYER: int = 0b100000
|
||||||
var player_nodes: Dictionary[int,Player] = {}
|
var player_nodes: Dictionary[int,Player] = {}
|
||||||
|
|
||||||
var dynamic_objects_spawner: MultiplayerSpawner
|
var dynamic_objects_spawner: MultiplayerSpawner
|
||||||
|
var plants: Array[PlantSite]
|
||||||
|
var plant_deadzones: Dictionary[StringName, Area3D]
|
||||||
|
|
||||||
## Spawns dynamic object at game scene [br]
|
## Spawns dynamic object at game scene [br]
|
||||||
## Dictionary keys: [br]
|
## Dictionary keys: [br]
|
||||||
|
|
@ -77,3 +79,22 @@ func shoot_internal(id:int , damage: int) -> void:
|
||||||
if collision != {} and collision["collider"] is Player:
|
if collision != {} and collision["collider"] is Player:
|
||||||
collision["collider"].take_damage.rpc_id(int(collision["collider"].name),damage)
|
collision["collider"].take_damage.rpc_id(int(collision["collider"].name),damage)
|
||||||
|
|
||||||
|
func is_on_site() -> bool:
|
||||||
|
for plant in plants:
|
||||||
|
if plant.is_player_on_site(multiplayer.get_unique_id()):
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
func get_site() -> PlantSite:
|
||||||
|
for plant in plants:
|
||||||
|
if plant.is_player_on_site(multiplayer.get_unique_id()):
|
||||||
|
return plant
|
||||||
|
return null
|
||||||
|
|
||||||
|
func kill_site(site: StringName) -> void:
|
||||||
|
if multiplayer.is_server() == false:
|
||||||
|
return
|
||||||
|
|
||||||
|
for body in plant_deadzones[site].get_overlapping_bodies():
|
||||||
|
if body is Player:
|
||||||
|
body.die()
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,10 @@ func request_spawn(data: Variant) -> Node:
|
||||||
node.slot = data.slot
|
node.slot = data.slot
|
||||||
|
|
||||||
node.apply_impulse(data.impulse)
|
node.apply_impulse(data.impulse)
|
||||||
|
|
||||||
|
for key in data.keys():
|
||||||
|
if key in ["scene","ammo","remaining_ammo","slot","position","rotation"]:
|
||||||
|
continue
|
||||||
|
node.set(key,data[key])
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
|
||||||
13
scripts/weapon_system/bomb/active_bomb.gd
Normal file
13
scripts/weapon_system/bomb/active_bomb.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
extends Node3D
|
||||||
|
|
||||||
|
var plant: StringName
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if multiplayer.is_server():
|
||||||
|
$Timer.timeout.connect(on_timeout)
|
||||||
|
|
||||||
|
func on_timeout():
|
||||||
|
if multiplayer.is_server() == false:
|
||||||
|
return
|
||||||
|
|
||||||
|
Session.kill_site(plant)
|
||||||
1
scripts/weapon_system/bomb/active_bomb.gd.uid
Normal file
1
scripts/weapon_system/bomb/active_bomb.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://boftqgpgqf56g
|
||||||
|
|
@ -8,5 +8,5 @@ func exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func state_input(event: InputEvent) -> void:
|
func state_input(event: InputEvent) -> void:
|
||||||
if event.is_action("plr_bomb"):
|
if event.is_action("plr_bomb") and Session.is_on_site():
|
||||||
transition.emit("Plant")
|
transition.emit("Plant")
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ func exit():
|
||||||
func on_animation_finished(animation: StringName):
|
func on_animation_finished(animation: StringName):
|
||||||
if animation == machine.animation_prefix + "plant":
|
if animation == machine.animation_prefix + "plant":
|
||||||
|
|
||||||
Session.spawn({"scene": active_bomb, "position": machine.player_camera.get_parent().global_position})
|
Session.spawn({"scene": active_bomb, "position": machine.player_camera.get_parent().global_position,"plant": Session.get_site().name})
|
||||||
|
|
||||||
machine.ammo -= 1
|
machine.ammo -= 1
|
||||||
return_to_previous.emit()
|
return_to_previous.emit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue