Keridos/Shape-Builder — pull request #5 by pokemane (2013-03-26 01:37:01+00:00)
Title: Add progress saving capabilities

Would love to add the capability to save progress, to enable resume in the event of a server crash/chunk unload/SSP quit.

I began a file backend of sorts to add the capability to record/export/read/import the progress data as a serialized table. I also began a Simulate() function that would run a "progress comparator" which would check the current progress table with the recorded one. (Note: a couple things may still be off, e.g. which variables are called. I tried to name them as clearly as possible)
The overall vision is to:
-at start of ShapeBuilder, check for an existing ProgressFile
-if one is found, set the "sim_mode" flag AND "cost_only" flag (important! need to count our progress, fuel used, etc in simulation) and proceed to the "ResumeProgress()" function (exact copy of the "ChoiceFunc method, except using the inputs from the table to mimic what the user had put in before)
-proceed with a simulation of the previous job, checking at every action (turn, move, place) for whether we've reached our last saved point (x,y,z,facing,block count)
-upon reaching the last saved point, un-set the Sim and Cost-only flags and proceed with normal operation.

I think I've gotten most of the core functionality finished; just need to test it in-game to make sure it works. Nothing new should call on normal operation modes (I hope! :D ).

Any and all suggestions are welcome. My motivation behind this is mainly to be able to build large domes and spheres with some degree of confidence that a crash or chunk unload won't end up with me wasting hundreds or thousands of glass blocks, and possibly several hours' time.

cheers!