Skip to content

Contributing to SWIM

Salieri edited this page Jul 5, 2023 · 2 revisions

Here is a quick overview of things you can do if you'd like to contribute to SWIM. In this case: Thank you very much. =)

Find bugs / potential for improvement and create a ticket

That's probably the easiest, doesn't require any special skills and can be done as you play. Should you encounter any bugs or think of something that could be improved, please create a ticket by using the correct template and filling it.
Please do yourself a favour though and use Find the Culprit first to confirm it really is a bug in SWIM. If it occurs in one of SWIMs macros, it's very likely it is SWIM though.
If you report bugs, it's also very helpful to open the console (F12) and look for red error messages there, if you see any (even those from Warpgate), share them in your ticket, they might be important.
As for feature requests (improvements), keep 'em coming, but be prepared to receive a 'no'. Don't be too disappointed then, I try to make everyone happy with SWIM but there's only so much I can do and not everything is feasible and I'm not always able to spend as much time as would be required to make a feature become reality. This is just a hobby after all. And I'm also not a professional dev, so not everything I want to do I can. Are you a dev, keep reading. ;-)

(Find tickets and) Create a PR

So you know how to write code and want to contribute to SWIM? Well, that's great, thank you. Going through the open tickets will give you an idea on what is currently lacking, buggy or asked for. I usually also create tickets for stuff that needs to be done. Pick any that strikes your fancy and mention in the ticket that you'll try to make a PR. This doesn't mean you have to but if it proves too difficult or too much work to fit your schedule, please write that in the ticket, so I don't wait for it. Of course you can also create a PR for just about anything else. But please create a ticket first. There we'll be able to discuss it a bit. It's always a bummer to create a PR that doesn't get merged and I'm a bit picky. Not because I want to but because I have to maintain the code later so I have to be able to comprehend it (and I'm not a professional dev). I'll usually respond within a day.
Also please focus your PR on the topic you want to tackle. It might be tempting to bring everything you see along the way in a better format or improve some other things as well, but this makes reviewing the PR a real pain.

Work on a translation

So you have at least very limited dev experience and you know a language other than English? Head on over to SWIMs Weblate Page sponsored by the League. There you can work on translations for SWIM.

Adjust the official modules file

You'll need to know a little bit about programming and Foundry VTT for this one, but not too much. SWIM draws some information (journal links, div classes, compendium keys) from a single file in SWIM, the Official Modules file. This needs to be filled with content by users such as you, otherwise it's worth nothing. That is because I don't have modules of other languages and even if I did, I wouldn't be able to read any of it. Working on the file for the non-english modules you have isn't terribly difficult but you'll need some elbow grease and a bit of knowledge on how it is structured.

The general structure

The code in SWIM works the file in reverse, meaning it checks from bottom up, rather than to to bottom. The code also stops on a first hit. Also the core rules modules (currently SWADE and SWPF) are at the very top, first has to be SWADE, always.
This structure ensures that enabled setting modules are found first if they have a match. I assume that you prefer your settings style and rules rather than the core rules one if you have a setting module active and this ensures that you get that. Additionally, English modules have to appear at the top of the file. The order of languages below that doesn't matter as long as the follow the core-rules-first-order.

Finding the links

The modules have a large number of links and I already added a substantial amount for the English modules. It is critical that you use the same property names, otherwise SWIM won't find them. You must not adjust property names to your language, only their values.
Finding your links is very straight forward: Find the correct heading in your core rules journal. Then drag and drop that heading from the left side of the journal (the table of content) to the part of the chat in Foundry where you can type. Foundry will put the link there ready to be sent. You don't want to send it to the chat of course, but you can easily copy the link from there.
Links always start with @UUID if you see this it is what you need. One important thing to note though: Links always end with {Header Title}. You want to remove that part as that part will be localised by SWIM anyway. It just names the link and SWIM might change the links title to fit it in the text, so don't paste that part in the file please.

Making the changes

In order to make the changes, you'll need to create a fork and then submit them as a PR to SWIM. Please follow the procedure above regarding the PR. This will allow others to know s/o is already working on their language so they don't do the same work as you.
You don't have to do all the links at once but please do them in alphabetical order. This will make it a lot easier for others to know where they need to start.

Make a donation

If everything else is not an option for you or you want to actively reward me, you can also make a donation at any time:
Ko-fi
This is one way to show me that my module is actually used and well-received.