Astropilot / ValheimTooler

A fancy cheats tool for the Valheim game
MIT License
52 stars 12 forks source link

[feature-request] /farinteract #28

Closed rysson closed 10 months ago

rysson commented 1 year ago

Thanks for the mod.

Could you add /farinteract command from SkToolBox?

/farinteract [Distance=50] - Toggles far interactions (building as well)
rysson commented 1 year ago

A don't know C#, especially how to compile a mod :-/ From SkToolBox code

                new Terminal.ConsoleCommand("/farinteract", "[Distance=50] - Toggles far interactions (building as well). To change distance, toggle this off then back on with new distance. (SkToolbox)", delegate (Terminal.ConsoleEventArgs args)
                {
                    farInteract = !farInteract;
                    if (farInteract)
                    {
                        if (args.Length > 1)
                        {
                            try
                            {
                                int value = int.Parse(args[1]) < 20 ? 20 : int.Parse(args[1]);
                                Player.m_localPlayer.m_maxInteractDistance = value;
                                Player.m_localPlayer.m_maxPlaceDistance = value;
                            }
                            catch (Exception)
                            {
                                PrintOut("Failed to set far interaction distance. Check params. /farinteract 50");
                            }
                        }
                        else
                        {
                            Player.m_localPlayer.m_maxInteractDistance = 50f;
                            Player.m_localPlayer.m_maxPlaceDistance = 50f;
                        }
                        PrintOut("Far interactions toggled! (" + farInteract.ToString() + " Distance: " + Player.m_localPlayer.m_maxInteractDistance + ")");
                    }
                    else
                    {
                        Player.m_localPlayer.m_maxInteractDistance = 5f;
                        Player.m_localPlayer.m_maxPlaceDistance = 5f;
                        PrintOut("Far interactions toggled! (" + farInteract.ToString() + ")");
                    }
                });
Astropilot commented 1 year ago

Hi, it should not be hard to implement it, I will look at it

Astropilot commented 10 months ago

Feature added in the new release! https://github.com/Astropilot/ValheimTooler/releases/tag/v1.9.0