better compatibilty with Better Buoyancy

This commit is contained in:
Lilian Jónsdóttir 2021-08-08 23:58:37 -07:00
parent 9ec8148562
commit c0240b4462
2 changed files with 19 additions and 6 deletions

View file

@ -41,6 +41,8 @@ local function sinkInWater(e)
local mobile = e.mobile local mobile = e.mobile
local ref = e.reference local ref = e.reference
local actor = ref.object local actor = ref.object
local waterLevel = mobile.cell.waterLevel
local headHeight = mobile.position.z + mobile.height * 0.8
-- no creatures -- no creatures
if mobile.actorType == tes3.actorType.creature then return end if mobile.actorType == tes3.actorType.creature then return end
@ -73,12 +75,21 @@ local function sinkInWater(e)
ref.id, downPull, encumbrance.current, encumbrance.base, encumbrance.normalized) ref.id, downPull, encumbrance.current, encumbrance.base, encumbrance.normalized)
end end
-- finally add down-pull from configured formula to tes3.mobilePlayer.velocity.z to simulate being pulled down -- reset if levitating
if mobile.levitate > 0 then downPull = 0 end
-- only if mostly underwater to stop pseudo-waterwalking when jumping into water
if headHeight <= waterLevel then
if downPull ~= 0 then if downPull ~= 0 then
-- finally add down-pull from configured formula to tes3.mobilePlayer.velocity.z to simulate being pulled down
mobile.velocity.z = -downPull mobile.velocity.z = -downPull
if config.debug then if config.debug then
common.log(debugStr) common.log(debugStr)
end end
elseif mobile.velocity.z <= 0 then
-- reset velocity removing of armour in water is accounted for
mobile.velocity.z = 0
end
end end
end end

View file

@ -35,7 +35,9 @@ MGE XE with MWSE @ [Nexus Mods](https://www.nexusmods.com/morrowind/mods/41102)
## Incompatibilites ## ## Incompatibilites ##
* OperatorJack's [Better Buoyancy](https://www.nexusmods.com/morrowind/mods/48929) or at least the swimming controls part. * The swimming controls part of OperatorJack's [Better Buoyancy](https://www.nexusmods.com/morrowind/mods/48929) is partially incompatible.
If the actor is unarmoured, or unencumbered with that option enabled, Better Buoyancy will work as expected. Otherwise, if this mod is affecting
the actor's velocity, Better Buoyancy will not function. Better Buoyancy's levitation controls are also unaffected.
## Credits ## ## Credits ##