Skip to content

Commit

Permalink
gamenet/generate: Record that some net objects are called events
Browse files Browse the repository at this point in the history
Fixes #108.
  • Loading branch information
heinrich5991 committed Dec 16, 2024
1 parent 9c991bd commit 5da5e3e
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 63 deletions.
4 changes: 3 additions & 1 deletion gamenet/generate/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,9 @@ def NetObjectEx(name, ex, values, **kwargs):
return NetObject(name, values, ex=ex, **kwargs)

class NetEvent(NetObject):
pass
def __init__(self, name, values, **kwargs):
super().__init__(name, values, **kwargs)
self.attributes.add("event")
def NetEventEx(name, ex, values, **kwargs):
return NetEvent(name, values, ex=ex, **kwargs)

Expand Down
32 changes: 24 additions & 8 deletions gamenet/generate/spec/ddnet-15.2.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -829,28 +829,36 @@
{"name": ["x"], "type": {"kind": "int32"}},
{"name": ["y"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 14,
"name": ["explosion"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 15,
"name": ["spawn"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 16,
"name": ["hammer", "hit"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 17,
Expand All @@ -859,7 +867,9 @@
"members": [
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 18,
Expand All @@ -868,7 +878,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 19,
Expand All @@ -877,7 +889,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 20,
Expand All @@ -886,7 +900,9 @@
"members": [
{"name": ["angle"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",
Expand Down
32 changes: 24 additions & 8 deletions gamenet/generate/spec/ddnet-16.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -955,28 +955,36 @@
{"name": ["x"], "type": {"kind": "int32"}},
{"name": ["y"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 14,
"name": ["explosion"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 15,
"name": ["spawn"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 16,
"name": ["hammer", "hit"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 17,
Expand All @@ -985,7 +993,9 @@
"members": [
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 18,
Expand All @@ -994,7 +1004,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 19,
Expand All @@ -1003,7 +1015,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 20,
Expand All @@ -1012,7 +1026,9 @@
"members": [
{"name": ["angle"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",
Expand Down
32 changes: 24 additions & 8 deletions gamenet/generate/spec/ddnet-16.7.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -973,28 +973,36 @@
{"name": ["x"], "type": {"kind": "int32"}},
{"name": ["y"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 14,
"name": ["explosion"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 15,
"name": ["spawn"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 16,
"name": ["hammer", "hit"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 17,
Expand All @@ -1003,7 +1011,9 @@
"members": [
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 18,
Expand All @@ -1012,7 +1022,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 19,
Expand All @@ -1021,7 +1033,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 20,
Expand All @@ -1030,7 +1044,9 @@
"members": [
{"name": ["angle"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",
Expand Down
32 changes: 24 additions & 8 deletions gamenet/generate/spec/ddnet-17.2.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1059,28 +1059,36 @@
{"name": ["x"], "type": {"kind": "int32"}},
{"name": ["y"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 14,
"name": ["explosion"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 15,
"name": ["spawn"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 16,
"name": ["hammer", "hit"],
"super": ["common"],
"members": [],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 17,
Expand All @@ -1089,7 +1097,9 @@
"members": [
{"name": ["client", "id"], "type": {"kind": "int32", "min": 0, "max": 63}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 18,
Expand All @@ -1098,7 +1108,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 19,
Expand All @@ -1107,7 +1119,9 @@
"members": [
{"name": ["sound", "id"], "type": {"kind": "enum", "enum": ["sound"]}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": 20,
Expand All @@ -1116,7 +1130,9 @@
"members": [
{"name": ["angle"], "type": {"kind": "int32"}}
],
"attributes": []
"attributes": [
"event"
]
},
{
"id": "0c4fd27d-47e3-3871-a226-9f417486a311",
Expand Down
Loading

0 comments on commit 5da5e3e

Please sign in to comment.