////////////////

        public void BehaviorAsKinetic(Projectile projectile, Vector2 oldVelocity)
        {
            var config = DestructibleTilesConfig.Instance;

            var rect = new Rectangle(
                (int)projectile.position.X + (int)oldVelocity.X,
                (int)projectile.position.Y + (int)oldVelocity.Y,
                projectile.width,
                projectile.height
                );

            bool onlySometimesRespects;
            bool respectsPlatforms = ProjectileAttributeHelpers.DoesVanillaProjectileHitPlatforms(
                projectile,
                out onlySometimesRespects
                ) && !onlySometimesRespects;

            int damage = DestructibleTilesProjectile.ComputeProjectileDamage(projectile);

            IList <(ushort, ushort)> hits = DestructibleTilesProjectile.FindNearbyHittableTiles(
                projectile.Center,
                rect,
                respectsPlatforms
                );

            if (config.DebugModeInfo)
            {
                this.OutputKineticProjectileDebugInfo(projectile, oldVelocity, hits);
            }

            foreach ((ushort x, ushort y) in hits)
            {
                DestructibleTilesProjectile.HitTile(damage, x, y, hits.Count);
            }
        }
        internal static void DefineProjectileGroups1(IList <EntityGroupMatcherDefinition <Projectile> > defs)
        {
            // General

            defs.Add(new EntityGroupMatcherDefinition <Projectile>(
                         "Any Explosive", null,
                         new ProjectileGroupMatcher((proj, grp) => {
                int _;
                return(ProjectileAttributeHelpers.IsExplosive(proj.type, out _, out _));
            })
                         ));
        }
Beispiel #3
0
        public void UnloadModules()
        {
            this.Loadables.OnModsUnload();

            this.Loadables                  = null;
            this.ReflectionHelpers          = null;
            this.PacketProtocolMngr         = null;
            this.ExceptionMngr              = null;
            this.Timers                     = null;
            this.LogHelpers                 = null;
            this.ModFeaturesHelpers         = null;
            this.BuffHelpers                = null;
            this.NetHelpers                 = null;
            this.NPCAttributeHelpers        = null;
            this.ProjectileAttributeHelpers = null;
            this.BuffIdentityHelpers        = null;
            this.NPCBannerHelpers           = null;
            this.RecipeFinderHelpers        = null;
            this.RecipeGroupHelpers         = null;
            this.PlayerHooks                = null;
            this.LoadHelpers                = null;
            this.GetModInfo                 = null;
            this.GetModTags                 = null;
            this.WorldStateHelpers          = null;
            this.ModLock                    = null;
            this.EntityGroups               = null;
            this.AnimatedColors             = null;
            this.AnimatedTextures           = null;
            this.PlayerMessages             = null;
            this.Inbox                 = null;
            this.ControlPanel          = null;
            this.MenuItemMngr          = null;
            this.MenuContextMngr       = null;
            this.MusicHelpers          = null;
            this.PlayerIdentityHelpers = null;
            this.LoadHooks             = null;
            this.CustomLoadHooks       = null;
            this.DataStore             = null;
            this.CustomHotkeys         = null;
            this.XnaHelpers            = null;
            this.Server                = null;
            //this.PlayerDataMngr = null;
            this.SupportInfo          = null;
            this.RecipeHack           = null;
            this.ModListHelpers       = null;
            this.ItemAttributeHelpers = null;
            this.WorldTimeHooks       = null;

            this.ControlPanelHotkey = null;
            this.DataDumpHotkey     = null;
        }
Beispiel #4
0
        private void LoadModules()
        {
            this.Loadables.OnModsLoad();

            this.ReflectionHelpers = new ReflectionHelpers();
            this.DataStore         = new DataStore();
            this.LoadHooks         = new LoadHooks();
            this.CustomLoadHooks   = new CustomLoadHooks();
            this.LoadHelpers       = new LoadHelpers();

            this.Timers             = new Timers();
            this.LogHelpers         = new LogHelpers();
            this.ModFeaturesHelpers = new ModFeaturesHelpers();
            this.PacketProtocolMngr = new PacketProtocolManager();

            this.BuffHelpers                = new BuffHelpers();
            this.NetHelpers                 = new NetPlayHelpers();
            this.NPCAttributeHelpers        = new NPCAttributeHelpers();
            this.ProjectileAttributeHelpers = new ProjectileAttributeHelpers();
            this.BuffIdentityHelpers        = new BuffAttributesHelpers();
            this.NPCBannerHelpers           = new NPCBannerHelpers();
            this.RecipeFinderHelpers        = new RecipeFinderHelpers();
            this.RecipeGroupHelpers         = new RecipeGroupHelpers();
            this.PlayerHooks                = new ExtendedPlayerHooks();
            this.WorldTimeHooks             = new WorldTimeHooks();
            this.WorldStateHelpers          = new WorldStateHelpers();
            this.ControlPanel               = new UIControlPanel();
            this.ModLock               = new ModLockService();
            this.EntityGroups          = new EntityGroups();
            this.PlayerMessages        = new PlayerMessages();
            this.Inbox                 = new InboxControl();
            this.GetModInfo            = new GetModInfo();
            this.GetModTags            = new GetModTags();
            this.MenuItemMngr          = new MenuItemManager();
            this.MenuContextMngr       = new MenuContextServiceManager();
            this.MusicHelpers          = new MusicHelpers();
            this.PlayerIdentityHelpers = new PlayerIdentityHelpers();
            this.CustomHotkeys         = new CustomHotkeys();
            this.XnaHelpers            = new XNAHelpers();
            this.Server                = new Server();
            //this.PlayerDataMngr = new PlayerDataManager();
            this.SupportInfo          = new SupportInfoDisplay();
            this.RecipeHack           = new RecipeHack();
            this.ModListHelpers       = new ModListHelpers();
            this.ItemAttributeHelpers = new ItemAttributeHelpers();
        }
        ////////////////

        /// <summary>
        /// Gets the "qualified" name (the name the player sees) of a given entity.
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public static string GetQualifiedName(Entity ent)
        {
            if (ent is Item)
            {
                return(ItemAttributeHelpers.GetQualifiedName((Item)ent));
            }
            if (ent is NPC)
            {
                return(NPCAttributeHelpers.GetQualifiedName((NPC)ent));
            }
            if (ent is Projectile)
            {
                return(ProjectileAttributeHelpers.GetQualifiedName((Projectile)ent));
            }
            if (ent is Player)
            {
                return(((Player)ent).name);
            }
            return("...a " + ent.GetType().Name);
        }