Commit graph

121 commits

Author SHA1 Message Date
ChillerDragon a6ecf91e52 Release 0.4.0 2023-04-09 16:27:36 +02:00
ChillerDragon b9a719ece9 Add pack() method to PacketHeader class
Also removed unused PacketHeader size field
2023-04-09 16:22:35 +02:00
ChillerDragon 3b93a6bba2 Packing python bools as tw net bools just works
python handles bools more like the ints 0 and 1
and those are exactly the values the
teeworlds network protocol expects

I can totally see this breaking in python4
or a new mypy version

maybe one day a ``get_bool()`` could make sense
also for readability

but for now this should be stable as long as the
tests pass
2023-04-09 12:14:13 +02:00
ChillerDragon f1d562f25f Add snap single test 2023-04-09 12:03:16 +02:00
ChillerDragon 2b28e755bc Add support for the data size field 2023-04-09 11:44:43 +02:00
ChillerDragon 1ab907a5ae Delete .gitkeep 2023-04-08 18:38:41 +02:00
ChillerDragon 7dc9e6de14 Add 48 chunk rcon server response test 2023-04-08 18:30:46 +02:00
ChillerDragon 7a8dc63aee Document message parsing progress 2023-04-08 15:27:52 +02:00
ChillerDragon 2c22d3bd39 Finish skin change tests 2023-04-08 15:27:12 +02:00
ChillerDragon 559f63d033 Generate messages with array fields
This commit was fully automated by

		./scripts/generate_messages.py
2023-04-08 14:25:58 +02:00
ChillerDragon 822074ea47 Add support for generating array chunk fields 2023-04-08 14:24:44 +02:00
ChillerDragon 7e7f419597 More skin change tests 2023-04-07 18:14:41 +02:00
ChillerDragon e24b3959ce Start working on skin change test 2023-04-07 16:57:04 +02:00
ChillerDragon 9615392156 Fix parsing messages with ids higher than 31
See my thought process here
https://github.com/ChillerDragon/teeworlds-protocol/pull/15
2023-04-07 16:10:56 +02:00
ChillerDragon bd4353538a Revert optionals cc generation test 2023-04-07 16:09:27 +02:00
ChillerDragon df3448d001 Add failing call vote packet test 2023-04-07 14:31:04 +02:00
ChillerDragon 7dfaeda45f Apply sanitize string cc to all messages that need it 2023-04-07 14:27:25 +02:00
ChillerDragon 3df2a7fb12 Make the errors of run_tests.sh more intense
I did run ./scripts/run_tests.sh and thought they passed lol
pylint is not using colored output so in the green wall
of tests its easy to over see.

This should not happen again after this change.
2023-04-07 13:08:56 +02:00
ChillerDragon 5fc964e4ed Fix pylint error 2023-04-07 13:08:44 +02:00
ChillerDragon 2346e271ac Note that this will never keep track of vital msgs for you 2023-04-07 12:54:18 +02:00
ChillerDragon a9ba5bd703 Sanitize string unpack by default the same way tw does it
This sadly probably comes with some hefty performance implications
2023-04-07 12:46:50 +02:00
ChillerDragon 1a864d903c Add test for client side token packing 2023-04-07 10:45:35 +02:00
ChillerDragon 640dca32ad Advertise my favorite command that ensured pipelines passing so far 2023-04-07 10:38:04 +02:00
ChillerDragon 61610e46d8 Release 0.3.3 2023-04-07 10:32:45 +02:00
ChillerDragon 1300c45a0f Finally found a working recurse 2023-04-07 10:22:47 +02:00
ChillerDragon fc3da234c1 Manually list all folders (not so nice imo) 2023-04-07 10:15:30 +02:00
ChillerDragon 8559dcbfeb Also revert readme back to setup.cfg 2023-04-07 09:40:32 +02:00
ChillerDragon dd304aad20 Ensure installing as package works in CI 2023-04-07 09:39:38 +02:00
ChillerDragon fa96ed570d Release 0.3.2 2023-04-07 09:28:36 +02:00
ChillerDragon a11a3cbb42 Switch back to setup.cfg in release script 2023-04-07 09:27:49 +02:00
ChillerDragon 8d0725d527 Back to find: (worked locally lets see) 2023-04-07 09:25:14 +02:00
ChillerDragon 434e6a9457 Go back to old build setup to fix import error 2023-04-07 09:06:13 +02:00
ChillerDragon 2052ff6da0 Duplicate package test to other script for testing 2023-04-07 08:58:37 +02:00
ChillerDragon d8790e94f4 Could also run python -m venv venv in CI 2023-04-06 19:43:29 +02:00
ChillerDragon 6ca69aed84 Add -x to shellcheck in CI 2023-04-06 19:15:10 +02:00
ChillerDragon 674e40c286 Ensure release passes all tests 2023-04-06 19:12:17 +02:00
ChillerDragon 2cbc3671bd Stricter release testing in venv
https://gitlab.com/teeworlds-network/twnet_parser/-/issues/3
2023-04-06 19:07:41 +02:00
ChillerDragon 454dfcdde2 Only generate changelog for latest release 2023-04-06 18:23:25 +02:00
ChillerDragon 0ad4f64a5f Release 0.3.1 2023-04-06 18:15:52 +02:00
ChillerDragon ccbc15d230 Move setup.cfg into pyproject.toml 2023-04-06 18:15:08 +02:00
ChillerDragon 78ea668487 Build twice to avoid having dirty working tree
Makes debugging build issues much more fun
2023-04-06 17:56:25 +02:00
ChillerDragon 146f2214e0 Weird assumed progress but ctrl,game+sys sounds solid
Just details missing like weird fields and snap items
2023-04-06 17:45:05 +02:00
ChillerDragon 639edda489 Add support for control messages 2023-04-06 17:44:17 +02:00
ChillerDragon 7ba6e18ced Keep messages a union of ctl and net (closed #1)
The messages array in the TwPacket class
is now planned to stay a Union of CtrlMessage and NetMessage.
Which both are empty duck typed classes. That abstract away
the 5 specific CtrlMessage classes and the many
game and system message classes.

```python
class CtrlMessage(Protocol):
    message_name: str
    def unpack(self, data: bytes) -> bool:
        ...
    def pack(self) -> bytes:
        ...

class NetMessage(Protocol):
    message_name: str
    system_message: bool
    header: ChunkHeader
    def unpack(self, data: bytes) -> bool:
        ...
    def pack(self) -> bytes:
        ...

class TwPacket(PrettyPrint):
    def __init__(self) -> None:
        self.messages: list[Union[CtrlMessage, NetMessage]] = []
```
2023-04-06 15:47:08 +02:00
ChillerDragon 37730deaa2 Start drafting control message layout 2023-04-02 21:01:44 +02:00
ChillerDragon a75c95d2ad Run ruff --fix . 2023-04-02 20:06:31 +02:00
ChillerDragon 760d8bce1f Fix comment too long 2023-04-02 20:03:50 +02:00
ChillerDragon 044e17b6e6 Do not import unused Unpacker 2023-04-02 20:02:27 +02:00
ChillerDragon d6d8abc091 Do not instantiate unused unpacker 2023-04-02 20:00:42 +02:00
ChillerDragon df3fcb9b17 Fix optional type assuming int 2023-04-02 19:56:29 +02:00