diff --git a/Asset Sources/Effects/Busy.svg b/Asset Sources/Effects/Busy.svg new file mode 100644 index 0000000..f235322 --- /dev/null +++ b/Asset Sources/Effects/Busy.svg @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + Z + Z + Z + + + + Z + Z + Z + + + + + + + diff --git a/Asset Sources/HUD/Typing.svg b/Asset Sources/HUD/Typing.svg deleted file mode 100644 index 76e70fc..0000000 --- a/Asset Sources/HUD/Typing.svg +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Game/Assets/Characters/Player.gd b/Game/Assets/Characters/Player.gd index 1d2aa0d..e07dd9f 100644 --- a/Game/Assets/Characters/Player.gd +++ b/Game/Assets/Characters/Player.gd @@ -107,6 +107,21 @@ var dead = false: # used to workaround Godot crash when destroying player_nodes $SpawnVFX.emitting = true #set_physics_process(true) dead = value +var focus_banner_alpha = 0 +var focus_banner_inc = 5 +var focus_banner_dec = 1 +var focus_banner_show = false + +var last_viewed_banner = null + +func view_banner(show:bool): + focus_banner_show = show + +@rpc(nosync, reliable, auth) func focus_banner(show:bool): + if show: + $FocusBanner.show() + else: + $FocusBanner.hide() @rpc(auth, nosync,unreliable) func update_movement(player_transform, head_rotation, lin_velocity, jetpack): global_transform = player_transform @@ -125,6 +140,11 @@ var dead = false: # used to workaround Godot crash when destroying player_nodes func _ready() -> void: #Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) view_zoom_target = 1.0 + + var banner_material = $FocusBanner.mesh.surface_get_material(0).duplicate() + $FocusBanner.mesh.surface_set_material(0, banner_material) + + focus_banner(false) if is_multiplayer_authority(): # prevent puppets from attempting to steer the authority - this just causes RPC errors input_active = true @@ -206,8 +226,30 @@ func _process(delta): $Jetpack/JetpackSound.stream_paused = true $Jetpack/OmniLight3D.hide() + # show focus banner on demand + + if focus_banner_show: + focus_banner_alpha = min(focus_banner_alpha + focus_banner_inc * delta, 1.0) + else: + focus_banner_alpha = max(focus_banner_alpha - focus_banner_dec * delta, 0.0) + + $FocusBanner.mesh.surface_get_material(0).set("albedo_color", Color(1,1,1, focus_banner_alpha)) + + print("PLayer: ", name, "; Focus banner alpha: ", focus_banner_alpha, "; Focus banner show: ", focus_banner_show) + if not input_active: return + + # demand seeing other player's banner: + print("Last viewed banner is ", last_viewed_banner) + if $"Head/Camera/RayCast3D".is_colliding(): + print("Probe got ", $"Head/Camera/RayCast3D".get_collider().name) + if $"Head/Camera/RayCast3D".get_collider().has_method(&"view_banner"): + $"Head/Camera/RayCast3D".get_collider().view_banner(true) + last_viewed_banner = $"Head/Camera/RayCast3D".get_collider() + elif last_viewed_banner: + last_viewed_banner.view_banner(false) + #assert(is_multiplayer_authority() == true, "input_active is true, even though the node is not multiplayer_authority") diff --git a/Game/Assets/Characters/Player.tscn b/Game/Assets/Characters/Player.tscn index 31898ca..d568303 100644 --- a/Game/Assets/Characters/Player.tscn +++ b/Game/Assets/Characters/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=3 uid="uid://cwuys43c7ak61"] +[gd_scene load_steps=30 format=3 uid="uid://cwuys43c7ak61"] [ext_resource type="Script" path="res://Assets/Characters/Player.gd" id="1"] [ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="3"] @@ -7,6 +7,7 @@ [ext_resource type="AudioStream" uid="uid://3kb1cqt6lcaq" path="res://Assets/SFX/Player_Spawn.wav" id="5_bmajs"] [ext_resource type="PackedScene" uid="uid://c5cwnfuw4go1b" path="res://Assets/Audio/SoundPlayer.tscn" id="5_yiom2"] [ext_resource type="AudioStream" uid="uid://dpxtkvkdj2ri3" path="res://Assets/SFX/Player_Jump_02.wav" id="6_s024f"] +[ext_resource type="Texture2D" uid="uid://w2koos4gq0r8" path="res://Assets/Effects/Busy.png" id="8_0hice"] [sub_resource type="StandardMaterial3D" id="4"] albedo_color = Color(0.545098, 0.545098, 0.545098, 1) @@ -123,6 +124,18 @@ sections = 7 section_length = 0.418 curve = SubResource( "Curve_gq708" ) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ctb51"] +transparency = 1 +no_depth_test = true +shading_mode = 0 +albedo_texture = ExtResource( "8_0hice" ) +disable_receive_shadows = true +billboard_mode = 1 +point_size = 47.3 + +[sub_resource type="QuadMesh" id="QuadMesh_nhjmb"] +material = SubResource( "StandardMaterial3D_ctb51" ) + [node name="Player" type="CharacterBody3D"] disable_mode = 2 collision_layer = 2 @@ -132,6 +145,7 @@ script = ExtResource( "1" ) [node name="Mesh" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.852763, 0) layers = 2 +cast_shadow = 0 mesh = SubResource( "1" ) surface_material_override/0 = null script = null @@ -154,6 +168,12 @@ script = null [node name="Tween" type="Node" parent="Head/Camera"] script = null +[node name="RayCast3D" type="RayCast3D" parent="Head/Camera"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.77099e-07, 0, -0.742805) +target_position = Vector3(0, 0, -1000) +collision_mask = 2 +script = null + [node name="Body" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.852763, 0) shape = SubResource( "2" ) @@ -269,4 +289,11 @@ script = null [node name="AudioStreamPlayer3D" parent="JumpSFX" index="0"] stream = ExtResource( "6_s024f" ) +[node name="FocusBanner" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +cast_shadow = 0 +mesh = SubResource( "QuadMesh_nhjmb" ) +surface_material_override/0 = null +script = null + [editable path="JumpSFX"] diff --git a/Game/Assets/Effects/Busy.png b/Game/Assets/Effects/Busy.png new file mode 100644 index 0000000..57ce747 --- /dev/null +++ b/Game/Assets/Effects/Busy.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:043c03b3ac12087ce618199bc19e5a444c9780a4e08baabbdd858ea7e530383e +size 14849 diff --git a/Game/Assets/Effects/Busy.png.import b/Game/Assets/Effects/Busy.png.import new file mode 100644 index 0000000..3856ee9 --- /dev/null +++ b/Game/Assets/Effects/Busy.png.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="StreamTexture2D" +uid="uid://w2koos4gq0r8" +path.s3tc="res://.godot/imported/Busy.png-2503879d0244aad9744ea454295024a6.s3tc.stex" +path.etc2="res://.godot/imported/Busy.png-2503879d0244aad9744ea454295024a6.etc2.stex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://Assets/Effects/Busy.png" +dest_files=["res://.godot/imported/Busy.png-2503879d0244aad9744ea454295024a6.s3tc.stex", "res://.godot/imported/Busy.png-2503879d0244aad9744ea454295024a6.etc2.stex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +compress/streamed=false +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/HDR_as_SRGB=false +process/size_limit=0 +detect_3d/compress_to=0 +svg/scale=1.0 diff --git a/Game/Main.gd b/Game/Main.gd index a54389c..2863090 100644 --- a/Game/Main.gd +++ b/Game/Main.gd @@ -146,18 +146,22 @@ var focus:GameFocus: hud.hide() if local_player: local_player.input_active = false + local_player.rpc(&"focus_banner", true) 1: # GAME Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) gui.hide() hud.show() if local_player: local_player.input_active = true + local_player.rpc(&"focus_banner", false) 2: # CHAT if local_player: local_player.input_active = false + local_player.rpc(&"focus_banner", true) 3: #AWAY if local_player: local_player.input_active = true + local_player.rpc(&"focus_banner", true) focus = new_focus @@ -229,7 +233,10 @@ func update_hud(): else: hud.get_node("ScoreRank").text += str(rank) + "\nGAP: " + str(-lead) -@rpc(any, reliable) func player_list_update(info, pid = get_tree().get_rpc_sender_id()): +@rpc(any, reliable) func player_list_update(info, pid = get_tree().get_rpc_sender_id(), erase:=false): + if erase: + player_list.erase(pid) + var new_info = PlayerInfo.new() new_info.deserialize(info) @@ -394,10 +401,13 @@ func _player_connected(pid) -> void: func _player_disconnected(pid) -> void: print("player disconnected, id: ", pid) - - if get_tree().multiplayer.is_server(): # if we're the server, broadcast that a player left + spawn_queue.erase(pid) + if get_tree().multiplayer.is_server(): chat.rpc(&'chat_notification', "Player [b]" + player_list.get(pid).name + "[/b] left") - + player_list.erase(pid) + rpc(&'player_list_update', null, pid, true) + rpc(&'destroy_player', pid) + func _connected_ok() -> void: print("connected to server") chat.chat_notification("Connected to server")