from direct.distributed.ClientRepository import ClientRepository
ClientRepository module: contains the ClientRepository class
- class ClientRepository(dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)
This is the open-source ClientRepository as provided by CMU. It communicates with the ServerRepository in this same directory.
If you are looking for the VR Studio’s implementation of the client repository, look to OTPClientRepository (elsewhere).
- GameGlobalsId = 0
- __init__(self, dcFileNames=None, dcSuffix='', connectMethod=None, threadedNet=None)
Returns a newly-allocated doId. Call freeDoId() when the object has been deleted.
- createDistributedObject(self, className=None, distObj=None, zoneId=0, optionalFields=None, doId=None, reserveDoId=False)
To create a DistributedObject, you must pass in either the name of the object’s class, or an already-created instance of the class (or both). If you pass in just a class name (to the className parameter), then a default instance of the object will be created, with whatever parameters the default constructor supplies. Alternatively, if you wish to create some initial values different from the default, you can create the instance yourself and supply it to the distObj parameter, then that instance will be used instead. (It should be a newly-created object, not one that has already been manifested on the network or previously passed through createDistributedObject.) In either case, the new DistributedObject is returned from this method.
This method will issue the appropriate network commands to make this object appear on all of the other clients.
You should supply an initial zoneId in which to manifest the object. The fields marked “required” or “ram” will be broadcast to all of the other clients; if you wish to broadcast additional field values at this time as well, pass a list of field names in the optionalFields parameters.
Normally, doId is None, to mean allocate a new doId for the object. If you wish to use a particular doId, pass it in here. If you also pass reserveDoId = True, this doId will be reserved from the allocation pool using self.reserveDoId(). You are responsible for ensuring this doId falls within the client’s allowable doId range and has not already been assigned to another object.
- deleteObject(self, doId)
Removes the object from the client’s view of the world. This should normally not be called directly except in the case of error recovery, since the server will normally be responsible for deleting and disabling objects as they go out of scope.
After this is called, future updates by server on this object will be ignored (with a warning message). The object will become valid again the next time the server sends a generate message for this doId.
This is not a distributed message and does not delete the object on the server or on any other client.
- doNotDeallocateChannel = True
- formatGenerate(self, distObj, extraFields)
Returns a datagram formatted for sending the generate message for the indicated object.
- freeDoId(self, doId)
Returns a doId back into the free pool for re-use.
Returns the doIdBase of the client that originally sent the current update message. This is only defined when processing an update message or a generate message.
- handleDatagram(self, di)
- handleDelete(self, di)
- handleDisable(self, di)
- handleGenerate(self, di)
- handleMessageType(self, msgType, di)
- handleRequestGenerates(self, di)
- handleSetDoIdrange(self, di)
- handleUpdateField(self, di)
Returns true if this client has been assigned a range of doId’s it may use to create objects, false otherwise.
- isLocalId(self, doId)
Returns true if this doId is one that we’re the owner of, false otherwise.
- notify = <direct.directnotify.Notifier.Notifier object>
- resendGenerate(self, obj)
Sends the generate message again for an already-generated object, presumably to inform any newly-arrived clients of this object’s current state.
- reserveDoId(self, doId)
Removes the indicate doId from the available pool, as if it had been explicitly allocated. You may pass it to freeDoId() later if you wish.
- sendDeleteMsg(self, doId)
- sendSetLocation(self, doId, parentId, zoneId)
- sendUpdate(self, distObj, fieldName, args)
Sends a normal update for a single field.
- sendUpdateToChannel(self, distObj, channelId, fieldName, args)
Sends a targeted update of a single field to a particular client. The top 32 bits of channelId is ignored; the lower 32 bits should be the client Id of the recipient (i.e. the client’s doIdbase). The field update will be sent to the indicated client only. The field must be marked clsend or p2p, and may not be marked broadcast.
- setInterestZones(self, interestZoneIds)
Changes the set of zones that this particular client is interested in hearing about.
- setObjectZone(self, distObj, zoneId)
Moves the object into the indicated zone.
- stopTrackRequestDeletedDO(self, *args)
- storeObjectLocation(self, object, parentId, zoneId)