Ejemplo n.º 1
0
    public static void EnsurePrefabIsPlayerRootCompatible(string name)
    {
        byte num;

        NetMainPrefab.EnsurePrefabName(name);
        if (!ControllablePrefab.playerRootCompatibilityCache.TryGetValue(name, out num))
        {
            ControllablePrefab controllablePrefab = NetMainPrefab.Lookup <ControllablePrefab>(name);
            if (controllablePrefab)
            {
                num = (byte)((controllablePrefab.playerRootComapatable ? 1 : 2));
            }
            else
            {
                num = 0;
            }
            ControllablePrefab.playerRootCompatibilityCache[name] = num;
        }
        if (num == 0)
        {
            throw new NonControllableException(name);
        }
        if (num == 2)
        {
            throw new NonPlayerRootControllableException(name);
        }
    }
Ejemplo n.º 2
0
    public static void EnsurePrefabIsPlayerRootCompatible(string name)
    {
        byte num;

        NetMainPrefab.EnsurePrefabName(name);
        if (!playerRootCompatibilityCache.TryGetValue(name, out num))
        {
            ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name);
            if (prefab == null)
            {
                num = 0;
            }
            else if (!prefab.playerRootComapatable)
            {
                num = 2;
            }
            else
            {
                num = 1;
            }
            playerRootCompatibilityCache[name] = num;
        }
        switch (num)
        {
        case 0:
            throw new NonControllableException(name);

        case 2:
            throw new NonPlayerRootControllableException(name);
        }
    }
Ejemplo n.º 3
0
    public static void EnsurePrefabIsAIRootCompatible(string name, out bool staticGroup)
    {
        sbyte num;

        NetMainPrefab.EnsurePrefabName(name);
        if (!ControllablePrefab.aiRootCompatibilityCache.TryGetValue(name, out num))
        {
            ControllablePrefab controllablePrefab = NetMainPrefab.Lookup <ControllablePrefab>(name);
            if (!controllablePrefab)
            {
                num = 0;
            }
            else if (controllablePrefab.aiRootComapatable)
            {
                num = (!((Character)controllablePrefab.serverPrefab).controllable.classFlagsStaticGroup ? 1 : -1);
            }
            else
            {
                num = 2;
            }
            ControllablePrefab.aiRootCompatibilityCache[name] = num;
        }
        switch (num)
        {
        case -1:
        {
            staticGroup = true;
            break;
        }

        case 0:
        {
            throw new NonControllableException(name);
        }

        case 1:
        {
            staticGroup = false;
            break;
        }

        case 2:
        {
            throw new NonAIRootControllableException(name);
        }

        default:
        {
            throw new NonControllableException(name);
        }
        }
    }
Ejemplo n.º 4
0
    private static byte GetVesselCompatibility(string name)
    {
        byte vesselCompatibility;

        NetMainPrefab.EnsurePrefabName(name);
        if (!vesselCompatibilityCache.TryGetValue(name, out vesselCompatibility))
        {
            ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name);
            if (prefab == null)
            {
                vesselCompatibility = 0;
            }
            else
            {
                vesselCompatibility = prefab.vesselCompatibility;
            }
            vesselCompatibilityCache[name] = vesselCompatibility;
        }
        return(vesselCompatibility);
    }
Ejemplo n.º 5
0
    private static byte GetVesselCompatibility(string name)
    {
        byte num;

        NetMainPrefab.EnsurePrefabName(name);
        if (ControllablePrefab.vesselCompatibilityCache.TryGetValue(name, out num))
        {
            return(num);
        }
        ControllablePrefab controllablePrefab = NetMainPrefab.Lookup <ControllablePrefab>(name);

        if (controllablePrefab)
        {
            num = controllablePrefab.vesselCompatibility;
        }
        else
        {
            num = 0;
        }
        ControllablePrefab.vesselCompatibilityCache[name] = num;
        return(num);
    }
Ejemplo n.º 6
0
    public static void EnsurePrefabIsAIRootCompatible(string name, out bool staticGroup)
    {
        sbyte num;

        NetMainPrefab.EnsurePrefabName(name);
        if (!aiRootCompatibilityCache.TryGetValue(name, out num))
        {
            ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name);
            if (prefab == null)
            {
                num = 0;
            }
            else if (!prefab.aiRootComapatable)
            {
                num = 2;
            }
            else
            {
                num = !((Character)prefab.serverPrefab).controllable.classFlagsStaticGroup ? ((sbyte)1) : ((sbyte)(-1));
            }
            aiRootCompatibilityCache[name] = num;
        }
        sbyte num2 = num;

        switch ((num2 + 1))
        {
        case 0:
            staticGroup = true;
            return;

        case 2:
            staticGroup = false;
            return;

        case 3:
            throw new NonAIRootControllableException(name);
        }
        throw new NonControllableException(name);
    }