jotunn 2.30 compatibility + minor bugs
This commit is contained in:
parent
6193b3ee2d
commit
ce671e7124
14 changed files with 107 additions and 49 deletions
|
|
@ -92,15 +92,15 @@ namespace RacesOfValheim
|
|||
{
|
||||
StartCoroutine(HowlRoutine());
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1)) // Tasto destro (Heavy Claw)
|
||||
else if (RaceInput.AttackDown(1)) // Tasto destro (Heavy Claw)
|
||||
{
|
||||
StartCoroutine(ClawRoutine("attack_claw1", FenrirConfig.FenringHeavyClawDamage.Value, 1.2f, 0.5f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(0)) // Tasto sinistro
|
||||
else if (RaceInput.AttackDown(0)) // Tasto sinistro
|
||||
{
|
||||
StartCoroutine(ClawRoutine("attack_claw0", FenrirConfig.FenringLightClawDamage.Value, 1.0f, 0.4f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(2)) // Tasto centrale
|
||||
else if (RaceInput.AttackDown(2)) // Tasto centrale
|
||||
{
|
||||
StartCoroutine(JumpAttackRoutine());
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ namespace RacesOfValheim
|
|||
bool canAct = RaceInput.Allowed;
|
||||
|
||||
// Fire attack on Right Click
|
||||
if (canAct && Input.GetMouseButton(1))
|
||||
if (canAct && RaceInput.AttackHeld(1))
|
||||
{
|
||||
if (Player.m_localPlayer.GetEitr() > 0)
|
||||
{
|
||||
|
|
@ -375,12 +375,12 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
// Attacks on Left Click
|
||||
if (canAct && Input.GetMouseButtonDown(0) && !isShootingFire)
|
||||
if (canAct && RaceInput.AttackDown(0) && !isShootingFire)
|
||||
{
|
||||
StartCoroutine(ClawRoutine()); // Single claw
|
||||
}
|
||||
// Double claw on Middle Click
|
||||
else if (canAct && Input.GetMouseButtonDown(2) && !isShootingFire)
|
||||
else if (canAct && RaceInput.AttackDown(2) && !isShootingFire)
|
||||
{
|
||||
StartCoroutine(DoubleClawRoutine());
|
||||
}
|
||||
|
|
@ -706,15 +706,15 @@ namespace RacesOfValheim
|
|||
|
||||
if (isGrounded && RaceInput.Allowed)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0)) // Left Click
|
||||
if (RaceInput.AttackDown(0)) // Left Click
|
||||
{
|
||||
StartCoroutine(WolfAttackRoutine("attack1", FenrirConfig.WolfAttack1Damage.Value, 0.6f, 0.2f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1)) // Right Click
|
||||
else if (RaceInput.AttackDown(1)) // Right Click
|
||||
{
|
||||
StartCoroutine(WolfAttackRoutine("attack2", FenrirConfig.WolfAttack2Damage.Value, 0.8f, 0.3f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(2)) // Middle Click
|
||||
else if (RaceInput.AttackDown(2)) // Middle Click
|
||||
{
|
||||
StartCoroutine(WolfAttackRoutine("attack3", FenrirConfig.WolfAttack3Damage.Value, 1.0f, 0.4f));
|
||||
}
|
||||
|
|
@ -879,16 +879,16 @@ namespace RacesOfValheim
|
|||
|
||||
if (isGrounded && RaceInput.Allowed)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0)) // Left Click
|
||||
if (RaceInput.AttackDown(0)) // Left Click
|
||||
{
|
||||
StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvBiteDamage.Value, 0.6f, 0.2f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1)) // Right Click
|
||||
else if (RaceInput.AttackDown(1)) // Right Click
|
||||
{
|
||||
// Right click uses bite but as a heavier attack since slash is moved to jump
|
||||
StartCoroutine(UlvAttackRoutine("attack_bite", FenrirConfig.UlvHeavyBiteDamage.Value, 0.8f, 0.3f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(2)) // Middle Click
|
||||
else if (RaceInput.AttackDown(2)) // Middle Click
|
||||
{
|
||||
StartCoroutine(UlvJumpAttackRoutine());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds ten custom playable races (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.4.13",
|
||||
"version_number": "1.4.14",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
"ValheimModding-Jotunn-2.26.1"
|
||||
"ValheimModding-Jotunn-2.30.0"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,49 @@ namespace RacesOfValheim
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Gamepad counterparts of the three mouse buttons, indexed like Input.GetMouseButton.
|
||||
// Not a free choice: ZInput.ResetKBMButtons binds Attack to Mouse0, Block to Mouse1 and
|
||||
// SecondaryAttack to Mouse2, so each form attack lands on the pad button vanilla already
|
||||
// pairs with the same mouse button - and does whatever that button does in vanilla at the
|
||||
// same time, exactly as the mouse already did. Going through ZInput rather than raw
|
||||
// joystick buttons also follows the pad layout picked in the game settings.
|
||||
private static readonly string[] PadAttackButtons = { "JoyAttack", "JoyBlock", "JoySecondaryAttack" };
|
||||
|
||||
/// <summary>
|
||||
/// Transformed-form attack input: the mouse button, or its gamepad counterpart. Forms read
|
||||
/// the device directly instead of going through Humanoid.StartAttack, so before this a
|
||||
/// gamepad player had no way to attack in any of them.
|
||||
/// </summary>
|
||||
public static bool AttackDown(int mouseButton)
|
||||
{
|
||||
return Input.GetMouseButtonDown(mouseButton) || PadAttackDown(mouseButton);
|
||||
}
|
||||
|
||||
/// <summary>Held-down counterpart of <see cref="AttackDown"/>.</summary>
|
||||
public static bool AttackHeld(int mouseButton)
|
||||
{
|
||||
return Input.GetMouseButton(mouseButton) || PadAttackHeld(mouseButton);
|
||||
}
|
||||
|
||||
/// <summary>The gamepad half of <see cref="AttackDown"/> alone, for attacks whose mouse
|
||||
/// side is a rebindable KeyboardShortcut rather than a fixed button.</summary>
|
||||
public static bool PadAttackDown(int mouseButton)
|
||||
{
|
||||
string button = PadButton(mouseButton);
|
||||
return button != null && ZInput.GetButtonDown(button);
|
||||
}
|
||||
|
||||
public static bool PadAttackHeld(int mouseButton)
|
||||
{
|
||||
string button = PadButton(mouseButton);
|
||||
return button != null && ZInput.GetButton(button);
|
||||
}
|
||||
|
||||
private static string PadButton(int mouseButton)
|
||||
{
|
||||
return mouseButton >= 0 && mouseButton < PadAttackButtons.Length ? PadAttackButtons[mouseButton] : null;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Player), "ActivateGuardianPower")]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
public const string PluginGUID = "com.nandor.racesofvalheim";
|
||||
public const string PluginName = "Races Of Valheim";
|
||||
public const string PluginVersion = "1.4.13";
|
||||
public const string PluginVersion = "1.4.14";
|
||||
|
||||
private readonly Harmony harmony = new Harmony(PluginGUID);
|
||||
|
||||
|
|
|
|||
|
|
@ -188,24 +188,25 @@ namespace RacesOfValheim
|
|||
|
||||
// Handle Attack - each trigger is a rebindable SkadiConfig keybind; the button id
|
||||
// passed into PerformAttackCoroutine (0/1/2) still selects which attack runs, exactly
|
||||
// as it did when these were raw mouse-button checks.
|
||||
// as it did when these were raw mouse-button checks. The same id also picks the
|
||||
// gamepad button (RaceInput.PadAttackDown), which stays fixed even if the key is rebound.
|
||||
if (CanAttackNow() && RaceInput.Allowed)
|
||||
{
|
||||
if (SkadiConfig.PrimaryAttackKey.Value.IsDownIgnoringHeldKeys())
|
||||
if (SkadiConfig.PrimaryAttackKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(0))
|
||||
{
|
||||
if (HasAttackForButton(0) && Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||
{
|
||||
StartCoroutine(PerformAttackCoroutine(0));
|
||||
}
|
||||
}
|
||||
else if (SkadiConfig.BreathAttackKey.Value.IsDownIgnoringHeldKeys())
|
||||
else if (SkadiConfig.BreathAttackKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(2))
|
||||
{
|
||||
if (Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||
{
|
||||
StartCoroutine(PerformAttackCoroutine(2));
|
||||
}
|
||||
}
|
||||
else if (SkadiConfig.SpinAttackKey.Value.IsDownIgnoringHeldKeys() && formRules.Form == SkadiProgression.FormType.SkeletonDragon) // Fader Spin
|
||||
else if ((SkadiConfig.SpinAttackKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(1)) && formRules.Form == SkadiProgression.FormType.SkeletonDragon) // Fader Spin
|
||||
{
|
||||
if (Time.time - lastAttackTime >= ATTACK_COOLDOWN)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -340,7 +340,8 @@ namespace RacesOfValheim
|
|||
if (isTransformed) return; // Do not cast human spell while in dragon form
|
||||
|
||||
// Middle Mouse Button to cast, by default - rebindable via SkadiConfig.ColdSpellKey.
|
||||
if (SkadiConfig.ColdSpellKey.Value.IsDownIgnoringHeldKeys())
|
||||
// On a gamepad, the secondary attack button (the pad's own middle-mouse equivalent).
|
||||
if (SkadiConfig.ColdSpellKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(2))
|
||||
{
|
||||
// The improved cast is a burst rather than a rapid-fire, so it waits longer.
|
||||
float cooldown = rules.ImprovedColdSpell ? IMPROVED_SPELL_COOLDOWN : SPELL_COOLDOWN;
|
||||
|
|
|
|||
|
|
@ -195,14 +195,17 @@ namespace RacesOfValheim
|
|||
public static readonly float SpineSizeSmall = 0.45f; // metres, state 5-6
|
||||
public static readonly float SpineSizeFull = 0.80f; // metres, state 7+
|
||||
/// <summary>
|
||||
/// Which bone they ride. Spine3 and ONLY Spine3 - no fallback chain.
|
||||
/// Which bone they ride. Spine2 and ONLY Spine2 - no fallback chain.
|
||||
///
|
||||
/// The earlier version tried Spine2, then Spine1, then Spine, on the theory that a missing
|
||||
/// bone should degrade rather than disappear. On this rig all three exist, so the fallback
|
||||
/// never fired for the right reason and only ever meant "somewhere on the back, roughly" -
|
||||
/// which is not good enough for a crest that was positioned by eye. One bone, or nothing.
|
||||
///
|
||||
/// It was Spine3 until this was caught: the player rig counts Spine, Spine1 and Spine2 and has
|
||||
/// no Spine3, so the crest never mounted anywhere and the only trace was a warning in the log.
|
||||
/// </summary>
|
||||
public const string SpineBoneName = "Spine3";
|
||||
public const string SpineBoneName = "Spine2";
|
||||
|
||||
// Found in game with the crest on screen. A ribcage is authored lying around a body, so
|
||||
// standing it up out of a back is a quarter turn on two axes - not something anybody was
|
||||
|
|
|
|||
|
|
@ -239,7 +239,16 @@ namespace RacesOfValheim
|
|||
SpineBoneName = config.Bind(spines, "Bone", SvermConfig.SpineBoneName,
|
||||
"Which bone the spines ride. This bone and no other - there is no fallback, so a " +
|
||||
"name that is not in the rig means no crest at all. Leave it blank to use " +
|
||||
"Spine3.");
|
||||
"Spine2.");
|
||||
|
||||
// Spine3 was the shipped default and is not a bone this rig has, so a .cfg still holding it
|
||||
// has never shown a crest. BepInEx keeps the value in the file over a changed default, so
|
||||
// without this the fix would only ever reach fresh installs. Nobody can have picked Spine3
|
||||
// on purpose and seen it work, which is what makes overwriting it safe.
|
||||
if (string.Equals(SpineBoneName.Value?.Trim(), "Spine3", System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SpineBoneName.Value = SvermConfig.SpineBoneName;
|
||||
}
|
||||
|
||||
// Defaults are the values found in game with the crest on screen, not zeroes: changing
|
||||
// nothing here now reproduces the placement that was actually approved.
|
||||
|
|
|
|||
|
|
@ -542,19 +542,20 @@ namespace RacesOfValheim
|
|||
|
||||
if (!RaceInput.Allowed || !grounded) return;
|
||||
|
||||
// Right click rams, left click bites, middle click slams. All three read raw
|
||||
// UnityEngine.Input rather than going anywhere near Humanoid.StartAttack, which
|
||||
// Sverm_RavagerBlockNativeAttack_Patch refuses outright for the whole form - see the
|
||||
// class doc for why that turned out to be the only reliable option.
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
// Right click rams, left click bites, middle click slams. All three read the device
|
||||
// directly (mouse, or its gamepad counterpart - see RaceInput.AttackDown) rather than
|
||||
// going anywhere near Humanoid.StartAttack, which Sverm_RavagerBlockNativeAttack_Patch
|
||||
// refuses outright for the whole form - see the class doc for why that turned out to
|
||||
// be the only reliable option.
|
||||
if (RaceInput.AttackDown(1))
|
||||
{
|
||||
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Ram, 2f, 0.3f, 0.7f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(0))
|
||||
else if (RaceInput.AttackDown(0))
|
||||
{
|
||||
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Bite, 2f, 0.3f, 0.6f));
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(2))
|
||||
else if (RaceInput.AttackDown(2))
|
||||
{
|
||||
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Slam, 1.2f, 0.4f, 1.0f));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ namespace RacesOfValheim
|
|||
Transform bone = FindBone(player, SvermConfigManagement.Bone);
|
||||
if (bone == null)
|
||||
{
|
||||
WarnMissingSpineBone();
|
||||
WarnMissingSpineBone(player);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -496,7 +496,7 @@ namespace RacesOfValheim
|
|||
/// Said once, not forty times a minute. The cosmetic pass runs on a timer, so an
|
||||
/// unqualified LogWarning here would bury the log in the time it takes to read it.
|
||||
/// </summary>
|
||||
private static void WarnMissingSpineBone()
|
||||
private static void WarnMissingSpineBone(Player player)
|
||||
{
|
||||
if (warnedMissingSpineBone) return;
|
||||
warnedMissingSpineBone = true;
|
||||
|
|
@ -505,8 +505,10 @@ namespace RacesOfValheim
|
|||
// the rig simply has no Spine3 - it counts Spine, Spine1, Spine2 - and there was no
|
||||
// way to know that from a warning that only said what was missing.
|
||||
System.Text.StringBuilder spine = new System.Text.StringBuilder();
|
||||
Player local = Player.m_localPlayer;
|
||||
VisEquipment visEq = local != null ? local.GetComponent<VisEquipment>() : null;
|
||||
// Read off the player being dressed, not Player.m_localPlayer. On the main menu the one
|
||||
// being dressed is the character preview and m_localPlayer is still null, so the old read
|
||||
// answered "none found" about a rig that has three spine bones.
|
||||
VisEquipment visEq = player != null ? player.GetComponent<VisEquipment>() : null;
|
||||
if (visEq != null && visEq.m_bodyModel != null && visEq.m_bodyModel.bones != null)
|
||||
{
|
||||
foreach (Transform b in visEq.m_bodyModel.bones)
|
||||
|
|
|
|||
|
|
@ -252,11 +252,11 @@ namespace RacesOfValheim
|
|||
|
||||
if (!isGrounded || !RaceInput.Allowed) return;
|
||||
|
||||
if (Input.GetMouseButtonDown(0)) // Stomp
|
||||
if (RaceInput.AttackDown(0)) // Stomp
|
||||
{
|
||||
StartCoroutine(StompRoutine());
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1)) // Spike volley
|
||||
else if (RaceInput.AttackDown(1)) // Spike volley
|
||||
{
|
||||
StartCoroutine(SpikeRoutine());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,11 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (__instance == Player.m_localPlayer && TrolRace.IsTrol())
|
||||
{
|
||||
if (item != null && item.m_shared != null && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable)
|
||||
// Only real food goes through the stomach check. Meads and potions have m_food == 0 and
|
||||
// vanilla never sends them to CanEat - only to the status-effect cooldown below it. Catching
|
||||
// every Consumable here refused potions whenever the extra stomachs were full, and
|
||||
// skipped that cooldown the rest of the time.
|
||||
if (item != null && item.m_shared != null && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable && item.m_shared.m_food > 0f)
|
||||
{
|
||||
__result = CanTrolEat(__instance, item);
|
||||
return false;
|
||||
|
|
|
|||
14
README.md
14
README.md
|
|
@ -4,16 +4,6 @@ A comprehensive Valheim mod allowing you to play as unique races, each providing
|
|||
|
||||
---
|
||||
|
||||
## Warning
|
||||
|
||||
Jotunn has not been updated for Valheim 1.0 yet, and RacesOfValheim cannot run without it. Until the official build is out, install this community rebuild of Jotunn instead:
|
||||
|
||||
[ReefTeam — Jotunn](https://thunderstore.io/c/valheim/p/ReefTeam/Jotunn/)
|
||||
|
||||
Remove it once the Jotunn team ships its own 1.0 release.
|
||||
|
||||
---
|
||||
|
||||
## Development & Feedback
|
||||
|
||||
This is a stable release, but more races and refinements are planned!
|
||||
|
|
@ -420,6 +410,10 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact
|
|||
|
||||
## Changelog
|
||||
|
||||
### v1.4.14
|
||||
- **Fix - The Trol could not drink potions or meads:** the Trol's extra-stomach check caught every consumable, not just food, so a potion or a mead was refused whenever the extra stomachs were full — and when they had room, it skipped the potion's own cooldown instead. Only real food goes through the stomach check now; potions and meads are back on vanilla's rules.
|
||||
- **NEW - Transformed forms can attack with a gamepad:** form attacks read the mouse buttons directly, so a gamepad player had no way to attack in any of them. Each form attack now also answers the pad button vanilla pairs with the same mouse button — Attack for left click, Block for right click, Secondary Attack for middle click — following the pad layout picked in the game settings. Covers the Fenrir forms, Skadi's dragon forms and her Cold Spell, the Sverm Ravager and the Trenta Muspell. On Skadi the keyboard keys stay rebindable; the pad buttons are fixed.
|
||||
|
||||
### v1.4.13
|
||||
- Update to 1.0.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds ten custom playable races (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.4.13",
|
||||
"version_number": "1.4.14",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
"ValheimModding-Jotunn-2.26.1"
|
||||
"ValheimModding-Jotunn-2.30.0"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue