Пример #1
0
    public static void SetupItems()
    {
        IdInfos = new Dictionary <ID, IdInfo>()
        {
            {
                ID.ERROR,

                new IdInfo {
                }
            },

            {
                ID.PLATFORM,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.PlatformBuildPosition,
                    RotationDelegate     = BuildingLogic.PlatformBuildRotation,
                    UseDelegate          = null,
                    FullAuto             = false,
                    CanAds               = false,
                    DisallowedCollisions = new ID[] { ID.PLATFORM }
                }
            },

            {
                ID.WALL,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.WallBuildPosition,
                    RotationDelegate     = BuildingLogic.WallBuildRotation,
                    UseDelegate          = null,
                    FullAuto             = false,
                    CanAds               = false,
                    DisallowedCollisions = new ID[] { ID.WALL, ID.TRIANGLE_WALL }
                }
            },

            {
                ID.SLOPE,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.SlopeBuildPosition,
                    RotationDelegate     = BuildingLogic.SlopeBuildRotation,
                    UseDelegate          = null,
                    FullAuto             = false,
                    CanAds               = false,
                    DisallowedCollisions = new ID[] { ID.SLOPE, ID.PIPE, ID.PIPE_JOINT }
                }
            },

            {
                ID.TRIANGLE_WALL,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.TriangleWallBuildPosition,
                    RotationDelegate     = BuildingLogic.TriangleWallBuildRotation,
                    UseDelegate          = null,
                    FullAuto             = false,
                    CanAds               = false,
                    DisallowedCollisions = new ID[] { ID.TRIANGLE_WALL, ID.WALL }
                }
            },

            {
                ID.PIPE,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.PipeBuildPosition,
                    RotationDelegate     = BuildingLogic.PipeBuildRotation,
                    DisallowedCollisions = new ID[] { ID.SLOPE, ID.PIPE, ID.PIPE_JOINT }
                }
            },

            {
                ID.PIPE_JOINT,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.PipeJointBuildPosition,
                    RotationDelegate     = BuildingLogic.PipeJointBuildRotation,
                    DisallowedCollisions = new ID[] { ID.SLOPE, ID.PIPE, ID.PIPE_JOINT }
                }
            },

            {
                ID.LOCKER,

                new IdInfo {
                    PositionDelegate     = BuildingLogic.LockerBuildPosition,
                    RotationDelegate     = BuildingLogic.LockerBuildRotation,
                    DisallowedCollisions = new ID[] { ID.LOCKER }
                }
            },

            {
                ID.ROCKET_JUMPER,

                new IdInfo {
                    UseDelegate = RocketJumper.Fire,
                    FullAuto    = false,
                    CanAds      = false
                }
            },

            {
                ID.THUNDERBOLT,

                new IdInfo {
                    UseDelegate = Thunderbolt.Fire,
                    FullAuto    = false,
                    CanAds      = true
                }
            },

            {
                ID.SCATTERSHOCK,

                new IdInfo {
                    UseDelegate = Scattershock.Fire,
                    FullAuto    = false,
                    CanAds      = true
                }
            },

            {
                ID.SWIFTSPARK,

                new IdInfo {
                    UseDelegate = SwiftSpark.Fire,
                    FullAuto    = true,
                    CanAds      = true
                }
            },

            {
                ID.SLIME_SPAWNER,

                new IdInfo {
                    UseDelegate = (Items.Instance Item, Player UsingPlayer) => {
                        Mobs.SpawnMob(Mobs.ID.Slime, UsingPlayer.Translation);
                    },
                    FullAuto = false,
                    CanAds   = false
                }
            }
        };

        //Lets make sure that every ID has an entry
        //This won't help mods but will help us greatly
        foreach (ID Type in System.Enum.GetValues(typeof(ID)))
        {
            if (Type == ID.NONE)
            {
                continue;
            }

            Assert.ActualAssert(IdInfos.ContainsKey(Type));
        }
    }