local game_mode = GLOBAL.TheNet:GetServerGameMode() if game_mode ~= "lavaarena" then return end local CLICK_TO_MOVE = GetModConfigData("CLICK_TO_MOVE") local TOGGLE_KEY = GetModConfigData("TOGGLE_KEY") local ACTIONS = GLOBAL.ACTIONS local BufferedAction = GLOBAL.BufferedAction local TheInput = GLOBAL.TheInput local PlayerControllerPostConstruct = function(self) local OriginalOnLeftClick = self.OnLeftClick self.OnLeftClick = function(self, down) local LocalIsAOET = self:IsAOETargeting() if down and (self.placer_recipe == nil or self.placer == nil) and not LocalIsAOET then local act = self:GetLeftMouseAction() or BufferedAction(self.inst, nil, ACTIONS.WALKTO, nil, TheInput:GetWorldPosition()) local mouseEntity = TheInput:GetWorldEntityUnderMouse() local mousePointsAtPlayerOrNil = mouseEntity == nil or mouseEntity == self.inst if not CLICK_TO_MOVE and act.action == ACTIONS.WALKTO and act.target == nil and mousePointsAtPlayerOrNil then return end end return OriginalOnLeftClick(self, down) end end if type(TOGGLE_KEY) == "string" then local key = TOGGLE_KEY:lower():byte() TheInput:AddKeyUpHandler(key, function() if not ((GLOBAL.TheFrontEnd:GetActiveScreen() and GLOBAL.TheFrontEnd:GetActiveScreen().name and (type(GLOBAL.TheFrontEnd:GetActiveScreen().name) == "string") and (GLOBAL.TheFrontEnd:GetActiveScreen().name == "HUD"))) then return end CLICK_TO_MOVE = not CLICK_TO_MOVE local player = GLOBAL.ThePlayer if CLICK_TO_MOVE then player.HUD.controls.networkchatqueue:PushMessage("TRUE", "Character will move when clicking on ground.", {0.196, 0.804, 0.196, 1}) else player.HUD.controls.networkchatqueue:PushMessage("FALSE", "Character will NOT move when clicking on ground.", {1, 0.388, 0.278, 1}) end end) end AddClassPostConstruct('components/playercontroller', PlayerControllerPostConstruct)