Exemplo n.º 1
0
        static void ItemRotator(Dictionary <string, ItemTypesServer.ItemTypeRaw> items, RotatorSettings settings, JSONNode customDataLitOnly)
        {
            ItemTypesServer.ItemTypeRaw unlitXP = RotatedTypeUnlit(settings.BaseType.name, "x+", settings.rotatedSideUnlit);
            ItemTypesServer.ItemTypeRaw unlitXN = RotatedTypeUnlit(settings.BaseType.name, "x-", settings.rotatedSideUnlit);
            ItemTypesServer.ItemTypeRaw unlitZP = RotatedTypeUnlit(settings.BaseType.name, "z+", settings.rotatedSideUnlit);
            ItemTypesServer.ItemTypeRaw unlitZN = RotatedTypeUnlit(settings.BaseType.name, "z-", settings.rotatedSideUnlit);

            settings.BaseType.description
            .SetAs("isRotatable", true)
            .SetAs("rotatablex+", unlitXP.name)
            .SetAs("rotatablex-", unlitXN.name)
            .SetAs("rotatablez+", unlitZP.name)
            .SetAs("rotatablez-", unlitZN.name);
            if (settings.sideTopUnlit != null)
            {
                settings.BaseType.description.SetAs("sidey+", settings.sideTopUnlit);
            }

            items[unlitXP.name]           = unlitXP;
            items[unlitXN.name]           = unlitXN;
            items[unlitZP.name]           = unlitZP;
            items[unlitZN.name]           = unlitZN;
            items[settings.BaseType.name] = settings.BaseType;


            if (customDataLitOnly != null)
            {
                string litBaseName = settings.BaseType.name + "lit";

                ItemTypesServer.ItemTypeRaw litXP = RotatedTypeLit(litBaseName, "x+", settings.rotatedSideLit, customDataLitOnly.DeepClone());
                ItemTypesServer.ItemTypeRaw litXN = RotatedTypeLit(litBaseName, "x-", settings.rotatedSideLit, customDataLitOnly.DeepClone());
                ItemTypesServer.ItemTypeRaw litZP = RotatedTypeLit(litBaseName, "z+", settings.rotatedSideLit, customDataLitOnly.DeepClone());
                ItemTypesServer.ItemTypeRaw litZN = RotatedTypeLit(litBaseName, "z-", settings.rotatedSideLit, customDataLitOnly.DeepClone());

                ItemTypesServer.ItemTypeRaw baseLitType = new ItemTypesServer.ItemTypeRaw(
                    litBaseName,
                    new JSONNode()
                    .SetAs("parentType", settings.BaseType.name)
                    .SetAs("isRotatable", true)
                    .SetAs("rotatablex+", litXP.name)
                    .SetAs("rotatablex-", litXN.name)
                    .SetAs("rotatablez+", litZP.name)
                    .SetAs("rotatablez-", litZN.name)
                    .SetAs("sidey+", settings.sideTopLit)
                    );

                items[litXP.name]       = litXP;
                items[litXN.name]       = litXN;
                items[litZP.name]       = litZP;
                items[litZN.name]       = litZN;
                items[baseLitType.name] = baseLitType;

                RegisteringChangeTypes.Add(() =>
                                           ItemTypesServer.RegisterChangeTypes(settings.BaseType.name, new List <string>()
                {
                    litXP.name, litXN.name, litZP.name, litZN.name,
                    unlitXP.name, unlitXN.name, unlitZP.name, unlitZN.name
                })
                                           );
            }
            else
            {
                RegisteringChangeTypes.Add(() =>
                                           ItemTypesServer.RegisterChangeTypes(settings.BaseType.name, new List <string>()
                {
                    unlitXP.name, unlitXN.name, unlitZP.name, unlitZN.name
                })
                                           );
            }
        }