Skip to content

Commit 5b916b8

Browse files
committed
option to shorten the teleport time as much as much as possible
extracted from valheimPlus#752
1 parent 6d6614f commit 5b916b8

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ We work together closely to make sure all our features are integrated and workin
3434
* Tweak/disable death penalty.
3535
* Tweak Rested bonus duration per comfort level.
3636
* Disable the use of portals.
37+
* Shorten the portal teleport animation time to the minimum possible.
3738
* Modify the Guardian buff duration, cooldown and animation.
3839
* Disable tutorials from Valkyrie.
3940
* Modify velocity and accuracy of projectiles from bows and javelins including a option to scale it with skill level.

ValheimPlus/Configurations/Sections/PlayerConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ public class PlayerConfiguration : ServerSyncConfig<PlayerConfiguration>
2626
public bool skipTutorials { get; internal set; } = false;
2727
public bool disableEncumbered { get; internal set; } = false;
2828
public bool autoPickUpWhenEncumbered { get; internal set; } = false;
29+
public bool disableEightSecondTeleport { get; internal set; } = false;
2930
}
3031
}

ValheimPlus/GameClasses/Player.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,4 +1205,17 @@ public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction
12051205
return instructions;
12061206
}
12071207
}
1208+
1209+
[HarmonyPatch(typeof(Player), nameof(Player.UpdateTeleport))]
1210+
public static class Player_UpdateTeleport_Patch
1211+
{
1212+
[HarmonyPrefix]
1213+
private static void Prefix(ref float ___m_teleportTimer, ref bool ___m_teleporting, ref Vector3 ___m_teleportTargetPos)
1214+
{
1215+
if (Configuration.Current.Player.disableEightSecondTeleport && ZNetScene.instance.IsAreaReady(___m_teleportTargetPos) && ___m_teleporting)
1216+
{
1217+
___m_teleportTimer += Helper.Clamp(8.1f - ___m_teleportTimer, 0, float.MaxValue);
1218+
}
1219+
}
1220+
}
12081221
}

valheim_plus.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,9 @@ disableEncumbered=false
642642
; Allow auto pickup of items when encumbered (overweight)
643643
autoPickUpWhenEncumbered=false
644644

645+
; Shortens the teleport time as much as much as possible
646+
disableEightSecondTeleport=false
647+
645648
[Server]
646649

647650
; Change false to true to enable this section. https://valheim.plus/documentation/list#Server

vplusconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,11 @@
12441244
"description": "If set to true, allows the auto pickup of items when encumbered (overweight) from carrying to much weight.",
12451245
"defaultValue": "false",
12461246
"defaultType": "bool"
1247+
},
1248+
"disableEightSecondTeleport": {
1249+
"description": "If set to true, shortens the teleport time as much as much as possible.",
1250+
"defaultValue": "false",
1251+
"defaultType": "bool"
12471252
}
12481253
}
12491254
},

0 commit comments

Comments
 (0)