@@ -50,6 +50,7 @@ NET_MESSAGES = {
50
50
},
51
51
52
52
[net_Disconnect ] = { -- 1
53
+ NativeConstructor = NET_Disconnect ,
53
54
__tostring = function (self )
54
55
if not self .initialized then
55
56
return " net_Disconnect"
@@ -81,6 +82,7 @@ NET_MESSAGES = {
81
82
},
82
83
83
84
[net_File ] = { -- 2
85
+ NativeConstructor = NET_File ,
84
86
__tostring = function (self )
85
87
if not self .initialized then
86
88
return " net_File"
@@ -132,6 +134,7 @@ NET_MESSAGES = {
132
134
},
133
135
134
136
[net_Tick ] = { -- 3
137
+ NativeConstructor = NET_Tick ,
135
138
__tostring = function (self )
136
139
if not self .initialized then
137
140
return " net_Tick"
@@ -167,6 +170,7 @@ NET_MESSAGES = {
167
170
},
168
171
169
172
[net_StringCmd ] = { -- 4
173
+ NativeConstructor = NET_StringCmd ,
170
174
__tostring = function (self )
171
175
if not self .initialized then
172
176
return " net_StringCmd"
@@ -198,6 +202,7 @@ NET_MESSAGES = {
198
202
},
199
203
200
204
[net_SetConVar ] = { -- 5
205
+ NativeConstructor = NET_SetConVar ,
201
206
__tostring = function (self )
202
207
if not self .initialized then
203
208
return " net_SetConVar"
@@ -253,6 +258,7 @@ NET_MESSAGES = {
253
258
},
254
259
255
260
[net_SignonState ] = { -- 6
261
+ NativeConstructor = NET_SignonState ,
256
262
__tostring = function (self )
257
263
if not self .initialized then
258
264
return " net_SignonState"
@@ -287,6 +293,7 @@ NET_MESSAGES = {
287
293
288
294
CLC = {
289
295
[clc_ClientInfo ] = { -- 8
296
+ NativeConstructor = CLC_ClientInfo ,
290
297
__tostring = function (self )
291
298
if not self .initialized then
292
299
return " clc_ClientInfo"
@@ -340,6 +347,7 @@ NET_MESSAGES = {
340
347
},
341
348
342
349
[clc_Move ] = { -- 9
350
+ NativeConstructor = CLC_Move ,
343
351
__tostring = function (self )
344
352
if not self .initialized then
345
353
return " clc_Move"
@@ -377,6 +385,7 @@ NET_MESSAGES = {
377
385
},
378
386
379
387
[clc_VoiceData ] = { -- 10
388
+ NativeConstructor = CLC_VoiceData ,
380
389
__tostring = function (self )
381
390
if not self .initialized then
382
391
return " clc_VoiceData"
@@ -410,6 +419,7 @@ NET_MESSAGES = {
410
419
},
411
420
412
421
[clc_BaselineAck ] = { -- 11
422
+ NativeConstructor = CLC_BaselineAck ,
413
423
__tostring = function (self )
414
424
if not self .initialized then
415
425
return " clc_BaselineAck"
@@ -443,6 +453,7 @@ NET_MESSAGES = {
443
453
},
444
454
445
455
[clc_ListenEvents ] = { -- 12
456
+ NativeConstructor = CLC_ListenEvents ,
446
457
__tostring = function ()
447
458
return " clc_ListenEvents"
448
459
end ,
@@ -478,6 +489,7 @@ NET_MESSAGES = {
478
489
},
479
490
480
491
[clc_RespondCvarValue ] = { -- 13
492
+ NativeConstructor = CLC_RespondCvarValue ,
481
493
__tostring = function (self )
482
494
if not self .initialized then
483
495
return " clc_RespondCvarValue"
@@ -515,6 +527,7 @@ NET_MESSAGES = {
515
527
},
516
528
517
529
[clc_FileCRCCheck ] = { -- 14
530
+ NativeConstructor = CLC_FileCRCCheck ,
518
531
__tostring = function (self )
519
532
if not self .initialized then
520
533
return " clc_FileCRCCheck"
@@ -561,6 +574,7 @@ NET_MESSAGES = {
561
574
},
562
575
563
576
[clc_CmdKeyValues ] = { -- 16
577
+ NativeConstructor = CLC_CmdKeyValues ,
564
578
__tostring = function (self )
565
579
if not self .initialized then
566
580
return " clc_CmdKeyValues"
@@ -598,6 +612,7 @@ NET_MESSAGES = {
598
612
},
599
613
600
614
[clc_FileMD5Check ] = { -- 17
615
+ NativeConstructor = CLC_FileMD5Check ,
601
616
__tostring = function (self )
602
617
if not self .initialized then
603
618
return " clc_FileMD5Check"
@@ -644,6 +659,7 @@ NET_MESSAGES = {
644
659
},
645
660
646
661
[clc_GMod_ClientToServer ] = { -- 18
662
+ NativeConstructor = CLC_GMod_ClientToServer ,
647
663
__tostring = function (self )
648
664
if not self .initialized then
649
665
return " clc_GMod_ClientToServer"
@@ -728,6 +744,7 @@ NET_MESSAGES = {
728
744
729
745
SVC = {
730
746
[svc_Print ] = { -- 7
747
+ NativeConstructor = SVC_Print ,
731
748
__tostring = function (self )
732
749
if not self .initialized then
733
750
return " svc_Print"
@@ -759,6 +776,7 @@ NET_MESSAGES = {
759
776
},
760
777
761
778
[svc_ServerInfo ] = { -- 8
779
+ NativeConstructor = SVC_ServerInfo ,
762
780
__tostring = function (self )
763
781
if not self .initialized then
764
782
return " svc_ServerInfo"
@@ -842,6 +860,7 @@ NET_MESSAGES = {
842
860
},
843
861
844
862
[svc_SendTable ] = { -- 9
863
+ NativeConstructor = SVC_SendTable ,
845
864
__tostring = function (self )
846
865
if not self .initialized then
847
866
return " svc_SendTable"
@@ -877,6 +896,7 @@ NET_MESSAGES = {
877
896
},
878
897
879
898
[svc_ClassInfo ] = { -- 10
899
+ NativeConstructor = SVC_ClassInfo ,
880
900
__tostring = function (self )
881
901
if not self .initialized then
882
902
return " svc_ClassInfo"
@@ -929,6 +949,7 @@ NET_MESSAGES = {
929
949
},
930
950
931
951
[svc_SetPause ] = { -- 11
952
+ NativeConstructor = SVC_SetPause ,
932
953
__tostring = function (self )
933
954
if not self .initialized then
934
955
return " svc_SetPause"
@@ -960,6 +981,7 @@ NET_MESSAGES = {
960
981
},
961
982
962
983
[svc_CreateStringTable ] = { -- 12
984
+ NativeConstructor = SVC_CreateStringTable ,
963
985
__tostring = function (self )
964
986
if not self .initialized then
965
987
return " svc_VoiceInit"
@@ -1011,6 +1033,7 @@ NET_MESSAGES = {
1011
1033
},
1012
1034
1013
1035
[svc_UpdateStringTable ] = { -- 13
1036
+ NativeConstructor = SVC_UpdateStringTable ,
1014
1037
__tostring = function (self )
1015
1038
if not self .initialized then
1016
1039
return " svc_UpdateStringTable"
@@ -1051,6 +1074,7 @@ NET_MESSAGES = {
1051
1074
},
1052
1075
1053
1076
[svc_VoiceInit ] = { -- 14
1077
+ NativeConstructor = SVC_VoiceInit ,
1054
1078
__tostring = function (self )
1055
1079
if not self .initialized then
1056
1080
return " svc_VoiceInit"
@@ -1084,6 +1108,7 @@ NET_MESSAGES = {
1084
1108
},
1085
1109
1086
1110
[svc_VoiceData ] = { -- 15
1111
+ NativeConstructor = SVC_VoiceData ,
1087
1112
__tostring = function (self )
1088
1113
if not self .initialized then
1089
1114
return " svc_VoiceData"
@@ -1121,6 +1146,7 @@ NET_MESSAGES = {
1121
1146
},
1122
1147
1123
1148
[svc_Sounds ] = { -- 17
1149
+ NativeConstructor = SVC_Sounds ,
1124
1150
__tostring = function (self )
1125
1151
if not self .initialized then
1126
1152
return " svc_Sounds"
@@ -1162,6 +1188,7 @@ NET_MESSAGES = {
1162
1188
},
1163
1189
1164
1190
[svc_SetView ] = { -- 18
1191
+ NativeConstructor = SVC_SetView ,
1165
1192
__tostring = function (self )
1166
1193
if not self .initialized then
1167
1194
return " svc_SetView"
@@ -1193,6 +1220,7 @@ NET_MESSAGES = {
1193
1220
},
1194
1221
1195
1222
[svc_FixAngle ] = { -- 19
1223
+ NativeConstructor = SVC_FixAngle ,
1196
1224
__tostring = function (self )
1197
1225
if not self .initialized then
1198
1226
return " svc_FixAngle"
@@ -1230,6 +1258,7 @@ NET_MESSAGES = {
1230
1258
},
1231
1259
1232
1260
[svc_CrosshairAngle ] = { -- 20
1261
+ NativeConstructor = SVC_CrosshairAngle ,
1233
1262
__tostring = function (self )
1234
1263
if not self .initialized then
1235
1264
return " svc_CrosshairAngle"
@@ -1265,6 +1294,7 @@ NET_MESSAGES = {
1265
1294
},
1266
1295
1267
1296
[svc_BSPDecal ] = { -- 21
1297
+ NativeConstructor = SVC_BSPDecal ,
1268
1298
__tostring = function (self )
1269
1299
if not self .initialized then
1270
1300
return " svc_BSPDecal"
@@ -1313,6 +1343,7 @@ NET_MESSAGES = {
1313
1343
},
1314
1344
1315
1345
[svc_UserMessage ] = { -- 23
1346
+ NativeConstructor = SVC_UserMessage ,
1316
1347
__tostring = function (self )
1317
1348
if not self .initialized then
1318
1349
return " svc_UserMessage"
@@ -1352,6 +1383,7 @@ NET_MESSAGES = {
1352
1383
},
1353
1384
1354
1385
[svc_EntityMessage ] = { -- 24
1386
+ NativeConstructor = SVC_EntityMessage ,
1355
1387
__tostring = function (self )
1356
1388
if not self .initialized then
1357
1389
return " svc_EntityMessage"
@@ -1389,6 +1421,7 @@ NET_MESSAGES = {
1389
1421
},
1390
1422
1391
1423
[svc_GameEvent ] = { -- 25
1424
+ NativeConstructor = SVC_GameEvent ,
1392
1425
__tostring = function (self )
1393
1426
if not self .initialized then
1394
1427
return " svc_GameEvent"
@@ -1422,6 +1455,7 @@ NET_MESSAGES = {
1422
1455
},
1423
1456
1424
1457
[svc_PacketEntities ] = { -- 26
1458
+ NativeConstructor = SVC_PacketEntities ,
1425
1459
__tostring = function (self )
1426
1460
if not self .initialized then
1427
1461
return " svc_PacketEntities"
@@ -1469,6 +1503,7 @@ NET_MESSAGES = {
1469
1503
},
1470
1504
1471
1505
[svc_TempEntities ] = { -- 27
1506
+ NativeConstructor = SVC_TempEntities ,
1472
1507
__tostring = function (self )
1473
1508
if not self .initialized then
1474
1509
return " svc_TempEntities"
@@ -1504,6 +1539,7 @@ NET_MESSAGES = {
1504
1539
},
1505
1540
1506
1541
[svc_Prefetch ] = { -- 28
1542
+ NativeConstructor = SVC_Prefetch ,
1507
1543
__tostring = function (self )
1508
1544
if not self .initialized then
1509
1545
return " svc_Prefetch"
@@ -1535,6 +1571,7 @@ NET_MESSAGES = {
1535
1571
},
1536
1572
1537
1573
[svc_Menu ] = { -- 29
1574
+ NativeConstructor = SVC_Menu ,
1538
1575
__tostring = function (self )
1539
1576
if not self .initialized then
1540
1577
return " svc_Menu"
@@ -1570,6 +1607,7 @@ NET_MESSAGES = {
1570
1607
},
1571
1608
1572
1609
[svc_GameEventList ] = { -- 30
1610
+ NativeConstructor = SVC_GameEventList ,
1573
1611
__tostring = function (self )
1574
1612
if not self .initialized then
1575
1613
return " svc_GameEventList"
@@ -1605,6 +1643,7 @@ NET_MESSAGES = {
1605
1643
},
1606
1644
1607
1645
[svc_GetCvarValue ] = { -- 31
1646
+ NativeConstructor = SVC_GetCvarValue ,
1608
1647
__tostring = function (self )
1609
1648
if not self .initialized then
1610
1649
return " svc_GetCvarValue"
@@ -1638,6 +1677,7 @@ NET_MESSAGES = {
1638
1677
},
1639
1678
1640
1679
[svc_CmdKeyValues ] = { -- 32
1680
+ NativeConstructor = SVC_CmdKeyValues ,
1641
1681
__tostring = function (self )
1642
1682
if not self .initialized then
1643
1683
return " svc_CmdKeyValues"
@@ -1675,6 +1715,7 @@ NET_MESSAGES = {
1675
1715
},
1676
1716
1677
1717
[svc_GMod_ServerToClient ] = { -- 33
1718
+ NativeConstructor = SVC_GMod_ServerToClient ,
1678
1719
__tostring = function (self )
1679
1720
if not self .initialized then
1680
1721
return " svc_GMod_ServerToClient"
@@ -1771,7 +1812,7 @@ NET_MESSAGES = {
1771
1812
}
1772
1813
}
1773
1814
1774
- function NetMessage (msgtype , server )
1815
+ function NetMessage (netchan , msgtype , server )
1775
1816
local metatable = NET_MESSAGES [msgtype ]
1776
1817
if not metatable then
1777
1818
if server then
@@ -1785,5 +1826,15 @@ function NetMessage(msgtype, server)
1785
1826
end
1786
1827
end
1787
1828
1788
- return setmetatable (table , metatable )
1829
+ return setmetatable ({}, metatable )
1830
+
1831
+ --[[ local nativeConstructor = metatable.NativeConstructor
1832
+ if not nativeConstructor then
1833
+ nativeConstructor = function()
1834
+ return setmetatable({}, metatable)
1835
+ end
1836
+ end
1837
+
1838
+ metatable.Native = metatable.Native or nativeConstructor(netchan)
1839
+ return metatable.Native]]
1789
1840
end
0 commit comments