Exemplo n.º 1
0
        public override void Unload()
        {
            EmoteCancelModule.cancelEmote();

            EmoteModule.Unload();
            EmoteCancelModule.Unload();
            BackpackModule.Unload();
            SpeedModule.Unload();
            EmoteStretcher.Unload();
            GravityModule.Unload();
        }
Exemplo n.º 2
0
        public override void Load()
        {
            anim_by_game = 0;             // this tells that base state is no animations

            EmoteModule.Load();
            EmoteCancelModule.Load();
            BackpackModule.Load();
            SpeedModule.Load();
            EmoteStretcher.Load();
            GravityModule.Load();
        }
Exemplo n.º 3
0
        // public static bool changedSprite;

        public static void Emote(string animation, bool by_command, Player player)
        {
            if (EmoteModMain.anim_by_game != 2)                 // if the game is not playing a cutscene
            {
                try                                             // anticrash3000
                {
                    player.StateMachine.State = Player.StDummy; // make player not able to move
                    player.DummyAutoAnimate   = false;          // make player not to auto animations
                    player.Speed = Vector2.Zero;                // stop the player

                    GravityModule.playerY = player.Y;           // record player y for the gravity switch

                    // if we were not doing an emote before, save default interactions state
                    if (EmoteModMain.anim_by_game == 0)
                    {
                        EmoteCancelModule.interactDefault      = EmoteModMain.celestenetSettings.Interactions; // (because if we record it during an emote its just going to be false)
                        EmoteCancelModule.invincibilityDefault = SaveData.Instance.Assists.Invincible;
                        SaveData.Instance.Assists.Invincible   = true;
                        // make playback emotes work
                        if (player.Sprite.Mode == PlayerSpriteMode.Playback)
                        {
                            playback = true;
                        }
                    }

                    // new sprite changes
                    if (!player.Sprite.Animations.ContainsKey(animation))
                    {
                        Dictionary <string, Sprite.Animation> .KeyCollection madeline_bp       = GFX.SpriteBank.SpriteData["player"].Sprite.Animations.Keys;
                        Dictionary <string, Sprite.Animation> .KeyCollection madeline_no_bp    = GFX.SpriteBank.SpriteData["player_no_backpack"].Sprite.Animations.Keys;
                        Dictionary <string, Sprite.Animation> .KeyCollection madeline_badeline = GFX.SpriteBank.SpriteData["player_badeline"].Sprite.Animations.Keys;
                        Dictionary <string, Sprite.Animation> .KeyCollection badeline          = GFX.SpriteBank.SpriteData["badeline"].Sprite.Animations.Keys;
                        Dictionary <string, Sprite.Animation> .KeyCollection madeline_playback = GFX.SpriteBank.SpriteData["player_playback"].Sprite.Animations.Keys;

                        // change sprite if animation not found
                        if (madeline_no_bp.Contains(animation, StringComparer.OrdinalIgnoreCase))
                        {
                            player.ResetSprite(PlayerSpriteMode.MadelineNoBackpack);
                        }
                        else if (badeline.Contains(animation, StringComparer.OrdinalIgnoreCase))
                        {
                            player.ResetSprite(PlayerSpriteMode.Badeline);
                        }
                        else if (madeline_bp.Contains(animation, StringComparer.OrdinalIgnoreCase))
                        {
                            player.ResetSprite(PlayerSpriteMode.Madeline);
                        }
                    }
                    // bounc e
                    if (animation == "bounce" || animation == "b")
                    {
                        if (!bounced)
                        {
                            GravityModule.playerY -= 1;
                        }
                        player.Sprite.Play("spin");
                        SpeedModule.currentDelay = player.Sprite.Animations["spin"].Delay;
                        bounced = true;
                    }
                    else
                    {
                        player.Sprite.Play(animation); // do emote
                        SpeedModule.currentDelay = player.Sprite.Animations[animation].Delay;
                    }

                    if (by_command) // command reply only if done by command
                    {
                        EmoteModMain.echo($"playing {animation}");
                    }

                    EmoteModMain.anim_by_game = 1; // acknowledge that emote is playing
                }
                catch (Exception e)
                {
                    Logger.Log("EmoteMod EXCEPTION", e.ToString()); // burh
                    EmoteModMain.echo($"failed to play {animation}");
                    EmoteCancelModule.cancelEmote();
                }
            }
        }