citymania-org / grf-py

A Python framework for making NewGRFs for OpenTTD
GNU General Public License v2.0
14 stars 3 forks source link

Bugfix: avoid prop name "class" #14

Closed ahyangyi closed 8 months ago

ahyangyi commented 9 months ago

Hi, there are some props named "class", which makes them very hard to interact with in Python.

Currently, they could only be worked around with constructs such as **{"class": b'TEST'}, but that's hardly satisfactory. This PR changes them to class_label.

ldpl commented 9 months ago

Well, problem is, I tried to keep naming of properties same as in nml. And it only works well if they're all named the same, otherwise you need to consult docs anyway. And naming it class doesn't pose much problem here as Action0 properties are supplied via props dict anyway. But I can imagine it being a problem if you want to keep consistent naming while propagating it further. And tbh I'm not really happy with nml naming for many other reasons so maybe I need to give up on following that and just make better docs for grf-py. But for now I think I'll hold off making that decision a bit more.

ldpl commented 8 months ago

ok, I gave up on nml naming but I didn't think much of what naming scheme I want to use yet. So I'm merging it rn but no promises I'll keep this name for long xD Though class_label seems to be ok so maybe it'll survive.