ComUnit

From Crumbled World Wiki

ComUnitExampleCode


Functions

return function description
setPos(Vec3 position)
setScriptGroup(ScriptGroup group)
setName(string name)
setCanReceiveTargeted(bool canRecive)
setCanReceiveBroadcast(bool canRecive)
sendTo(int targetIndex, string message, object parameters) sends a message to another ComUnit with id targetIndex. the message will be delivered next frame. RTT=2frames.
sendTo(string targetName, string message, object parameters) sends a message to another ComUnit with name targetName. the message will be delivered next frame. RTT=2frames.
sendNetworkSync(string message, string parameter) sends a message to to all other connected clients. to sync this script. May not reach reciver
sendNetworkSyncTo(string message, string parameter) sends a message to to all connected clients to the script using networkName. May not reach reciver
sendNetworkSyncSafe(string message, string parameter) sends a message to to all other connected clients. to sync this script. It is guaranteed to be delivered if networkName is connected to active script
sendNetworkSyncSafeTo(string message, string parameter) sends a message to to all other connected clients to the script using networkName. It is guaranteed to be delivered if networkName is connected to active script
sendToSpoof(int fromIndex, int targetIndex, string message, object parameters) This allow you to send a message from one script pretending to be another.
broadCast(Vec3 position, float range, string message, object parameters)
broadCastSpoof(int fromIndex, Vec3 position, float range, string message, object parameters) This allow you to broadcast a message from one script pretending to be another.
Vec3 getPos()
int getIndex()
ScriptGroup getGroup()
Billboard getBillboard()
bool hasMessage() returns true if any message is in queue.
{frame=number, fromIndex=number, message=string, parameter=object} popMessage() return a table
clearMessages()