Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- AnimalHusbandry
- BeehivePlaceable
- BgaPlaceable
- BunkerSiloPlaceable
- BuyingStationPlaceable
- Doghouse
- FarmhousePlaceable
- GreenhousePlaceable
- HeatingPlantPlaceable
- HusbandryModuleWater
- Placeable
- SellingStationPlaceable
- SiloExtensionPlaceable
- SiloPlaceable
- SolarCollectorPlaceable
- WindTurbinePlaceable
- WoodSellStationPlaceable
- 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
BuyingStationPlaceable
DescriptionClass for placeable siloFunctions
collectPickObjects
DescriptionCollect pick objectsDefinition
collectPickObjects(integer node)Arguments
integer | node | node id |
107 | function BuyingStationPlaceable:collectPickObjects(node) |
108 | local foundNode = false |
109 | if not foundNode then |
110 | for _, loadTrigger in ipairs(self.buyingStation.loadTriggers) do |
111 | if node == loadTrigger.triggerNode then |
112 | foundNode = true |
113 | break |
114 | end |
115 | end |
116 | end |
117 | |
118 | if not foundNode then |
119 | BuyingStationPlaceable:superClass().collectPickObjects(self, node) |
120 | end |
121 | end |
delete
DescriptionDeleting placeable siloDefinition
delete()Code
34 | function BuyingStationPlaceable:delete() |
35 | if self.buyingStation ~= nil then |
36 | self.buyingStation:delete() |
37 | end |
38 | |
39 | unregisterObjectClassName(self) |
40 | BuyingStationPlaceable:superClass().delete(self) |
41 | end |
finalizePlacement
DescriptionCalled if placeable is placedDefinition
finalizePlacement()Code
72 | function BuyingStationPlaceable:finalizePlacement() |
73 | BuyingStationPlaceable:superClass().finalizePlacement(self) |
74 | |
75 | self.buyingStation:register(true) |
76 | end |
load
DescriptionLoad siloDefinition
load(string xmlFilename, float x, float y, float z, float rx, float ry, float rz, boolean initRandom)Arguments
string | xmlFilename | xml file name |
float | x | x world position |
float | y | z world position |
float | z | z world position |
float | rx | rx world rotation |
float | ry | ry world rotation |
float | rz | rz world rotation |
boolean | initRandom | initialize random |
boolean | success | success |
54 | function BuyingStationPlaceable:load(xmlFilename, x,y,z, rx,ry,rz, initRandom) |
55 | if not BuyingStationPlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, initRandom) then |
56 | return false |
57 | end |
58 | |
59 | local xmlFile = loadXMLFile("TempXML", xmlFilename) |
60 | |
61 | self.buyingStation = BuyingStation:new(self.isServer, self.isClient) |
62 | self.buyingStation:load(self.nodeId, xmlFile, "placeable.buyingStation", self.customEnvironment) |
63 | self.buyingStation.owningPlaceable = self |
64 | |
65 | delete(xmlFile) |
66 | |
67 | return true |
68 | end |
new
DescriptionCreating placeable siloDefinition
new(boolean isServer, boolean isClient, table customMt)Arguments
boolean | isServer | is server |
boolean | isClient | is client |
table | customMt | custom metatable |
table | instance | Instance of object |
24 | function BuyingStationPlaceable:new(isServer, isClient, customMt) |
25 | local self = Placeable:new(isServer, isClient, customMt or SiloPlaceable_mt) |
26 | |
27 | registerObjectClassName(self, "BuyingStationPlaceable") |
28 | |
29 | return self |
30 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
82 | function BuyingStationPlaceable:readStream(streamId, connection) |
83 | BuyingStationPlaceable:superClass().readStream(self, streamId, connection) |
84 | if connection:getIsServer() then |
85 | local buyingStationId = NetworkUtil.readNodeObjectId(streamId) |
86 | self.buyingStation:readStream(streamId, connection) |
87 | g_client:finishRegisterObject(self.buyingStation, buyingStationId) |
88 | end |
89 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
95 | function BuyingStationPlaceable:writeStream(streamId, connection) |
96 | BuyingStationPlaceable:superClass().writeStream(self, streamId, connection) |
97 | if not connection:getIsServer() then |
98 | NetworkUtil.writeNodeObjectId(streamId, NetworkUtil.getObjectId(self.buyingStation)) |
99 | self.buyingStation:writeStream(streamId, connection) |
100 | g_server:registerObjectInStream(connection, self.buyingStation) |
101 | end |
102 | end |