@@ -40,14 +40,6 @@ function Precache( context )
40
40
41
41
DebugPrint (" [BAREBONES] Performing pre-load precache" )
42
42
43
- for _ ,Item in pairs ( g_ItemPrecache ) do
44
- PrecacheItemByNameAsync ( Item , function ( item ) end )
45
- end
46
-
47
- for _ ,Unit in pairs ( g_UnitPrecache ) do
48
- PrecacheUnitByNameAsync ( Unit , function ( unit ) end )
49
- end
50
-
51
43
for _ ,Model in pairs ( g_ModelPrecache ) do
52
44
PrecacheResource ( " model" , Model , context )
53
45
end
@@ -66,14 +58,37 @@ function Precache( context )
66
58
67
59
-- precache all hero econ folders
68
60
-- this makes immortals and stuff work
69
- local allheroes = LoadKeyValues (' scripts/npc/npc_heroes.txt' )
70
- for key ,value in pairs (LoadKeyValues (' scripts/npc/herolist.txt' )) do
71
- if value == 1 then
72
- local hero = string.sub (key , 15 )
73
- -- PrecacheResource("particle_folder", "particles/econ/items/" .. hero, context)
74
- PrecacheResource (" model_folder" , " particles/heroes/" .. hero , context )
61
+ -- I'm comment this out cause the prior code was only loading the particles (moved to later)
62
+ -- And loading all the items models are just impossible cause it gives out of memory exception
63
+
64
+ -- local allheroes = LoadKeyValues('scripts/npc/npc_heroes.txt')
65
+ -- for key,value in pairs(LoadKeyValues('scripts/npc/herolist.txt')) do
66
+ -- if value == 1 then
67
+ -- local hero = string.sub(key, 15)
68
+ -- local modelFolder = "models/items/" .. hero
69
+ -- print("Loading model folder :" .. modelFolder)
70
+ -- PrecacheResource("model_folder", modelFolder, context)
71
+ -- end
72
+ -- end
73
+
74
+ -- Delay Precache particle
75
+ -- Team Selection + Picking screen should be enough to load all the information needed
76
+ -- This is better than using GameMode:PostLoadPrecache because it start the loading as soon as the players connect
77
+ -- and gives less delay when loading to the next screen
78
+ GameEvents :OnConnectFull ( function ()
79
+ print (" Precaching all hero particle cosmetics" )
80
+ PrecacheUnitByNameAsync ( " npc_dota_load_econ_dummy" , function ( unit )
81
+ print (" Finish loading cosmetics" )
82
+ end )
83
+
84
+ for _ ,Item in pairs ( g_ItemPrecache ) do
85
+ PrecacheItemByNameAsync ( Item , function ( item ) end )
75
86
end
76
- end
87
+
88
+ for _ ,Unit in pairs ( g_UnitPrecache ) do
89
+ PrecacheUnitByNameAsync ( Unit , function ( unit ) end )
90
+ end
91
+ end )
77
92
78
93
-- Particles can be precached individually or by folder
79
94
-- It it likely that precaching a single particle system will precache all of its children, but this may not be guaranteed
0 commit comments