So I had a go. Its a lot more inefficent compared to checking the wetness value. So im going to see if theres another way of doing it. if not i will use your idea
What is more inefficient? And why do you say so?
Merged post void OnEntityEnter(TriggerBase trigger, BaseEntity entity) {
Puts("OnEntityEnter works!");
BasePlayer pl = entity as BasePlayer;
if(pl!= null && pl.IsSwimming()) {
// do something
}
}
Merged postAnother suggestion. See how other plugins are doing it if the above doesn't work, for example:
https://umod.org/plugins/water-limitsdoes
private bool IsInWater(BasePlayer player)
{
ModelState modelState = player.modelState;
#if DEBUG
LogWarning($"{player.displayName} is {System.Math.Ceiling(modelState.waterLevel)}% underwater");
#endif
return modelState != null && modelState.waterLevel > 0f && player.metabolism.wetness.value > 0f;
}