feat(aswid): running water covers rivers and lakes; sway on boats
Open water now means any water: swimming in it, or flying over a metre or more of it, sea, river or lake. Standing on anything solid stays safe, so docks, bridges and wading do not count. On a boat there is still no burn or drain, but the camera keeps swaying. 'Ocean Only' restores the sea-only behaviour, and the settings say Open Water instead of Open Sea. Also rewrites the README's per-boss Aswid section from the code: it listed stats, unlocks and an aura that no longer exist.
This commit is contained in:
parent
a00db24ebd
commit
c76341af0d
12 changed files with 85 additions and 57 deletions
|
|
@ -58,10 +58,11 @@ namespace RacesOfValheim
|
|||
|
||||
// ─── Running Water ─────────────────────────────────────────────────────
|
||||
// Lore says a vampire cannot cross running water unaided (Dagaz's report). Swimming costs
|
||||
// more, and the open sea burns, swimming or flying; standing on a boat is being carried,
|
||||
// which the lore allows. The camera sway is a per-player comfort choice and stays local
|
||||
// more, and open water - sea, river or lake - burns, swimming or flying over it; a boat
|
||||
// carries you, which the lore allows, though the camera still sways on board. The camera sway is a per-player comfort choice and stays local
|
||||
// (ConfigSync's "camera sway" key part).
|
||||
public static ConfigEntry<bool> RunningWaterEnabled;
|
||||
public static ConfigEntry<bool> WaterOceanOnly;
|
||||
public static ConfigEntry<float> SwimStaminaMultiplier;
|
||||
public static ConfigEntry<float> SeaHealthLossPerSecond;
|
||||
public static ConfigEntry<float> SeaStaminaDrainPerSecond;
|
||||
|
|
@ -222,17 +223,19 @@ namespace RacesOfValheim
|
|||
|
||||
const string water = "Aswid - Running Water";
|
||||
RunningWaterEnabled = config.Bind(water, "Running Water", true,
|
||||
new ConfigDescription("Swimming costs more stamina, and the open sea (the Ocean biome, over deep water) hurts you while you swim or fly over it. Standing on or steering a boat protects you.", null));
|
||||
new ConfigDescription("Swimming costs more stamina, and open water - the sea, rivers, lakes - hurts you while you swim in it or fly over it. Standing on, steering or sitting in a boat protects you. Wading, docks and bridges are safe.", null));
|
||||
WaterOceanOnly = config.Bind(water, "Ocean Only", false,
|
||||
new ConfigDescription("Limits the burn, the drain and the camera sway to the Ocean biome, leaving rivers and lakes alone. The swim stamina cost applies everywhere either way.", null));
|
||||
SwimStaminaMultiplier = config.Bind(water, "Swim Stamina Multiplier", 2f,
|
||||
new ConfigDescription("Multiplies the stamina swimming costs, anywhere. At 0 stamina the game's own drowning starts. Around 5 and up, swimming any distance is no longer possible.", new AcceptableValueRange<float>(1f, 10f)));
|
||||
SeaHealthLossPerSecond = config.Bind(water, "Open Sea Health Loss Per Second", 1f,
|
||||
new ConfigDescription("Health the open sea burns away each second.", new AcceptableValueRange<float>(0f, 20f)));
|
||||
SeaStaminaDrainPerSecond = config.Bind(water, "Open Sea Stamina Drain Per Second", 2f,
|
||||
new ConfigDescription("Stamina the open sea drains each second, on top of what swimming or flying costs.", new AcceptableValueRange<float>(0f, 30f)));
|
||||
SeaHealthFloor = config.Bind(water, "Open Sea Health Floor", 0.1f,
|
||||
new ConfigDescription("The sea's burn stops at this fraction of your max health. Drowning, once your stamina runs out, has no floor.", new AcceptableValueRange<float>(0f, 1f)));
|
||||
SeaHealthLossPerSecond = config.Bind(water, "Open Water Health Loss Per Second", 1f,
|
||||
new ConfigDescription("Health open water burns away each second.", new AcceptableValueRange<float>(0f, 20f)));
|
||||
SeaStaminaDrainPerSecond = config.Bind(water, "Open Water Stamina Drain Per Second", 2f,
|
||||
new ConfigDescription("Stamina open water drains each second, on top of what swimming or flying costs.", new AcceptableValueRange<float>(0f, 30f)));
|
||||
SeaHealthFloor = config.Bind(water, "Open Water Health Floor", 0.1f,
|
||||
new ConfigDescription("The water's burn stops at this fraction of your max health. Drowning, once your stamina runs out, has no floor.", new AcceptableValueRange<float>(0f, 1f)));
|
||||
SeaCameraSway = config.Bind(water, "Camera Sway", true,
|
||||
new ConfigDescription("The camera rolls gently while the open sea is hurting you, as if seasick. Local: each player chooses for themselves.", null));
|
||||
new ConfigDescription("The camera rolls gently while you are out on the water, on a boat too, as if seasick. Local: each player chooses for themselves.", null));
|
||||
SeaCameraSwayStrength = config.Bind(water, "Camera Sway Strength", 1f,
|
||||
new ConfigDescription("How far the camera rolls. 1 is about 4 degrees. Local.", new AcceptableValueRange<float>(0f, 3f)));
|
||||
|
||||
|
|
|
|||
|
|
@ -905,7 +905,7 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// The seasick camera: a slow roll while the open sea is hurting the Aswid. Applied after
|
||||
/// The seasick camera: a slow roll while the Aswid is out on the water, on a boat too. Applied after
|
||||
/// vanilla has settled the camera's rotation for the frame, as a roll around the view axis,
|
||||
/// so it never moves where the player aims - only how the horizon sits.
|
||||
/// </summary>
|
||||
|
|
@ -917,7 +917,7 @@ namespace RacesOfValheim
|
|||
|
||||
public static void Postfix(float dt, ref Quaternion rot)
|
||||
{
|
||||
bool on = AswidRace.AtSea && AswidConfig.SeaCameraSway.Value && AswidRace.IsAswid() &&
|
||||
bool on = AswidRace.OnWater && AswidConfig.SeaCameraSway.Value && AswidRace.IsAswid() &&
|
||||
Player.m_localPlayer != null && !Player.m_localPlayer.IsDead();
|
||||
|
||||
// Eased in and out over about a second, so leaving the sea does not snap the horizon.
|
||||
|
|
|
|||
|
|
@ -1514,22 +1514,30 @@ namespace RacesOfValheim
|
|||
|
||||
private static readonly int OpenSeaHash = "SE_AswidOpenSea".GetStableHashCode();
|
||||
|
||||
/// <summary>True while the open sea is hurting the local Aswid. Read by the camera sway.</summary>
|
||||
public static bool AtSea { get; private set; }
|
||||
// How deep the water under an airborne Aswid has to be before it counts. Keeps a hop over
|
||||
// a puddle or a swamp ditch from registering; a bat over a river or a lake still does.
|
||||
private const float MinFlyOverDepth = 1f;
|
||||
|
||||
/// <summary>True while the local Aswid is out on the water, boat or not. Read by the camera sway.</summary>
|
||||
public static bool OnWater { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dagaz's running water: the Ocean biome burns and drains an Aswid in it or over it,
|
||||
/// swimming or flying - a bat cannot simply cross the sea. A boat carries you across, as
|
||||
/// the lore allows, so standing on one, steering one or sitting in one protects you.
|
||||
/// Dagaz's running water: open water burns and drains an Aswid in it or over it, swimming
|
||||
/// or flying - a bat cannot simply cross a lake or the sea. A boat carries you across, as
|
||||
/// the lore allows: on board there is no burn and no drain, but the sea still turns your
|
||||
/// stomach, so the camera keeps swaying.
|
||||
/// </summary>
|
||||
private void UpdateOpenSea(float dt)
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
SEMan seman = player.GetSEMan();
|
||||
|
||||
AtSea = OnOpenSea(player);
|
||||
bool onBoat = OnBoat(player);
|
||||
bool exposed = !onBoat && InOpenWater(player);
|
||||
OnWater = AswidConfig.RunningWaterEnabled.Value && (exposed || (onBoat && BiomeAllowed(player)));
|
||||
|
||||
bool has = seman.HaveStatusEffect(OpenSeaHash);
|
||||
if (!AtSea)
|
||||
if (!exposed)
|
||||
{
|
||||
if (has) seman.RemoveStatusEffect(OpenSeaHash, true);
|
||||
return;
|
||||
|
|
@ -1549,17 +1557,34 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
private static bool OnOpenSea(Player player)
|
||||
private static bool OnBoat(Player player)
|
||||
{
|
||||
return player.GetStandingOnShip() != null || player.IsAttachedToShip() || player.GetControlledShip() != null;
|
||||
}
|
||||
|
||||
/// <summary>The Ocean-only setting, if on, limits everything here to the sea.</summary>
|
||||
private static bool BiomeAllowed(Player player)
|
||||
{
|
||||
return !AswidConfig.WaterOceanOnly.Value || player.GetCurrentBiome() == Heightmap.Biome.Ocean;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In water or over it. Valheim has one water plane for the sea, the rivers and the lakes
|
||||
/// alike, so "the terrain under you is below the water level" finds all three. Swimming
|
||||
/// counts wherever it happens. In the air it takes a metre of water below, so a jump over
|
||||
/// a puddle does not; standing on anything solid - a dock, a bridge, a shallow bank you
|
||||
/// are wading on - does not count, since the ground ray only sees terrain and would
|
||||
/// otherwise read a dock as open water.
|
||||
/// </summary>
|
||||
private static bool InOpenWater(Player player)
|
||||
{
|
||||
if (!AswidConfig.RunningWaterEnabled.Value) return false;
|
||||
if (player.GetCurrentBiome() != Heightmap.Biome.Ocean) return false;
|
||||
if (player.GetStandingOnShip() != null || player.IsAttachedToShip() || player.GetControlledShip() != null) return false;
|
||||
if (!BiomeAllowed(player)) return false;
|
||||
if (player.IsSwimming()) return true;
|
||||
if (player.IsOnGround() || ZoneSystem.instance == null) return false;
|
||||
|
||||
// The Ocean biome reaches up the beaches, so being in it is not enough: the seabed
|
||||
// under you has to be below the water. A shore walk stays dry; a swim or a flight
|
||||
// out past the shallows does not.
|
||||
if (ZoneSystem.instance == null) return false;
|
||||
return ZoneSystem.instance.GetGroundHeight(player.transform.position) < ZoneSystem.instance.m_waterLevel;
|
||||
float depth = ZoneSystem.instance.m_waterLevel - ZoneSystem.instance.GetGroundHeight(player.transform.position);
|
||||
return depth >= MinFlyOverDepth;
|
||||
}
|
||||
|
||||
private void UpdateAswidState()
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// The open sea under an Aswid. Only a marker: the burn and the drain are applied by
|
||||
/// AswidRace.UpdateOpenSea, and the camera sway reads AswidRace.AtSea.
|
||||
/// Open water under an Aswid off a boat. Only a marker: the burn and the drain are applied by
|
||||
/// AswidRace.UpdateOpenSea, and the camera sway reads AswidRace.OnWater.
|
||||
/// </summary>
|
||||
public class SE_AswidOpenSea : SE_Stats
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue