Skip to content
This repository has been archived by the owner on Dec 25, 2021. It is now read-only.

Code cleanup #10

Open
lodenrogue opened this issue Jul 24, 2018 · 4 comments
Open

Code cleanup #10

lodenrogue opened this issue Jul 24, 2018 · 4 comments

Comments

@lodenrogue
Copy link

How about abstracting some of these features into their own python file? Maybe (suggestion) using some object oriented programming features like polymorphism to simplify all those if, else statements?

@savagezen
Copy link
Owner

Thanks for the input! I am not familiar with polymorphism or (admittedly) other object oriented features, but will look into them. If you're willing, you're more than willing to do so yourself and make a pull request.

I am aware of the verbose nature of the program; particularly if additional libraries and source material continue to be added. A major stumbling block is that the program is made to install directly to a Linux binary and I am not (yet) knowledgeable as to how to make things other than the main script install. Though, taking a quick look at my PKGBUILD it doesn't appear too complicated, it will just take some experimenting to figure out.

@raithwind
Copy link

I don't know what you are doing to turn it into a linux binary, but would that still work if the python script references a config file for the tables? ex all the loot tables could be a json or something that you load in and then expand?

@savagezen
Copy link
Owner

I've had some time to think about this and, yes, it is possible. My concern previously was that implementing library files would break cross-platform compatibility (e.g. Linux wouldn't use the reference files but would install them and vice-versa for Windows).

However, the library files could be made (JSON or just a file containing a python dictionary / list) for different sources or content categories (weapons, items, art, etc...) or source books. Windows should read it fine as long as the python script in the source reads (imports) them correctly.

The job, then of installing those libraries on Linux doesn't have to fall on this script, but can easily be done by the PKGBUILD which packages the source for (Arch) Linux installation. Other distributions would have to use a more manual process, but the commands would all be referenced in the PKGBUILD.

@raithwind
Copy link

That sounds reasonable, and the inclusion of the os module would mean that you could have the files stored in a subdirectory and us os to handle the cross platform compatibility of reading from the subdir?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants