H-uru / Plasma

Cyan Worlds's Plasma game engine
http://h-uru.github.io/Plasma/
GNU General Public License v3.0
202 stars 80 forks source link

Make `Python.Cheat` command more usable by not parsing its argument #1543

Closed dgelessus closed 7 months ago

dgelessus commented 7 months ago

The argument is now always treated as a plain string and passed directly to the cheat. This is the behavior expected by all the functions in xCheat.py, which parse the string argument manually where needed.

The previous implementation evaluated the argument value as a Python expression. This theoretically allowed passing non-string arguments, but none of the cheats use this (and it's also a potential code execution issue). If no argument was passed, the function was called with no arguments, which is also not supported by any of the cheats.

In practice, this required unintuitive syntax for calling the cheats correctly, for example:

Python.Cheat GetPlayerID None
Python.Cheat GetSDL "'FirstWeekClothing'"

With the new argument handling, these have been simplified to:

Python.Cheat GetPlayerID
Python.Cheat GetSDL FirstWeekClothing