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
- getMaterialCustomShaderFilename
- getMaterialCustomShaderVariation
- getMaterialDiffuseMapFilename
- getMaterialDiffuseMapHasAlpha
- getMaterialEmissiveMapFilename
- getMaterialEmissiveMapHasAlpha
- getMaterialGlossMapFilename
- getMaterialHasRefractionMap
- getMaterialIsAlphaBlended
- getMaterialIsAlphaTested
- getMaterialNormalMapFilename
- getMaterialNormalMapFormat
- getMaterialReflectionMapScaling
- setMaterialCustomMapFromFile
- setMaterialCustomShaderVariation
- setMaterialDiffuseMapFromFile
- setMaterialGlossMapFromFile
- setMaterialNormalMapFromFile
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
ChainsawStateEvent
DescriptionEvent for chainsaw stateParent
EventFunctions
emptyNew
DescriptionCreate instance of Event classDefinition
emptyNew()Return Values
table | self | instance of class event |
14 | function ChainsawStateEvent.emptyNew() |
15 | local self = Event.new(ChainsawStateEvent_mt) |
16 | return self |
17 | end |
new
DescriptionCreate new instance of eventDefinition
new(table player, boolean isCutting, boolean isHorizontalCut)Arguments
table | player | player |
boolean | isCutting | is cutting |
boolean | isHorizontalCut | is horizontal cutting |
table | instance | instance of event |
25 | function ChainsawStateEvent.new(player, isCutting, isHorizontalCut, hasBeencut) |
26 | local self = ChainsawStateEvent.emptyNew() |
27 | self.player = player |
28 | self.isCutting = isCutting |
29 | self.isHorizontalCut = isHorizontalCut |
30 | self.hasBeenCut = hasBeencut |
31 | return self |
32 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
38 | function ChainsawStateEvent:readStream(streamId, connection) |
39 | self.player = NetworkUtil.readNodeObject(streamId) |
40 | self.isCutting = streamReadBool(streamId) |
41 | self.isHorizontalCut = streamReadBool(streamId) |
42 | self.hasBeenCut = streamReadBool(streamId) |
43 | self:run(connection) |
44 | end |
run
DescriptionRun action on receiving sideDefinition
run(integer connection)Arguments
integer | connection | connection |
60 | function ChainsawStateEvent:run(connection) |
61 | if not connection:getIsServer() then |
62 | g_server:broadcastEvent(self, false, connection, self.player) |
63 | end |
64 | |
65 | local currentTool = self.player.baseInformation.currentHandtool |
66 | if currentTool ~= nil and currentTool.setCutting ~= nil then |
67 | currentTool:setCutting(self.isCutting, self.isHorizontalCut, self.hasBeenCut, true) |
68 | end |
69 | end |
sendEvent
DescriptionBroadcast event from server to all clients, if called on client call function on server and broadcast it to all clientsDefinition
sendEvent(table player, boolean isCutting, boolean isHorizontalCut, boolean noEventSend)Arguments
table | player | player |
boolean | isCutting | is cutting |
boolean | isHorizontalCut | is horizontal cutting |
boolean | noEventSend | no event send |
77 | function ChainsawStateEvent.sendEvent(player, isCutting, isHorizontalCut, hasBeenCut, noEventSend) |
78 | local currentTool = player.baseInformation.currentHandtool |
79 | if currentTool ~= nil and currentTool.setCutting ~= nil and (currentTool.isCutting ~= isCutting or currentTool.hasBeenCut ~= hasBeenCut) then |
80 | if noEventSend == nil or noEventSend == false then |
81 | if g_server ~= nil then |
82 | g_server:broadcastEvent(ChainsawStateEvent.new(player, isCutting, isHorizontalCut, hasBeenCut), nil, nil, player) |
83 | else |
84 | g_client:getServerConnection():sendEvent(ChainsawStateEvent.new(player, isCutting, isHorizontalCut, hasBeenCut)) |
85 | end |
86 | end |
87 | end |
88 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
50 | function ChainsawStateEvent:writeStream(streamId, connection) |
51 | NetworkUtil.writeNodeObject(streamId, self.player) |
52 | streamWriteBool(streamId, self.isCutting) |
53 | streamWriteBool(streamId, self.isHorizontalCut) |
54 | streamWriteBool(streamId, self.hasBeenCut) |
55 | end |