diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-09-02 23:12:33 -0700 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-09-02 23:12:33 -0700 |
| commit | 4d51178d32e07c070c61aa7567856bec7eda3639 (patch) | |
| tree | 7ef4884dd2221340f9c1ed96bd0f52c761ae9fb0 /scenes | |
| parent | 0939d84e611f1c63fd5805339a2f777251fb1653 (diff) | |
hit/killsounds, swimming, main menu, fixed explosion physics
Diffstat (limited to 'scenes')
| -rw-r--r-- | scenes/ClientUI.tscn | 45 | ||||
| -rw-r--r-- | scenes/GameBase.tscn | 2 | ||||
| -rw-r--r-- | scenes/ServerUI.tscn | 100 | ||||
| -rw-r--r-- | scenes/ballistics/Rocket.gd | 21 | ||||
| -rw-r--r-- | scenes/ballistics/Rocket.tscn | 30 | ||||
| -rw-r--r-- | scenes/characters/PlayerAreaDetect.gd | 9 | ||||
| -rw-r--r-- | scenes/characters/PlayerRigid.tscn | 22 | ||||
| -rw-r--r-- | scenes/environment/CaptureFlag.tscn | 2 | ||||
| -rw-r--r-- | scenes/environment/Water.tscn | 2 | ||||
| -rw-r--r-- | scenes/environment/dockscene.tscn | 2 | ||||
| -rw-r--r-- | scenes/environment/housescene.tscn | 2 | ||||
| -rw-r--r-- | scenes/environment/islandscene.tscn | 2 | ||||
| -rw-r--r-- | scenes/weapons/rockets.gd | 11 |
13 files changed, 45 insertions, 205 deletions
diff --git a/scenes/ClientUI.tscn b/scenes/ClientUI.tscn deleted file mode 100644 index 50b0a77..0000000 --- a/scenes/ClientUI.tscn +++ /dev/null @@ -1,45 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://scripts/ClientUI.gd" type="Script" id=1] - -[node name="ClientUI" type="Node2D"] -script = ExtResource( 1 ) - -[node name="IP" type="LineEdit" parent="."] -margin_left = 23.0 -margin_top = 25.0 -margin_right = 119.0 -margin_bottom = 49.0 -text = "127.0.0.1" - -[node name="Port" type="SpinBox" parent="."] -margin_left = 132.0 -margin_top = 25.0 -margin_right = 206.0 -margin_bottom = 49.0 -max_value = 65536.0 -value = 25565.0 - -[node name="Name" type="LineEdit" parent="."] -margin_left = 23.0 -margin_top = 69.0 -margin_right = 206.0 -margin_bottom = 93.0 -text = "PlayerName" - -[node name="ConnectButton" type="Button" parent="."] -margin_left = 23.0 -margin_top = 113.0 -margin_right = 209.0 -margin_bottom = 138.0 -text = "Connect" - -[node name="LocalButton" type="Button" parent="."] -margin_left = 23.0 -margin_top = 251.0 -margin_right = 209.0 -margin_bottom = 271.0 -text = "Host Local Game" - -[connection signal="pressed" from="ConnectButton" to="." method="_connect_btn"] -[connection signal="pressed" from="LocalButton" to="." method="_run_local_server"] diff --git a/scenes/GameBase.tscn b/scenes/GameBase.tscn index 6725a55..eaa6c86 100644 --- a/scenes/GameBase.tscn +++ b/scenes/GameBase.tscn @@ -8,7 +8,7 @@ script = ExtResource( 3 ) [node name="Water" parent="." instance=ExtResource( 1 )] -transform = Transform( 6000, 0, 0, 0, 15, 0, 0, 0, 6000, 0, 0, 0 ) +transform = Transform( 6000, 0, 0, 0, 100, 0, 0, 0, 6000, 0, 0, 0 ) [node name="WORLDGEO" type="Spatial" parent="."] diff --git a/scenes/ServerUI.tscn b/scenes/ServerUI.tscn deleted file mode 100644 index 8081c81..0000000 --- a/scenes/ServerUI.tscn +++ /dev/null @@ -1,100 +0,0 @@ -[gd_scene load_steps=5 format=2] - -[ext_resource path="res://scripts/CmdPrompt.gd" type="Script" id=1] -[ext_resource path="res://scripts/Console.gd" type="Script" id=2] -[ext_resource path="res://scripts/ServerUI.gd" type="Script" id=4] - -[sub_resource type="StyleBoxFlat" id=1] -bg_color = Color( 0.0705882, 0.0705882, 0.0705882, 1 ) - -[node name="ServerUI" type="Node2D"] -script = ExtResource( 4 ) - -[node name="StartButton" type="Button" parent="." groups=["init_fields"]] -margin_left = 18.0 -margin_top = 19.0 -margin_right = 103.0 -margin_bottom = 39.0 -text = "Start Server" - -[node name="StopButton" type="Button" parent="."] -visible = false -margin_left = 18.0 -margin_top = 55.0 -margin_right = 102.0 -margin_bottom = 75.0 -text = "Stop Server" - -[node name="MapPath" type="LineEdit" parent="." groups=["init_fields"]] -margin_left = 117.0 -margin_top = 19.0 -margin_right = 334.0 -margin_bottom = 43.0 -text = "res://maps/Main.tscn" - -[node name="Console" type="ScrollContainer" parent="."] -margin_left = 588.0 -margin_top = 19.0 -margin_right = 1004.0 -margin_bottom = 383.0 -custom_styles/bg = SubResource( 1 ) -scroll_horizontal_enabled = false -script = ExtResource( 2 ) - -[node name="ConsoleLines" type="VBoxContainer" parent="Console"] -margin_right = 406.0 -margin_bottom = 14.0 - -[node name="Label" type="Label" parent="Console/ConsoleLines"] -margin_right = 406.0 -margin_bottom = 14.0 -text = "----------------------------------CONSOLE-----------------------------------" - -[node name="CmdPrompt" type="LineEdit" parent="."] -margin_left = 588.0 -margin_top = 402.0 -margin_right = 1004.0 -margin_bottom = 426.0 -script = ExtResource( 1 ) -console_path = NodePath("../Console") - -[node name="PlayerCount" type="SpinBox" parent="." groups=["init_fields"]] -margin_left = 347.0 -margin_top = 19.0 -margin_right = 421.0 -margin_bottom = 43.0 -min_value = 1.0 -value = 4.0 - -[node name="Port" type="SpinBox" parent="." groups=["init_fields"]] -margin_left = 260.0 -margin_top = 55.0 -margin_right = 334.0 -margin_bottom = 79.0 -max_value = 65536.0 -value = 25565.0 - -[node name="IP" type="LineEdit" parent="." groups=["init_fields"]] -margin_left = 117.0 -margin_top = 55.0 -margin_right = 247.0 -margin_bottom = 79.0 -text = "127.0.0.1" - -[node name="MOTD" type="TextEdit" parent="." groups=["init_fields"]] -margin_left = 117.0 -margin_top = 129.0 -margin_right = 334.0 -margin_bottom = 169.0 -text = "MOTD" - -[node name="ServerName" type="LineEdit" parent="." groups=["init_fields"]] -margin_left = 117.0 -margin_top = 92.0 -margin_right = 334.0 -margin_bottom = 116.0 -text = "Server Name" - -[connection signal="pressed" from="StartButton" to="." method="start_server"] -[connection signal="pressed" from="StopButton" to="." method="stop_server"] -[connection signal="text_entered" from="CmdPrompt" to="CmdPrompt" method="enter_cmd"] diff --git a/scenes/ballistics/Rocket.gd b/scenes/ballistics/Rocket.gd index d21b9f6..171a49e 100644 --- a/scenes/ballistics/Rocket.gd +++ b/scenes/ballistics/Rocket.gd @@ -12,7 +12,7 @@ func _ready(): $RocketTrail.emitting = true func get_init_info(): - return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "life" : life, "shooter" : shooter} + return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "life" : life, "shooter" : shooter, "shooter_id" : shooter_id} remote func update_phys_transform(t, lv, av): transform = t @@ -24,10 +24,10 @@ func _physics_process(delta): add_central_force(global_transform.basis.x*strength) life += delta else: - explode() + rpc("explode") $RocketTrail.emitting = false -func explode(): +remotesync func explode(): if cannot_explode: return cannot_explode = true @@ -41,15 +41,12 @@ func explode(): world.add_child(expl) expl.init(global_transform.origin, Vector3.ZERO) - - for body in $BlastArea.get_overlapping_bodies(): - if body.has_method("damage") and body.is_network_master(): - body.rpc("damage", 50, "explosive", shooter, "using 'rocket'") - print((5000*(global_transform.origin - body.global_transform.origin).normalized())) - body.apply_central_impulse((5000*(global_transform.origin - body.global_transform.origin).normalized())) - body.rpc("apply_central_impulse", (5000*(global_transform.origin - body.global_transform.origin).normalized())) - + if is_network_master(): + for body in $BlastArea.get_overlapping_bodies(): + if body.has_method("damage"): + body.rpc("damage", 20, "explosive", [shooter_id, shooter], "using 'rocket'") + body.rpc_id(body.get_network_master(), "net_apply_impulse", (500*(body.global_transform.origin - global_transform.origin).normalized())) $AnimationPlayer.play("explode") func _on_collision(body): - explode() + rpc("explode") diff --git a/scenes/ballistics/Rocket.tscn b/scenes/ballistics/Rocket.tscn index 03e807e..4b8e05d 100644 --- a/scenes/ballistics/Rocket.tscn +++ b/scenes/ballistics/Rocket.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=9 format=2] -[ext_resource path="res://work/RocketMaterial.material" type="Material" id=1] +[ext_resource path="res://materials/RocketMaterial.material" type="Material" id=1] [ext_resource path="res://particles/RocketTrail.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/ballistics/Rocket.gd" type="Script" id=3] [ext_resource path="res://sounds/explode.wav" type="AudioStream" id=4] @@ -23,27 +23,6 @@ surfaces/0 = { [sub_resource type="BoxShape" id=2] extents = Vector3( 0.111378, 0.254987, 0.104516 ) -[sub_resource type="Gradient" id=6] -offsets = PoolRealArray( 0, 0.180645, 0.554839, 1 ) -colors = PoolColorArray( 1, 0.140625, 0, 1, 1, 0.906855, 0.148387, 1, 1, 1, 1, 1, 0, 0, 0, 1 ) - -[sub_resource type="GradientTexture" id=7] -gradient = SubResource( 6 ) - -[sub_resource type="Curve" id=4] -_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.140449, 0.409091 ), 0.0, 0.0, 0, 0 ] - -[sub_resource type="CurveTexture" id=5] -curve = SubResource( 4 ) - -[sub_resource type="ParticlesMaterial" id=8] -spread = 2.23 -gravity = Vector3( 0, 1, 0 ) -initial_velocity = 19.8 -damping = 13.78 -scale_curve = SubResource( 5 ) -color_ramp = SubResource( 7 ) - [sub_resource type="Animation" id=3] resource_name = "explode" tracks/0/type = "method" @@ -57,7 +36,7 @@ tracks/0/keys = { "transitions": PoolRealArray( 1 ), "values": [ { "args": [ ], -"method": "queue_free" +"method": "net_remove" } ] } tracks/1/type = "method" @@ -95,8 +74,7 @@ shape = SubResource( 2 ) [node name="RocketTrail" parent="." instance=ExtResource( 2 )] transform = Transform( -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0.0857886, 0, 0 ) -emitting = false -process_material = SubResource( 8 ) +visibility_aabb = AABB( -78.3554, -22.7817, -31.4143, 156.711, 45.5634, 62.8285 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/explode = SubResource( 3 ) diff --git a/scenes/characters/PlayerAreaDetect.gd b/scenes/characters/PlayerAreaDetect.gd new file mode 100644 index 0000000..7bcf48b --- /dev/null +++ b/scenes/characters/PlayerAreaDetect.gd @@ -0,0 +1,9 @@ +extends Area + +func _on_AreaDetect_area_entered(area): + if area.name == "WaterArea": + get_parent().enter_water() + +func _on_AreaDetect_area_exited(area): + if area.name == "WaterArea": + get_parent().exit_water() diff --git a/scenes/characters/PlayerRigid.tscn b/scenes/characters/PlayerRigid.tscn index 54e93e8..1394258 100644 --- a/scenes/characters/PlayerRigid.tscn +++ b/scenes/characters/PlayerRigid.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://scripts/characters/player_controller_new.gd" type="Script" id=1] -[ext_resource path="res://textures/FreeMono.otf" type="DynamicFontData" id=2] +[ext_resource path="res://theming/FreeMono.otf" type="DynamicFontData" id=2] +[ext_resource path="res://scenes/characters/PlayerAreaDetect.gd" type="Script" id=3] [sub_resource type="PhysicsMaterial" id=3] friction = 2.0 @@ -22,7 +23,7 @@ outline_size = 3 use_filter = true font_data = ExtResource( 2 ) -[node name="Player" type="RigidBody" groups=["playable", "player"]] +[node name="Soldier" type="RigidBody" groups=["playable", "player"]] collision_layer = 32769 collision_mask = 32769 mode = 2 @@ -56,12 +57,6 @@ cast_to = Vector3( 0, 0, -2.5 ) collision_mask = 131075 collide_with_areas = true -[node name="LongRay" type="RayCast" parent="Head/Camera"] -enabled = true -cast_to = Vector3( 0, 0, -500 ) -collision_mask = 131075 -collide_with_areas = true - [node name="MeleeRay" type="RayCast" parent="Head/Camera"] enabled = true cast_to = Vector3( 0, 0, -2.5 ) @@ -109,3 +104,12 @@ path_max_distance = 1.0 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.09891, 0 ) billboard = 1 font = SubResource( 5 ) + +[node name="AreaDetect" type="Area" parent="."] +script = ExtResource( 3 ) + +[node name="Collision" type="CollisionShape" parent="AreaDetect"] +shape = SubResource( 1 ) + +[connection signal="area_entered" from="AreaDetect" to="AreaDetect" method="_on_AreaDetect_area_entered"] +[connection signal="area_exited" from="AreaDetect" to="AreaDetect" method="_on_AreaDetect_area_exited"] diff --git a/scenes/environment/CaptureFlag.tscn b/scenes/environment/CaptureFlag.tscn index 57eedf4..1347f64 100644 --- a/scenes/environment/CaptureFlag.tscn +++ b/scenes/environment/CaptureFlag.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=17 format=2] [ext_resource path="res://textures/conc_slabs01_c.png" type="Texture" id=1] -[ext_resource path="res://textures/FreeMono.otf" type="DynamicFontData" id=2] +[ext_resource path="res://theming/FreeMono.otf" type="DynamicFontData" id=2] [ext_resource path="res://scenes/environment/CaptureFlag.gd" type="Script" id=3] [ext_resource path="res://sounds/capture.wav" type="AudioStream" id=4] diff --git a/scenes/environment/Water.tscn b/scenes/environment/Water.tscn index 3bae192..04410b1 100644 --- a/scenes/environment/Water.tscn +++ b/scenes/environment/Water.tscn @@ -8,7 +8,7 @@ size = Vector2( 2, 2 ) [sub_resource type="Shader" id=2] code = "shader_type spatial; -render_mode world_vertex_coords; +render_mode world_vertex_coords, cull_disabled; uniform int ShaderID = 4; diff --git a/scenes/environment/dockscene.tscn b/scenes/environment/dockscene.tscn index 012209d..6bf7f31 100644 --- a/scenes/environment/dockscene.tscn +++ b/scenes/environment/dockscene.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://work/Material_002.material" type="Material" id=1] +[ext_resource path="res://materials/Material_002.material" type="Material" id=1] [sub_resource type="ArrayMesh" id=1] resource_name = "dockscene_Cube002" diff --git a/scenes/environment/housescene.tscn b/scenes/environment/housescene.tscn index 2b0c4f2..5a60d0d 100644 --- a/scenes/environment/housescene.tscn +++ b/scenes/environment/housescene.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://work/housetexture.material" type="Material" id=1] +[ext_resource path="res://materials/housetexture.material" type="Material" id=1] [sub_resource type="ArrayMesh" id=1] resource_name = "housescene_Cube003" diff --git a/scenes/environment/islandscene.tscn b/scenes/environment/islandscene.tscn index 66da09f..6226569 100644 --- a/scenes/environment/islandscene.tscn +++ b/scenes/environment/islandscene.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://work/sandyground.material" type="Material" id=1] +[ext_resource path="res://materials/sandyground.material" type="Material" id=1] [sub_resource type="ArrayMesh" id=1] resource_name = "islandscene_Icosphere" diff --git a/scenes/weapons/rockets.gd b/scenes/weapons/rockets.gd index e765a93..fedeebd 100644 --- a/scenes/weapons/rockets.gd +++ b/scenes/weapons/rockets.gd @@ -4,7 +4,7 @@ var weapon_name = "ROCKETS" var player onready var world = get_tree().get_root().get_node("GAMEWORLD") -var ammo_full : int = 5 +var ammo_full : int = 50 var ammo : int var reload_time :float= 1.0 @@ -22,19 +22,16 @@ func attack1(): if cooldown_time <= 0.0 and ammo >= 1: ammo -= 1 cooldown_time = reload_time - rpc("add_rocket_to_scene", -1*player.cam.global_transform.basis.z) + rpc("add_rocket_to_scene", -1*player.cam.global_transform.basis.z, get_tree().get_network_unique_id()) -remotesync func add_rocket_to_scene(dir): - print(dir) +remotesync func add_rocket_to_scene(dir, id): var rocket = preload("res://scenes/ballistics/Rocket.tscn").instance() world.get_node("BALLISTICS").add_child(rocket, true) rocket.shooter = player.name + " (" + world.players_info[player.get_network_master()][0] + ")" - #rocket.set_network_master(player.get_network_master()) - #if get_tree().get_network_unique_id() == player.get_network_master(): + rocket.shooter_id = id rocket.global_transform.origin = player.cam.global_transform.origin rocket.global_transform.basis.x = dir rocket.add_collision_exception_with(player) - func attack2(): pass |
