So, I'm adding a feature to Climates & Cloaks for being wet.
Detecting when the character is swimming was pretty easy.
IF (GameManager.Instance.PlayerMotor.IsSwimming)
But how to detect that the character is wading in ponds etc? Or in dungeons where rooms are just half-filled with water?
This sort of worked?
IF (GameManager.Instance.PlayerMotor.IsMovingLessThanHalfSpeed && !GameManager.Instance.PlayerMotor.IsCrouching)
But I am assuming there is an easier way to catch this? The problem with using IsMovingLessThanHalfSpeed is that depressing the Sneak key causes the same effect. The there doesn't appear to be a "IsSneaking" value. Which I'm sure is its own problem when it comes to modding Stealth.
Maybe I can detect when a character is not in a dungeon and below ground level? But this might not work with height differences in regions (not to mention mods like Mountains & Hills).
Detect wading?
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
- pango
- Posts: 3359
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: Detect wading?
The two cases are handled next to each other in PlayerFootsteps.cs:
https://github.com/Interkarma/daggerfal ... ps.cs#L139
(with playerOnExteriorWater defined just a bit above l. 104)
I guess that for the former you'll have to be careful to tell apart when the player is swimming and when he's waterwalking (because in the latter case I think he shouldn't get wet).
For the latter, it involves comparing player height with water height in the current dungeon module, so it should be possible to tell how deep the player is in water...
https://github.com/Interkarma/daggerfal ... ps.cs#L139
(with playerOnExteriorWater defined just a bit above l. 104)
I guess that for the former you'll have to be careful to tell apart when the player is swimming and when he's waterwalking (because in the latter case I think he shouldn't get wet).
For the latter, it involves comparing player height with water height in the current dungeon module, so it should be possible to tell how deep the player is in water...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
Re: Detect wading?
Hey, that should work! Thanks
And the waterwalking should be easily handled by playerEntity.IsWaterWalking
And the waterwalking should be easily handled by playerEntity.IsWaterWalking