Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller bug bot protected #1001

Open
2 of 5 tasks
InnerCircleTFS opened this issue Dec 22, 2024 · 0 comments
Open
2 of 5 tasks

controller bug bot protected #1001

InnerCircleTFS opened this issue Dec 22, 2024 · 0 comments
Labels
Priority: Low Minor impact Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@InnerCircleTFS
Copy link
Contributor

InnerCircleTFS commented Dec 22, 2024

Priority

Low

Area

  • Data
  • Source
  • Docker
  • Other

What happened?

I was testing how to create modules with a controller and noticed that there is an error if I create the exact same module with a controller or in the traditional way. Only with the controller do I get this error: ERROR: caught a lua call to a bot protected game function, the call was cancelled. In the traditional way, I don't get this error.
Example:

traditional:

function init()
    connect(g_game, {
        onGameStart = online,
    })
    if g_game.isOnline() then
        online()
    end
end

function online()
  print("game_botProtectBugTraditional")
  print("[Traditional]call init g_game.setFightMode(1)")
  g_game.setFightMode(1)
  print("[Traditional]call terminate g_game.setFightMode(1)")
end

function terminate()
  disconnect(g_game, {
      onGameStart = online
  })
end
Module
  name: game_botProtectBugTraditional
  sandboxed: true
  scripts: [ game_botProtectBugTraditional ]
  @onLoad: init()
  @onUnload: terminate()

Controller:

controllerProtectBug = Controller:new()

function controllerProtectBug:onInit()

end

function controllerProtectBug:onGameStart()
  print("game_botProtectBugController")
  print("[Controller] call init g_game.setFightMode(1)")
  g_game.setFightMode(1)
  print("[Controller] call terminate g_game.setFightMode(1)")
end

function controllerProtectBug:onTerminate()
end
Module
  name: game_botProtectBugController
  scripts: [ game_botProtectBugController ]
  sandboxed: true
  @onLoad: controllerProtectBug:init()
  @onUnload: controllerProtectBug:terminate()

output: on onGameStart

output print traditional:

game_botProtectBugTraditional

[Traditional]call init g_game.setFightMode(1)

[Traditional]call terminate g_game.setFightMode(1)

output print Controller

game_botProtectBugController

[Controller] call init g_game.setFightMode(1)

ERROR: caught a lua call to a bot protected game function, the call was cancelled
stack traceback:
    [builtin#142]: at 0x7ff64c44dc30
    [C]: in function 'setFightMode'
    ...botProtectBugController/game_botProtectBugController.lua:11: in function '__onGameStart'
    /modulelib/controller.lua:10: in function </modulelib/controller.lua:9>
    
[Controller] call terminate g_game.setFightMode(1)

What OS are you seeing the problem on?

Windows

Code of Conduct

  • I agree to follow this project's Code of Conduct
@InnerCircleTFS InnerCircleTFS added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Dec 22, 2024
@github-actions github-actions bot added Priority: Low Minor impact Status: Pending Test This PR or Issue requires more testing labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Minor impact Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

1 participant