Beispiel #1
0
    def read(self, msg, map):
        enc = self.pdef.enc
        lm = lerpmode(enc)
        
        vectyp = (enc & 0x30) >> 4
        
        if wantlerp(enc):
            dolerp = msg.readbits(1)
        else:
            dolerp = 0

        narea = -1
        if vectyp > 1:
            narea = read_smallint(msg) - 1
            
        nx = self.codec[0](msg)
        ny = self.codec[0](msg)
        nz = 0.0
        if vectyp > 0:
            nz = self.codec[0](msg)
            
        nval = vect3d(nx, ny, nz), narea

        self.lastread = nval
        
        #print '%s: %f'%(self.pdef.name, nval)
        
        # If we change immediately on receipt, change _val_ now.
        if lm == LM_IMM:
            if self.prop.val != nval:
                self.prop.val = nval
                return True
            return False
        # So we don't change immediately. Write the new value into
        # _writenew_. 

        self.writenew = nval;

        # If we don't lerp, or the server does not want us to lerp to the
        # new value, write the new value into _writeold_ so lerp() will
        # always see the new value.

        if not dolerp or self.updated:
            self.writeold = nval
            
        self.updated = True
        # Unless we're immediate, we don't change the value in this
        # function.
        return False
Beispiel #2
0
 def __init__(self, loc = vect3d(), area = -1):
     Property.__init__(self)
     self._loc = loc
     self._area = area