Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
PlaceableBuyingStation
DescriptionSpecialization for placeablesFunctions
- collectPickObjects
- getBuyingStation
- onDelete
- onFinalizePlacement
- onLoad
- onReadStream
- onWriteStream
- prerequisitesPresent
- registerEventListeners
- registerFunctions
- registerOverwrittenFunctions
- registerXMLPaths
collectPickObjects
DescriptionDefinitioncollectPickObjects()Code
117 | function PlaceableBuyingStation:collectPickObjects(superFunc, node) |
118 | local spec = self.spec_buyingStation |
119 | if spec.buyingStation ~= nil then |
120 | for _, loadTrigger in ipairs(spec.buyingStation.loadTriggers) do |
121 | if node == loadTrigger.triggerNode then |
122 | return |
123 | end |
124 | end |
125 | end |
126 | |
127 | superFunc(self, node) |
128 | end |
getBuyingStation
DescriptionDefinitiongetBuyingStation()Code
132 | function PlaceableBuyingStation:getBuyingStation() |
133 | return self.spec_buyingStation.buyingStation |
134 | end |
onDelete
DescriptionDefinitiononDelete()Code
72 | function PlaceableBuyingStation:onDelete() |
73 | local spec = self.spec_buyingStation |
74 | |
75 | if spec.buyingStation ~= nil then |
76 | g_currentMission.storageSystem:removeLoadingStation(spec.buyingStation, spec.buyingStation.owningPlaceable) |
77 | spec.buyingStation:delete() |
78 | end |
79 | end |
onFinalizePlacement
DescriptionDefinitiononFinalizePlacement()Code
83 | function PlaceableBuyingStation:onFinalizePlacement() |
84 | local spec = self.spec_buyingStation |
85 | |
86 | if spec.buyingStation ~= nil then |
87 | spec.buyingStation:register(true) |
88 | end |
89 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
55 | function PlaceableBuyingStation:onLoad(savegame) |
56 | local spec = self.spec_buyingStation |
57 | |
58 | local buyingStation = BuyingStation.new(self.isServer, self.isClient) |
59 | if buyingStation:load(self.components, self.xmlFile, "placeable.buyingStation", self.customEnvironment, self.i3dMappings) then |
60 | spec.buyingStation = buyingStation |
61 | spec.buyingStation.owningPlaceable = self |
62 | |
63 | g_currentMission.storageSystem:addLoadingStation(spec.buyingStation, spec.buyingStation.owningPlaceable) |
64 | else |
65 | Logging.xmlError(self.xmlFile, "Could not load buying station") |
66 | buyingStation:delete() |
67 | end |
68 | end |
onReadStream
DescriptionDefinitiononReadStream()Code
93 | function PlaceableBuyingStation:onReadStream(streamId, connection) |
94 | local spec = self.spec_buyingStation |
95 | if spec.buyingStation ~= nil then |
96 | local buyingStationId = NetworkUtil.readNodeObjectId(streamId) |
97 | spec.buyingStation:readStream(streamId, connection) |
98 | g_client:finishRegisterObject(spec.buyingStation, buyingStationId) |
99 | end |
100 | end |
onWriteStream
DescriptionCalled on server side on joinDefinition
onWriteStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
106 | function PlaceableBuyingStation:onWriteStream(streamId, connection) |
107 | local spec = self.spec_buyingStation |
108 | if spec.buyingStation ~= nil then |
109 | NetworkUtil.writeNodeObjectId(streamId, NetworkUtil.getObjectId(spec.buyingStation)) |
110 | spec.buyingStation:writeStream(streamId, connection) |
111 | g_server:registerObjectInStream(connection, spec.buyingStation) |
112 | end |
113 | end |
prerequisitesPresent
DescriptionChecks if all prerequisite specializations are loadedDefinition
prerequisitesPresent(table specializations)Arguments
table | specializations | specializations |
boolean | hasPrerequisite | true if all prerequisite specializations are loaded |
18 | function PlaceableBuyingStation.prerequisitesPresent(specializations) |
19 | return true |
20 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
36 | function PlaceableBuyingStation.registerEventListeners(placeableType) |
37 | SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableBuyingStation) |
38 | SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableBuyingStation) |
39 | SpecializationUtil.registerEventListener(placeableType, "onFinalizePlacement", PlaceableBuyingStation) |
40 | SpecializationUtil.registerEventListener(placeableType, "onReadStream", PlaceableBuyingStation) |
41 | SpecializationUtil.registerEventListener(placeableType, "onWriteStream", PlaceableBuyingStation) |
42 | end |
registerFunctions
DescriptionDefinitionregisterFunctions()Code
24 | function PlaceableBuyingStation.registerFunctions(placeableType) |
25 | SpecializationUtil.registerFunction(placeableType, "getBuyingStation", PlaceableBuyingStation.getBuyingStation) |
26 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
30 | function PlaceableBuyingStation.registerOverwrittenFunctions(placeableType) |
31 | SpecializationUtil.registerOverwrittenFunction(placeableType, "collectPickObjects", PlaceableBuyingStation.collectPickObjects) |
32 | end |
registerXMLPaths
DescriptionDefinitionregisterXMLPaths()Code
46 | function PlaceableBuyingStation.registerXMLPaths(schema, basePath) |
47 | schema:setXMLSpecializationType("BuyingStation") |
48 | BuyingStation.registerXMLPaths(schema, basePath .. ".buyingStation") |
49 | schema:setXMLSpecializationType() |
50 | end |