Jump to content

Recommended Posts

Apparently, there's an issue with Windows builds of DST and DS, where if one alt-tabs out of the game, with default keybinds, the game in background will continue to see the Alt (CONTROL_FORCE_INSPECT) pressed down until it regains focus. (I can't really tell on the Mac, as the cmd key cannot be assigned to a control at all, and Alt-tab obviously doesn't task-switch away from the game). This is a problem for me because it causes playeractionpicker:GetClickActions to shuffle the actions around from left-click to right-click etc.

In eXiGe's DST version of ActionQueue Reborn, he fixed this by overriding components/playercontroller:IsControlPressed method to not report the Alt key as pressed when an action queue was active. The question is, how to put this in singleplayer? The method in DS is in TheInput, which I assume is an instance of the class in input.lua, so I thought something like this would work: 

AddClassPostConstruct("input", function(self)
  DebugPrint("AQR: AddClass - Input")
  local InputIsControlPressed = self.IsControlPressed
  self.IsControlPressed = function(self, control)
    DebugPrint("AQR: InputIsControlPressed override")
    if control == CONTROL_FORCE_INSPECT and ActionQueuer and ActionQueuer.action_thread then return false end
    return InputIsControlPressed(self,control)
  end
end)

... but it doesn't even execute the first function, judging by the lack of the first debugprint output. What do I need to do to override methods in TheInput?

Or is overriding Input methods a dead end, and I should find another solution? (I'm thinking of ignoring the Alt in the playeractionpicker, by returning rightclick actions to a query for left-click actions, when the "AQ running" condition is met.)

 

I went with the last idea, seems to work fine (with actually holding alt in the Mac version of the game):

AddComponentPostInit("playeractionpicker", function(self, inst)
  self.GetLeftClickActions = function(self,a,b)
    if TheInput:IsControlPressed(CONTROL_FORCE_INSPECT) and ActionQueuer and ActionQueuer.action_thread then
      return self:GetRightClickActions(b,a)
    else
      return self:GetClickActions(b,a)
    end
  end
end)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...