From 382c6d0445fe009ddc804fe63b640b177ff194ec Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 9 May 2021 20:39:42 +0200 Subject: [PATCH] Factorio: Fix free samples still preventing starting items --- data/factorio/mod_template/control.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/data/factorio/mod_template/control.lua b/data/factorio/mod_template/control.lua index 83250a49..ceb8f73d 100644 --- a/data/factorio/mod_template/control.lua +++ b/data/factorio/mod_template/control.lua @@ -35,9 +35,7 @@ function on_player_created(event) -- FIXME: This (probably) fires before any other mod has a chance to change the player's force -- For now, they will (probably) always be on the 'player' force when this event fires. local data = {} - if FREE_SAMPLES ~= 0 then - data['pending_samples'] = table.deepcopy(global.forcedata[player.force.name]['earned_samples']) - end + data['pending_samples'] = table.deepcopy(global.forcedata[player.force.name]['earned_samples']) global.playerdata[player.index] = data update_player(player.index) -- Attempt to send pending free samples, if relevant. end @@ -56,9 +54,6 @@ script.on_event(defines.events.on_rocket_launched, on_rocket_launched) -- Updates a player, attempting to send them any pending samples (if relevant) function update_player(index) - if FREE_SAMPLES == 0 then -- This is effectively a noop - return - end local player = game.players[index] if not player or not player.valid then -- Do nothing if we reference an invalid player somehow return @@ -108,9 +103,7 @@ function update_player_event(event) --end end -if FREE_SAMPLES then - script.on_event(defines.events.on_player_main_inventory_changed, update_player_event) -end +script.on_event(defines.events.on_player_main_inventory_changed, update_player_event) function add_samples(force, name, count) local function add_to_table(t)