From 7a1d857de96174dfa5a0fa40f8c14acbd2f651c2 Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Sun, 25 Sep 2022 06:39:12 -0400 Subject: weapons, viewmodels, some performance fixes --- godot/scenes/GameBase.tscn | 3 +- godot/scenes/ballistics/Cannonball.tscn | 13 +- godot/scenes/ballistics/Rocket.gd | 4 +- godot/scenes/characters/PlayerRigid.tscn | 67 ++++----- godot/scenes/characters/viewmodel_arms.tscn | 180 +++++++++++++++++++++++ godot/scenes/environment/CableDynamic.tscn | 3 + godot/scenes/machines/Cannon.tscn | 20 ++- godot/scenes/vehicles/Gunbrig.tscn | 2 +- godot/scenes/vehicles/ship_parts/SquareSail.gd | 9 +- godot/scenes/vehicles/ship_parts/SquareSail.tscn | 3 - godot/scenes/weapons/hands.gd | 46 ++++++ godot/scenes/weapons/hands.res | Bin 0 -> 173 bytes godot/scenes/weapons/pistol.gd | 64 ++++++++ godot/scenes/weapons/pistol.tres | 7 + godot/scenes/weapons/pistol.tscn | 146 ++++++++++++++++++ godot/scenes/weapons/rockets.gd | 68 +++++---- godot/scenes/weapons/rockets.tres | 7 + godot/scenes/weapons/rockets.tscn | 71 +++++++++ godot/scenes/weapons/w_Rockets.tscn | 6 - 19 files changed, 624 insertions(+), 95 deletions(-) create mode 100644 godot/scenes/characters/viewmodel_arms.tscn create mode 100644 godot/scenes/weapons/hands.gd create mode 100644 godot/scenes/weapons/hands.res create mode 100644 godot/scenes/weapons/pistol.gd create mode 100644 godot/scenes/weapons/pistol.tres create mode 100644 godot/scenes/weapons/pistol.tscn create mode 100644 godot/scenes/weapons/rockets.tres create mode 100644 godot/scenes/weapons/rockets.tscn delete mode 100644 godot/scenes/weapons/w_Rockets.tscn (limited to 'godot/scenes') diff --git a/godot/scenes/GameBase.tscn b/godot/scenes/GameBase.tscn index 6764b81..1f09aa2 100644 --- a/godot/scenes/GameBase.tscn +++ b/godot/scenes/GameBase.tscn @@ -26,5 +26,6 @@ current = true far = 8192.0 [node name="PLAYERCAM" type="ClippedCamera" parent="."] -far = 8192.0 +near = 0.01 +far = 520.7 script = ExtResource( 4 ) diff --git a/godot/scenes/ballistics/Cannonball.tscn b/godot/scenes/ballistics/Cannonball.tscn index 83c3942..4e5d06a 100644 --- a/godot/scenes/ballistics/Cannonball.tscn +++ b/godot/scenes/ballistics/Cannonball.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://scripts/ballistics/Cannonball.gd" type="Script" id=1] @@ -26,6 +26,9 @@ normal_enabled = true normal_scale = 1.0 normal_texture = SubResource( 5 ) +[sub_resource type="BoxShape" id=6] +extents = Vector3( 0.286994, 0.293614, 0.250986 ) + [node name="Cannonball" type="RigidBody"] mass = 10.0 continuous_cd = true @@ -41,4 +44,12 @@ shape = SubResource( 1 ) mesh = SubResource( 2 ) material/0 = SubResource( 3 ) +[node name="PickupArea" type="Area" parent="."] +collision_layer = 2 +collision_mask = 2 +monitoring = false + +[node name="CollisionShape" type="CollisionShape" parent="PickupArea"] +shape = SubResource( 6 ) + [connection signal="body_entered" from="." to="." method="_on_collision"] diff --git a/godot/scenes/ballistics/Rocket.gd b/godot/scenes/ballistics/Rocket.gd index 329825d..e475f9b 100644 --- a/godot/scenes/ballistics/Rocket.gd +++ b/godot/scenes/ballistics/Rocket.gd @@ -39,8 +39,8 @@ remotesync func explode(): 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())) + body.rpc("damage", 20, "EXPLOSIVE", [shooter_id, shooter], "using 'rocket'") + body.rpc_id(body.get_network_master(), "net_apply_impulse", (1300*(body.global_transform.origin+Vector3(0,1,0) - global_transform.origin).normalized())) $AnimationPlayer.play("explode") func _on_collision(_body): diff --git a/godot/scenes/characters/PlayerRigid.tscn b/godot/scenes/characters/PlayerRigid.tscn index 5a5a63a..6e9fe48 100644 --- a/godot/scenes/characters/PlayerRigid.tscn +++ b/godot/scenes/characters/PlayerRigid.tscn @@ -1,19 +1,20 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=13 format=2] [ext_resource path="res://scripts/characters/player_controller_new.gd" type="Script" id=1] [ext_resource path="res://theming/FreeMono.otf" type="DynamicFontData" id=2] [ext_resource path="res://scenes/characters/PlayerAreaDetect.gd" type="Script" id=3] +[ext_resource path="res://scenes/characters/viewmodel_arms.tscn" type="PackedScene" id=4] +[ext_resource path="res://scenes/weapons/hands.res" type="Resource" id=5] +[ext_resource path="res://scenes/weapons/pistol.tres" type="Resource" id=6] +[ext_resource path="res://scenes/weapons/rockets.tres" type="Resource" id=7] -[sub_resource type="PhysicsMaterial" id=3] +[sub_resource type="PhysicsMaterial" id=8] resource_local_to_scene = true rough = true [sub_resource type="BoxShape" id=6] extents = Vector3( 0.325, 0.9, 0.325 ) -[sub_resource type="CubeMesh" id=2] -size = Vector3( 0.2, 0.2, 1 ) - [sub_resource type="CubeMesh" id=4] size = Vector3( 0.6, 1.8, 0.6 ) @@ -26,29 +27,32 @@ font_data = ExtResource( 2 ) [sub_resource type="BoxShape" id=1] extents = Vector3( 0.325, 0.9, 0.325 ) -[sub_resource type="CylinderMesh" id=7] -top_radius = 0.01 -bottom_radius = 0.01 -height = 0.3 -radial_segments = 6 - [node name="Soldier" type="RigidBody" groups=["playable", "player"]] collision_layer = 32769 collision_mask = 32769 mode = 2 mass = 80.0 -physics_material_override = SubResource( 3 ) +physics_material_override = SubResource( 8 ) continuous_cd = true contacts_reported = 3 contact_monitor = true +can_sleep = false +axis_lock_angular_x = true +axis_lock_angular_y = true +axis_lock_angular_z = true linear_damp = 0.0 angular_damp = 0.0 script = ExtResource( 1 ) +weapon_slot1 = ExtResource( 5 ) +weapon_slot2 = ExtResource( 6 ) +weapon_slot3 = ExtResource( 7 ) [node name="Collision" type="CollisionShape" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0 ) shape = SubResource( 6 ) +[node name="WeaponSound" type="AudioStreamPlayer3D" parent="."] + [node name="Neck" type="Spatial" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44, 0 ) @@ -66,30 +70,16 @@ unique_name_in_owner = true enabled = true cast_to = Vector3( 0, 0, -2.5 ) collision_mask = 262145 -collide_with_areas = true -[node name="viewmodel_c" type="ViewportContainer" parent="Neck"] -visible = false -margin_right = 1024.0 -margin_bottom = 600.0 - -[node name="viewmodel" type="Viewport" parent="Neck/viewmodel_c"] -size = Vector2( 1024, 600 ) -transparent_bg = true -handle_input_locally = false -render_target_update_mode = 0 - -[node name="vm_camera" type="Camera" parent="Neck/viewmodel_c/viewmodel"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.539779, 0 ) -cull_mask = 524288 -current = true -fov = 90.0 -far = 75.9 - -[node name="MeshInstance" type="MeshInstance" parent="Neck/viewmodel_c/viewmodel"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0266792, -0.813922 ) -layers = 524288 -mesh = SubResource( 2 ) +[node name="GunRay" type="RayCast" parent="Neck/Head"] +cast_to = Vector3( 0, 0, -300 ) + +[node name="VIEWMODEL_ARMS" parent="Neck/Head" instance=ExtResource( 4 )] +unique_name_in_owner = true +transform = Transform( -0.1, 0, -1.50996e-08, 0, 0.1, 0, 1.50996e-08, 0, -0.1, 0, -0.055375, 0.0132675 ) + +[node name="CarryPoint" type="Position3D" parent="Neck/Head"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.07564 ) [node name="Feet" type="RayCast" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.03, 0 ) @@ -113,14 +103,13 @@ font = SubResource( 5 ) [node name="AreaDetect" type="Area" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0 ) +collision_layer = 4 +collision_mask = 4 +monitorable = false script = ExtResource( 3 ) [node name="Collision" type="CollisionShape" parent="AreaDetect"] shape = SubResource( 1 ) -[node name="normal_vis" type="MeshInstance" parent="."] -mesh = SubResource( 7 ) -skeleton = NodePath("../Feet") - [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/godot/scenes/characters/viewmodel_arms.tscn b/godot/scenes/characters/viewmodel_arms.tscn new file mode 100644 index 0000000..1808785 --- /dev/null +++ b/godot/scenes/characters/viewmodel_arms.tscn @@ -0,0 +1,180 @@ +[gd_scene load_steps=13 format=2] + +[ext_resource path="res://animations/humanidle.tres" type="Animation" id=1] +[ext_resource path="res://animations/humanpunch.tres" type="Animation" id=2] +[ext_resource path="res://meshes/human/viewmodel_arms.tres" type="ArrayMesh" id=3] +[ext_resource path="res://meshes/human/viewmodel_arms_SKIN.tres" type="Skin" id=4] +[ext_resource path="res://animations/raise_fists.tres" type="Animation" id=5] +[ext_resource path="res://animations/lower_fists.tres" type="Animation" id=6] +[ext_resource path="res://animations/fists_idle.tres" type="Animation" id=7] +[ext_resource path="res://animations/pistol_idle_vm.tres" type="Animation" id=8] +[ext_resource path="res://animations/pistol_fire_vm.tres" type="Animation" id=9] +[ext_resource path="res://animations/pistol_reload_vm.tres" type="Animation" id=10] +[ext_resource path="res://animations/rockets_launch_vm.tres" type="Animation" id=11] +[ext_resource path="res://animations/rockets_idle_vm.tres" type="Animation" id=12] + +[node name="viewmodel_arms" type="Spatial"] + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "humanidle" +anims/fists_idle = ExtResource( 7 ) +anims/humanidle = ExtResource( 1 ) +anims/humanpunch = ExtResource( 2 ) +anims/lower_fists = ExtResource( 6 ) +anims/pistol_fire_vm = ExtResource( 9 ) +anims/pistol_idle_vm = ExtResource( 8 ) +anims/pistol_reload_vm = ExtResource( 10 ) +anims/raise_fists = ExtResource( 5 ) +anims/rockets_idle_vm = ExtResource( 12 ) +anims/rockets_launch_vm = ExtResource( 11 ) + +[node name="Skeleton" type="Skeleton" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.507587, -0.379486 ) +bones/0/name = "ArmRoot.R" +bones/0/parent = -1 +bones/0/rest = Transform( -0.177871, -0.984054, 3.39781e-08, 0.984054, -0.177871, -1.94956e-07, 1.97891e-07, -1.24085e-09, 1, 0, 0.591936, 0.369128 ) +bones/0/enabled = true +bones/0/bound_children = [ ] +bones/1/name = "Shoulder.R" +bones/1/parent = 0 +bones/1/rest = Transform( 0.787947, -0.615656, -0.0103313, 0.61496, 0.78768, -0.0371922, 0.0310354, 0.0229522, 0.999255, 3.97029e-08, 0.622106, 6.46544e-09 ) +bones/1/enabled = true +bones/1/bound_children = [ ] +bones/2/name = "Elbow.R" +bones/2/parent = 1 +bones/2/rest = Transform( 0.977179, 0.125413, 0.171442, 0.0174242, 0.757057, -0.653116, -0.2117, 0.641199, 0.737595, -1.78814e-07, 1.67641, 4.05125e-08 ) +bones/2/enabled = true +bones/2/bound_children = [ ] +bones/3/name = "Wrist.R" +bones/3/parent = 2 +bones/3/rest = Transform( 0.942879, -0.20747, 0.260645, 0.237384, 0.967355, -0.0887301, -0.233727, 0.145535, 0.961348, 2.68221e-07, 1.29325, 0 ) +bones/3/enabled = true +bones/3/bound_children = [ NodePath("GunBone") ] +bones/4/name = "Thumb.R" +bones/4/parent = 3 +bones/4/rest = Transform( 0.771494, -0.608265, -0.186579, 0.518122, 0.770842, -0.370612, 0.369253, 0.189254, 0.909854, -0.138479, 0.349082, 0.150327 ) +bones/4/enabled = true +bones/4/bound_children = [ ] +bones/5/name = "ThumbJoint.R" +bones/5/parent = 4 +bones/5/rest = Transform( 0.998414, 0.0553932, 0.0100235, -0.0557424, 0.997692, 0.0387759, -0.00785248, -0.0392731, 0.999198, 1.19209e-07, 0.185314, 1.49012e-07 ) +bones/5/enabled = true +bones/5/bound_children = [ ] +bones/6/name = "Forefinger.R" +bones/6/parent = 3 +bones/6/rest = Transform( 0.990211, -0.0868984, 0.109229, 0.087316, 0.99618, 0.000963221, -0.108895, 0.00858365, 0.994016, -0.0704187, 0.577644, 0.101705 ) +bones/6/enabled = true +bones/6/bound_children = [ ] +bones/7/name = "ForefingerJoint.R" +bones/7/parent = 6 +bones/7/rest = Transform( 0.961771, -0.273567, -0.0125167, 0.273567, 0.957673, 0.0895728, -0.0125173, -0.0895727, 0.995902, -1.78814e-07, 0.168752, -7.45058e-08 ) +bones/7/enabled = true +bones/7/bound_children = [ ] +bones/8/name = "Middlefinger.R" +bones/8/parent = 3 +bones/8/rest = Transform( 0.99595, -0.0877201, -0.0197039, 0.0899057, 0.972106, 0.216627, 0.000151744, -0.217521, 0.976056, -0.00396565, 0.635147, -0.0137653 ) +bones/8/enabled = true +bones/8/bound_children = [ ] +bones/9/name = "MiddlefingerJoint.R" +bones/9/parent = 8 +bones/9/rest = Transform( 0.952338, -0.302326, -0.0406409, 0.302788, 0.953041, 0.00561015, 0.0370363, -0.0176483, 0.999158, 4.61936e-07, 0.171389, 8.9407e-08 ) +bones/9/enabled = true +bones/9/bound_children = [ ] +bones/10/name = "Ringfinger.R" +bones/10/parent = 3 +bones/10/rest = Transform( 0.996881, -0.0294961, 0.073197, 0.00553321, 0.951366, 0.308013, -0.0787223, -0.306647, 0.948562, 0.047418, 0.585948, -0.124826 ) +bones/10/enabled = true +bones/10/bound_children = [ ] +bones/11/name = "RingfingerJoint.R" +bones/11/parent = 10 +bones/11/rest = Transform( 0.993602, -0.107312, 0.035221, 0.107189, 0.994224, 0.00535263, -0.035592, -0.00154307, 0.999365, 1.19209e-07, 0.148602, -6.89179e-08 ) +bones/11/enabled = true +bones/11/bound_children = [ ] +bones/12/name = "Pinky.R" +bones/12/parent = 3 +bones/12/rest = Transform( 0.956205, -0.152718, 0.249696, -0.0177502, 0.821265, 0.570271, -0.292157, -0.549728, 0.782587, 0.0680349, 0.524245, -0.176284 ) +bones/12/enabled = true +bones/12/bound_children = [ ] +bones/13/name = "HandIK.R" +bones/13/parent = -1 +bones/13/rest = Transform( 0.569709, -0.756887, -0.32024, 0.81482, 0.469348, 0.340267, -0.10724, -0.454791, 0.884118, -2.46612, -1.39053, 1.26266 ) +bones/13/enabled = true +bones/13/bound_children = [ ] +bones/14/name = "HandIK.L" +bones/14/parent = -1 +bones/14/rest = Transform( 0.569709, 0.756887, 0.32024, -0.81482, 0.469348, 0.340267, 0.10724, -0.454791, 0.884118, 2.46964, -1.39423, 1.2634 ) +bones/14/enabled = true +bones/14/bound_children = [ ] +bones/15/name = "ArmRoot.L" +bones/15/parent = -1 +bones/15/rest = Transform( 0.0316384, 0.984054, 0.175035, 0.175035, -0.177871, 0.968362, 0.984054, -8.9407e-08, -0.177871, 0, 0.591936, 0.369128 ) +bones/15/enabled = true +bones/15/bound_children = [ ] +bones/16/name = "Shoulder.L" +bones/16/parent = 15 +bones/16/rest = Transform( -0.170694, -0.0869216, 0.981483, -0.61496, 0.787681, -0.0371923, -0.769862, -0.609921, -0.187906, -1.49012e-08, 0.622106, -7.45058e-09 ) +bones/16/enabled = true +bones/16/bound_children = [ ] +bones/17/name = "Elbow.L" +bones/17/parent = 16 +bones/17/rest = Transform( 0.977179, -0.125413, -0.171442, -0.0174242, 0.757057, -0.653116, 0.2117, 0.641199, 0.737596, -3.91155e-08, 1.67642, -3.72529e-09 ) +bones/17/enabled = true +bones/17/bound_children = [ ] +bones/18/name = "Wrist.L" +bones/18/parent = 17 +bones/18/rest = Transform( 0.942879, 0.20747, -0.260645, -0.237384, 0.967355, -0.0887299, 0.233727, 0.145534, 0.961349, -1.49012e-08, 1.29325, -1.78814e-07 ) +bones/18/enabled = true +bones/18/bound_children = [ ] +bones/19/name = "Thumb.L" +bones/19/parent = 18 +bones/19/rest = Transform( 0.771494, 0.608265, 0.186579, -0.518122, 0.770842, -0.370612, -0.369253, 0.189254, 0.909854, 0.138479, 0.349082, 0.150327 ) +bones/19/enabled = true +bones/19/bound_children = [ ] +bones/20/name = "ThumbJoint.L" +bones/20/parent = 19 +bones/20/rest = Transform( 0.998414, -0.0553931, -0.0100235, 0.0557423, 0.997692, 0.038776, 0.00785247, -0.0392732, 0.999198, -5.96046e-08, 0.185314, 3.27826e-07 ) +bones/20/enabled = true +bones/20/bound_children = [ ] +bones/21/name = "Forefinger.L" +bones/21/parent = 18 +bones/21/rest = Transform( 0.990211, 0.0868986, -0.109229, -0.0873162, 0.99618, 0.000963001, 0.108895, 0.00858388, 0.994016, 0.0704185, 0.577644, 0.101706 ) +bones/21/enabled = true +bones/21/bound_children = [ ] +bones/22/name = "ForefingerJoint.L" +bones/22/parent = 21 +bones/22/rest = Transform( 0.961771, 0.273567, 0.0125167, -0.273567, 0.957673, 0.0895729, 0.0125173, -0.0895728, 0.995902, -2.98023e-08, 0.168752, 2.5332e-07 ) +bones/22/enabled = true +bones/22/bound_children = [ ] +bones/23/name = "Middlefinger.L" +bones/23/parent = 18 +bones/23/rest = Transform( 0.99595, 0.0877202, 0.0197039, -0.0899058, 0.972106, 0.216626, -0.000151757, -0.217521, 0.976056, 0.00396539, 0.635146, -0.0137648 ) +bones/23/enabled = true +bones/23/bound_children = [ ] +bones/24/name = "MiddlefingerJoint.L" +bones/24/parent = 23 +bones/24/rest = Transform( 0.952338, 0.302326, 0.0406409, -0.302788, 0.953041, 0.0056103, -0.0370364, -0.0176485, 0.999158, -1.04308e-07, 0.171389, 5.96046e-08 ) +bones/24/enabled = true +bones/24/bound_children = [ ] +bones/25/name = "Ringfinger.L" +bones/25/parent = 18 +bones/25/rest = Transform( 0.996881, 0.029496, -0.0731969, -0.00553319, 0.951366, 0.308013, 0.0787223, -0.306647, 0.948562, -0.0474181, 0.585947, -0.124826 ) +bones/25/enabled = true +bones/25/bound_children = [ ] +bones/26/name = "RingfingerJoint.L" +bones/26/parent = 25 +bones/26/rest = Transform( 0.993601, 0.107312, -0.0352211, -0.107189, 0.994224, 0.0053527, 0.0355921, -0.00154313, 0.999365, 0, 0.148602, 1.67638e-08 ) +bones/26/enabled = true +bones/26/bound_children = [ ] +bones/27/name = "Pinky.L" +bones/27/parent = 18 +bones/27/rest = Transform( 0.956205, 0.152718, -0.249696, 0.0177501, 0.821265, 0.570271, 0.292158, -0.549728, 0.782587, -0.0680351, 0.524245, -0.176284 ) +bones/27/enabled = true +bones/27/bound_children = [ ] + +[node name="arms" type="MeshInstance" parent="Skeleton"] +mesh = ExtResource( 3 ) +skin = ExtResource( 4 ) + +[node name="GunBone" type="BoneAttachment" parent="Skeleton"] +transform = Transform( -0.978, -0.15941, 0.134542, 0.1673, -0.214165, 0.962363, -0.124596, 0.963702, 0.236124, -1.28918, -0.187637, 3.05885 ) +bone_name = "Wrist.R" diff --git a/godot/scenes/environment/CableDynamic.tscn b/godot/scenes/environment/CableDynamic.tscn index 608e144..42738bd 100644 --- a/godot/scenes/environment/CableDynamic.tscn +++ b/godot/scenes/environment/CableDynamic.tscn @@ -8,9 +8,12 @@ export var endpoint_path := @\"\"; onready var endpoint := get_node(endpoint_pat func _ready(): if endpoint_path == \"\": set_physics_process(false) + update() func _physics_process(_delta): return + +func update(): var length = to_local(endpoint.global_transform.origin).length() mesh1.scale.x = length; mesh2.scale.x = length; mesh1.transform.origin.z = -length/2; mesh2.transform.origin.z = -length/2; diff --git a/godot/scenes/machines/Cannon.tscn b/godot/scenes/machines/Cannon.tscn index fbfbdf1..9bcd95d 100644 --- a/godot/scenes/machines/Cannon.tscn +++ b/godot/scenes/machines/Cannon.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://scripts/machines/Cannon.gd" type="Script" id=1] [ext_resource path="res://sounds/explode.wav" type="AudioStream" id=2] [ext_resource path="res://meshes/cannon_barrel.tres" type="ArrayMesh" id=3] [ext_resource path="res://meshes/cannon_base.tres" type="ArrayMesh" id=4] +[ext_resource path="res://theming/FreeMono.otf" type="DynamicFontData" id=5] [sub_resource type="PhysicsMaterial" id=8] rough = true @@ -14,8 +15,11 @@ extents = Vector3( 1, 0.5, 0.5 ) [sub_resource type="BoxShape" id=6] extents = Vector3( 0.2, 0.473253, 0.536751 ) -[sub_resource type="CubeMesh" id=7] -size = Vector3( 0.4, 0.4, 0.4 ) +[sub_resource type="DynamicFont" id=9] +size = 41 +outline_size = 2 +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 5 ) [node name="Cannon" type="RigidBody"] mass = 3180.0 @@ -52,12 +56,16 @@ transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.87360 [node name="SteerArea" type="Area" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.935472, 0.123637, 0 ) +collision_layer = 2 +collision_mask = 2 monitoring = false [node name="CollisionShape" type="CollisionShape" parent="SteerArea"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0778996, 0.339775, 0 ) shape = SubResource( 6 ) -[node name="MeshInstance" type="MeshInstance" parent="SteerArea"] -visible = false -mesh = SubResource( 7 ) +[node name="StatusNotifier" type="Label3D" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.748, 1.143, 0 ) +billboard = 2 +text = "!" +font = SubResource( 9 ) diff --git a/godot/scenes/vehicles/Gunbrig.tscn b/godot/scenes/vehicles/Gunbrig.tscn index 1c5441b..ce417c7 100644 --- a/godot/scenes/vehicles/Gunbrig.tscn +++ b/godot/scenes/vehicles/Gunbrig.tscn @@ -54,7 +54,7 @@ agent_max_slope = 46.0 region_min_size = 3.0 [node name="Gunbrig" type="RigidBody"] -mass = 2380.0 +mass = 238000.0 physics_material_override = SubResource( 28 ) linear_damp = 1.0 angular_damp = 1.0 diff --git a/godot/scenes/vehicles/ship_parts/SquareSail.gd b/godot/scenes/vehicles/ship_parts/SquareSail.gd index de68c71..b387232 100644 --- a/godot/scenes/vehicles/ship_parts/SquareSail.gd +++ b/godot/scenes/vehicles/ship_parts/SquareSail.gd @@ -4,14 +4,9 @@ var sheet_out: float = -6.2 var wind_bone: int = -1 func _ready(): - $Skeleton/IKL.start() - $Skeleton/IKR.start() wind_bone = $Skeleton.find_bone("Bone") -func _process(_delta): - var old_t = $Skeleton.get_bone_pose(wind_bone) - old_t.origin.y = lerp(old_t.origin.y, 0.0, 0.05) - $Skeleton.set_bone_pose(wind_bone, old_t) - func set_sheet(amount: float): #0 to 1 + $Skeleton/IKL.start(true) + $Skeleton/IKR.start(true) $Sheet.transform.origin.y = amount * sheet_out diff --git a/godot/scenes/vehicles/ship_parts/SquareSail.tscn b/godot/scenes/vehicles/ship_parts/SquareSail.tscn index e662979..61224c9 100644 --- a/godot/scenes/vehicles/ship_parts/SquareSail.tscn +++ b/godot/scenes/vehicles/ship_parts/SquareSail.tscn @@ -216,9 +216,6 @@ use_magnet = true magnet = Vector3( 100, 0, 0 ) target_node = NodePath("../../Sheet/SheetL") -[node name="WindMarker" type="Position3D" parent="Skeleton"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.807913, -3.74433, -0.0811262 ) - [node name="SheetlineL" parent="." instance=ExtResource( 4 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.4745 ) endpoint_path = NodePath("../Sheet/SheetL") diff --git a/godot/scenes/weapons/hands.gd b/godot/scenes/weapons/hands.gd new file mode 100644 index 0000000..567ff85 --- /dev/null +++ b/godot/scenes/weapons/hands.gd @@ -0,0 +1,46 @@ +extends Resource + +var player_owner: RigidBody = null +const fist_damage: int = 15 +var can_swing: bool = true +var blocking: bool = false + +const name: String = "HANDS" + +func init(owner): + player_owner = owner + +func deselect() -> bool: + if can_swing and !blocking: + return true + return false + +func select() -> void: + player_owner.rpc("anim_event", {"VMANIMPLAY" : "humanidle"}) + +func attack1(): + if !can_swing or blocking: + return + can_swing = false + player_owner.rpc("anim_event", {"VMANIMPLAY" : "humanpunch"}) + yield(player_owner.get_tree().create_timer(0.45), "timeout") + if player_owner.melee_ray.is_colliding(): + var hit = player_owner.melee_ray.get_collider() + player_owner.rpc("play_weapon_sound", "res://sounds/punch_generic.wav") + if hit.has_method("damage"): + hit.rpc("damage", fist_damage, "BLUNT", [player_owner.get_network_master(), player_owner.name], "using fists") + if hit.has_method("net_apply_impulse"): + hit.rpc("net_apply_impulse", -100*player_owner.melee_ray.global_transform.basis.z) + yield(player_owner.get_tree().create_timer(0.55), "timeout") + can_swing = true + +func mouse_input(_m1: float, _m3: float, m2: float) -> void: + if m2 > 0 and !blocking and can_swing: + blocking = true + player_owner.rpc("anim_event", {"VMANIMPLAY" : "raise_fists"}) + elif blocking and m2 == 0: + blocking = false + player_owner.rpc("anim_event", {"VMANIMPLAY" : "lower_fists"}) + +func can_pickup() -> bool: + return !blocking and can_swing diff --git a/godot/scenes/weapons/hands.res b/godot/scenes/weapons/hands.res new file mode 100644 index 0000000..e00284f Binary files /dev/null and b/godot/scenes/weapons/hands.res differ diff --git a/godot/scenes/weapons/pistol.gd b/godot/scenes/weapons/pistol.gd new file mode 100644 index 0000000..219696b --- /dev/null +++ b/godot/scenes/weapons/pistol.gd @@ -0,0 +1,64 @@ +extends Resource + +var player_owner: RigidBody = null +const bullet_damage: int = 35 +var can_fire: bool = true +var pistol_scene: Spatial = null +var reloading: bool = false + +const name: String = "PISTOL" +const trfrm = Transform(Vector3(-0.476,2.762,-0.515), Vector3(-1.095,0.299,2.614), Vector3(2.588,0.634,1.011),Vector3(-0.232,0.644,0.006)) + +func _init(): + pistol_scene = preload("res://scenes/weapons/pistol.tscn").instance() + pistol_scene.set_visible(false) + +func init(owner): + player_owner = owner + player_owner.add_weapon_vm(pistol_scene, trfrm) + +func select() -> void: + if can_fire: pistol_scene.get_node("AnimationPlayer").play("idle") + player_owner.rpc("anim_event", {"VMANIMPLAY" : "pistol_idle_vm"}) + pistol_scene.set_visible(true) + +func deselect() -> bool: + if reloading: + return false + pistol_scene.set_visible(false) + return true + +func reload() -> void: + if can_fire or reloading: + return + reloading = true + player_owner.rpc("anim_event", {"VMANIMPLAY" : "pistol_reload_vm"}) + pistol_scene.get_node("PistolReload").play() + yield(player_owner.get_tree().create_timer(2.7), "timeout") + pistol_scene.get_node("AnimationPlayer").play("reset") + can_fire = true + reloading = false + +func attack1(): + if !can_fire: + return + can_fire = false + + pistol_scene.get_node("AnimationPlayer").play("fire") + player_owner.rpc("anim_event", {"VMANIMPLAY" : "pistol_fire_vm"}) + yield(player_owner.get_tree().create_timer(0.05), "timeout") + player_owner.gun_ray.force_raycast_update() + if player_owner.gun_ray.is_colliding(): + var hit = player_owner.gun_ray.get_collider() + if hit.has_method("damage"): + hit.rpc("damage", bullet_damage, "PIERCE", [player_owner.get_network_master(), player_owner.name], "using a pistol") + else: + var puff = preload("res://particles/DirtPuff.tscn").instance() + player_owner.world.add_child(puff) + puff.global_transform.origin = player_owner.gun_ray.get_collision_point() + puff.look_at(player_owner.gun_ray.get_collision_point() + player_owner.gun_ray.get_collision_normal(), Vector3.UP) + if hit.has_method("net_apply_impulse"): + hit.rpc("net_apply_impulse", -150*player_owner.melee_ray.global_transform.basis.z) + +func mouse_input(_m1: float, _m3: float, m2: float) -> void: + pass diff --git a/godot/scenes/weapons/pistol.tres b/godot/scenes/weapons/pistol.tres new file mode 100644 index 0000000..d7342d1 --- /dev/null +++ b/godot/scenes/weapons/pistol.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://scenes/weapons/pistol.gd" type="Script" id=1] + +[resource] +resource_local_to_scene = true +script = ExtResource( 1 ) diff --git a/godot/scenes/weapons/pistol.tscn b/godot/scenes/weapons/pistol.tscn new file mode 100644 index 0000000..6ea9408 --- /dev/null +++ b/godot/scenes/weapons/pistol.tscn @@ -0,0 +1,146 @@ +[gd_scene load_steps=23 format=2] + +[ext_resource path="res://meshes/pistol.tres" type="ArrayMesh" id=1] +[ext_resource path="res://animations/weapons/pistol_idle.tres" type="Animation" id=2] +[ext_resource path="res://animations/weapons/pistol_fire.tres" type="Animation" id=3] +[ext_resource path="res://meshes/pistol_skin.tres" type="Skin" id=4] +[ext_resource path="res://sounds/pistol.wav" type="AudioStream" id=5] +[ext_resource path="res://animations/weapons/pistol_reset.tres" type="Animation" id=6] +[ext_resource path="res://sounds/lock_click.wav" type="AudioStream" id=7] +[ext_resource path="res://sounds/reload_sounds.wav" type="AudioStream" id=8] + +[sub_resource type="Gradient" id=4] +offsets = PoolRealArray( 0, 0.577778 ) +colors = PoolColorArray( 1, 0.633789, 0.0625, 1, 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture" id=5] +gradient = SubResource( 4 ) + +[sub_resource type="Curve" id=6] +max_value = 0.05 +_data = [ Vector2( 0, 0.05 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=7] +curve = SubResource( 6 ) + +[sub_resource type="ParticlesMaterial" id=1] +direction = Vector3( 0, 0.5, 1 ) +spread = 25.06 +initial_velocity = 3.0 +initial_velocity_random = 0.04 +angle = 360.0 +angle_random = 1.0 +scale_random = 0.03 +scale_curve = SubResource( 7 ) +color = Color( 1, 0.678431, 0, 1 ) +color_ramp = SubResource( 5 ) + +[sub_resource type="SpatialMaterial" id=2] +flags_unshaded = true +vertex_color_use_as_albedo = true +params_billboard_mode = 3 +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id=3] +material = SubResource( 2 ) +size = Vector2( 0.25, 1 ) + +[sub_resource type="Gradient" id=13] +offsets = PoolRealArray( 0, 0.16, 0.488889 ) +colors = PoolColorArray( 1, 0, 0, 1, 1, 0.679688, 0, 1, 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture" id=14] +gradient = SubResource( 13 ) + +[sub_resource type="Curve" id=11] +_data = [ Vector2( 0, 0.405045 ), 0.0, 0.0, 0, 0, Vector2( 0.0806452, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.229839, 0 ), 0.0, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=12] +curve = SubResource( 11 ) + +[sub_resource type="ParticlesMaterial" id=8] +spread = 14.56 +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 14.7 +damping = 8.82 +angle = 360.0 +angle_random = 1.0 +scale_random = 0.07 +scale_curve = SubResource( 12 ) +color_ramp = SubResource( 14 ) +hue_variation = 0.07 + +[sub_resource type="SpatialMaterial" id=9] +flags_unshaded = true +vertex_color_use_as_albedo = true +params_billboard_mode = 3 +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="PrismMesh" id=10] +material = SubResource( 9 ) +size = Vector3( 0.3, 0.3, 0.3 ) + +[node name="pistol_model" type="Spatial"] + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "idle" +anims/fire = ExtResource( 3 ) +anims/idle = ExtResource( 2 ) +anims/reset = ExtResource( 6 ) + +[node name="Skeleton" type="Skeleton" parent="."] +bones/0/name = "Hammer" +bones/0/parent = -1 +bones/0/rest = Transform( 0.942829, 0.333276, 9.68673e-08, -0.333276, 0.942829, 1.32945e-07, -4.7022e-08, -1.57628e-07, 1, 0.0808807, 0.0417358, 0.0358447 ) +bones/0/enabled = true +bones/0/bound_children = [ ] +bones/1/name = "Frizzen" +bones/1/parent = -1 +bones/1/rest = Transform( 0.877352, 0.479847, 1.229e-07, -0.479847, 0.877352, -1.26661e-07, -1.68604e-07, 5.21531e-08, 1, 0.16979, 0.0569473, 0.0387622 ) +bones/1/enabled = true +bones/1/bound_children = [ ] +bones/2/name = "neutral_bone" +bones/2/parent = -1 +bones/2/rest = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 ) +bones/2/enabled = true +bones/2/bound_children = [ ] + +[node name="Pistol" type="MeshInstance" parent="Skeleton"] +mesh = ExtResource( 1 ) +skin = ExtResource( 4 ) + +[node name="FireAudio" type="AudioStreamPlayer3D" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.625837, 0, 0 ) +stream = ExtResource( 5 ) +attenuation_model = 2 + +[node name="LockParticles" type="Particles" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14647, 0.0421569, 0 ) +emitting = false +amount = 10 +lifetime = 0.5 +one_shot = true +explosiveness = 0.97 +process_material = SubResource( 1 ) +draw_pass_1 = SubResource( 3 ) + +[node name="MuzzleParticles" type="Particles" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.529256, 0.065655, 0 ) +emitting = false +amount = 16 +lifetime = 0.67 +one_shot = true +explosiveness = 1.0 +process_material = SubResource( 8 ) +draw_pass_1 = SubResource( 10 ) + +[node name="ReloadAudio" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource( 7 ) +unit_db = -6.154 + +[node name="PistolReload" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 8 ) diff --git a/godot/scenes/weapons/rockets.gd b/godot/scenes/weapons/rockets.gd index c519fd6..5270186 100644 --- a/godot/scenes/weapons/rockets.gd +++ b/godot/scenes/weapons/rockets.gd @@ -1,37 +1,47 @@ -extends Node +extends Resource -var weapon_name = "ROCKETS" -var player -onready var world = get_tree().get_root().get_node("GAMEWORLD") +var player_owner: RigidBody = null +var can_throw: bool = true +var rockets_scene: Spatial = null -var ammo_full : int = 50 -var ammo : int +var rockets_left: int = 5 -var reload_time :float= 1.0 -var cooldown_time : float = 0.0 +const name: String = "HANDS" -func _ready(): - ammo = ammo_full - player = get_parent() +var trfrm = Transform ( Vector3(1.501,-0.142,-2.418), Vector3(-2.367,-0.693,-1.429),Vector3(-0.516,2.761,-0.483),Vector3(-0.206,0.639,-0.045)) -func _process(delta): - if cooldown_time > 0.0: - cooldown_time -= delta +func _init(): + rockets_scene = preload("res://scenes/weapons/rockets.tscn").instance() + rockets_scene.set_visible(false) + +func init(owner): + player_owner = owner + player_owner.add_weapon_vm(rockets_scene, trfrm) + +func select() -> void: + player_owner.rpc("anim_event", {"VMANIMPLAY" : "rockets_idle_vm"}) + if rockets_left > 0: rockets_scene.set_visible(true) + +func deselect() -> bool: + if !can_throw and rockets_left > 0: + return false + rockets_scene.set_visible(false) + return true func attack1(): - if cooldown_time <= 0.0 and ammo >= 1: - ammo -= 1 - cooldown_time = reload_time - rpc("add_rocket_to_scene", player.head.global_transform.basis, get_tree().get_network_unique_id()) - -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.shooter_id = id - rocket.global_transform.origin = player.head.global_transform.origin - rocket.global_transform.basis = Basis(-1*dir.z, dir.y, dir.x) - rocket.add_collision_exception_with(player) - -func attack2(): + if !can_throw: + return + can_throw = false + player_owner.rpc("anim_event", {"VMANIMPLAY" : "rockets_launch_vm"}) + rockets_scene.get_node("AnimationPlayer").play("throw_animation") + yield(player_owner.get_tree().create_timer(1.43), "timeout") + rockets_left -= 1 + player_owner.rpc("add_rocket_to_scene", rockets_scene.global_transform.origin, player_owner.head.global_transform.basis, player_owner.get_network_master()) + yield(player_owner.get_tree().create_timer(1.6), "timeout") + if rockets_left > 0: + can_throw = true + else: + rockets_scene.set_visible(false) + +func mouse_input(_m1: float, _m3: float, m2: float) -> void: pass diff --git a/godot/scenes/weapons/rockets.tres b/godot/scenes/weapons/rockets.tres new file mode 100644 index 0000000..c94083f --- /dev/null +++ b/godot/scenes/weapons/rockets.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" load_steps=2 format=2] + +[ext_resource path="res://scenes/weapons/rockets.gd" type="Script" id=1] + +[resource] +resource_local_to_scene = true +script = ExtResource( 1 ) diff --git a/godot/scenes/weapons/rockets.tscn b/godot/scenes/weapons/rockets.tscn new file mode 100644 index 0000000..b2c47d7 --- /dev/null +++ b/godot/scenes/weapons/rockets.tscn @@ -0,0 +1,71 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://meshes/rocket.tres" type="ArrayMesh" id=1] + +[sub_resource type="ParticlesMaterial" id=1] +direction = Vector3( -1, 0, 0 ) +spread = 17.73 +initial_velocity = 3.0 +initial_velocity_random = 0.12 +angle = 360.0 +angle_random = 1.0 +scale = 0.02 +color = Color( 1, 0.701961, 0, 1 ) + +[sub_resource type="SpatialMaterial" id=2] +flags_unshaded = true +vertex_color_use_as_albedo = true +params_billboard_mode = 3 +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id=3] +material = SubResource( 2 ) +size = Vector2( 0.25, 1 ) + +[sub_resource type="Animation" id=4] +resource_name = "throw_animation" +length = 3.0 +tracks/0/type = "value" +tracks/0/path = NodePath("Sparks:emitting") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.5, 2.53138 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 1, +"values": [ false, true, false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 1.4349, 2.55169 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 1, +"values": [ true, false, true ] +} + +[node name="rockets" type="Spatial"] + +[node name="rocket_mesh" type="MeshInstance" parent="."] +transform = Transform( -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0 ) +mesh = ExtResource( 1 ) + +[node name="Sparks" type="Particles" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.217459, 0, 0 ) +emitting = false +amount = 16 +lifetime = 0.25 +local_coords = false +process_material = SubResource( 1 ) +draw_pass_1 = SubResource( 3 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/throw_animation = SubResource( 4 ) diff --git a/godot/scenes/weapons/w_Rockets.tscn b/godot/scenes/weapons/w_Rockets.tscn deleted file mode 100644 index c52f8e3..0000000 --- a/godot/scenes/weapons/w_Rockets.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://scenes/weapons/rockets.gd" type="Script" id=1] - -[node name="w_Rockets" type="Spatial"] -script = ExtResource( 1 ) -- cgit v1.2.3