Here's my current control.lua for the mod I've started:
Code: Select all
require "util"
require "defines"
script.on_init(function()
local force = game.forces.player
force.technologies['toolbelt'].researched=true
end)
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.insert{name="shotgun", count=1}
end)
** No matter what I do, the second part will not work. There's more I want to do with it in terms of adding and removing equipment at startup, but again this is just a test to make sure things are working(small changes before big, etc.). I based this on the included control.lua that Factorio comes with for the freeplay scenario. That starts off like this:
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
end)
What am I missing here? Thanks in advance.