nanos-world / issues

Issue Tracker for nanos world
9 stars 1 forks source link

Add actor `WaterLevelChanged` event #478

Closed Timmy-the-nobody closed 2 years ago

Timmy-the-nobody commented 2 years ago

Describe the solution you'd like

WaterLevelChanged events available for all actors classes, returning :

New enums for water levels could also be useful if these new events were added: WaterLevel.NotInWater = 0 WaterLevel.InWater = 1 WaterLevel.UnderWater = 2

Describe alternatives you've considered

This could be done with frequent Actor:IsInWater() checks but would require more resources than if events were triggered at the beginning or end of a collision with a water volume.

gtnardy commented 2 years ago

Hello! Thank you for the suggestion!

What do you mean by "water level"?

Timmy-the-nobody commented 2 years ago

Hey, you can think of it as a state indicating how immersed an actor is in a volume of water. Like is the actor out of the water? partially in the water? completely in the water? etc..

gtnardy commented 2 years ago

Ah got it!

For Characters, we have something like that already: https://docs.nanos.world/docs/next/scripting-reference/classes/character#swimmingmodechanged

For actors in general I think I can add an event for entering/leaving water, but I'm not sure if I would like to add an event for "how submerse" the actor is, as this value is not something straight neither sent to servers.

Timmy-the-nobody commented 2 years ago

Thanks I didn't knew there was a SwimmingModeChanged event! About the third state I think that "only" having in/out states would be more than enough (and lighter, as you said).

But that makes me think of another addition now, it could probably be usefull to be able to enable/disable a character's ability to swim with a method like SetCanSwim, and separate swimming and submersion into two distinct things ? Maybe the planned buoyance control methods will be more adapted for this, but this could for exemple allow scripters to make players drown if their inventory is too full, a bit like how SCUM's developers managed it on their game.

gtnardy commented 2 years ago

Track https://feedback.nanos.world/ideas/p/add-actor-waterlevelchanged-event