Index: src/action.c
===================================================================
--- src/action.c	(revision 5868)
+++ src/action.c	(working copy)
@@ -1191,12 +1191,31 @@
 		psWeapStats = NULL;
 	}
 
+	// If we are idle (DACTION_NONE), then we start auto-repair (if possible)
+	// but before that, we check to see if we were hit since the last time we
+	// started the autorepair action. (which is set in droidSelfRepair())
+	// --snip
+	// The ugly portion of the if check is to workaround a timeLastHit issue
+	// that was present in old save games.  We use it now for testing a savegame
+	// so we can tell this works.  *IT WILL BE REMOVED before commit(as this comment will be)*
+	// https://gna.org/bugs/?12217 load savegame "02" to test.
+	// --snip
 	switch (psDroid->action)
 	{
 	case DACTION_NONE:
+		//if we were hit after the repair start time, then reset action
+		if (psDroid->timeLastHit > psDroid->actionStarted
+			&& psDroid->timeLastHit !=0xffffffff && psDroid->actionStarted !=0)
+		{
+			// something is hitting us, so reset our orders.
+			psDroid->action = DACTION_NONE;
+			orderDroid(psDroid, DORDER_NONE);
+			psDroid->actionStarted = gameTime;
+			return;
+		}
+
 	case DACTION_WAITFORREPAIR:
-		// doing nothing
-		//since not doing anything, see if need to self repair
+		// see if need to self repair
 		if (selfRepairEnabled(psDroid->player))
 		{
 			//wait for 1 second to give the repair facility a chance to do the repair work
@@ -1816,6 +1835,19 @@
 	case DACTION_SULK:
 		// unable to route to target ... don't do anything aggressive until time is up
 		// we need to do something defensive at this point ???
+		// ok, we will.  If we got hit after we started sulking, then defend ourselves.
+		// --snip
+		// yes, same verbage as above, the ugly check will be removed...
+		//--snip
+		if (psDroid->timeLastHit > psDroid->actionStarted
+			&& psDroid->timeLastHit !=0xffffffff && psDroid->actionStarted !=0)
+		{
+			// something is hitting us, so reset our orders.
+			psDroid->action = DACTION_NONE;
+			orderDroid(psDroid, DORDER_NONE);
+			psDroid->actionStarted = gameTime;
+			return;
+		}
 
 		//hmmm, hope this doesn't cause any problems!
 		if (gameTime > psDroid->actionStarted)
@@ -2403,6 +2435,17 @@
 					psDroid->psActionTarget[0], &(psDroid->turretRotation[0]),
 					&(psDroid->turretPitch[0]), NULL, false, 0);
 		}
+		else
+		{
+			//if we were hit after the self-repair start time, then reset action
+			if (psDroid->timeLastHit > psDroid->actionStarted)
+			{
+					psDroid->action = DACTION_NONE;
+					orderDroid(psDroid, DORDER_NONE);
+					psDroid->actionStarted = gameTime;
+					return;
+			}
+		}
 
 		//check still next to the damaged droid
 		xdiff = (SDWORD)psDroid->pos.x - (SDWORD)psDroid->psActionTarget[0]->pos.x;
Index: src/droid.c
===================================================================
--- src/droid.c	(revision 5868)
+++ src/droid.c	(working copy)
@@ -2973,7 +2973,7 @@
 	psDroid->lastEmission = 0;
 		// ffs AM
 	psDroid->bTargetted = false;
-	psDroid->timeLastHit = UDWORD_MAX;
+	psDroid->timeLastHit = 0;	// We haven't been hit so set it to 0
 	psDroid->lastHitWeapon = UDWORD_MAX;	// no such weapon
 
 	// it was never drawn before

