Merge branch 'localisation' into localisation-turkish
This commit is contained in:
commit
f8e0d13029
23 changed files with 371 additions and 85 deletions
|
|
@ -39,17 +39,26 @@ namespace RacesOfValheim
|
|||
public static ConfigEntry<float> WidthScale;
|
||||
|
||||
/// <summary>
|
||||
/// 1 is the Sverm's size, which is what the design asked to try first ("se non va li
|
||||
/// allarghiamo"). Raise it to enlarge the eyes: 1.6 is roughly a grey from the films.
|
||||
/// Scales the almond eyes (EyeExtent). The default 0.8 is the tuned grey look; raise it for
|
||||
/// bigger eyes.
|
||||
/// </summary>
|
||||
public static ConfigEntry<float> EyeSizeMultiplier;
|
||||
|
||||
// The eye geometry is the Sverm's, unchanged (SvermVisuals): offsets are metres in the head
|
||||
// bone's OWN frame, so they land on the same part of the face at any body scale.
|
||||
public const float EyeSeparation = 0.032f;
|
||||
public const float EyeForward = 0.081f;
|
||||
public const float EyeHeight = 0.181f;
|
||||
public const float EyeSize = 0.062f;
|
||||
// A grey's eyes, on the Sverm's eye spot: offsets are metres in the head bone's OWN frame
|
||||
// at human scale, so they land on the same part of the face at any body scale.
|
||||
// Pushed apart and forward of the Sverm's, because an almond this wide would otherwise
|
||||
// meet its twin over the nose and sink into the cheek.
|
||||
public const float EyeSeparation = 0.037f;
|
||||
public const float EyeForward = 0.090f;
|
||||
public const float EyeHeight = 0.183f;
|
||||
|
||||
// Full width, height and depth of one eye in metres at Eye Size Multiplier 1. The saved
|
||||
// default of 0.8 makes that 50 x 28 x 18 mm.
|
||||
public static readonly Vector3 EyeExtent = new Vector3(0.0625f, 0.035f, 0.0225f);
|
||||
|
||||
// Degrees. Slant raises the outer corner; wrap turns each eye out toward its temple.
|
||||
public const float EyeSlant = 22f;
|
||||
public const float EyeWrap = 20f;
|
||||
|
||||
// ─── Eitr: diet, shield, soft fall ───────────────────────────────────
|
||||
|
||||
|
|
@ -152,7 +161,7 @@ namespace RacesOfValheim
|
|||
new AcceptableValueRange<float>(0.7f, 1.2f)));
|
||||
|
||||
EyeSizeMultiplier = config.Bind(look, "Eye Size Multiplier", 0.8f,
|
||||
new ConfigDescription("1 = the Sverm's eye size; 0.8 is slightly smaller. Raise to enlarge the black eyes.",
|
||||
new ConfigDescription("Scales the black almond eyes. 0.8 is the default look; raise it for bigger eyes.",
|
||||
new AcceptableValueRange<float>(0.5f, 3f)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace RacesOfValheim
|
|||
float target = 0f;
|
||||
if (Time.time - AlfarArchon.StartedAt < 0.6f) target = 4f; // lift off
|
||||
else if (RaceInput.Allowed && JumpHeld()) target = speed;
|
||||
else if (RaceInput.Allowed && ZInput.GetButton("Crouch")) target = -speed;
|
||||
else if (RaceInput.Allowed && CrouchHeld()) target = -speed;
|
||||
|
||||
Vector3 velocity = flyer.linearVelocity;
|
||||
velocity.y = Mathf.Lerp(velocity.y, target, 0.25f);
|
||||
|
|
@ -97,9 +97,15 @@ namespace RacesOfValheim
|
|||
|
||||
private static bool JumpHeld()
|
||||
{
|
||||
// ZInput's "Jump" covers the space bar and the pad's jump button alike, and respects the
|
||||
// controls the player picked in the settings.
|
||||
return ZInput.GetButton("Jump");
|
||||
// "Jump" is the keyboard binding only; the pad's button is a separate "JoyJump", read
|
||||
// the way PlayerController reads it, kept off while a radial menu has the pad.
|
||||
return ZInput.GetButton("Jump") || (ZInput.GetButton("JoyJump") && !Hud.InRadial());
|
||||
}
|
||||
|
||||
private static bool CrouchHeld()
|
||||
{
|
||||
// Same split as jump: PlayerController ORs "Crouch" with "JoyCrouch".
|
||||
return ZInput.GetButton("Crouch") || (ZInput.GetButton("JoyCrouch") && !Hud.InRadial());
|
||||
}
|
||||
|
||||
private static void FlushSpend(Player player)
|
||||
|
|
|
|||
|
|
@ -305,6 +305,34 @@ namespace RacesOfValheim
|
|||
|
||||
// ─── Geisli: the beam ────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The pad's way to hold the beam. Every pad button is taken in vanilla's Classic layout, so,
|
||||
/// like Skadi's Cold Spell, the beam borrows the secondary attack: bare-handed, or in the
|
||||
/// archon form, which has no weapons anyway. The radial entry only gives a single press,
|
||||
/// which cannot hold a beam.
|
||||
/// </summary>
|
||||
private static bool PadBeamHeld(Player player) =>
|
||||
!RaceInput.RadialOpen && RaceInput.PadAttackHeld(2) &&
|
||||
(AlfarArchon.Active || RaceInput.EmptyHanded(player));
|
||||
|
||||
/// <summary>
|
||||
/// Swallows the unarmed secondary (the kick) while the pad's secondary attack is the beam,
|
||||
/// the same way SkadiAttackPatch does for the Cold Spell.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(Humanoid), "StartAttack")]
|
||||
public static class Alfar_GeisliPadKick_Patch
|
||||
{
|
||||
public static bool Prefix(Humanoid __instance, bool secondaryAttack, ref bool __result)
|
||||
{
|
||||
if (!secondaryAttack || __instance != Player.m_localPlayer) return true;
|
||||
Player player = (Player)__instance;
|
||||
if (!AlfarVisuals.IsAlfarPlayer(player) || !Unlocked(AlfarPowerConfig.GeisliState)) return true;
|
||||
if (!PadBeamHeld(player)) return true;
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static LineRenderer beamLine;
|
||||
private static readonly List<LineRenderer> beamArcs = new List<LineRenderer>();
|
||||
private static GameObject beamFx;
|
||||
|
|
@ -324,7 +352,7 @@ namespace RacesOfValheim
|
|||
private static void TickBeam(Player player)
|
||||
{
|
||||
bool wanted = RaceInput.Allowed && !player.IsDead() && Unlocked(AlfarPowerConfig.GeisliState) &&
|
||||
AlfarPowerConfig.GeisliKey.Value.IsPressedIgnoringHeldKeys();
|
||||
(AlfarPowerConfig.GeisliKey.Value.IsPressedIgnoringHeldKeys() || PadBeamHeld(player));
|
||||
|
||||
if (!wanted)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,35 +161,67 @@ namespace RacesOfValheim
|
|||
}
|
||||
if (eyes == null) return;
|
||||
|
||||
PlaceEyes(headBone, eyes);
|
||||
PlaceEyes(player, eyes);
|
||||
}
|
||||
|
||||
private static void PlaceEyes(Transform headBone, Transform holder)
|
||||
/// <summary>
|
||||
/// A grey's eyes: wide black almonds, outer corners raised, wrapping round the sides of the
|
||||
/// face. Each is a sphere squashed to an ellipsoid and turned in the skull's own frame.
|
||||
///
|
||||
/// FIXED HEAD-LOCAL UNITS, never headBone.lossyScale. The Alfar Visual is scaled
|
||||
/// non-uniformly, so the head's lossyScale is only an approximation that changes as the
|
||||
/// head turns; recomputed on the 0.5s cosmetic pass it made the eyes trail the face. The
|
||||
/// face is skinned to the same bone through the same matrices, so a constant local offset
|
||||
/// stays glued to it at any body scale, and PlaceEyes only has to run when the eyes change.
|
||||
/// </summary>
|
||||
private static void PlaceEyes(Player player, Transform holder)
|
||||
{
|
||||
Vector3 lossy = headBone.lossyScale;
|
||||
if (Mathf.Abs(lossy.x) < 0.0001f || Mathf.Abs(lossy.y) < 0.0001f || Mathf.Abs(lossy.z) < 0.0001f) return;
|
||||
|
||||
EyeFrame frame = holder.GetComponent<EyeFrame>();
|
||||
if (frame == null) return;
|
||||
|
||||
// The Visual is scaled non-uniformly (thinner than tall), so lossyScale has three
|
||||
// different components and a single divisor would squash the spheres. Each axis is
|
||||
// divided by its own.
|
||||
Vector3 toLocal = new Vector3(1f / lossy.x, 1f / lossy.y, 1f / lossy.z);
|
||||
float eyeSize = AlfarConfig.EyeSize * AlfarConfig.EyeSizeMultiplier.Value;
|
||||
const float toLocal = PlayerFace.MetresToHeadLocal;
|
||||
|
||||
Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * AlfarConfig.EyeHeight;
|
||||
float height = AlfarConfig.EyeHeight;
|
||||
float separation = AlfarConfig.EyeSeparation;
|
||||
float size = AlfarConfig.EyeSizeMultiplier.Value;
|
||||
PlayerFace.AdjustEyes(player, ref height, ref separation, ref size);
|
||||
|
||||
Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp);
|
||||
|
||||
for (int i = 0; i < holder.childCount; i++)
|
||||
{
|
||||
Transform eye = holder.GetChild(i);
|
||||
|
||||
// Index 0 is offset against the right axis, so it is the model's left eye.
|
||||
// Index 0 is offset against the right axis, so it is the model's left eye. The
|
||||
// slant and the wrap are mirrored so both outer corners go up and back.
|
||||
float side = i == 0 ? -1f : 1f;
|
||||
Vector3 offset = baseOffset + frame.LocalRight * (side * AlfarConfig.EyeSeparation);
|
||||
|
||||
eye.localPosition = Vector3.Scale(offset, toLocal);
|
||||
eye.localScale = Vector3.Scale(Vector3.one * eyeSize, toLocal);
|
||||
// This eye's hand corrections (RaceEyeTuning).
|
||||
float forward = AlfarConfig.EyeForward;
|
||||
float eyeHeight = height;
|
||||
float eyeSeparation = separation;
|
||||
float eyeSize = size;
|
||||
float wrap = AlfarConfig.EyeWrap;
|
||||
float slant = AlfarConfig.EyeSlant;
|
||||
float tilt = 0f;
|
||||
RaceEyeTuning.Eye tuning = RaceEyeTuning.For(AlfarConfig.RaceId, player, side);
|
||||
if (tuning != null)
|
||||
{
|
||||
forward += tuning.Forward;
|
||||
eyeHeight += tuning.Height;
|
||||
eyeSeparation += tuning.Separation;
|
||||
eyeSize *= tuning.Size;
|
||||
tilt = tuning.RotX;
|
||||
wrap += tuning.RotY;
|
||||
slant += tuning.RotZ;
|
||||
}
|
||||
|
||||
Vector3 offset = frame.LocalForward * forward + frame.LocalUp * eyeHeight
|
||||
+ frame.LocalRight * (side * eyeSeparation);
|
||||
|
||||
eye.localPosition = offset * toLocal;
|
||||
eye.localRotation = facing * Quaternion.Euler(tilt, wrap * side, slant * side);
|
||||
eye.localScale = AlfarConfig.EyeExtent * (eyeSize * toLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -234,9 +266,8 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Matte black, and nothing else: the colour is black, the emission is black, and the two
|
||||
/// properties that make a lit shader shine are zeroed where the shader has them. The
|
||||
/// Sverm's eyes burn; these must read as holes.
|
||||
/// Black with a wet sheen: no emission, but smooth enough to catch a highlight, which is
|
||||
/// what makes a grey's eyes read as eyes and not as two holes punched in the face.
|
||||
/// </summary>
|
||||
private static Material BlackMaterial(Shader shader)
|
||||
{
|
||||
|
|
@ -244,10 +275,9 @@ namespace RacesOfValheim
|
|||
material.color = Color.black;
|
||||
|
||||
if (material.HasProperty("_EmissionColor")) material.SetColor("_EmissionColor", Color.black);
|
||||
if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0f);
|
||||
if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0f);
|
||||
if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0.8f);
|
||||
if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0.8f);
|
||||
if (material.HasProperty("_Metallic")) material.SetFloat("_Metallic", 0f);
|
||||
if (material.HasProperty("_SpecColor")) material.SetColor("_SpecColor", Color.black);
|
||||
|
||||
return material;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -338,8 +338,6 @@ namespace RacesOfValheim
|
|||
// The raw -> cooked table the Draugh already maintains is the source of truth.
|
||||
meatToCooked = new Dictionary<string, string>(DraughFoodPatches.rawToCookedMapping);
|
||||
meatToCooked.Remove("GreydwarfEye"); // stew ingredient, not flesh
|
||||
meatToCooked["AsksvinMeat"] = "CookedAsksvinMeat";
|
||||
meatToCooked["BoneMawSerpentMeat"] = "CookedBoneMawSerpentMeat";
|
||||
|
||||
foreach (string stationName in CookingStationPrefabs)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ namespace RacesOfValheim
|
|||
new ConfigDescription("As above, around the third axis. The default half turn is what rights the borrowed socket, which arrives upside down on a player's head bone.",
|
||||
new AcceptableValueRange<float>(-180f, 180f), new ConfigurationManagerAttributes { Order = 58 }));
|
||||
|
||||
EyeSmoke = config.Bind(eyes, "Eye Smoke", true,
|
||||
EyeSmoke = config.Bind(eyes, "Eye Smoke", false,
|
||||
new ConfigDescription("Lights the smoke the creature carries inside its own sockets and leaves switched off. Tinted to match the eyes, so it turns with them at the last stage.",
|
||||
null, new ConfigurationManagerAttributes { Order = 50 }));
|
||||
EyeFlatColorShader = config.Bind(eyes, "Eye Flat Colour Shader", false,
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ namespace RacesOfValheim
|
|||
private const float BaseEyeHeight = 0.181f;
|
||||
private const float BaseEyeSeparation = 0.032f;
|
||||
|
||||
// The borrowed socket at the size the Skeleton wears it, times the config multiplier, was
|
||||
// two green blocks on the face; at half it was smaller than the painted eye underneath,
|
||||
// which then showed round it. Applied before the multiplier, so a saved config keeps its
|
||||
// meaning as "relative to the default".
|
||||
private const float BaseEyeScale = 0.75f;
|
||||
|
||||
// ─── Race check ─────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -99,6 +105,10 @@ namespace RacesOfValheim
|
|||
// built again rather than merely moved.
|
||||
public string SourceModel = "";
|
||||
public bool FlatShader;
|
||||
|
||||
// Which body the base pose was measured for: the female face puts the eyes elsewhere
|
||||
// (PlayerFace), so a change of body model is a rebuild too.
|
||||
public bool Female;
|
||||
}
|
||||
|
||||
/// <summary>The pose an eye was authored at on the creature. Everything else is a delta on this.</summary>
|
||||
|
|
@ -180,7 +190,8 @@ namespace RacesOfValheim
|
|||
EyeFrame existing = eyes.GetComponent<EyeFrame>();
|
||||
if (existing == null ||
|
||||
existing.SourceModel != AswidConfig.EyeSourceModel.Value ||
|
||||
existing.FlatShader != AswidConfig.EyeFlatColorShader.Value)
|
||||
existing.FlatShader != AswidConfig.EyeFlatColorShader.Value ||
|
||||
existing.Female != PlayerFace.IsFemale(player))
|
||||
{
|
||||
eyes.name = EyesName + "_Removed";
|
||||
Object.Destroy(eyes.gameObject);
|
||||
|
|
@ -309,9 +320,6 @@ namespace RacesOfValheim
|
|||
|
||||
float scale = GetPlayerScale(player) * toLocal;
|
||||
|
||||
Vector3 shift = frame.LocalForward * (AswidConfig.EyeForwardOffset.Value * scale)
|
||||
+ frame.LocalUp * (AswidConfig.EyeHeightOffset.Value * scale);
|
||||
|
||||
for (int i = 0; i < holder.childCount; i++)
|
||||
{
|
||||
Transform eye = holder.GetChild(i);
|
||||
|
|
@ -324,6 +332,16 @@ namespace RacesOfValheim
|
|||
float side = Mathf.Sign(Vector3.Dot(authored.Position, frame.LocalRight));
|
||||
if (side == 0f) side = i == 0 ? -1f : 1f;
|
||||
|
||||
// This eye's hand corrections (RaceEyeTuning), on top of the race's own offsets.
|
||||
RaceEyeTuning.Eye tuning = RaceEyeTuning.For("Aswid", player, side);
|
||||
float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward : 0f);
|
||||
float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height : 0f);
|
||||
float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation : 0f);
|
||||
float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size : 1f);
|
||||
|
||||
Vector3 shift = frame.LocalForward * (forward * scale)
|
||||
+ frame.LocalUp * (height * scale);
|
||||
|
||||
// YAW IS MIRRORED, the other two are not. Turning both eyes the same way on Y
|
||||
// makes the pair look sideways - both point off the same shoulder, because a face
|
||||
// is symmetric about its centre line and yaw is the axis that crosses it. Negating
|
||||
|
|
@ -332,15 +350,31 @@ namespace RacesOfValheim
|
|||
//
|
||||
// Pitch and roll are shared deliberately: both eyes looking up is a face looking
|
||||
// up, and mirroring either of those would cross them instead of aiming them.
|
||||
//
|
||||
// This twist is on the HEAD BONE's raw axes (it multiplies from the left), and on
|
||||
// this rig those are not the face's: bone X points out of the face and bone Z
|
||||
// sideways. The defaults were dialled in against that, so it stays as it is.
|
||||
Quaternion twist = Quaternion.Euler(
|
||||
AswidConfig.EyeRotationX.Value,
|
||||
AswidConfig.EyeRotationY.Value * side,
|
||||
AswidConfig.EyeRotationZ.Value);
|
||||
|
||||
// The RaceEyeTuning corrections turn the eye on the FACE's axes instead: conjugated by
|
||||
// the face frame, X tips it, Y turns it toward the temple and Z raises the outer
|
||||
// corner, the same on both eyes. Added to the bone-axis twist above, X rolled the
|
||||
// eyes and a mirrored Z tipped one up and the other down.
|
||||
Quaternion nudge = Quaternion.identity;
|
||||
if (tuning != null)
|
||||
{
|
||||
nudge = authored.Rotation
|
||||
* Quaternion.Euler(tuning.RotX, tuning.RotY * side, tuning.RotZ * side)
|
||||
* Quaternion.Inverse(authored.Rotation);
|
||||
}
|
||||
|
||||
eye.localPosition = authored.Position + shift +
|
||||
frame.LocalRight * (side * AswidConfig.EyeSeparationOffset.Value * scale);
|
||||
eye.localRotation = twist * authored.Rotation;
|
||||
eye.localScale = authored.Scale * AswidConfig.EyeSizeMultiplier.Value;
|
||||
frame.LocalRight * (side * separation * scale);
|
||||
eye.localRotation = nudge * twist * authored.Rotation;
|
||||
eye.localScale = authored.Scale * size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -424,6 +458,12 @@ namespace RacesOfValheim
|
|||
MeasureFrame(player, headBone, frame);
|
||||
frame.SourceModel = modelName;
|
||||
frame.FlatShader = AswidConfig.EyeFlatColorShader.Value;
|
||||
frame.Female = PlayerFace.IsFemale(player);
|
||||
|
||||
float baseHeight = BaseEyeHeight;
|
||||
float baseSeparation = BaseEyeSeparation;
|
||||
float baseSize = BaseEyeScale;
|
||||
PlayerFace.AdjustEyes(player, ref baseHeight, ref baseSeparation, ref baseSize);
|
||||
|
||||
// canonicalToFrame turns "face forward, as authored" into "face forward, on THIS
|
||||
// rig's own axes" - the rotation that carries the ordinary (X,Y,Z) convention onto
|
||||
|
|
@ -458,8 +498,8 @@ namespace RacesOfValheim
|
|||
float toLocal = 1f / headBone.lossyScale.x;
|
||||
|
||||
Vector3 basePosition = frame.LocalForward * (BaseEyeForward * toLocal)
|
||||
+ frame.LocalUp * (BaseEyeHeight * toLocal)
|
||||
+ frame.LocalRight * (side * BaseEyeSeparation * toLocal);
|
||||
+ frame.LocalUp * (baseHeight * toLocal)
|
||||
+ frame.LocalRight * (side * baseSeparation * toLocal);
|
||||
|
||||
// The socket's own authored tilt is skipped for the same reason its position is -
|
||||
// canonicalToFrame alone (face forward, on this rig's axes) is what the config's
|
||||
|
|
@ -481,7 +521,7 @@ namespace RacesOfValheim
|
|||
// this object at on a real skeleton. Divided into the new parent's scale, the pair
|
||||
// lands at exactly the size vanilla wears them, which is the whole point of
|
||||
// borrowing them instead of drawing spheres.
|
||||
Vector3 baseScale = source.lossyScale * toLocal;
|
||||
Vector3 baseScale = source.lossyScale * (toLocal * baseSize);
|
||||
|
||||
// Remembered before anything moves it, because everything the config does is
|
||||
// expressed as a delta on this.
|
||||
|
|
|
|||
|
|
@ -112,12 +112,13 @@ namespace RacesOfValheim
|
|||
// Flight only knows powered forward, reverse or neither, so the stick is a
|
||||
// threshold, not a throttle. Steering stays on the camera, i.e. the right stick.
|
||||
float stick = -JoyLeftStickY();
|
||||
bool forward = input && (Input.GetKey(KeyCode.W) || stick > StickThreshold);
|
||||
// The keyboard side reads vanilla's own Forward/Backward/Run actions, so a key the
|
||||
// player rebound in the settings flies too, not just W, S and Shift.
|
||||
bool forward = input && (ZInput.GetButton("Forward") || stick > StickThreshold);
|
||||
// Forward wins a W+S mash rather than the two cancelling into a dead hover.
|
||||
bool backward = input && !forward && (Input.GetKey(KeyCode.S) || stick < -StickThreshold);
|
||||
bool backward = input && !forward && (ZInput.GetButton("Backward") || stick < -StickThreshold);
|
||||
// Sprint on a pad is vanilla's run button, wherever the chosen layout puts it.
|
||||
bool sprintKey = input && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ||
|
||||
ZInput.GetButton("JoyRun"));
|
||||
bool sprintKey = input && (ZInput.GetButton("Run") || ZInput.GetButton("JoyRun"));
|
||||
bool onGround = __instance.IsOnGround();
|
||||
// IsSwimming is the exact test UpdateMotion uses to hand the frame to UpdateSwimming
|
||||
// instead of UpdateFlying, so it is also the one condition DirectedFlightWaterPatch has
|
||||
|
|
|
|||
|
|
@ -24,11 +24,16 @@ namespace RacesOfValheim
|
|||
{ "HareMeat", "CookedHareMeat" },
|
||||
{ "ChickenMeat", "CookedChickenMeat" },
|
||||
{ "BugMeat", "CookedBugMeat" },
|
||||
{ "VoltureMeat", "RoastedVoltureMeat" },
|
||||
{ "VoltureMeat", "CookedVoltureMeat" },
|
||||
{ "GreydwarfEye", "DeerStew" },
|
||||
{ "Entrails", "Sausages" },
|
||||
{ "Bloodbag", "BloodPudding" },
|
||||
{ "MooseMeat", "CookedMooseMeat" },
|
||||
// Bjorn, the Valheim 1.0 bear.
|
||||
{ "BjornMeat", "CookedBjornMeat" },
|
||||
// Ashlands.
|
||||
{ "AsksvinMeat", "CookedAsksvinMeat" },
|
||||
{ "BoneMawSerpentMeat", "CookedBoneMawSerpentMeat" },
|
||||
// Raw blubber keeps its own name and icon (EdibleUncooked_ copies them from the raw
|
||||
// item) and gives the stats of Seal Meat Soup.
|
||||
{ "SealBlubber", "SealSoup" }
|
||||
|
|
|
|||
|
|
@ -124,9 +124,11 @@ namespace RacesOfValheim
|
|||
// still clearing by about 2mm. Same size of eye, sitting deeper, and the cap is flatter
|
||||
// for it - which is what reads as set into the skull rather than resting on it.
|
||||
public static readonly float EyeSeparation = 0.032f; // half the distance between them
|
||||
public static readonly float EyeForward = 0.081f; // centre ~63mm out
|
||||
public static readonly float EyeForward = 0.085f; // 0.081 left the smaller ball buried
|
||||
public static readonly float EyeHeight = 0.181f; // ~15mm lower than before
|
||||
public static readonly float EyeSize = 0.062f; // ~48mm across, so a 24mm radius
|
||||
// Then cut down after playtest: at 0.062 the cap read as two lamps covering the face. An
|
||||
// 18mm radius at the same depth leaves a cap of about 22mm on a 0.78 Dvergar.
|
||||
public static readonly float EyeSize = 0.036f;
|
||||
|
||||
// How hard the eyes burn. The colours the game gives a starred dverger are HDR - one star
|
||||
// is (0, 4, 3.3) - and anything past 1 clips to white on the way to the bloom pass, which
|
||||
|
|
|
|||
|
|
@ -277,10 +277,11 @@ namespace RacesOfValheim
|
|||
// metre was the entire drift: the offsets below are under a centimetre in local units
|
||||
// and never stood a chance of mattering next to it.
|
||||
float raceScale = GetVisualScale(player);
|
||||
Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal)
|
||||
+ localUp * (DvergarConfig.EyeHeight * raceScale * toLocal);
|
||||
|
||||
float eyeLocalSize = DvergarConfig.EyeSize * raceScale * toLocal;
|
||||
float height = DvergarConfig.EyeHeight;
|
||||
float separation = DvergarConfig.EyeSeparation;
|
||||
float eyeSize = DvergarConfig.EyeSize;
|
||||
PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize);
|
||||
|
||||
for (int i = 0; i < holder.childCount; i++)
|
||||
{
|
||||
|
|
@ -291,9 +292,25 @@ namespace RacesOfValheim
|
|||
// curved and the two sides do not present the same surface to a ball of this
|
||||
// radius.
|
||||
float side = i == 0 ? -1f : 1f;
|
||||
float size = i == 0 ? eyeLocalSize * DvergarConfig.LeftEyeSizeMultiplier : eyeLocalSize;
|
||||
|
||||
eye.localPosition = baseLocal + localRight * (side * DvergarConfig.EyeSeparation * raceScale * toLocal);
|
||||
// This eye's hand corrections (RaceEyeTuning).
|
||||
float forward = DvergarConfig.EyeForward;
|
||||
float eyeHeight = height;
|
||||
float eyeSeparation = separation;
|
||||
float size = eyeSize * raceScale * toLocal;
|
||||
RaceEyeTuning.Eye tuning = RaceEyeTuning.For(DvergarConfig.RaceId, player, side);
|
||||
if (tuning != null)
|
||||
{
|
||||
forward += tuning.Forward;
|
||||
eyeHeight += tuning.Height;
|
||||
eyeSeparation += tuning.Separation;
|
||||
size *= tuning.Size;
|
||||
}
|
||||
if (i == 0) size *= DvergarConfig.LeftEyeSizeMultiplier;
|
||||
|
||||
eye.localPosition = localForward * (forward * raceScale * toLocal)
|
||||
+ localUp * (eyeHeight * raceScale * toLocal)
|
||||
+ localRight * (side * eyeSeparation * raceScale * toLocal);
|
||||
eye.localScale = Vector3.one * size;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds eleven custom playable races (Alfar, Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.",
|
||||
"version_number": "1.6.1",
|
||||
"version_number": "1.6.2",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
|
|
|
|||
51
JotunnModStub/PlayerFace.cs
Normal file
51
JotunnModStub/PlayerFace.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// Where a player's painted eyes are, for the races that hang something over them (Alfar,
|
||||
/// Aswid, Dvergar, Sverm).
|
||||
///
|
||||
/// Every eye constant in this mod (0.081 forward, 0.181 up, 0.032 apart) was tuned on the MALE
|
||||
/// body. The female body is a different mesh on the same rig and the same skin texture, and it
|
||||
/// maps the painted eyes elsewhere: read offline from VisEquipment.m_models (bodymale vs
|
||||
/// bodyfem, Valheim 1.0.20), by finding the dark socket pixels of PlayerCharacter_01 and
|
||||
/// following the UVs back onto each mesh in head-bone space, the female eyes sit about 6mm
|
||||
/// lower and a quarter closer together. Both are weighted 100% to Head, so once placed they
|
||||
/// follow the head exactly; a sphere on the male spot simply sits on the brow, off the face.
|
||||
///
|
||||
/// HEAD-LOCAL UNITS. The player armature is authored at 100x, so one metre at human scale is
|
||||
/// 0.01 in the head bone's own space. That is a constant of the rig, not of this frame:
|
||||
/// reading headBone.lossyScale live instead breaks under a non-uniform body scale (the Alfar),
|
||||
/// where the value drifts as the head turns.
|
||||
/// </summary>
|
||||
public static class PlayerFace
|
||||
{
|
||||
public const float MetresToHeadLocal = 0.01f;
|
||||
|
||||
// Female against male. The UV reading gave -6mm, but in game the eyes still sat a full
|
||||
// eye-height above the painted ones on every race (screenshots, 2026-10-27), so the
|
||||
// height is the measured shift plus that.
|
||||
private const float FemaleHeightShift = -0.014f;
|
||||
private const float FemaleSeparationScale = 0.75f;
|
||||
private const float FemaleSizeScale = 0.9f;
|
||||
|
||||
/// <summary>True while the body wears the female mesh (VisEquipment model index 1).</summary>
|
||||
public static bool IsFemale(Player player)
|
||||
{
|
||||
VisEquipment vis = player != null ? player.GetComponent<VisEquipment>() : null;
|
||||
if (vis == null || vis.m_bodyModel == null || vis.m_models == null || vis.m_models.Length < 2) return false;
|
||||
return vis.m_bodyModel.sharedMesh == vis.m_models[1].m_mesh;
|
||||
}
|
||||
|
||||
/// <summary>Moves male-tuned eye numbers (metres) onto the female face; leaves a male face alone.</summary>
|
||||
public static void AdjustEyes(Player player, ref float height, ref float separation, ref float size)
|
||||
{
|
||||
if (!IsFemale(player)) return;
|
||||
|
||||
height += FemaleHeightShift;
|
||||
separation *= FemaleSeparationScale;
|
||||
size *= FemaleSizeScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
JotunnModStub/RaceEyeTuning.cs
Normal file
64
JotunnModStub/RaceEyeTuning.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
/// <summary>
|
||||
/// Hand corrections for every race that hangs eyes on the face, per body and per eye. Per body
|
||||
/// because the two bodies put their painted eyes in different places (PlayerFace); per eye
|
||||
/// because the face is not symmetric enough for one set to fit both. Left and right are the
|
||||
/// character's own.
|
||||
///
|
||||
/// Every value is a delta on the placement the race's own code computes: zeros (and size 1)
|
||||
/// change nothing. They were dialled in on screen with Configuration Manager sliders
|
||||
/// (playtest, 2026-10-27) and then written down here; the sliders are gone.
|
||||
/// </summary>
|
||||
public static class RaceEyeTuning
|
||||
{
|
||||
/// <summary>One eye's corrections. Metres for the offsets, degrees for the rotations.</summary>
|
||||
public sealed class Eye
|
||||
{
|
||||
public float Forward, Height, Separation, RotX, RotY, RotZ;
|
||||
public float Size = 1f;
|
||||
}
|
||||
|
||||
private static readonly Eye Untouched = new Eye();
|
||||
|
||||
// [race] -> { male left, male right, female left, female right }
|
||||
private static readonly Dictionary<string, Eye[]> tunings = new Dictionary<string, Eye[]>
|
||||
{
|
||||
[AlfarConfig.RaceId] = new[]
|
||||
{
|
||||
new Eye(),
|
||||
new Eye { Separation = 0.009f },
|
||||
new Eye { Separation = 0.006f, RotX = -17.524f },
|
||||
new Eye { Separation = 0.015f, RotX = -17.524f },
|
||||
},
|
||||
["Aswid"] = new[]
|
||||
{
|
||||
new Eye { Height = -0.005f, Separation = -0.005f, Size = 1.273f, RotX = 6.49f, RotY = 4.544f, RotZ = 4.544f },
|
||||
new Eye { Forward = -0.002f, Height = -0.005f, Separation = 0.004f, Size = 1.444f, RotZ = 6.49f },
|
||||
new Eye { Forward = -0.006f, Height = -0.010f, Size = 1.314f, RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f },
|
||||
new Eye { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f },
|
||||
},
|
||||
[DvergarConfig.RaceId] = new[]
|
||||
{
|
||||
new Eye { Forward = -0.003f, Size = 1.05f },
|
||||
new Eye { Forward = -0.004f, Separation = 0.005f },
|
||||
new Eye { Forward = -0.011f, Separation = 0.005f, Size = 1.616f },
|
||||
new Eye { Forward = -0.015f, Separation = 0.013f, Size = 1.616f },
|
||||
},
|
||||
// The Sverm's helmet hides its eyes, so it keeps the code's own placement.
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The corrections for one eye of the body this player is wearing right now. Side is the
|
||||
/// races' own convention: negative is offset against the head frame's right axis, which is
|
||||
/// the character's left eye. Never null.
|
||||
/// </summary>
|
||||
public static Eye For(string race, Player player, float side)
|
||||
{
|
||||
if (!tunings.TryGetValue(race, out Eye[] set)) return Untouched;
|
||||
return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -167,6 +167,19 @@ namespace RacesOfValheim
|
|||
return Input.GetMouseButtonDown(mouseButton) || PadAttackDown(mouseButton);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nothing in either hand and not building. The pad has no spare button, so a race power
|
||||
/// that needs one borrows the secondary attack under this condition only: with a weapon or
|
||||
/// a tool in hand that button stays the item's, as in vanilla.
|
||||
/// </summary>
|
||||
public static bool EmptyHanded(Player player)
|
||||
{
|
||||
if (player == null || player.InPlaceMode()) return false;
|
||||
var hands = Traverse.Create(player);
|
||||
return hands.Field<ItemDrop.ItemData>("m_rightItem").Value == null &&
|
||||
hands.Field<ItemDrop.ItemData>("m_leftItem").Value == null;
|
||||
}
|
||||
|
||||
/// <summary>Held-down counterpart of <see cref="AttackDown"/>.</summary>
|
||||
public static bool AttackHeld(int mouseButton)
|
||||
{
|
||||
|
|
@ -202,7 +215,7 @@ namespace RacesOfValheim
|
|||
private static bool loggedOpen;
|
||||
private static bool loggedClosed;
|
||||
|
||||
private static bool RadialOpen
|
||||
internal static bool RadialOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
public const string PluginGUID = "com.nandor.racesofvalheim";
|
||||
public const string PluginName = "Races Of Valheim";
|
||||
public const string PluginVersion = "1.6.1";
|
||||
public const string PluginVersion = "1.6.2";
|
||||
|
||||
private readonly Harmony harmony = new Harmony(PluginGUID);
|
||||
|
||||
|
|
|
|||
|
|
@ -465,13 +465,7 @@ namespace RacesOfValheim
|
|||
/// mode and with nothing in either hand. Shared with SkadiAttackPatch, which swallows the
|
||||
/// unarmed kick under exactly the same condition.
|
||||
/// </summary>
|
||||
public static bool PadCastsColdSpell(Player player)
|
||||
{
|
||||
if (player == null || player.InPlaceMode()) return false;
|
||||
var hands = HarmonyLib.Traverse.Create(player);
|
||||
return hands.Field<ItemDrop.ItemData>("m_rightItem").Value == null &&
|
||||
hands.Field<ItemDrop.ItemData>("m_leftItem").Value == null;
|
||||
}
|
||||
public static bool PadCastsColdSpell(Player player) => RaceInput.EmptyHanded(player);
|
||||
|
||||
private IEnumerator ColdSpellKickCoroutine(SkadiProgression.FormRules rules)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -251,10 +251,10 @@ namespace RacesOfValheim
|
|||
|
||||
float scale = player.transform.localScale.x;
|
||||
|
||||
Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal)
|
||||
+ frame.LocalUp * (EyeHeight * scale * toLocal);
|
||||
|
||||
float eyeLocalSize = EyeSize * scale * toLocal;
|
||||
float height = EyeHeight;
|
||||
float separation = EyeSeparation;
|
||||
float eyeSize = EyeSize;
|
||||
PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize);
|
||||
|
||||
for (int i = 0; i < holder.childCount; i++)
|
||||
{
|
||||
|
|
@ -262,9 +262,25 @@ namespace RacesOfValheim
|
|||
|
||||
// Index 0 is offset against the right axis, so it is the model's left eye.
|
||||
float side = i == 0 ? -1f : 1f;
|
||||
float size = i == 0 ? eyeLocalSize * LeftEyeSizeMultiplier : eyeLocalSize;
|
||||
|
||||
eye.localPosition = baseLocal + frame.LocalRight * (side * EyeSeparation * scale * toLocal);
|
||||
// This eye's hand corrections (RaceEyeTuning).
|
||||
float forward = EyeForward;
|
||||
float eyeHeight = height;
|
||||
float eyeSeparation = separation;
|
||||
float size = eyeSize * scale * toLocal;
|
||||
RaceEyeTuning.Eye tuning = RaceEyeTuning.For(SvermConfig.RaceId, player, side);
|
||||
if (tuning != null)
|
||||
{
|
||||
forward += tuning.Forward;
|
||||
eyeHeight += tuning.Height;
|
||||
eyeSeparation += tuning.Separation;
|
||||
size *= tuning.Size;
|
||||
}
|
||||
if (i == 0) size *= LeftEyeSizeMultiplier;
|
||||
|
||||
eye.localPosition = frame.LocalForward * (forward * scale * toLocal)
|
||||
+ frame.LocalUp * (eyeHeight * scale * toLocal)
|
||||
+ frame.LocalRight * (side * eyeSeparation * scale * toLocal);
|
||||
eye.localScale = Vector3.one * size;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"rov_compendium_alfar_utsog": "[Elder Unlock] Utsog: $1% of the damage you deal comes back to you as eitr.\n",
|
||||
"rov_compendium_alfar_kall": "[Bonemass Unlock] Kall ('$1' Key): Pulls every dropped item within $2 meters to you. Waits $3 seconds.\n",
|
||||
"rov_compendium_alfar_ljosstorm": "[Moder Unlock] Ljosstorm ('$1' Key): A psionic storm over a $2 meter area for $3 seconds. Waits $4 seconds.\n",
|
||||
"rov_compendium_alfar_geisli": "[Yagluth Unlock] Geisli ('$1' Key, hold): A laser from your right hand, up to $2 meters, for at most $3 seconds, costing eitr by the second.\n",
|
||||
"rov_compendium_alfar_geisli": "[Yagluth Unlock] Geisli ('$1' Key, hold): A laser from your right hand, up to $2 meters, for at most $3 seconds, costing eitr by the second. On a gamepad, hold the secondary attack with empty hands.\n",
|
||||
"rov_compendium_alfar_kyrr": "[Queen Unlock] Kyrr ('$1' Key): Holds what you look at in stasis for $2 seconds ($3 for a boss).\n",
|
||||
"rov_compendium_alfar_sameining": "[Fader Unlock] Sameining ('$1' Key): The archon. Needs $2% of your eitr and a ready Heimkall; spends all the eitr and turns it into a pool of protection. For up to $3 seconds you are larger, faster and you fly, and a psionic pulse strikes everything hostile around you, but you cannot use weapons. When it ends - time up or pool gone - you are called home at one health and the Heimkall begins its wait.\n",
|
||||
"rov_compendium_alfar_more_to_come": "More powers wake as the great ones fall.\n",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"rov_compendium_alfar_utsog": "[Sblocco Anziano] Utsog: il $1% dei danni che infliggi ti torna come eitr.\n",
|
||||
"rov_compendium_alfar_kall": "[Sblocco Bonemass] Kall (tasto '$1'): attira a te ogni oggetto a terra entro $2 metri. Attesa $3 secondi.\n",
|
||||
"rov_compendium_alfar_ljosstorm": "[Sblocco Moder] Ljosstorm (tasto '$1'): una tempesta psionica su un'area di $2 metri per $3 secondi. Attesa $4 secondi.\n",
|
||||
"rov_compendium_alfar_geisli": "[Sblocco Yagluth] Geisli (tasto '$1', tenuto): un laser dalla mano destra, fino a $2 metri, per al massimo $3 secondi, consumando eitr al secondo.\n",
|
||||
"rov_compendium_alfar_geisli": "[Sblocco Yagluth] Geisli (tasto '$1', tenuto): un laser dalla mano destra, fino a $2 metri, per al massimo $3 secondi, consumando eitr al secondo. Col controller, tieni premuto l'attacco secondario a mani vuote.\n",
|
||||
"rov_compendium_alfar_kyrr": "[Sblocco Regina] Kyrr (tasto '$1'): tiene in stasi ciò che guardi per $2 secondi ($3 per un boss).\n",
|
||||
"rov_compendium_alfar_sameining": "[Sblocco Fader] Sameining (tasto '$1'): l'arconte. Servono il $2% dell'eitr e un Heimkall pronto; spende tutto l'eitr e lo trasforma in una riserva di protezione. Per al massimo $3 secondi sei più grande, più veloce e voli, e un impulso psionico colpisce tutto ciò che è ostile attorno a te, ma non puoi usare armi. Alla fine - tempo scaduto o riserva esaurita - vieni richiamato a casa con un punto ferita e l'attesa dell'Heimkall ricomincia.\n",
|
||||
"rov_compendium_alfar_more_to_come": "Altri poteri si risveglieranno man mano che cadono i grandi.\n",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"rov_compendium_alfar_utsog": "[Открывается со Старейшиной] Утсог: $1% нанесённого вами урона возвращается к вам в виде эйтра.\n",
|
||||
"rov_compendium_alfar_kall": "[Открывается с Боунмассом] Калль (клавиша '$1'): притягивает к вам все лежащие предметы в радиусе $2 метров. Перезарядка $3 секунд.\n",
|
||||
"rov_compendium_alfar_ljosstorm": "[Открывается с Модером] Льёсстормр (клавиша '$1'): псионическая буря на площади $2 метров на $3 секунд. Перезарядка $4 секунд.\n",
|
||||
"rov_compendium_alfar_geisli": "[Открывается с Ягнутом] Гейсли (клавиша '$1', удерживать): лазер из правой руки до $2 метров, не дольше $3 секунд, эйтр тратится каждую секунду.\n",
|
||||
"rov_compendium_alfar_geisli": "[Открывается с Ягнутом] Гейсли (клавиша '$1', удерживать): лазер из правой руки до $2 метров, не дольше $3 секунд, эйтр тратится каждую секунду. На геймпаде удерживайте вторичную атаку с пустыми руками.\n",
|
||||
"rov_compendium_alfar_kyrr": "[Открывается с Королевой] Кюрр (клавиша '$1'): удерживает того, на кого смотрите, в стазисе $2 секунд ($3 для босса).\n",
|
||||
"rov_compendium_alfar_sameining": "[Открывается с Фадером] Саминг (клавиша '$1'): архонт. Нужно $2% эйтра и готовый Хеймкалль; тратит весь эйтр и превращает его в запас защиты. До $3 секунд вы больше, быстрее и летаете, а псионический импульс бьёт всех врагов вокруг, но оружием пользоваться нельзя. В конце - по времени или с исчерпанным запасом - вас возвращают домой с одной единицей здоровья, и Хеймкалль начинает ожидание.\n",
|
||||
"rov_compendium_alfar_more_to_come": "Новые силы пробуждаются по мере падения великих.\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue