From 5736e84e21c36bb161483e373f3e3b09ddaf04fb Mon Sep 17 00:00:00 2001 From: Caio Mathielo Date: Sun, 10 Dec 2017 23:52:05 +0100 Subject: [PATCH] Fix bug that would allow player to move slightly if clicking on the char --- workshop/modinfo.lua | 2 +- workshop/modmain.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/workshop/modinfo.lua b/workshop/modinfo.lua index baeab0f..1b9a45b 100644 --- a/workshop/modinfo.lua +++ b/workshop/modinfo.lua @@ -8,7 +8,7 @@ description = "Makes it possible to disable the walk by clicking action in the g author = "machete_kills" --A version number so you can ask people if they are running an old version of your mod. -version = "0.2.0" +version = "0.2.1" --This lets other players know if your mod is out of date. This typically needs to be updated every time there's a new game update. api_version = 6 diff --git a/workshop/modmain.lua b/workshop/modmain.lua index 487dea7..8df24ee 100644 --- a/workshop/modmain.lua +++ b/workshop/modmain.lua @@ -12,7 +12,9 @@ local PlayerControllerPostConstruct = function(self) -- Only intercept if "down" and also if nothing is being placed if down and (self.placer_recipe == nil or self.placer == nil) then local act = self:GetLeftMouseAction() or BufferedAction(self.inst, nil, ACTIONS.WALKTO, nil, TheInput:GetWorldPosition()) - if not CLICK_TO_WALK_ENABLED and act.action == ACTIONS.WALKTO and act.target == nil and TheInput:GetWorldEntityUnderMouse() == nil then + local mouseEntity = TheInput:GetWorldEntityUnderMouse() + local mousePointsAtPlayerOrNil = mouseEntity == nil or mouseEntity == self.inst + if not CLICK_TO_WALK_ENABLED and act.action == ACTIONS.WALKTO and act.target == nil and mousePointsAtPlayerOrNil then return end end