ShapeClass.client_getAvailableChildConnectionCount
Called to check how many more child (output) connections with the given type flag the Interactable will accept. Return 1 or more to allow a connection of this type.
Kind: Callback
Environments: Game
Game
Callback side: Client
ShapeClass:client_getAvailableChildConnectionCount( flags )
-- Example of implementation that accepts 10 logic connections and 1 power connection
MyInteractable.maxChildCount = 11
MyInteractable.connectionOutput = sm.interactable.connectionType.logic + sm.interactable.connectionType.power
function MyIteractable.client_getAvailableChildConnectionCount( self, flags )
if bit.band( flags, sm.interactable.connectionType.logic ) ~= 0 then
return 10 - self:getParents( sm.interactable.connectionType.logic )
end
if bit.band( flags, sm.interactable.connectionType.power ) ~= 0 then
return 1 - self:getParents( sm.interactable.connectionType.power )
end
return 0
end
Note: maxChildCount must be 1 or more for this callback to be called.
Parameters:
| Name | Type | Description |
|---|---|---|
self |
table | The class instance. |
flags |
integer | Connection type flags. |
Returns:
| Type | Description |
|---|---|
| integer | The number of available connections. |