Page 1 of 1

Freeplay Scenario player joined message interface

Posted: Sun Jan 20, 2019 7:02 pm
by Muppet9010
Can the Freeplay scenario control.lua include an interface/commands to disable the default new game behaviour, in the same manner as the silo script can be disabled. As this scenario is the default used by most servers it would be helpful for mods that use different win conditions or starting conditions to be able to prevent these behaviours and implement only their own.

code in control.lua from Freeplay scenario

Code: Select all

script.on_event(defines.events.on_player_created, function(event)
  local player = game.players[event.player_index]
  player.insert{name="iron-plate", count=8}
  player.insert{name="pistol", count=1}
  player.insert{name="firearm-magazine", count=10}
  player.insert{name="burner-mining-drill", count = 1}
  player.insert{name="stone-furnace", count = 1}
  player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}})
  if (#game.players <= 1) then
    game.show_message_dialog{text = {"msg-intro"}}
  else
    player.print({"msg-intro"})
  end
  silo_script.on_player_created(event)
end)
I am aware that the player inventory items can be removed by mods, but the win conditions message cannot be undone and the charter chunks in Multiplayer would be problematic to unchart appropriately when new players join mid game.

I know this isn't a strict modding interface request, but it is part of the core game so seemed the best place for it.

Re: Freeplay Scenario player joined message interface

Posted: Sun Jan 20, 2019 7:10 pm
by Klonan
I have already added a remote interface to freeplay for 0.17:

Code: Select all

remote.add_interface("freeplay",
{
  get_created_items = function()
    return global.created_items
  end,
  set_created_items = function(map)
    global.created_items = map
  end,
  get_respawn_items = function()
    return global.respawn_items
  end,
  set_respawn_items = function(map)
    global.respawn_items = map
  end,
  set_skip_intro = function(bool)
    global.skip_intro = bool
  end,
  set_chart_distance = function(value)
    global.chart_distance = tonumber(value)
  end
})

Re: Freeplay Scenario player joined message interface

Posted: Sun Jan 20, 2019 7:44 pm
by Muppet9010
Nice