-- Fredzaza --
-- TMP --
-- @date 08/12/2019 --

Balde = {};

function Balde.prerequisitesPresent(specializations)
      return true;
end;
function Balde.initSpecialization()
end
function Balde.registerOverwrittenFunctions(vehicleType)
end
function Balde.registerFunctions(vehicleType)	
end
function Balde.registerEvents(vehicleType)
end
function Balde:registerActionEventsPlayer()
end
function Balde:registerActionEventsMenu()
end

function Balde:onRegisterActionEvents(isSelected, isOnActiveVehicle)
	if isOnActiveVehicle then
		if self.Balde == nil then 
			self.Balde = {}
		else	
			self:clearActionEventsTable( self.Balde )
		end 
	end
end

function Balde.registerEventListeners(vehicleType)
	SpecializationUtil.registerEventListener(vehicleType, "onLoad", Balde)
	SpecializationUtil.registerEventListener(vehicleType, "onDelete", Balde)
    SpecializationUtil.registerEventListener(vehicleType, "onReadStream", Balde)
    SpecializationUtil.registerEventListener(vehicleType, "onWriteStream", Balde)
	SpecializationUtil.registerEventListener(vehicleType, "onUpdate", Balde)
	SpecializationUtil.registerEventListener(vehicleType, "onDeactivate", Balde)
	SpecializationUtil.registerEventListener(vehicleType, "onDraw", Balde)
	SpecializationUtil.registerEventListener(vehicleType, "onRegisterActionEvents", Balde)
end

function Balde:onLoad(vehicle)	
	self.baldeprincipal = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.balde_principal#index"));
	self.baldevisual = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.balde_visual#index"));
end;

function Balde:onDelete() 
end;

function Balde:onReadStream(streamId, connection)
end;

function Balde:onWriteStream(streamId, connection)
end;

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

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

function Balde:onUpdate(dt, vehicle)
local attacherVehicle = self:getAttacherVehicle()
	if attacherVehicle ~= nil then
		if attacherVehicle.baldevisualexcavadora ~= nil then
			link(attacherVehicle.baldevisualexcavadora, self.baldevisual)
		end
		else
			unlink(self.baldevisual)
			link(self.baldeprincipal, self.baldevisual)
	end
end;

function Balde:onUpdateTick() 
end;

function Balde:onDeactivate()
	unlink(self.baldevisual)
	link(self.baldeprincipal, self.baldevisual)
end;

function Balde:onDraw()  
end;