Skip to content

Commit

Permalink
option to shorten the teleport time as much as much as possible
Browse files Browse the repository at this point in the history
extracted from valheimPlus#752
  • Loading branch information
Grantapher committed May 28, 2023
1 parent 6d6614f commit 5b916b8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ We work together closely to make sure all our features are integrated and workin
* Tweak/disable death penalty.
* Tweak Rested bonus duration per comfort level.
* Disable the use of portals.
* Shorten the portal teleport animation time to the minimum possible.
* Modify the Guardian buff duration, cooldown and animation.
* Disable tutorials from Valkyrie.
* Modify velocity and accuracy of projectiles from bows and javelins including a option to scale it with skill level.
Expand Down
1 change: 1 addition & 0 deletions ValheimPlus/Configurations/Sections/PlayerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public class PlayerConfiguration : ServerSyncConfig<PlayerConfiguration>
public bool skipTutorials { get; internal set; } = false;
public bool disableEncumbered { get; internal set; } = false;
public bool autoPickUpWhenEncumbered { get; internal set; } = false;
public bool disableEightSecondTeleport { get; internal set; } = false;
}
}
13 changes: 13 additions & 0 deletions ValheimPlus/GameClasses/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,4 +1205,17 @@ public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction
return instructions;
}
}

[HarmonyPatch(typeof(Player), nameof(Player.UpdateTeleport))]
public static class Player_UpdateTeleport_Patch
{
[HarmonyPrefix]
private static void Prefix(ref float ___m_teleportTimer, ref bool ___m_teleporting, ref Vector3 ___m_teleportTargetPos)
{
if (Configuration.Current.Player.disableEightSecondTeleport && ZNetScene.instance.IsAreaReady(___m_teleportTargetPos) && ___m_teleporting)
{
___m_teleportTimer += Helper.Clamp(8.1f - ___m_teleportTimer, 0, float.MaxValue);
}
}
}
}
3 changes: 3 additions & 0 deletions valheim_plus.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ disableEncumbered=false
; Allow auto pickup of items when encumbered (overweight)
autoPickUpWhenEncumbered=false

; Shortens the teleport time as much as much as possible
disableEightSecondTeleport=false

[Server]

; Change false to true to enable this section. https://valheim.plus/documentation/list#Server
Expand Down
5 changes: 5 additions & 0 deletions vplusconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,11 @@
"description": "If set to true, allows the auto pickup of items when encumbered (overweight) from carrying to much weight.",
"defaultValue": "false",
"defaultType": "bool"
},
"disableEightSecondTeleport": {
"description": "If set to true, shortens the teleport time as much as much as possible.",
"defaultValue": "false",
"defaultType": "bool"
}
}
},
Expand Down

0 comments on commit 5b916b8

Please sign in to comment.