From c0240b44620b5e710f27ed14e2174e7c2ce325d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 8 Aug 2021 23:58:37 -0700 Subject: [PATCH] better compatibilty with Better Buoyancy --- MWSE/mods/celediel/ASinkingFeeling/main.lua | 21 ++++++++++++++++----- README.md | 4 +++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/MWSE/mods/celediel/ASinkingFeeling/main.lua b/MWSE/mods/celediel/ASinkingFeeling/main.lua index 2812d48..e4b06fc 100644 --- a/MWSE/mods/celediel/ASinkingFeeling/main.lua +++ b/MWSE/mods/celediel/ASinkingFeeling/main.lua @@ -41,6 +41,8 @@ local function sinkInWater(e) local mobile = e.mobile local ref = e.reference local actor = ref.object + local waterLevel = mobile.cell.waterLevel + local headHeight = mobile.position.z + mobile.height * 0.8 -- no creatures if mobile.actorType == tes3.actorType.creature then return end @@ -73,11 +75,20 @@ local function sinkInWater(e) ref.id, downPull, encumbrance.current, encumbrance.base, encumbrance.normalized) end - -- finally add down-pull from configured formula to tes3.mobilePlayer.velocity.z to simulate being pulled down - if downPull ~= 0 then - mobile.velocity.z = -downPull - if config.debug then - common.log(debugStr) + -- 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 + -- finally add down-pull from configured formula to tes3.mobilePlayer.velocity.z to simulate being pulled down + mobile.velocity.z = -downPull + if config.debug then + common.log(debugStr) + end + elseif mobile.velocity.z <= 0 then + -- reset velocity removing of armour in water is accounted for + mobile.velocity.z = 0 end end end diff --git a/README.md b/README.md index 08cf5f8..2d3645c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,9 @@ MGE XE with MWSE @ [Nexus Mods](https://www.nexusmods.com/morrowind/mods/41102) ## 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 ##