Merge branch 'fix-draugh-bear-alfar-gamepad': Draugh meats, Alfar levitation and Geisli on gamepad, rebindable flight keys
This commit is contained in:
commit
4cf9f6bee0
10 changed files with 68 additions and 23 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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" }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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