Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin to auto-generate regionlist file? #21

Open
huanga opened this issue Apr 16, 2011 · 5 comments
Open

Plugin to auto-generate regionlist file? #21

huanga opened this issue Apr 16, 2011 · 5 comments

Comments

@huanga
Copy link

huanga commented Apr 16, 2011

Might be over-kill on server resources with a plugin that'd keep track of region changes, so I don't think that is a viable solution.
But, at the same time, I find it annoying and difficult to maintain regionlist file manually.

It'd be really nice and cool if you can do this:

  1. At end of each generation, in the folder the command was executed from, touch .pigmap-lastsuccess
  2. At a potential increment build run (ie: incomplete info for full build, but also lacking -c and -r), look at the file date of .pigmap-lastsuccess, compare each file in region / chunk directory with the time of last success to see if newer (ie: if a save have been done on the same file)
  3. Automatically build the list of files pigmap needs to visit to perform an incremental update

Hope my pseudo steps make sense and get considered :)

@huanga
Copy link
Author

huanga commented Apr 16, 2011

Okay, I got bored and wrote a small bash script...
I am not familiar with other shells, and this have only been tested lightly for myself.
Only thing I've noticed is my regions -1,-1; -1,0; 0,-1; and 0,0 are always updatd. I don't know the cause to this. Also, this ONLY works with the region save format. Since I am not old school enough to have a chunk based save, I do not even know how to begin. Aside from those, I'm not aware of any issues, and I am most likely not able to provide any support.

#! /bin/sh
# Some configurations
pigmap="/user/minecraft/mcscripts/pigmap"
i_path="/user/minecraft/mcramdisk/world"
o_path="/var/www/minecraft.site.com/map"
g_path="/user/minecraft/mcscripts/images"
b_param=6
t_param=1
z_param=10
h_param=3
working_path="/user/minecraft/mcramdisk"

# Don't touch anything else down here
# Switch to working directory as needed
if [ ! -z "$working_path" ]
    then
        cd $working_path
fi
# Verify if we have had previous runs
if [ -e .pigmap-lastsuccess ]
    then
        # Incremental Build
        for filename in $i_path/region/*
        do
            if [ $filename -nt .pigmap-lastsuccess ]
                then
                    # this file is newer!
                    echo $filename requires rendering!
                    echo $filename >> regionlist
            fi
        done
        # Issue the incremental build command
        $pigmap -i $i_path -o $o_path -r regionlist -g $g_path -h $h_param -x
    else
        # Initial Build
        $pigmap -B $b_param -T $t_param -Z $z_param -i $i_path -o $o_path -g $g_path -h $h_param
fi

# DONE! Remove regionlist (for next run) and touch .pigmap-lastsuccess
rm regionlist
touch .pigmap-lastsuccess

I'm keeping this issue open for now so other users can provide comments on how to improve this... If this is not the appropriate action, please feel free to adjust as you see fit.

@tdebarochez
Copy link

I made this little script for my server : https://gist.github.com/922978
and hope it will be useful.
Put it in the Minecraft root path and pigmap just below. The result will be stored in pigmap/output/ path

@equalpants
Copy link
Owner

I'll probably add an option eventually to detect changed regions/chunks by timestamp; since it's so easy to do this with a script, though, it's not a high priority.

P.S. pigmap.params is already touched on every map generation (full or incremental); no need for another file.
P.P.S. Check out "find -newer"; you can probably use it to simplify your script.

@equalpants
Copy link
Owner

...uh, I see tdebarochez beat me to it! Be sure to look at his script; it's very nice.

@florianbeisel
Copy link

Just in case you might make use of my script I put it on gist: https://gist.github.com/944469

NadnerbD pushed a commit to NadnerbD/pigmap that referenced this issue Dec 15, 2011
…ants#26, closes equalpants#27)

Added mossy and cracked stone bricks (closes equalpants#21, closes equalpants#22)

	modified:   blockimages.cpp
	modified:   blockimages.h
NadnerbD pushed a commit to NadnerbD/pigmap that referenced this issue Dec 15, 2011
…ants#26, closes equalpants#27)

Added mossy and cracked stone bricks (closes equalpants#21, closes equalpants#22)

	modified:   blockimages.cpp
	modified:   blockimages.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants