GithubHelp home page GithubHelp logo

Comments (1)

DashingCat avatar DashingCat commented on August 22, 2024

I took a look at the root cause for this issue, and here is the relevant code (the source file is Celeste/Holdable.cs, some variables were renamed for clarity)

public void Release(Vector2 force)
{
    if (base.Entity.CollideCheck<Solid>())
    {
        if (force.X != 0f)
        {
            bool collideFlag = false;
            int sign = Math.Sign(force.X);
            int increment = 0;
            
            // 1)
            while (!collideFlag && increment++ < 10)
            {
                if (!base.Entity.CollideCheck<Solid>(base.Entity.Position + sign * increment * Vector2.UnitX))
                {
                    collideFlag = true;
                }
            }
            if (collideFlag)
            {
                base.Entity.X += sign * increment;
            }
            // end 1)
        }

        while (base.Entity.CollideCheck<Solid>())
        {
            base.Entity.Position += Vector2.UnitY; // 2)
        }
    }


    // ... more code not relevant to the issue ...
}

This method Release is called whenever a Holdable is either thrown or released on the ground; its parameter force contains the direction of the throw in it's X property; and base.Entity refers to the Holdable.

All vanilla Holdables have a collider with a width of at most 8 units, which is the width of a tile too.
As they are aligned with Madeline's sprite, they will never collide with side walls on release in vanilla.
sidewall

So in vanilla, the condition actually only checks for ceilings, and the code:

  1. attempts to move the Holdable forward a bit to see if it can fit further after the ceiling;
  2. and if this fails, proceeds to move the Holdable down so it doesn't get stuck in the ceiling.

However, with modded, wider Holdables, it goes through the same processes with sidewalls as well, because the hitbox of the Holdable extends into the wall (here is a TheoCrystal with a modded width of 12 units):
widertheo

  1. doesn't do anything, because it keeps pushing the entity in the wall so it will keep on colliding;
  2. and proceeds to keep moving the entity down until it doesn't collide with solids (which does warp the Holdable either to a below floor or out of bounds below the level).

In our example, here is where the TheoCrystal ends up after a release (the bottom of the screenshot corresponds to the bottom of the room):
oobtheo

I'm not sure if there is a fix that would work for any given width, and until then I would recommend that modders re-implement this method to fit their needs.

from everest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.