--- fixStartPosition
--- simple specialisation to prevent Mod-hopping after savegame loading. This is a general issue with xyz-spain mods
---
--- V1.0: 
--- author: upsidedown
--- date: 10.11.2013


fixStartPosition = {};



function fixStartPosition.prerequisitesPresent(specializations)
	return true;
end;

function fixStartPosition:load(xmlFile)

	
end;

function fixStartPosition:loadFromAttributesAndNodes(xmlFile, key, resetVehicles)  
   if not resetVehicles then
		self.fixStartPositionTime = 0;
		self.fixStartPosition = {};
		for i=1, table.getn(self.components) do
			self.fixStartPosition[i] = {};
			self.fixStartPosition[i].px,self.fixStartPosition[i].py,self.fixStartPosition[i].pz = getWorldTranslation(self.components[i].node);
			self.fixStartPosition[i].rx,self.fixStartPosition[i].ry,self.fixStartPosition[i].rz = getWorldRotation(self.components[i].node);			
		end;
   end;
   
   return BaseMission.VEHICLE_LOAD_OK;
end;

function fixStartPosition:getSaveAttributesAndNodes(nodeIdent)
   local attributes = ""; --' steermode="'..tonumber(self.XSmode)..'"';
   return attributes, nil;
end;

function fixStartPosition:mouseEvent(posX, posY, isDown, isUp, button)
end;

function fixStartPosition:keyEvent(unicode, sym, modifier, isDown)
end;

function fixStartPosition:update(dt)
	if self.fixStartPositionTime ~= nil then
		if self.fixStartPositionTime < 1500 then 
			for i=1, table.getn(self.components) do
				self:setWorldPosition(self.fixStartPosition[i].px,self.fixStartPosition[i].py,self.fixStartPosition[i].pz,self.fixStartPosition[i].rx,self.fixStartPosition[i].ry,self.fixStartPosition[i].rz, i);
			end;
			if self:getIsActive() then
				self.fixStartPositionTime = self.fixStartPositionTime + dt;
			end;
			--print(self.fixStartPositionTime)
		end;
	end;
end;

function fixStartPosition:draw()
end;

function fixStartPosition:delete()
end;


function fixStartPosition:writeStream(streamId, connection)

end;


function fixStartPosition:readStream(streamId, connection)

end;

