Jump to content

Integrating git version control into a plugin to track changes in save games


raath

Recommended Posts

I'm a PHP developer and I use git a lot as part of my every day routine.

For me, git is the perfect means of keeping a historical record of changes and looking at the structure of the save files, git is the perfect method of backing up save games. At the moment I'm having a bad time with my mun base and other landed craft. For no reason, my structures keep ending up under the surface so I have to track down a previous save game and hope that I can return them to their original altitude. With Git, I could go through the commits to the point of time when the structures end up under the surface and restore them and save me a few hours of rapid disassembly while I try and find it's original altitude.

My idea is to write a simple plugin that will fire a git commit command when a game is saved so I don't have to remember to do it manually. Then if things start teleporting into the planet or other odd nastiness happens to ruin the game, I can hunt through the version history and restore the original altitudes thus rescuing my game.

As I said I'm a LAMP developer, working on linux, some python experience so the transition to C# hopefully won't be that painless. I'm looking for some hints and tips to get me fast tracked.

First problem I have in my quest is that I've discovered there is an OnSave method but MonoDevelop doesn't seem to like my code.

using System;
using UnityEngine;

namespace VersionKontrol
{
class KerbalVersionKontrol : PartModule
{
public override void onSave (ConfigNode node)
{
print ("** Here be some git magic eventually **");
}
}
}

I'll be executing git commit -a -m "<saveType> <ISO date string>"

but when I build MonoDevelop tells me

'VersionKontrol.KerbalVersionKontrol.onSave(ConfigNode)' is marked as an override but no suitable method found to override

Is there also a method to call when a save game is created? so I could fire git init in that save game directory?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

×
×
  • Create New...