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
- AnimatedMapObject
- AnimatedObject
- Bale
- Basketball
- BgaSellStation
- BunkerSilo
- BuyingStation
- DigitalDisplay
- DogBall
- HelpIcons
- InlineBale
- InlineBaleSingle
- LoadingStation
- MountableObject
- NightIllumination
- Nightlight2
- NightlightFlicker
- PackedBale
- PhysicsObject
- ProductionPoint
- Rotator
- SellingStation
- SimParticleSystem
- Storage
- SunAdmirer
- TourIconsMobile
- UnloadingStation
- VehicleSellingPoint
- WildlifeSpawner
- 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
LoadingStation
ParentObjectFunctions
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
92 | function LoadingStation:readStream(streamId, connection) |
93 | LoadingStation:superClass().readStream(self, streamId, connection) |
94 | if connection:getIsServer() then |
95 | for _, loadTrigger in ipairs(self.loadTriggers) do |
96 | local loadTriggerId = NetworkUtil.readNodeObjectId(streamId) |
97 | loadTrigger:readStream(streamId, connection) |
98 | g_client:finishRegisterObject(loadTrigger, loadTriggerId) |
99 | end |
100 | end |
101 | end |
registerXMLPaths
DescriptionDefinitionregisterXMLPaths()Code
344 | function LoadingStation.registerXMLPaths(schema, basePath) |
345 | schema:register(XMLValueType.NODE_INDEX, basePath .. "#node", "Loading station node") |
346 | schema:register(XMLValueType.STRING, basePath .. "#stationName", "Station name", "LoadingStation") |
347 | schema:register(XMLValueType.FLOAT, basePath .. "#storageRadius", "Inside of this radius storages can be placed", 50) |
348 | schema:register(XMLValueType.BOOL, basePath .. "#supportsExtension", "Supports extensions", false) |
349 | schema:register(XMLValueType.STRING, basePath .. "#fillTypes", "Basic supported filltypes") |
350 | schema:register(XMLValueType.STRING, basePath .. "#fillTypeCategories", "Basic supported filltype categories") |
351 | |
352 | LoadTrigger.registerXMLPaths(schema, basePath .. ".loadTrigger(?)") |
353 | end |
removeFillLevel
DescriptionremoveFillLevelDefinition
removeFillLevel(integer fillTypeIndex, float fillDelta, integer farmId)Arguments
integer | fillTypeIndex | |
float | fillDelta | |
integer | farmId |
float | remainingDelta |
275 | function LoadingStation:removeFillLevel(fillTypeIndex, fillDelta, farmId) |
276 | |
277 | --#debug assertWithCallstack(fillDelta >= 0, "fillDelta needs to be positive") |
278 | |
279 | local remainingDelta = fillDelta |
280 | for _, sourceStorage in pairs(self.sourceStorages) do |
281 | if self:hasFarmAccessToStorage(farmId, sourceStorage) then |
282 | local oldFillLevel = sourceStorage:getFillLevel(fillTypeIndex) |
283 | if oldFillLevel > 0 then |
284 | sourceStorage:setFillLevel(oldFillLevel - fillDelta, fillTypeIndex) |
285 | end |
286 | local newFillLevel = sourceStorage:getFillLevel(fillTypeIndex) |
287 | remainingDelta = remainingDelta - (oldFillLevel - newFillLevel) |
288 | |
289 | if remainingDelta < 0.0001 then |
290 | remainingDelta = 0 |
291 | break |
292 | end |
293 | end |
294 | end |
295 | |
296 | return remainingDelta |
297 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
107 | function LoadingStation:writeStream(streamId, connection) |
108 | LoadingStation:superClass().writeStream(self, streamId, connection) |
109 | if not connection:getIsServer() then |
110 | for _, loadTrigger in ipairs(self.loadTriggers) do |
111 | NetworkUtil.writeNodeObjectId(streamId, NetworkUtil.getObjectId(loadTrigger)) |
112 | loadTrigger:writeStream(streamId, connection) |
113 | g_server:registerObjectInStream(connection, loadTrigger) |
114 | end |
115 | end |
116 | end |