-- Fredzaza --

Godet = {};
Godet.modDirectory = g_currentModDirectory;

function Godet.prerequisitesPresent(specializations)
      return true;
end;
function Godet.initSpecialization()
	local schema = Vehicle.xmlSchema
    schema:setXMLSpecializationType("Godet")
	schema:register(XMLValueType.NODE_INDEX, "vehicle.objet#index", "index")
	schema:register(XMLValueType.NODE_INDEX, "vehicle.godetvisual#index", "index")
end
function Godet.registerOverwrittenFunctions(vehicleType)
end
function Godet.registerFunctions(vehicleType)	
end
function Godet.registerEvents(vehicleType)
end
function Godet:registerActionEventsPlayer()
end
function Godet:registerActionEventsMenu()
end

function Godet:onRegisterActionEvents(isSelected, isOnActiveVehicle)
end

function Godet.registerEventListeners(vehicleType)
	SpecializationUtil.registerEventListener(vehicleType, "onLoad", Godet)
	SpecializationUtil.registerEventListener(vehicleType, "onDelete", Godet)
    SpecializationUtil.registerEventListener(vehicleType, "onReadStream", Godet)
    SpecializationUtil.registerEventListener(vehicleType, "onWriteStream", Godet)

	SpecializationUtil.registerEventListener(vehicleType, "onUpdate", Godet)
	SpecializationUtil.registerEventListener(vehicleType, "onPostDetach", Godet)
	SpecializationUtil.registerEventListener(vehicleType, "onDeactivate", Godet)
	SpecializationUtil.registerEventListener(vehicleType, "onDraw", Godet)
	SpecializationUtil.registerEventListener(vehicleType, "onRegisterActionEvents", Godet)
end

function Godet:onLoad(vehicle)	
	self.racine2 = self.xmlFile:getValue("vehicle.objet#index", nil, self.components, self.i3dMappings)
	self.godetvisual = self.xmlFile:getValue("vehicle.godetvisual#index", nil, self.components, self.i3dMappings)
end;

function Godet:onDelete() 
end;

function Godet:onPostDetach()
end

function Godet:onReadStream(streamId, connection)
end;
  
function Godet:onWriteStream(streamId, connection)
end;

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

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

function Godet:onUpdate(dt, vehicle)
		local attacherVehicle = self:getAttacherVehicle()
		if attacherVehicle ~= nil then
			if attacherVehicle.godetvisualpelle ~= nil then
				link(attacherVehicle.godetvisualpelle, self.godetvisual)
			end
		else
			unlink(self.godetvisual)
			link(self.racine2, self.godetvisual)
        end
end;

function Godet:onUpdateTick() 
end;	
function Godet:onDeactivate()
	unlink(self.godetvisual)
	link(self.racine2, self.godetvisual)
end;       
function Godet:onDraw()  
end;
