Skip to content

Commit 5da5e3e

Browse files
committed
gamenet/generate: Record that some net objects are called events
Fixes #108.
1 parent 9c991bd commit 5da5e3e

File tree

9 files changed

+189
-63
lines changed

9 files changed

+189
-63
lines changed

gamenet/generate/datatypes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,9 @@ def NetObjectEx(name, ex, values, **kwargs):
10991099
return NetObject(name, values, ex=ex, **kwargs)
11001100

11011101
class NetEvent(NetObject):
1102-
pass
1102+
def __init__(self, name, values, **kwargs):
1103+
super().__init__(name, values, **kwargs)
1104+
self.attributes.add("event")
11031105
def NetEventEx(name, ex, values, **kwargs):
11041106
return NetEvent(name, values, ex=ex, **kwargs)
11051107

gamenet/generate/spec/ddnet-15.2.5.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -829,28 +829,36 @@
829829
{"name": ["x"], "type": {"kind": "int32"}},
830830
{"name": ["y"], "type": {"kind": "int32"}}
831831
],
832-
"attributes": []
832+
"attributes": [
833+
"event"
834+
]
833835
},
834836
{
835837
"id": 14,
836838
"name": ["explosion"],
837839
"super": ["common"],
838840
"members": [],
839-
"attributes": []
841+
"attributes": [
842+
"event"
843+
]
840844
},
841845
{
842846
"id": 15,
843847
"name": ["spawn"],
844848
"super": ["common"],
845849
"members": [],
846-
"attributes": []
850+
"attributes": [
851+
"event"
852+
]
847853
},
848854
{
849855
"id": 16,
850856
"name": ["hammer", "hit"],
851857
"super": ["common"],
852858
"members": [],
853-
"attributes": []
859+
"attributes": [
860+
"event"
861+
]
854862
},
855863
{
856864
"id": 17,
@@ -859,7 +867,9 @@
859867
"members": [
860868
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
861869
],
862-
"attributes": []
870+
"attributes": [
871+
"event"
872+
]
863873
},
864874
{
865875
"id": 18,
@@ -868,7 +878,9 @@
868878
"members": [
869879
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
870880
],
871-
"attributes": []
881+
"attributes": [
882+
"event"
883+
]
872884
},
873885
{
874886
"id": 19,
@@ -877,7 +889,9 @@
877889
"members": [
878890
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
879891
],
880-
"attributes": []
892+
"attributes": [
893+
"event"
894+
]
881895
},
882896
{
883897
"id": 20,
@@ -886,7 +900,9 @@
886900
"members": [
887901
{"name": ["angle"], "type": {"kind": "int32"}}
888902
],
889-
"attributes": []
903+
"attributes": [
904+
"event"
905+
]
890906
},
891907
{
892908
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",

gamenet/generate/spec/ddnet-16.2.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -955,28 +955,36 @@
955955
{"name": ["x"], "type": {"kind": "int32"}},
956956
{"name": ["y"], "type": {"kind": "int32"}}
957957
],
958-
"attributes": []
958+
"attributes": [
959+
"event"
960+
]
959961
},
960962
{
961963
"id": 14,
962964
"name": ["explosion"],
963965
"super": ["common"],
964966
"members": [],
965-
"attributes": []
967+
"attributes": [
968+
"event"
969+
]
966970
},
967971
{
968972
"id": 15,
969973
"name": ["spawn"],
970974
"super": ["common"],
971975
"members": [],
972-
"attributes": []
976+
"attributes": [
977+
"event"
978+
]
973979
},
974980
{
975981
"id": 16,
976982
"name": ["hammer", "hit"],
977983
"super": ["common"],
978984
"members": [],
979-
"attributes": []
985+
"attributes": [
986+
"event"
987+
]
980988
},
981989
{
982990
"id": 17,
@@ -985,7 +993,9 @@
985993
"members": [
986994
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
987995
],
988-
"attributes": []
996+
"attributes": [
997+
"event"
998+
]
989999
},
9901000
{
9911001
"id": 18,
@@ -994,7 +1004,9 @@
9941004
"members": [
9951005
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
9961006
],
997-
"attributes": []
1007+
"attributes": [
1008+
"event"
1009+
]
9981010
},
9991011
{
10001012
"id": 19,
@@ -1003,7 +1015,9 @@
10031015
"members": [
10041016
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
10051017
],
1006-
"attributes": []
1018+
"attributes": [
1019+
"event"
1020+
]
10071021
},
10081022
{
10091023
"id": 20,
@@ -1012,7 +1026,9 @@
10121026
"members": [
10131027
{"name": ["angle"], "type": {"kind": "int32"}}
10141028
],
1015-
"attributes": []
1029+
"attributes": [
1030+
"event"
1031+
]
10161032
},
10171033
{
10181034
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",

gamenet/generate/spec/ddnet-16.7.2.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -973,28 +973,36 @@
973973
{"name": ["x"], "type": {"kind": "int32"}},
974974
{"name": ["y"], "type": {"kind": "int32"}}
975975
],
976-
"attributes": []
976+
"attributes": [
977+
"event"
978+
]
977979
},
978980
{
979981
"id": 14,
980982
"name": ["explosion"],
981983
"super": ["common"],
982984
"members": [],
983-
"attributes": []
985+
"attributes": [
986+
"event"
987+
]
984988
},
985989
{
986990
"id": 15,
987991
"name": ["spawn"],
988992
"super": ["common"],
989993
"members": [],
990-
"attributes": []
994+
"attributes": [
995+
"event"
996+
]
991997
},
992998
{
993999
"id": 16,
9941000
"name": ["hammer", "hit"],
9951001
"super": ["common"],
9961002
"members": [],
997-
"attributes": []
1003+
"attributes": [
1004+
"event"
1005+
]
9981006
},
9991007
{
10001008
"id": 17,
@@ -1003,7 +1011,9 @@
10031011
"members": [
10041012
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
10051013
],
1006-
"attributes": []
1014+
"attributes": [
1015+
"event"
1016+
]
10071017
},
10081018
{
10091019
"id": 18,
@@ -1012,7 +1022,9 @@
10121022
"members": [
10131023
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
10141024
],
1015-
"attributes": []
1025+
"attributes": [
1026+
"event"
1027+
]
10161028
},
10171029
{
10181030
"id": 19,
@@ -1021,7 +1033,9 @@
10211033
"members": [
10221034
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
10231035
],
1024-
"attributes": []
1036+
"attributes": [
1037+
"event"
1038+
]
10251039
},
10261040
{
10271041
"id": 20,
@@ -1030,7 +1044,9 @@
10301044
"members": [
10311045
{"name": ["angle"], "type": {"kind": "int32"}}
10321046
],
1033-
"attributes": []
1047+
"attributes": [
1048+
"event"
1049+
]
10341050
},
10351051
{
10361052
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",

gamenet/generate/spec/ddnet-17.2.1.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,28 +1059,36 @@
10591059
{"name": ["x"], "type": {"kind": "int32"}},
10601060
{"name": ["y"], "type": {"kind": "int32"}}
10611061
],
1062-
"attributes": []
1062+
"attributes": [
1063+
"event"
1064+
]
10631065
},
10641066
{
10651067
"id": 14,
10661068
"name": ["explosion"],
10671069
"super": ["common"],
10681070
"members": [],
1069-
"attributes": []
1071+
"attributes": [
1072+
"event"
1073+
]
10701074
},
10711075
{
10721076
"id": 15,
10731077
"name": ["spawn"],
10741078
"super": ["common"],
10751079
"members": [],
1076-
"attributes": []
1080+
"attributes": [
1081+
"event"
1082+
]
10771083
},
10781084
{
10791085
"id": 16,
10801086
"name": ["hammer", "hit"],
10811087
"super": ["common"],
10821088
"members": [],
1083-
"attributes": []
1089+
"attributes": [
1090+
"event"
1091+
]
10841092
},
10851093
{
10861094
"id": 17,
@@ -1089,7 +1097,9 @@
10891097
"members": [
10901098
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
10911099
],
1092-
"attributes": []
1100+
"attributes": [
1101+
"event"
1102+
]
10931103
},
10941104
{
10951105
"id": 18,
@@ -1098,7 +1108,9 @@
10981108
"members": [
10991109
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
11001110
],
1101-
"attributes": []
1111+
"attributes": [
1112+
"event"
1113+
]
11021114
},
11031115
{
11041116
"id": 19,
@@ -1107,7 +1119,9 @@
11071119
"members": [
11081120
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
11091121
],
1110-
"attributes": []
1122+
"attributes": [
1123+
"event"
1124+
]
11111125
},
11121126
{
11131127
"id": 20,
@@ -1116,7 +1130,9 @@
11161130
"members": [
11171131
{"name": ["angle"], "type": {"kind": "int32"}}
11181132
],
1119-
"attributes": []
1133+
"attributes": [
1134+
"event"
1135+
]
11201136
},
11211137
{
11221138
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",

0 commit comments

Comments
 (0)