CigarLounge / sbox-TTT

TTT is a mafia-esque multiplayer game created using s&box
https://cigarlounge.github.io/
Other
21 stars 11 forks source link

Fea: Make hands behave more like vanilla Magneto Stick #310

Closed the-remeko closed 1 year ago

the-remeko commented 1 year ago

I changed the Hands to use a FixedJoint with custom PhysicsSprings instead of parenting to get the elastic effect of the vanilla Magneto Stick. I also made the game reduce prop damage by 75% (like in vanilla), which made it pretty hard to instakill someone with one of the chairs in the skyscraper cafeteria. You'd probably have better luck with heavier props, though. Also, sometimes a prop hits someone several times in one go and does massive damage, which mimics the inconsistency of vanilla propkilling.

matekdev commented 1 year ago

Should I be removing IgnoreDamage when testing this? We also add the interactable tag in GrabbableProp.cs, I think we need to remove this as well since props should collide with players when grabbed?

matekdev commented 1 year ago

Do you also know a way to break the weld if too much force is applied onto it? Need to stop people from prop flying, etc.

the-remeko commented 1 year ago

Should I be removing IgnoreDamage when testing this? We also add the interactable tag in GrabbableProp.cs, I think we need to remove this as well since props should collide with players when grabbed?

I changed it to use IgnoreDamage while the prop is held instead of when it is dropped. To make props collide with players while held, I made it stop adding the interactable tag. I also added a networked HeldProp property to the Player so we can prevent the WalkController from getting stuck on a prop held by its player. Let me know if there's a better way to do that.

Finally, I added an OnPhysicsCollision override to the Player that figures out how much momentum colliding objects lose and applies that to the player. You can now get pushed around by held or thrown props. Sometimes pushing someone around with a held prop kills them, but from my testing I think it's due to fall damage (just like vanilla :scream:).

Do you also know a way to break the weld if too much force is applied onto it? Need to stop people from prop flying, etc.

Props don't directly collide with the holding player anymore, but I added a force limit to the weld anyway to make people drop a prop if it gets caught on something and they run away. I also made it so you can't hold a prop that is being stood on by a player. Players might be able to use two props to fly depending on Rubikon randomness.

matekdev commented 1 year ago

I'm closing this, I've taken your commits into my new branch.