Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DON'T SQUASH] Implement ice breaking on falling & fix crash if ctf_map is not present #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

appgurueu
Copy link
Contributor

I have replaced the fall_damage_add_percent with a proper solution that works as follows:

  • Check if the player fell on ice, dig the ice (with sound) if that's the case;
  • If the player fell only on ice, limit the fall damage (to one heart currently, damage incurred from "breaking" the ice);
  • Preserve the player velocity by calling add_velocity and inferring the speed from the damage

It has to rely on some hacks unfortunately as fall damage is entirely clientside.

A minor fix to keep ctf_map as an optional dependency is also included.

@LoneWolfHT
Copy link
Member

ctf_map should be an optional dependency

@appgurueu
Copy link
Contributor Author

appgurueu commented Dec 31, 2021

ctf_map should be an optional dependency

Yes, that's why I fixed a crash that occurred when ctf_map was not available. I worded that weirdly in the comment, but the commit message is pretty clear.

@appgurueu appgurueu changed the title Implement ice breaking on falling & fix crash if ctf_map is not present [DON'T SQUASH] Implement ice breaking on falling & fix crash if ctf_map is not present Dec 31, 2021
@LoneWolfHT
Copy link
Member

  • This crashes when ground is not found. (No hp returned)
  • Players still land on ice if they're moving along the x/z axis while falling
  • collisionbox checking feels like overkill
  • I feel like a raycast would be better than looping through minetest.get_node()

What I would try:

  • Player hits ice
    • Raycast to find ground, take player velocity into cast direction
      • If player is moving
        • Remove a 3x2 (+1?) area of ice, taking the player dir into account (X = player's landing pos) image
      • If player is not moving
        • Remove the ice directly below them, and set_pos() to make sure they fall through it

@appgurueu
Copy link
Contributor Author

Raycasts work on selectionboxes which is why I have avoided them here. But I suppose we have about a year to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants