fix some edgecases with spectating and such

This commit is contained in:
bgkillas 2024-08-25 11:13:24 -04:00
parent ebb28b80f7
commit 81bbd5a96d
4 changed files with 7 additions and 4 deletions

View file

@ -135,7 +135,7 @@ local function get_sync_entities(return_all)
else
table_extend_filtered(entities2, entities, function(ent)
local x, y = EntityGetTransform(ent)
local has_anyone = #EntityGetInRadiusWithTag(x, y, DISTANCE_LIMIT, "ew_peer") > 0
local has_anyone = #EntityGetInRadiusWithTag(x, y, DISTANCE_LIMIT, "ew_client") > 0
if not has_anyone then
skipped_counter = skipped_counter + 1
end

View file

@ -116,6 +116,7 @@ local function player_died()
EntityAddChild(ctx.my_player.entity, iron)
rpc.add_nickname(ctx.my_id)
remove_healthbar_locally()
EntityAddComponent2(ctx.my_player.entity, "StreamingKeepAliveComponent")
end)
end

View file

@ -390,9 +390,6 @@
<WalletComponent>
</WalletComponent>
<StreamingKeepAliveComponent>
</StreamingKeepAliveComponent>
<KickComponent>
</KickComponent>

View file

@ -637,9 +637,14 @@ local function set_camera_pos()
inventory_target = EntityAddComponent2(cam_target, "InventoryGuiComponent")
end
local audio = EntityGetFirstComponent(camera_target, "AudioListenerComponent")
local keep_alive = EntityGetFirstComponent(camera_target, "StreamingKeepAliveComponent")
if audio ~= nil then
EntityRemoveComponent(camera_target, audio)
if camera_target ~= ctx.my_player.ent then
EntityRemoveComponent(camera_target, keep_alive)
end
EntityAddComponent2(cam_target, "AudioListenerComponent")
EntityAddComponent2(cam_target, "StreamingKeepAliveComponent")
end
end
camera_target = cam_target