2024-09-01 19:25:01 -04:00
|
|
|
local nickname = dofile_once("mods/quant.ew/files/system/nickname.lua")
|
|
|
|
|
2024-08-25 17:10:57 -04:00
|
|
|
local spectate = {}
|
|
|
|
|
2024-08-28 13:54:05 +03:00
|
|
|
local gui = GuiCreate()
|
|
|
|
|
2024-08-26 15:02:50 -04:00
|
|
|
local camera_player
|
2024-08-25 17:10:57 -04:00
|
|
|
|
2024-08-26 15:02:50 -04:00
|
|
|
local re_cam = false
|
|
|
|
|
|
|
|
local camera_player_id
|
2024-08-26 12:25:16 -04:00
|
|
|
|
2024-08-25 17:10:57 -04:00
|
|
|
local camera_target
|
|
|
|
|
2024-08-26 12:25:16 -04:00
|
|
|
local cam_target
|
|
|
|
|
2024-08-25 17:10:57 -04:00
|
|
|
local inventory_target
|
|
|
|
|
2024-08-28 12:18:40 -04:00
|
|
|
local was_notplayer = false
|
|
|
|
|
2024-09-13 17:20:19 -04:00
|
|
|
local has_switched = false
|
|
|
|
|
2024-10-09 20:53:29 -04:00
|
|
|
local attached = false
|
|
|
|
|
2024-10-26 19:32:01 -04:00
|
|
|
local redo = false
|
|
|
|
|
2024-10-09 21:51:36 -04:00
|
|
|
local function perks_ui(enable)
|
|
|
|
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
|
|
|
if EntityHasTag(child, "perk_entity") then
|
|
|
|
local ui = EntityGetFirstComponentIncludingDisabled(child, "UIIconComponent")
|
|
|
|
if ui ~= nil then
|
|
|
|
local sprite = ComponentGetValue2(ui, "icon_sprite_file")
|
|
|
|
if string.sub(sprite, -1, -1) == "g" then
|
|
|
|
if not enable then
|
|
|
|
ComponentSetValue2(ui, "icon_sprite_file", string.sub(sprite, 0, -2))
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if enable then
|
|
|
|
ComponentSetValue2(ui, "icon_sprite_file", sprite .. "g")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-10-09 20:53:29 -04:00
|
|
|
function spectate.disable_throwing(enable, entity)
|
|
|
|
if entity == nil then
|
|
|
|
entity = cam_target.entity
|
|
|
|
end
|
2024-10-06 21:54:21 -04:00
|
|
|
local inv
|
2024-10-09 20:53:29 -04:00
|
|
|
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
|
2024-10-06 21:54:21 -04:00
|
|
|
if EntityGetName(child) == "inventory_quick" then
|
|
|
|
inv = child
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _, item in ipairs(EntityGetAllChildren(inv) or {}) do
|
|
|
|
local com = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
|
|
|
if com ~= nil then
|
|
|
|
ComponentSetValue2(com, "permanently_attached", enable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-08-26 15:02:50 -04:00
|
|
|
local function get_me()
|
|
|
|
local i = 0
|
2024-09-27 09:06:18 -04:00
|
|
|
local alive = -1, -1
|
|
|
|
for peer_id, potential_target in pairs(ctx.players) do
|
|
|
|
if GameHasFlagRun("ending_game_completed") and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
|
|
|
goto continue
|
|
|
|
end
|
2024-08-26 15:02:50 -04:00
|
|
|
i = i + 1
|
2024-09-27 09:06:18 -04:00
|
|
|
alive = peer_id, i
|
2024-08-26 15:02:50 -04:00
|
|
|
if peer_id == ctx.my_id then
|
2024-09-27 09:06:18 -04:00
|
|
|
return peer_id, i
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
::continue::
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
return alive
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
|
|
|
|
2024-10-15 17:01:22 -04:00
|
|
|
local function set_camera_free(enable)
|
|
|
|
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
|
|
|
if cam ~= nil then
|
|
|
|
ComponentSetValue2(cam, "center_camera_on_this_entity", not enable)
|
|
|
|
ComponentSetValue2(cam, "move_camera_with_aim", not enable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-10-26 19:32:01 -04:00
|
|
|
local function set_camera_position(x, y)
|
2024-10-15 17:01:22 -04:00
|
|
|
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
|
|
|
if cam ~= nil then
|
|
|
|
ComponentSetValue2(cam, "mDesiredCameraPos", x, y)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-08-26 12:25:16 -04:00
|
|
|
local function target()
|
2024-08-28 15:58:23 -04:00
|
|
|
if cam_target.entity == ctx.my_player.entity and not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
2024-10-09 21:51:36 -04:00
|
|
|
perks_ui(true)
|
2024-10-09 20:53:29 -04:00
|
|
|
if attached then
|
|
|
|
local inv_me = EntityGetFirstComponent(ctx.my_player.entity, "InventoryGuiComponent")
|
|
|
|
if inv_me ~= nil then
|
|
|
|
ComponentSetValue2(inv_me, "mActive", attached)
|
|
|
|
end
|
|
|
|
attached = false
|
|
|
|
end
|
2024-09-01 19:25:01 -04:00
|
|
|
local sprite = EntityGetFirstComponent(ctx.my_player.entity, "SpriteComponent", "ew_nickname")
|
2024-10-07 20:18:34 -04:00
|
|
|
if sprite ~= nil and not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
2024-09-01 19:25:01 -04:00
|
|
|
EntityRemoveComponent(ctx.my_player.entity, sprite)
|
|
|
|
end
|
2024-10-26 19:32:01 -04:00
|
|
|
set_camera_free(false)
|
2024-08-26 12:25:16 -04:00
|
|
|
if camera_target == nil then
|
2024-08-28 15:58:23 -04:00
|
|
|
camera_target = ctx.my_player
|
|
|
|
elseif camera_target.entity ~= ctx.my_player.entity then
|
|
|
|
local audio = EntityGetFirstComponent(camera_target.entity, "AudioListenerComponent")
|
|
|
|
local audio_n = EntityAddComponent2(cam_target.entity, "AudioListenerComponent")
|
2024-09-21 17:17:32 -04:00
|
|
|
if audio == nil then
|
|
|
|
ComponentSetValue2(audio_n, "z", -60)
|
|
|
|
else
|
|
|
|
ComponentSetValue2(audio_n, "z", ComponentGetValue2(audio, "z"))
|
|
|
|
end
|
2024-10-02 19:18:49 -04:00
|
|
|
--local keep_alive = EntityGetFirstComponent(camera_target.entity, "StreamingKeepAliveComponent")
|
2024-08-28 15:58:23 -04:00
|
|
|
EntityRemoveComponent(camera_target.entity, audio)
|
2024-10-02 19:18:49 -04:00
|
|
|
--if keep_alive ~= nil then
|
|
|
|
-- EntityRemoveComponent(camera_target.entity, keep_alive)
|
|
|
|
--end
|
2024-08-28 15:58:23 -04:00
|
|
|
EntityRemoveComponent(camera_target.entity, inventory_target)
|
2024-08-26 12:25:16 -04:00
|
|
|
camera_target = cam_target
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
2024-10-15 17:01:22 -04:00
|
|
|
set_camera_free(true)
|
2024-09-27 09:06:18 -04:00
|
|
|
if cam_target == nil or not EntityGetIsAlive(cam_target.entity) then
|
2024-10-26 19:32:01 -04:00
|
|
|
redo = true
|
2024-08-28 15:03:21 -04:00
|
|
|
return
|
|
|
|
end
|
2024-09-08 19:11:03 -04:00
|
|
|
local my_x, my_y = GameGetCameraPos()
|
|
|
|
local mx, my
|
2024-10-04 19:19:59 -04:00
|
|
|
local to_x, to_y = EntityGetTransform(cam_target.entity)
|
2024-10-13 10:31:22 -04:00
|
|
|
if to_x == nil then
|
|
|
|
return
|
|
|
|
end
|
2024-09-08 19:11:03 -04:00
|
|
|
if GameGetIsGamepadConnected() then
|
2024-10-04 19:19:59 -04:00
|
|
|
mx, my = InputGetJoystickAnalogStick(0, 1)
|
|
|
|
mx, my = mx * 256 + to_x, my * 256 + to_y
|
2024-09-08 19:11:03 -04:00
|
|
|
else
|
|
|
|
mx, my = DEBUG_GetMouseWorld()
|
|
|
|
end
|
|
|
|
local t_x, t_y = to_x + (mx - to_x) / 3 , to_y + (my - to_y) / 3
|
|
|
|
local dx, dy = t_x - my_x, t_y - my_y
|
|
|
|
local di = dx * dx + dy * dy
|
2024-10-18 07:28:28 -04:00
|
|
|
if di > 512 * 512 then
|
2024-10-26 19:32:01 -04:00
|
|
|
set_camera_position(to_x, to_y)
|
2024-09-08 19:11:03 -04:00
|
|
|
else
|
|
|
|
local cos, sin = dx / 512, dy / 512
|
|
|
|
local d = math.sqrt(di)
|
|
|
|
dx, dy = d * cos, d * sin
|
2024-10-26 19:32:01 -04:00
|
|
|
set_camera_position(my_x + dx, my_y + dy)
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
|
|
|
if camera_target == nil then
|
2024-08-28 15:58:23 -04:00
|
|
|
camera_target = ctx.my_player
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
2024-10-26 19:32:01 -04:00
|
|
|
if camera_target.entity ~= cam_target.entity or redo then
|
|
|
|
redo = false
|
2024-10-09 20:53:29 -04:00
|
|
|
if EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
|
|
|
if cam_target.entity ~= ctx.my_player.entity then
|
|
|
|
spectate.disable_throwing(false, ctx.my_player.entity)
|
|
|
|
elseif attached then
|
|
|
|
spectate.disable_throwing(true, ctx.my_player.entity)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if attached then
|
|
|
|
local inv_me = EntityGetFirstComponent(ctx.my_player.entity, "InventoryGuiComponent")
|
|
|
|
if inv_me ~= nil then
|
|
|
|
ComponentSetValue2(inv_me, "mActive", attached)
|
|
|
|
end
|
|
|
|
attached = false
|
|
|
|
end
|
2024-10-15 16:46:48 -04:00
|
|
|
if cam_target == ctx.my_player then
|
2024-10-09 21:51:36 -04:00
|
|
|
perks_ui(true)
|
2024-10-15 16:46:48 -04:00
|
|
|
else
|
2024-10-07 20:18:34 -04:00
|
|
|
if not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
2024-10-06 12:58:05 -04:00
|
|
|
nickname.add_label(ctx.my_player.entity, ctx.my_player.name, "data/fonts/font_pixel_white.xml", 0.75)
|
|
|
|
end
|
2024-09-01 19:25:01 -04:00
|
|
|
end
|
2024-08-28 15:58:23 -04:00
|
|
|
if ctx.my_player.entity ~= camera_target.entity and inventory_target ~= nil then
|
|
|
|
EntityRemoveComponent(camera_target.entity, inventory_target)
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
inventory_target = nil
|
2024-08-28 15:58:23 -04:00
|
|
|
if ctx.my_player.entity ~= cam_target.entity then
|
|
|
|
inventory_target = EntityAddComponent2(cam_target.entity, "InventoryGuiComponent")
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
2024-08-28 15:58:23 -04:00
|
|
|
local audio = EntityGetFirstComponent(camera_target.entity, "AudioListenerComponent")
|
2024-10-02 19:18:49 -04:00
|
|
|
--local keep_alive = EntityGetFirstComponent(camera_target.entity, "StreamingKeepAliveComponent")
|
2024-08-26 12:25:16 -04:00
|
|
|
if audio ~= nil then
|
2024-08-28 15:58:23 -04:00
|
|
|
local audio_n = EntityAddComponent2(cam_target.entity, "AudioListenerComponent")
|
2024-08-28 12:18:40 -04:00
|
|
|
ComponentSetValue2(audio_n, "z", ComponentGetValue2(audio, "z"))
|
2024-08-28 15:58:23 -04:00
|
|
|
EntityRemoveComponent(camera_target.entity, audio)
|
2024-10-02 19:18:49 -04:00
|
|
|
--if camera_target.entity ~= ctx.my_player.entity and keep_alive ~= nil and not EntityHasTag(camera_target.entity, "ew_notplayer") then
|
|
|
|
-- EntityRemoveComponent(camera_target.entity, keep_alive)
|
|
|
|
--end
|
|
|
|
--if cam_target.entity ~= ctx.my_player.entity and not EntityHasTag(cam_target, "ew_notplayer") then
|
|
|
|
-- EntityAddComponent2(cam_target.entity, "StreamingKeepAliveComponent")
|
|
|
|
--end
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
camera_target = cam_target
|
|
|
|
end
|
|
|
|
|
2024-08-25 17:10:57 -04:00
|
|
|
local function set_camera_pos()
|
2024-08-26 15:02:50 -04:00
|
|
|
if cam_target == nil or re_cam then
|
|
|
|
local i = 0
|
2024-08-26 12:25:16 -04:00
|
|
|
for peer_id, potential_target in pairs(ctx.players) do
|
2024-09-27 09:06:18 -04:00
|
|
|
if GameHasFlagRun("ending_game_completed") and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
|
|
|
goto continue
|
|
|
|
end
|
2024-08-26 12:25:16 -04:00
|
|
|
i = i + 1
|
2024-08-26 18:10:50 -04:00
|
|
|
if i == camera_player then
|
2024-08-28 15:58:23 -04:00
|
|
|
cam_target = potential_target
|
2024-08-26 12:25:16 -04:00
|
|
|
camera_player = i
|
2024-08-26 15:02:50 -04:00
|
|
|
re_cam = false
|
2024-08-26 12:25:16 -04:00
|
|
|
camera_player_id = peer_id
|
|
|
|
break
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
::continue::
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-08-26 15:02:50 -04:00
|
|
|
if cam_target == nil then
|
2024-09-27 09:06:18 -04:00
|
|
|
camera_player_id, camera_player = get_me()
|
2024-08-26 15:02:50 -04:00
|
|
|
re_cam = true
|
2024-08-26 12:25:16 -04:00
|
|
|
set_camera_pos()
|
|
|
|
else
|
|
|
|
target()
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-08-26 12:25:16 -04:00
|
|
|
else
|
|
|
|
target()
|
|
|
|
end
|
|
|
|
end
|
2024-08-25 17:10:57 -04:00
|
|
|
|
2024-08-26 12:25:16 -04:00
|
|
|
local function update_i()
|
2024-08-26 15:02:50 -04:00
|
|
|
local i = 0
|
2024-09-27 09:06:18 -04:00
|
|
|
for peer_id, potential_target in pairs(ctx.players) do
|
|
|
|
if GameHasFlagRun("ending_game_completed") and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
|
|
|
goto continue
|
|
|
|
end
|
2024-08-26 12:25:16 -04:00
|
|
|
i = i + 1
|
|
|
|
if peer_id == camera_player_id then
|
|
|
|
camera_player = i
|
2024-08-26 15:02:50 -04:00
|
|
|
re_cam = true
|
|
|
|
return
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
::continue::
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
camera_player_id, camera_player = get_me()
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local function number_of_players()
|
|
|
|
local i = 0
|
2024-09-27 09:06:18 -04:00
|
|
|
for _, potential_target in pairs(ctx.players) do
|
|
|
|
if GameHasFlagRun("ending_game_completed") and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
|
|
|
goto continue
|
|
|
|
end
|
2024-08-26 15:02:50 -04:00
|
|
|
i = i + 1
|
2024-09-27 09:06:18 -04:00
|
|
|
::continue::
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
|
|
|
return i
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
|
|
|
|
2024-08-26 12:25:16 -04:00
|
|
|
local last_len
|
2024-08-25 17:10:57 -04:00
|
|
|
|
|
|
|
function spectate.on_world_update()
|
2024-10-13 12:06:05 -04:00
|
|
|
if ctx.run_ended then
|
|
|
|
return
|
|
|
|
end
|
2024-08-28 12:18:40 -04:00
|
|
|
if EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
|
|
|
was_notplayer = true
|
|
|
|
elseif was_notplayer then
|
|
|
|
was_notplayer = false
|
2024-09-27 09:06:18 -04:00
|
|
|
camera_player_id, camera_player = get_me()
|
2024-08-28 12:18:40 -04:00
|
|
|
re_cam = true
|
|
|
|
end
|
2024-08-26 15:02:50 -04:00
|
|
|
if camera_player == nil then
|
2024-09-27 09:06:18 -04:00
|
|
|
camera_player_id, camera_player = get_me()
|
2024-08-28 12:18:40 -04:00
|
|
|
re_cam = true
|
2024-08-26 15:02:50 -04:00
|
|
|
end
|
2024-08-26 12:25:16 -04:00
|
|
|
if last_len == nil then
|
2024-08-26 15:02:50 -04:00
|
|
|
last_len = number_of_players()
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
2024-08-28 15:58:23 -04:00
|
|
|
if last_len ~= number_of_players() or (cam_target ~= nil and not EntityGetIsAlive(cam_target.entity)) then
|
2024-08-26 12:25:16 -04:00
|
|
|
update_i()
|
2024-08-26 15:02:50 -04:00
|
|
|
last_len = number_of_players()
|
2024-08-26 12:25:16 -04:00
|
|
|
end
|
2024-09-27 09:06:18 -04:00
|
|
|
if cam_target ~= nil and GameHasFlagRun("ending_game_completed") and EntityHasTag(cam_target.entity, "ew_notplayer") then
|
|
|
|
update_i()
|
|
|
|
last_len = number_of_players()
|
|
|
|
end
|
|
|
|
if camera_player == -1 then
|
|
|
|
return
|
|
|
|
end
|
2024-08-26 12:25:16 -04:00
|
|
|
|
2024-09-02 14:00:39 -04:00
|
|
|
if InputIsKeyJustDown(54) or InputIsJoystickButtonJustDown(0, 13) then
|
2024-09-01 11:54:10 +03:00
|
|
|
camera_player = camera_player - 1
|
|
|
|
if camera_player < 1 then
|
|
|
|
camera_player = last_len
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-09-01 11:54:10 +03:00
|
|
|
|
2024-09-13 17:20:19 -04:00
|
|
|
has_switched = true
|
2024-09-01 11:54:10 +03:00
|
|
|
re_cam = true
|
2024-09-02 14:00:39 -04:00
|
|
|
elseif InputIsKeyJustDown(55) or InputIsJoystickButtonJustDown(0, 14) then
|
2024-09-01 11:54:10 +03:00
|
|
|
camera_player = camera_player + 1
|
|
|
|
if camera_player > last_len then
|
|
|
|
camera_player = 1
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
2024-09-01 11:54:10 +03:00
|
|
|
|
2024-09-13 17:20:19 -04:00
|
|
|
has_switched = true
|
2024-09-01 11:54:10 +03:00
|
|
|
re_cam = true
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
|
|
|
set_camera_pos()
|
2024-08-27 19:54:54 +03:00
|
|
|
ctx.spectating_over_peer_id = camera_player_id
|
2024-08-28 13:54:05 +03:00
|
|
|
|
2024-09-13 17:20:19 -04:00
|
|
|
if GameHasFlagRun("ew_flag_notplayer_active") and not has_switched then
|
2024-10-07 20:18:34 -04:00
|
|
|
GuiStartFrame(gui)
|
|
|
|
GuiZSet(gui, 11)
|
2024-08-28 13:54:05 +03:00
|
|
|
local w, h = GuiGetScreenDimensions(gui)
|
2024-09-02 14:00:39 -04:00
|
|
|
local text
|
|
|
|
if GameGetIsGamepadConnected() then
|
|
|
|
text = "Use d-pad-left and d-pad-right keys to spectate over other players."
|
|
|
|
else
|
|
|
|
text = "Use ',' and '.' keys to spectate over other players."
|
|
|
|
end
|
2024-08-28 13:54:05 +03:00
|
|
|
local tw, th = GuiGetTextDimensions(gui, text)
|
|
|
|
GuiText(gui, w-2-tw, h-1-th, text)
|
|
|
|
end
|
2024-08-28 18:53:18 -04:00
|
|
|
if cam_target.entity ~= ctx.my_player.entity then
|
|
|
|
local inv_spec = EntityGetFirstComponent(cam_target.entity, "InventoryGuiComponent")
|
|
|
|
local inv_me = EntityGetFirstComponent(ctx.my_player.entity, "InventoryGuiComponent")
|
2024-08-29 11:22:07 -04:00
|
|
|
if inv_spec ~= nil then
|
2024-10-07 20:18:34 -04:00
|
|
|
if inv_me == nil then
|
|
|
|
if InputIsKeyJustDown(43) or InputIsJoystickButtonJustDown(0, 16) then
|
|
|
|
attached = not ComponentGetValue2(inv_spec, "mActive")
|
|
|
|
ComponentSetValue2(inv_spec, "mActive", attached)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if ComponentGetValue2(inv_me, "mActive") then
|
|
|
|
attached = not ComponentGetValue2(inv_spec, "mActive")
|
|
|
|
ComponentSetValue2(inv_spec, "mActive", attached)
|
|
|
|
end
|
2024-10-06 20:49:39 -04:00
|
|
|
end
|
2024-10-07 07:44:15 -04:00
|
|
|
spectate.disable_throwing(attached)
|
2024-08-29 11:22:07 -04:00
|
|
|
end
|
2024-10-05 06:12:44 -04:00
|
|
|
if inv_me ~= nil then
|
|
|
|
ComponentSetValue2(inv_me, "mActive", false)
|
|
|
|
end
|
2024-10-09 21:51:36 -04:00
|
|
|
perks_ui(false)
|
2024-09-13 17:20:19 -04:00
|
|
|
elseif GameGetFrameNum() % 10 == 0 then
|
|
|
|
for peer_id, data in pairs(ctx.players) do
|
|
|
|
if peer_id ~= ctx.my_id then
|
|
|
|
local audio = EntityGetFirstComponent(data.entity, "AudioListenerComponent")
|
|
|
|
local inv_target = EntityGetFirstComponent(data.entity, "InventoryGuiComponent")
|
2024-10-02 19:18:49 -04:00
|
|
|
--local keep_alive = EntityGetFirstComponent(data.entity, "StreamingKeepAliveComponent")
|
2024-09-13 17:20:19 -04:00
|
|
|
if audio ~= nil then
|
2024-09-14 17:29:20 -04:00
|
|
|
EntityRemoveComponent(data.entity, audio)
|
2024-09-13 17:20:19 -04:00
|
|
|
end
|
2024-10-02 19:18:49 -04:00
|
|
|
--if keep_alive ~= nil and not EntityHasTag(data.entity, "ew_notplayer") then
|
|
|
|
-- EntityRemoveComponent(data.entity, keep_alive)
|
|
|
|
--end
|
2024-09-13 17:20:19 -04:00
|
|
|
if inv_target ~= nil then
|
2024-09-14 17:29:20 -04:00
|
|
|
EntityRemoveComponent(data.entity, inv_target)
|
2024-09-13 17:20:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2024-08-28 18:53:18 -04:00
|
|
|
end
|
2024-08-25 17:10:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
return spectate
|