I already have this in the control.lua
But the game tells mescript.on_event(defines.events.on_player_created, function(event)
game.local_player.insert{name="iron-plate", count=100}
end)
This function can only be used when called from the console.
But the game tells mescript.on_event(defines.events.on_player_created, function(event)
game.local_player.insert{name="iron-plate", count=100}
end)
This function can only be used when called from the console.
script.on_event(defines.events.on_player_created, function(event)
local player = game.get_player(event.player_index)
player.insert{name="iron-plate", count=100}
end)
control.lua{
"name": "ReplycateEverything",
"version": "0.0.1",
"title": "Replycate Everything",
"author": "pieppiep",
"homepage": "",
"contact": "",
"description": "Replycate everything, mine nothing.",
"dependencies": ["base >= 0.12.15", "dark-matter-replicators >= 0.5.7"]
}
You start with a solar panel, medium electric pole and a replicator from the dark matter replicators mod.require "defines"
local CHUNK_SIZE = 64
local function clear_chunk(surface, c_x, c_y)
for _, obj in ipairs(surface.find_entities_filtered{area = {{c_x - CHUNK_SIZE/2, c_y - CHUNK_SIZE/2}, {c_x + CHUNK_SIZE/2, c_y + CHUNK_SIZE/2}}}) do
if obj.valid and obj.type ~= "player" then
obj.destroy()
end
end
end
script.on_event(defines.events.on_chunk_generated, function(event)
local surface = game.surfaces['nauvis']
local c_x = event.area.left_top.x
local c_y = event.area.left_top.y
clear_chunk(surface, c_x, c_y)
end)
script.on_event(defines.events.on_player_created, function(event)
local player = game.get_player(event.player_index)
player.clear_items_inside()
player.insert{name="solar-panel", count=10}
player.insert{name="medium-electric-pole", count=3}
player.insert{name="replicator-1", count=1}
end)