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

[fixed] Attached Keg collision issus #2218

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

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Dec 1, 2024

Status

  • READY: this PR is (to the best of your knowledge) ready to be incorporated into the game.

Description

[fixed] Keg in hand will not push blobs on the ground (Saw, Heart, ...) around anymore
[fixed] Blobs thrown at an attached Keg will not collide with it anymore 
        except for enemy's Boulder, Arrow, BallistaBolt and Rock

Fixes #2214

First I tried setting this.getShape().getConsts().collideWhenAttached = true; to false but then nothing would collide with attached Keg anymore. So I used

bool doesCollideWithBlob(CBlob@ this, CBlob@ blob)
{
	if (blob is null)
		return false;

	bool should_collide = this.isAttached() ? (blob.hasTag("projectile hits keg") && blob.getShape().vellen > 0.01f) : true;
	return should_collide;
}

If Keg is attached, only blobs that are moving and that have tag "projectile hits keg" can collide with Keg.
If Keg is not attached, then other blobs can collide with Keg as usual.

Boulder, Arrow, Ballista Bolt and catapult Rocks are given the new tag "projectile hits keg".
Other blobs that don't have this tag will not collide with an attached Keg.
So bucket or Saw thrown at Keg (which is loaded in a Catapult) will not collide with it anymore.

I considered using existing tag "projectile" but Rock and Boulder don't have this and blobs with that tag will set off mines so I couldn't just give Rock and Boulder that tag. So although I hate to do it I had to introduce the new tag "projectile hits keg".

I want only blobs to collide with an attached Keg that can actually hit it and therefore detach it.
Let me know if there are better approaches.

Tested in offline and online, works as envisioned.

For testing steps, see the linked issue above.

@Vam-Jam Vam-Jam added the change A change to an existing feature or mechanic label Dec 1, 2024
@mugg91
Copy link
Contributor Author

mugg91 commented Dec 1, 2024

This video shows the issues that this PR fixes.

Kek.mp4

@mugg91
Copy link
Contributor Author

mugg91 commented Dec 7, 2024

It was requested that Keg should collide with Keg in hand. I will look into it.
Tag projectile hits keg could be added to Keg itself.

That being said it has been difficult to fix this issue without introducing other issues.

Copy link
Member

@Vam-Jam Vam-Jam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in offline & online, tested with two players

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change A change to an existing feature or mechanic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keg should not collide with some blobs
2 participants