Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
ManureBarrel
DescriptionSpecialization for liquid manure barrel, connects function of barrel to attached manure spreaderFunctions
- getAreEffectsVisible
- getIsWorkAreaActive
- onLoad
- onPostAttachImplement
- onPostDetachImplement
- prerequisitesPresent
- registerEventListeners
- registerOverwrittenFunctions
getAreEffectsVisible
DescriptionDefinitiongetAreEffectsVisible()Code
73 | function ManureBarrel:getAreEffectsVisible(superFunc) |
74 | local spec = self.spec_manureBarrel |
75 | |
76 | if spec.attachedTool ~= nil then |
77 | return false |
78 | end |
79 | |
80 | return superFunc(self) |
81 | end |
getIsWorkAreaActive
DescriptionDefinitiongetIsWorkAreaActive()Code
85 | function ManureBarrel:getIsWorkAreaActive(superFunc, workArea) |
86 | local spec = self.spec_manureBarrel |
87 | |
88 | if spec.attachedTool ~= nil then |
89 | return false |
90 | end |
91 | |
92 | return superFunc(self, workArea) |
93 | end |
onLoad
DescriptionDefinitiononLoad()Code
36 | function ManureBarrel:onLoad(savegame) |
37 | local spec = self.spec_manureBarrel |
38 | |
39 | XMLUtil.checkDeprecatedXMLElements(self.xmlFile, self.configFileName, "vehicle.manureBarrel#toolAttachAnimName", "vehicle.attacherJoints.attacherJoint.objectChange") --FS17 to FS19 |
40 | |
41 | spec.attachToolJointIndex = getXMLInt(self.xmlFile, "vehicle.manureBarrel#attacherJointIndex") |
42 | end |
onPostAttachImplement
DescriptionDefinitiononPostAttachImplement()Code
46 | function ManureBarrel:onPostAttachImplement(attachable, inputJointDescIndex, jointDescIndex) |
47 | local spec = self.spec_manureBarrel |
48 | if jointDescIndex == spec.attachToolJointIndex then |
49 | spec.attachedTool = attachable |
50 | end |
51 | end |
onPostDetachImplement
DescriptionDefinitiononPostDetachImplement()Code
55 | function ManureBarrel:onPostDetachImplement(implementIndex) |
56 | local spec = self.spec_manureBarrel |
57 | |
58 | local object |
59 | if self.getObjectFromImplementIndex ~= nil then |
60 | object = self:getObjectFromImplementIndex(implementIndex) |
61 | end |
62 | |
63 | if object ~= nil then |
64 | local attachedImplements = self:getAttachedImplements() |
65 | if attachedImplements[implementIndex].jointDescIndex == spec.attachToolJointIndex then |
66 | spec.attachedTool = nil |
67 | end |
68 | end |
69 | end |
prerequisitesPresent
DescriptionDefinitionprerequisitesPresent()Code
15 | function ManureBarrel.prerequisitesPresent(specializations) |
16 | return SpecializationUtil.hasSpecialization(Sprayer, specializations) and SpecializationUtil.hasSpecialization(AttacherJoints, specializations) |
17 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
28 | function ManureBarrel.registerEventListeners(vehicleType) |
29 | SpecializationUtil.registerEventListener(vehicleType, "onLoad", ManureBarrel) |
30 | SpecializationUtil.registerEventListener(vehicleType, "onPostAttachImplement", ManureBarrel) |
31 | SpecializationUtil.registerEventListener(vehicleType, "onPostDetachImplement", ManureBarrel) |
32 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
21 | function ManureBarrel.registerOverwrittenFunctions(vehicleType) |
22 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getAreEffectsVisible", ManureBarrel.getAreEffectsVisible) |
23 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getIsWorkAreaActive", ManureBarrel.getIsWorkAreaActive) |
24 | end |