Added "Focus Banner" - a billboard indicating if players are AFK. Shows up after aiming on them to not reveal invisible players.

main
unfa 2021-09-26 00:46:34 +02:00
parent e67ab9131c
commit 5ceaccead1
7 changed files with 359 additions and 119 deletions

View File

@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="35.691444mm"
height="35.691444mm"
viewBox="0 0 35.691444 35.691444"
version="1.1"
id="svg5"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
sodipodi:docname="Busy.svg"
inkscape:export-filename="/data/Projects/Games/Liblast/Game/Assets/Effects/Busy.png"
inkscape:export-xdpi="182.1837"
inkscape:export-ydpi="182.1837"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
showguides="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="2.8284272"
inkscape:cx="76.013977"
inkscape:cy="126.92566"
inkscape:window-width="1920"
inkscape:window-height="1051"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-25.239306,-69.836283)">
<rect
style="fill:#1a1a1a;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect846"
width="134.8968"
height="134.8968"
x="93.949081"
y="265.58179"
transform="matrix(0.26458333,0,0,0.26458333,0.38194447,-81.418261)"
ry="15.501829" />
<g
id="g1403"
transform="translate(-0.32552103,-80.940569)">
<g
id="g1408"
transform="matrix(1.2861969,0,0,1.2861969,-5.4467756,-29.537825)">
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="path1018"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,-0.39286945,0.05051189)" />
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="circle1100"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,6.6738625,0.05051189)" />
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="circle1102"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,13.740594,0.05051189)" />
</g>
<g
id="g1295"
transform="translate(48.563822,-0.2929655)">
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect892"
width="17.665462"
height="72.902885"
x="108.97824"
y="299.32016"
transform="matrix(-0.06837626,0,0,0.26458333,59.865801,-0.85719203)" />
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect1126"
width="27.746"
height="6.2045555"
x="181.90314"
y="290.96198"
transform="matrix(0.26458333,0,0,0.26458333,0.01122486,0.17678874)" />
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect1290"
width="27.746"
height="6.2045555"
x="181.90314"
y="290.96198"
transform="matrix(0.26458333,0,0,0.26458333,0.01122486,20.073233)" />
</g>
</g>
<g
id="g4978"
transform="translate(26.483624,-81.133982)">
<g
id="g4354"
transform="matrix(1.0511794,-0.10702792,0.10682266,1.0531992,-17.421238,-8.1814737)"
style="stroke:#000000;stroke-width:3.0257;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:11.4357;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none"
x="-85.426476"
y="382.01416"
id="text2332"
transform="matrix(0.26458333,0,0,0.26458333,25.239306,69.836283)"><tspan
sodipodi:role="line"
id="tspan2330"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#000000;stroke-width:11.4357;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">Z</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:8.09743;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none"
x="-85.426476"
y="382.01416"
id="text4342"
transform="matrix(0.3736614,0,0,0.3736614,40.606422,27.958017)"><tspan
sodipodi:role="line"
id="tspan4340"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#000000;stroke-width:8.09743;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">Z</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:5.50795;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none"
x="-85.426476"
y="382.01416"
id="text4346"
transform="matrix(0.54933213,0,0,0.54933213,63.985676,-38.633129)"><tspan
sodipodi:role="line"
id="tspan4344"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#000000;stroke-width:5.50795;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">Z</tspan></text>
</g>
<ellipse
style="fill:#ffffff;stroke:#000000;stroke-width:7.55906;stroke-linecap:round;stroke-linejoin:round;paint-order:markers stroke fill"
id="path4378"
cx="-37.236206"
cy="348.5336"
transform="matrix(0.15624209,-0.0158163,0.0158163,0.15624209,16.323982,110.1488)"
rx="102.22083"
ry="75.96608" />
<g
id="g4490"
style="stroke:#ffffff;stroke-width:1.89106;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
transform="matrix(1.0511794,-0.10702792,0.10682266,1.0531992,-17.421238,-8.1814737)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:7.14732;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
x="-85.426476"
y="382.01416"
id="text4480"
transform="matrix(0.26458333,0,0,0.26458333,25.239306,69.836283)"><tspan
sodipodi:role="line"
id="tspan4478"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#ffffff;stroke-width:7.14732;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill">Z</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:5.06089;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
x="-85.426476"
y="382.01416"
id="text4484"
transform="matrix(0.3736614,0,0,0.3736614,40.606422,27.958017)"><tspan
sodipodi:role="line"
id="tspan4482"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#ffffff;stroke-width:5.06089;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill">Z</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:3.44247;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
x="-85.426476"
y="382.01416"
id="text4488"
transform="matrix(0.54933213,0,0,0.54933213,63.985676,-38.633129)"><tspan
sodipodi:role="line"
id="tspan4486"
x="-85.426476"
y="382.01416"
style="font-weight:bold;stroke:#ffffff;stroke-width:3.44247;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill">Z</tspan></text>
</g>
<ellipse
style="fill:#ffffff;stroke:#000000;stroke-width:28.5424;stroke-linecap:round;stroke-linejoin:round;paint-order:markers stroke fill"
id="ellipse4800"
cx="-37.236206"
cy="348.5336"
transform="matrix(0.04197888,-0.00412883,0.00424949,0.0407868,23.549345,162.94028)"
rx="102.22083"
ry="75.96608" />
<ellipse
style="fill:#ffffff;stroke:#000000;stroke-width:45.6509;stroke-linecap:round;stroke-linejoin:round;paint-order:markers stroke fill"
id="ellipse4802"
cx="-37.236206"
cy="348.5336"
transform="matrix(0.02650169,-0.00255661,0.00268275,0.02525559,21.684179,172.89382)"
rx="102.22083"
ry="75.96608" />
<ellipse
style="fill:#ffffff;stroke:#000000;stroke-width:79.0643;stroke-linecap:round;stroke-linejoin:round;paint-order:markers stroke fill"
id="ellipse4804"
cx="-37.236206"
cy="348.5336"
transform="matrix(0.01553516,-0.00145399,0.00157261,0.01436327,19.348644,179.55458)"
rx="102.22083"
ry="75.96608" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="35.691444mm"
height="35.691444mm"
viewBox="0 0 35.691444 35.691444"
version="1.1"
id="svg5"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
sodipodi:docname="Typing.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
showguides="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.4142136"
inkscape:cx="84.145707"
inkscape:cy="106.41957"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-25.239306,-69.836283)">
<rect
style="fill:#1a1a1a;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect846"
width="134.8968"
height="134.8968"
x="93.949081"
y="265.58179"
transform="matrix(0.26458333,0,0,0.26458333,0.38194527,-0.43223007)"
ry="15.501829" />
<g
id="g1403"
transform="translate(-0.32552103,0.04546184)">
<g
id="g1408"
transform="matrix(0.86797791,0,0,0.86797791,5.1609046,10.76183)">
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="path1018"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,-0.39286945,0.05051189)" />
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="circle1100"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,6.6738625,0.05051189)" />
<circle
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="circle1102"
cx="118.34465"
cy="364.00507"
r="7.9967141"
transform="matrix(0.26458333,0,0,0.26458333,13.740594,0.05051189)" />
</g>
<g
id="g1295"
transform="translate(1.1786278,-0.2929655)">
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect892"
width="17.665462"
height="72.902885"
x="108.97824"
y="299.32016"
transform="matrix(-0.06837626,0,0,0.26458333,59.865801,-0.85719203)" />
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect1126"
width="27.746"
height="6.2045555"
x="181.90314"
y="290.96198"
transform="matrix(0.26458333,0,0,0.26458333,0.01122486,0.17678874)" />
<rect
style="fill:#ffffff;stroke:#4d4d4d;stroke-width:0;stroke-linecap:round;paint-order:markers stroke fill"
id="rect1290"
width="27.746"
height="6.2045555"
x="181.90314"
y="290.96198"
transform="matrix(0.26458333,0,0,0.26458333,0.01122486,20.073233)" />
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -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")

View File

@ -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"]

BIN
Game/Assets/Effects/Busy.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -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

View File

@ -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")