Skip to content

Commit 82fca6b

Browse files
committed
Improve idle performance
1 parent 887c996 commit 82fca6b

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

lib/observers/interiorIdObserver.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local _scanDelay = 500
22

33
Citizen.CreateThread(function()
44
while true do
5-
-- /!\ To do: Find a more reliable way to get the current interior ID
65
Global.currentInteriorId = GetInteriorFromEntity(PlayerPedId())
76

87
if Global.currentInteriorId == 0 then
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
CreateThread(function()
22
while true do
3-
if Global.Security.isInsideOffice1 then
4-
EnableExteriorCullModelThisFrame(`bh1_05_build1`)
5-
EnableExteriorCullModelThisFrame(`bh1_05_em`)
3+
local sleep = 500
64

7-
DisableOcclusionThisFrame()
8-
end
5+
if Global.Security.isInsideOffice1 or Global.Security.isInsideOffice2 or Global.Security.isInsideOffice3 or Global.Security.isInsideOffice4 then
6+
sleep = 0
97

10-
if Global.Security.isInsideOffice2 then
11-
EnableExteriorCullModelThisFrame(`hei_hw1_08_hotplaz01`)
12-
EnableExteriorCullModelThisFrame(`hw1_08_hotplaz_rail`)
13-
EnableExteriorCullModelThisFrame(`hw1_08_emissive_c`)
8+
if Global.Security.isInsideOffice1 then
9+
EnableExteriorCullModelThisFrame(`bh1_05_build1`)
10+
EnableExteriorCullModelThisFrame(`bh1_05_em`)
11+
end
1412

15-
DisableOcclusionThisFrame()
16-
end
13+
if Global.Security.isInsideOffice2 then
14+
EnableExteriorCullModelThisFrame(`hei_hw1_08_hotplaz01`)
15+
EnableExteriorCullModelThisFrame(`hw1_08_hotplaz_rail`)
16+
EnableExteriorCullModelThisFrame(`hw1_08_emissive_c`)
17+
end
1718

18-
if Global.Security.isInsideOffice3 then
19-
EnableExteriorCullModelThisFrame(`hei_kt1_05_01`)
20-
EnableExteriorCullModelThisFrame(`kt1_05_glue_b`)
21-
EnableExteriorCullModelThisFrame(`kt1_05_kt_emissive_kt1_05`)
22-
23-
DisableOcclusionThisFrame()
24-
end
19+
if Global.Security.isInsideOffice3 then
20+
EnableExteriorCullModelThisFrame(`hei_kt1_05_01`)
21+
EnableExteriorCullModelThisFrame(`kt1_05_glue_b`)
22+
EnableExteriorCullModelThisFrame(`kt1_05_kt_emissive_kt1_05`)
23+
end
2524

26-
if Global.Security.isInsideOffice4 then
27-
EnableExteriorCullModelThisFrame(`hei_kt1_08_buildingtop_a`)
28-
EnableExteriorCullModelThisFrame(`hei_kt1_08_kt1_emissive_ema`)
25+
if Global.Security.isInsideOffice4 then
26+
EnableExteriorCullModelThisFrame(`hei_kt1_08_buildingtop_a`)
27+
EnableExteriorCullModelThisFrame(`hei_kt1_08_kt1_emissive_ema`)
28+
end
2929

3030
DisableOcclusionThisFrame()
3131
end
3232

33-
Wait(0)
33+
Wait(sleep)
3434
end
3535
end)

0 commit comments

Comments
 (0)