Time to get rid of the GameEvent objects and move to dictionaries?
Sounds really good, perfect not to say. Hopefully you'll also add some kind of to_dict() method or a way of iterating over the event variables!Ayuto wrote:The plan is to implement __getitem__ and __setitem__. If we still keep the get_<type>/set_<type> methods it's absolutely backwards compatible, because it's just an addition.
__iter__ would probably be enough, since you could just do:
Syntax: Select all
d = {var: event[var] for var in event}
We can also expose the KeyValues object. Then you would do
Syntax: Select all
event.variables.as_dict()
I have created a new branch for the __getitem__ implementation. https://github.com/Source-Python-Dev-Team/Source.Python/commit/06658ab791b3db65cd83356798d5ac5f86f7fb21
I think the event system is the same on all branches. Some weeks ago I checked the offset of the KeyValues object and it was the same on all games we support. That's why I just reconstructed the structure of CGameEvent and didn't use an offset. Not sure if we want to change that. I honestly don't think we need to.
I think the event system is the same on all branches. Some weeks ago I checked the offset of the KeyValues object and it was the same on all games we support. That's why I just reconstructed the structure of CGameEvent and didn't use an offset. Not sure if we want to change that. I honestly don't think we need to.
Awesome, this looks fantastic! The system just became infinitely times better with the KeyValues addition, for me at least.Ayuto wrote:I have created a new branch for the __getitem__ implementation. https://github.com/Source-Python-Dev-Team/Source.Python/commit/06658ab791b3db65cd83356798d5ac5f86f7fb21
I think the event system is the same on all branches. Some weeks ago I checked the offset of the KeyValues object and it was the same on all games we support. That's why I just reconstructed the structure of CGameEvent and didn't use an offset. Not sure if we want to change that. I honestly don't think we need to.
I've spent 5+ hours with the new system and found absolutely no issues with it. Boolean values seem to always come in as 1 and 0, but that hasn't bothered me (you can still do all operations normally, only identity testing fails) and they can easily be converted using bool() if someone really wants a bool. But other than that, seems to work just fine!satoon101 wrote:I went ahead an removed the first event_test branch. I won't be home for a few days, so please feel free to test this out and let us know if you find any issues or if it works perfectly fine. Once we get confirmation, it looks good enough for me to merge into master.
Who is online
Users browsing this forum: No registered users and 31 guests