Refactorio / FactorioWebInterface

MIT License
0 stars 6 forks source link

silent-command issue #78

Closed ProjectSky closed 3 years ago

ProjectSky commented 3 years ago

image

grilledham commented 3 years ago

This happens becasue the Redmew scenario requires using commands to run properly in multiplayer. I could look into adding an option to turn off the server using commands.

ProjectSky commented 3 years ago

This happens becasue the Redmew scenario requires using commands to run properly in multiplayer. I could look into adding an option to turn off the server using commands.

local function exec_command(cmd)
  local params = cmd.parameter
  local player = cmd.player_index
  if params and not player then -- isServers?
    local status, err = pcall(function() return loadstring(params)() end )
    if not status then game.print(err) end
  end
end

commands.add_command("exec", "<function> execute lua function, only server can use this command", exec_command)