Author Topic: Can someone explain the trust system?  (Read 1407 times)

In general I want to know if someone can explain how the trust system works?
Also, can you explain the flow of it, how the potential trust things work and where trust relationship data is stored on the client and the server?
How and when does the data from the clients trust list get populated on the server (all those potential trust entries on a clients brick group have to come from somewhere).

What i've picked up so far...
serverCmdTrust_Invite(%client, %targetClient, %targetBLID, %trustLevel):
The entry point of the trust system. Client tells the server he want's trust of target BLID's trust. Server asks target client. Target client responds and lets client know the outcome. Server and both clients now have a copy of this new trust relationship.
serverCmdTrust_Demote(%client, %targetBLID, %trustLevel):
Used to demote someone from trust list. Client tells the server he is demoting the trust of Target BLID. Now both clients and the server have a copy that the relationship was broken.

getTrustLevel(%obj1, %obj2)
Get's the client from %obj1 and %obj2 and compares their trust. How does this comparison work.

More questions for getTrustLevel()
Does the server look ask both clients?
What if a client isn't there?
How do the potential trusts factor into this?

getTrustLevel(%obj1, %obj2)
Get's the client from %obj1 and %obj2 and compares their trust. How does this comparison work.

Something like this, I believe:

%bg1 = getBrickGroupFromObject(%obj1);
%bg2 = getBrickGroupFromObject(%obj2);

return min(%bg1.trust[%bg2.bl_id], %bg2.trust[%bg1.bl_id]);


Where min returns the lowest numeric argument.
« Last Edit: August 19, 2013, 10:37:59 AM by Port »

this is a useful function

setMutualBrickGroupTrust(someID,someOtherID,level <0-3>);
0 is no trust
1 is build
2 is full
3 is self trust (allow wanding of bricks)

this is a useful function

setMutualBrickGroupTrust(someID,someOtherID,level <0-3>);
0 is no trust
1 is build
2 is full
3 is self trust (allow wanding of bricks)

For reference, that function is pretty much the same as doing this (except it might also send the info to clients, not sure):

BrickGroup_someID.trust[someOtherID] = level;
BrickGroup_someOtherID.trust[someID] = level;
« Last Edit: August 19, 2013, 10:37:48 AM by Port »

function TrustAll()
{
   for(%a=0;%a<clientgroup.getcount();%a++)
   {
      %c=clientgroup.getobject(%a);
      %g = %c.brickgroup;
      if(isObject(%g))
         for(%b=0;%b<clientgroup.getcount();%b++)
            %g.trust[clientgroup.getobject(%b).bl_id]=2;
   }
}

This is probably what you want, for what you are making