Jump to content
Sign in to follow this  
glassPen

A simple Bourne Again Shell Script to install custom Maps

Recommended Posts

I have written a simple BASH script for GNU Linux to install maps that users make for 0ad.

Please review and improve. Use as you would like.

See readme.

This was originaly made for SwampGremlin's map.

EDIT by Sanderd17:

Removed the script as we cannot accept scripts that require to be run as root, unless really necessary.

Edited by sanderd17

Share this post


Link to post
Share on other sites

May I ask what's wrong with "copy and paste"?

(Not sure where Altas saves the maps ATM. Maybe it would help do add a link or a README.TXT to the folder the screenshot folder is in containing information about the paths (simple) modifications should go to)

  • Like 1

Share this post


Link to post
Share on other sites

Well, for me (current SVN) it's "Documents\My Games\0ad\mods\user\maps\scenarios" (or "skirmish").

That's not a path easy to guess...

Edited by FeXoR

Share this post


Link to post
Share on other sites

Assuming mappers/modders provide a zip file containing maps/{scenarios,skirmish}/* and the ui folder with the preview image (can't remember that path), you can just drop that file into the user mod (see GameDataPaths on the wiki). (No compression or DEFLATE for the zip only.)

Share this post


Link to post
Share on other sites

Yes, it seems easy enough. But when in game i noticed that apparantly it isn't for allot of people. Also, the install dir varies with platform and install method.

Also this script of for linux, not windows. Also when installing on nix the /usr/share is not owned by the user group.

Edited by glassPen

Share this post


Link to post
Share on other sites

Assuming mappers/modders provide a zip file containing maps/{scenarios,skirmish}/* and the ui folder with the preview image (can't remember that path), you can just drop that file into the user mod (see GameDataPaths on the wiki). (No compression or DEFLATE for the zip only.)

That's the best way as is now, I agree. Still not very comfortable IMO.

(E.g. the mappreview should be searched for in the path the map is in also)

Edited by FeXoR

Share this post


Link to post
Share on other sites

I'm sorry, read your script, and I had to remove it.

There's really no way we can accept that script to be ran as root.

As other comments mentioned, moving it to the user mod (i.e. ~/.local/share/0ad/mods/user on Linux) will also install the map. This does not require root privileges, and allows the map to stay available when updating the game.

Next to being dangerous (although your code seemed to have enough quotes on first sight), it's also a bad habit to run scripts as root. We've got a lot of error reports about users trying to build the SVN, just because they build it as root. They did it out of habit, and it messed up paths and file permissions. As such, we now explicitly stop the execution of both the compilation script and the pyrogenesis executable when it's run as root. This should also be done in your script if you want to publish it again.

Share this post


Link to post
Share on other sites

Assuming mappers/modders provide a zip file containing maps/{scenarios,skirmish}/* and the ui folder with the preview image (can't remember that path), you can just drop that file into the user mod (see GameDataPaths on the wiki). (No compression or DEFLATE for the zip only.)

If the mod contained those folders, wouldn't it mess things up for those who already had them? Even if the game would read multiple maps folders, it would be messy.

Edited by greenknight32
  • Like 1

Share this post


Link to post
Share on other sites

If the mod contained those folders, wouldn't it mess things up for those who already had them? Even if the game would read multiple maps folders, it would be messy.

No it would not. It just puts all those files in one (virtual) folder that is read by the game.

Share this post


Link to post
Share on other sites

... the mappreview should be searched for in the path the map is in also

Would that be possible guys? If it can't find it in the default folder, it looks for the preview image there.

Share this post


Link to post
Share on other sites

Should be possible (would move pictures out of the art folder though), but I'd rather have all of those images in one folder (so either next to the maps, or in the art folder) than spread out.

Share this post


Link to post
Share on other sites

No it would not. It just puts all those files in one (virtual) folder that is read by the game.

I figured the game would probably deal with it ok, but would the player be seeing maps1 and maps2 etc? That's what I meant by messy.

Share this post


Link to post
Share on other sites

No just map1.zip and map2.zip (with better names) in the user/ folder.

That's what I meant. Suppose there's a new version of one of those maps, you want to replace the old version, and it's in one of five different maps folders....

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...