Skip to main content
Skip to main content

ManureBarrel

ManureBarrel

Description

Specialization for liquid manure barrel, connects function of barrel to attached manure spreader

Functions

getAreEffectsVisible

Description

Definition

getAreEffectsVisible()

Arguments

anysuperFunc

Code

function ManureBarrel:getAreEffectsVisible(superFunc)
local spec = self.spec_manureBarrel

if spec.attachedTool ~ = nil then
return false
end

return superFunc( self )
end

getIsWorkAreaActive

Description

Definition

getIsWorkAreaActive()

Arguments

anysuperFunc
anyworkArea

Code

function ManureBarrel:getIsWorkAreaActive(superFunc, workArea)
local spec = self.spec_manureBarrel

if spec.attachedTool ~ = nil then
return false
end

return superFunc( self , workArea)
end

initSpecialization

Description

Definition

initSpecialization()

Code

function ManureBarrel.initSpecialization()
local schema = Vehicle.xmlSchema
schema:setXMLSpecializationType( "ManureBarrel" )

schema:register(XMLValueType.INT, "vehicle.manureBarrel#attacherJointIndex" , "Attacher joint index" )

schema:setXMLSpecializationType()
end

onLoad

Description

Definition

onLoad()

Arguments

anysavegame

Code

function ManureBarrel:onLoad(savegame)
local spec = self.spec_manureBarrel

XMLUtil.checkDeprecatedXMLElements( self.xmlFile, "vehicle.manureBarrel#toolAttachAnimName" , "vehicle.attacherJoints.attacherJoint.objectChange" ) --FS17 to FS19

spec.attachToolJointIndex = self.xmlFile:getValue( "vehicle.manureBarrel#attacherJointIndex" )
end

onPostAttachImplement

Description

Definition

onPostAttachImplement()

Arguments

anyattachable
anyinputJointDescIndex
anyjointDescIndex
anyloadFromSavegame

Code

function ManureBarrel:onPostAttachImplement(attachable, inputJointDescIndex, jointDescIndex, loadFromSavegame)
local spec = self.spec_manureBarrel
if jointDescIndex = = spec.attachToolJointIndex then
spec.attachedTool = attachable
end
end

onPostDetachImplement

Description

Definition

onPostDetachImplement()

Arguments

anyimplementIndex

Code

function ManureBarrel:onPostDetachImplement(implementIndex)
local spec = self.spec_manureBarrel

local object
if self.getObjectFromImplementIndex ~ = nil then
object = self:getObjectFromImplementIndex(implementIndex)
end

if object ~ = nil then
local attachedImplements = self:getAttachedImplements()
if attachedImplements[implementIndex].jointDescIndex = = spec.attachToolJointIndex then
spec.attachedTool = nil
end
end
end

prerequisitesPresent

Description

Definition

prerequisitesPresent()

Arguments

anyspecializations

Code

function ManureBarrel.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization( Sprayer , specializations) and SpecializationUtil.hasSpecialization( AttacherJoints , specializations)
end

registerEventListeners

Description

Definition

registerEventListeners()

Arguments

anyvehicleType

Code

function ManureBarrel.registerEventListeners(vehicleType)
SpecializationUtil.registerEventListener(vehicleType, "onLoad" , ManureBarrel )
SpecializationUtil.registerEventListener(vehicleType, "onPostAttachImplement" , ManureBarrel )
SpecializationUtil.registerEventListener(vehicleType, "onPostDetachImplement" , ManureBarrel )
end

registerOverwrittenFunctions

Description

Definition

registerOverwrittenFunctions()

Arguments

anyvehicleType

Code

function ManureBarrel.registerOverwrittenFunctions(vehicleType)
SpecializationUtil.registerOverwrittenFunction(vehicleType, "getAreEffectsVisible" , ManureBarrel.getAreEffectsVisible)
SpecializationUtil.registerOverwrittenFunction(vehicleType, "getIsWorkAreaActive" , ManureBarrel.getIsWorkAreaActive)
end