1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Merge pull request #1188 from Refactorio/fix_steel_recipe

Fix steel recipe not showing for magic crafters if player force hasn't unlocked steel tech.
This commit is contained in:
grilledham 2021-02-28 12:41:37 +00:00 committed by GitHub
commit 5ed794f41c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1468,6 +1468,12 @@ local set_inactive_token =
end
)
local change_to_player_force_callback = Token.register(function(entity)
if entity.valid then
entity.force = 'player'
end
end)
Public.magic_item_crafting_callback =
Token.register(
function(entity, data)
@ -1477,7 +1483,10 @@ Public.magic_item_crafting_callback =
entity.minable = false
entity.destructible = false
entity.operable = false
entity.force = 'player'
-- This is so the recipe is set for furnaces even if the player force hasn't unlocked them yet.
entity.force = 'neutral'
Task.set_timeout_in_ticks(1, change_to_player_force_callback, entity)
local recipe = callback_data.recipe
if recipe then
@ -1523,7 +1532,10 @@ Public.magic_item_crafting_callback_weighted =
entity.minable = false
entity.destructible = false
entity.operable = false
entity.force = 'player'
-- This is so the recipe is set for furnaces even if the player force hasn't unlocked them yet.
entity.force = 'neutral'
Task.set_timeout_in_ticks(1, change_to_player_force_callback, entity)
local weights = callback_data.weights
local loot = callback_data.loot