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
FarmhousePlaceable
DescriptionPlayer house with spawnpointParent
PlaceableFunctions
delete
DescriptionDeleting placeable farmhouseDefinition
delete()Code
32 | function FarmhousePlaceable:delete() |
33 | unregisterObjectClassName(self) |
34 | |
35 | if self.sleepingTrigger ~= nil then |
36 | removeTrigger(self.sleepingTrigger) |
37 | end |
38 | |
39 | g_currentMission:removeActivatableObject(self) |
40 | self.objectActivated = false |
41 | |
42 | FarmhousePlaceable:superClass().delete(self) |
43 | end |
getIsActivatable
DescriptionGet is activateableDefinition
getIsActivatable()Return Values
boolean | isActivateable | is activateable |
134 | function FarmhousePlaceable:getIsActivatable() |
135 | return g_currentMission:getFarmId() == self:getOwnerFarmId() |
136 | end |
load
DescriptionLoad farmhouseDefinition
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 |
56 | function FarmhousePlaceable:load(xmlFilename, x,y,z, rx,ry,rz, initRandom) |
57 | if not FarmhousePlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, initRandom) then |
58 | return false |
59 | end |
60 | |
61 | local xmlFile = loadXMLFile("TempXML", xmlFilename) |
62 | |
63 | self.spawnNode = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse#spawnNode")) |
64 | |
65 | self.sleepingTrigger = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse.sleeping#triggerNode")) |
66 | if self.sleepingTrigger ~= nil then |
67 | addTrigger(self.sleepingTrigger, "sleepingTriggerCallback", self) |
68 | end |
69 | self.sleepingCamera = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse.sleeping#cameraNode")) |
70 | |
71 | self.activateText = g_i18n:getText("ui_inGameSleep") |
72 | |
73 | self.isEnabled = true |
74 | self.objectActivated = false |
75 | |
76 | |
77 | delete(xmlFile) |
78 | |
79 | return true |
80 | end |
new
DescriptionCreating placeable farmhouseDefinition
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 |
22 | function FarmhousePlaceable:new(isServer, isClient, customMt) |
23 | local self = Placeable:new(isServer, isClient, customMt or FarmhousePlaceable_mt) |
24 | |
25 | registerObjectClassName(self, "FarmhousePlaceable") |
26 | |
27 | return self |
28 | end |
onActivateObject
DescriptionOn activate objectDefinition
onActivateObject()Code
144 | function FarmhousePlaceable:onActivateObject() |
145 | g_sleepManager:showDialog() |
146 | end |