Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

USARBot.USARComServer


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
class USARComServer extends ComServer;

//conversion ratio
var float C_MeterToUU;

//Check for connectivity
function bool isReachable(string r1,string r2)
{
    local actor robot1;
    local actor robot2;
    local float d;
    local float dm;
    local float Pd;
    robot1=USARDeathMatch(Owner).getRobot(r1);
    if(robot1==None)
    {
        if(bDebug)
            log("USARComServer: "$r1$" does not exist");
        return false;
    }
    robot2=USARDeathMatch(Owner).getRobot(r2);
    if(robot2==None)
    {
        if(bDebug)
            log("USARComServer: "$r2$" does not exist");
        return false;
    }
    //Distance calculation
    d =Square(robot1.Location.x-robot2.Location.x);
    d=d+Square(robot1.Location.y-robot2.Location.y);
    d=d+Square(robot1.Location.z-robot2.Location.z);
    d=Sqrt(d);
    if (bDebug) log("USARComServer: Distance between "$r1$" and "$r2$" is "$d$" UU");
    //Convert to metres
    dm = d/C_MeterToUU; //Change this to use converter
    if (bDebug) log("USARComServer: Distance between "$r1$" and "$r2$" is "$dm$" m");
    //Calculate signal strenth
    Pd=ePdo-(10*eN*(Loge(d/eDo)/Loge(10)));
    if (bDebug) log("USARComServer: Signal Strength between "$r1$" and "$r2$" is "$Pd$" dBm");
    
    return (Pd>eCutoff);
}

defaultproperties
{
    C_MeterToUU=250
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 19.12.2006 19:17:24.000 - Creation time: Mo 16.4.2007 11:20:55.328 - Created with UnCodeX