@@ -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_CreateStringTable"
@@ -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"
@@ -1125,6 +1150,7 @@ NET_MESSAGES = {
1125
1150
},
1126
1151
1127
1152
[svc_Sounds ] = { -- 17
1153
+ NativeConstructor = SVC_Sounds ,
1128
1154
__tostring = function (self )
1129
1155
if not self .initialized then
1130
1156
return " svc_Sounds"
@@ -1166,6 +1192,7 @@ NET_MESSAGES = {
1166
1192
},
1167
1193
1168
1194
[svc_SetView ] = { -- 18
1195
+ NativeConstructor = SVC_SetView ,
1169
1196
__tostring = function (self )
1170
1197
if not self .initialized then
1171
1198
return " svc_SetView"
@@ -1197,6 +1224,7 @@ NET_MESSAGES = {
1197
1224
},
1198
1225
1199
1226
[svc_FixAngle ] = { -- 19
1227
+ NativeConstructor = SVC_FixAngle ,
1200
1228
__tostring = function (self )
1201
1229
if not self .initialized then
1202
1230
return " svc_FixAngle"
@@ -1234,6 +1262,7 @@ NET_MESSAGES = {
1234
1262
},
1235
1263
1236
1264
[svc_CrosshairAngle ] = { -- 20
1265
+ NativeConstructor = SVC_CrosshairAngle ,
1237
1266
__tostring = function (self )
1238
1267
if not self .initialized then
1239
1268
return " svc_CrosshairAngle"
@@ -1269,6 +1298,7 @@ NET_MESSAGES = {
1269
1298
},
1270
1299
1271
1300
[svc_BSPDecal ] = { -- 21
1301
+ NativeConstructor = SVC_BSPDecal ,
1272
1302
__tostring = function (self )
1273
1303
if not self .initialized then
1274
1304
return " svc_BSPDecal"
@@ -1317,6 +1347,7 @@ NET_MESSAGES = {
1317
1347
},
1318
1348
1319
1349
[svc_UserMessage ] = { -- 23
1350
+ NativeConstructor = SVC_UserMessage ,
1320
1351
__tostring = function (self )
1321
1352
if not self .initialized then
1322
1353
return " svc_UserMessage"
@@ -1356,6 +1387,7 @@ NET_MESSAGES = {
1356
1387
},
1357
1388
1358
1389
[svc_EntityMessage ] = { -- 24
1390
+ NativeConstructor = SVC_EntityMessage ,
1359
1391
__tostring = function (self )
1360
1392
if not self .initialized then
1361
1393
return " svc_EntityMessage"
@@ -1393,6 +1425,7 @@ NET_MESSAGES = {
1393
1425
},
1394
1426
1395
1427
[svc_GameEvent ] = { -- 25
1428
+ NativeConstructor = SVC_GameEvent ,
1396
1429
__tostring = function (self )
1397
1430
if not self .initialized then
1398
1431
return " svc_GameEvent"
@@ -1426,6 +1459,7 @@ NET_MESSAGES = {
1426
1459
},
1427
1460
1428
1461
[svc_PacketEntities ] = { -- 26
1462
+ NativeConstructor = SVC_PacketEntities ,
1429
1463
__tostring = function (self )
1430
1464
if not self .initialized then
1431
1465
return " svc_PacketEntities"
@@ -1473,6 +1507,7 @@ NET_MESSAGES = {
1473
1507
},
1474
1508
1475
1509
[svc_TempEntities ] = { -- 27
1510
+ NativeConstructor = SVC_TempEntities ,
1476
1511
__tostring = function (self )
1477
1512
if not self .initialized then
1478
1513
return " svc_TempEntities"
@@ -1508,6 +1543,7 @@ NET_MESSAGES = {
1508
1543
},
1509
1544
1510
1545
[svc_Prefetch ] = { -- 28
1546
+ NativeConstructor = SVC_Prefetch ,
1511
1547
__tostring = function (self )
1512
1548
if not self .initialized then
1513
1549
return " svc_Prefetch"
@@ -1539,6 +1575,7 @@ NET_MESSAGES = {
1539
1575
},
1540
1576
1541
1577
[svc_Menu ] = { -- 29
1578
+ NativeConstructor = SVC_Menu ,
1542
1579
__tostring = function (self )
1543
1580
if not self .initialized then
1544
1581
return " svc_Menu"
@@ -1574,6 +1611,7 @@ NET_MESSAGES = {
1574
1611
},
1575
1612
1576
1613
[svc_GameEventList ] = { -- 30
1614
+ NativeConstructor = SVC_GameEventList ,
1577
1615
__tostring = function (self )
1578
1616
if not self .initialized then
1579
1617
return " svc_GameEventList"
@@ -1609,6 +1647,7 @@ NET_MESSAGES = {
1609
1647
},
1610
1648
1611
1649
[svc_GetCvarValue ] = { -- 31
1650
+ NativeConstructor = SVC_GetCvarValue ,
1612
1651
__tostring = function (self )
1613
1652
if not self .initialized then
1614
1653
return " svc_GetCvarValue"
@@ -1642,6 +1681,7 @@ NET_MESSAGES = {
1642
1681
},
1643
1682
1644
1683
[svc_CmdKeyValues ] = { -- 32
1684
+ NativeConstructor = SVC_CmdKeyValues ,
1645
1685
__tostring = function (self )
1646
1686
if not self .initialized then
1647
1687
return " svc_CmdKeyValues"
@@ -1679,6 +1719,7 @@ NET_MESSAGES = {
1679
1719
},
1680
1720
1681
1721
[svc_GMod_ServerToClient ] = { -- 33
1722
+ NativeConstructor = SVC_GMod_ServerToClient ,
1682
1723
__tostring = function (self )
1683
1724
if not self .initialized then
1684
1725
return " svc_GMod_ServerToClient"
@@ -1775,7 +1816,7 @@ NET_MESSAGES = {
1775
1816
}
1776
1817
}
1777
1818
1778
- function NetMessage (msgtype , server )
1819
+ function NetMessage (netchan , msgtype , server )
1779
1820
local metatable = NET_MESSAGES [msgtype ]
1780
1821
if not metatable then
1781
1822
if server then
@@ -1789,5 +1830,15 @@ function NetMessage(msgtype, server)
1789
1830
end
1790
1831
end
1791
1832
1792
- return setmetatable (table , metatable )
1833
+ return setmetatable ({}, metatable )
1834
+
1835
+ --[[ local nativeConstructor = metatable.NativeConstructor
1836
+ if not nativeConstructor then
1837
+ nativeConstructor = function()
1838
+ return setmetatable({}, metatable)
1839
+ end
1840
+ end
1841
+
1842
+ metatable.Native = metatable.Native or nativeConstructor(netchan)
1843
+ return metatable.Native]]
1793
1844
end
0 commit comments