Skip to content

Commit

Permalink
Merge pull request #352 from pyanodon/Frozen
Browse files Browse the repository at this point in the history
moving over sim fix and paste setting fix
  • Loading branch information
kingarthur91 authored Feb 9, 2024
2 parents c85b682 + 8a82e62 commit fdc1ef5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 55 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.20
Date: ?
Date: 2024-2-7
Changes:
- Fixed Fusion menu simulations not running under Alternative Energy
- Fixed that the requester paste modifier setting wasnt correctly catching all entities due to mod load order issues
---------------------------------------------------------------------------------------------------
Version: 2.1.19
Date: 2024-1-31
Expand Down
54 changes: 53 additions & 1 deletion data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,56 @@ if not mods.pyalternativeenergy then
end
end

require('prototypes/map-gen-presets')
require('prototypes/map-gen-presets')

-- Updating requester paste setting
if settings.startup['rpm_entity'].value ~= 30 or settings.startup['rpm_items'].value ~= 30 then
--log("Updating recipe requester paste values")
--These types (data.raw[entity_type]) are placeable entities
local entity_types = {'accumulator','artillery-turret','beacon','boiler','burner-generator','character','arithmetic-combinator','decider-combinator','constant-combinator','container','logistic-container','infinity-container','assembling-machine','rocket-silo','furnace','electric-energy-interface','electric-pole','unit-spawner','fish','combat-robot','construction-robot','logistic-robot','gate','generator','heat-interface','heat-pipe','inserter','lab','lamp','land-mine','linked-container','market','mining-drill','offshore-pump','pipe','infinity-pipe','pipe-to-ground','player-port','power-switch','programmable-speaker','pump','radar','curved-rail','straight-rail','rail-chain-signal','rail-signal','reactor','roboport','simple-entity','simple-entity-with-owner','simple-entity-with-force','solar-panel','spider-leg','storage-tank','train-stop','linked-belt','loader-1x1','loader','splitter','transport-belt','underground-belt','tree','turret','ammo-turret','electric-turret','fluid-turret','unit','car','artillery-wagon','cargo-wagon','fluid-wagon','locomotive','spider-vehicle','wall'}
-- We store the result of each lookup so we don't have to do it again
-- When iterating *the entire recipe table X every individual result* this is worthwhile!
local valid_entities = {}
-- This is only hit when we request an index that doesn't exist (name we haven't checked)
-- We then check if it's an entity and make an entry for that answer, followed by returning that result
setmetatable(valid_entities, {
__index = function(self, index)
local item = data.raw.item[index]
-- Place result?
if item and item.place_result then
rawset(self, index, true)
return true
end
-- Valid entity?
for _, type_name in pairs(entity_types) do
if data.raw[type_name][index] then
rawset(self, index, true)
return true
end
end
-- Otherwise, nope!
rawset(self, index, false)
return false
end
})

for _, recipe in pairs(data.raw.recipe) do
for _, result_table in pairs({
recipe.result and {recipe.result},
recipe.results,
recipe.normal and (recipe.normal.results or {recipe.normal.result}),
recipe.expensive and (recipe.expensive.results or {recipe.expensive.result})
}) do
for _, result in pairs(result_table) do -- This looks long, however we skip a lot of the logic with caching
local result_name = result[1] or result.name
if result_name and valid_entities[result_name] then
--log("Set multiplier for " .. recipe.name .. " (" .. result_name .. ")")
recipe.requester_paste_multiplier = settings.startup['rpm_entity'].value
goto continue
end
end
end
recipe.requester_paste_multiplier = settings.startup['rpm_items'].value
::continue::
end
end
52 changes: 0 additions & 52 deletions data-updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,58 +203,6 @@ end
--adding to module limitation list
FUN.productivity(recipes_list)

-- Updating requester paste setting
if settings.startup['rpm_entity'].value ~= 30 or settings.startup['rpm_items'].value ~= 30 then
--log("Updating recipe requester paste values")
--These types (data.raw[entity_type]) are placeable entities
local entity_types = {'accumulator','artillery-turret','beacon','boiler','burner-generator','character','arithmetic-combinator','decider-combinator','constant-combinator','container','logistic-container','infinity-container','assembling-machine','rocket-silo','furnace','electric-energy-interface','electric-pole','unit-spawner','fish','combat-robot','construction-robot','logistic-robot','gate','generator','heat-interface','heat-pipe','inserter','lab','lamp','land-mine','linked-container','market','mining-drill','offshore-pump','pipe','infinity-pipe','pipe-to-ground','player-port','power-switch','programmable-speaker','pump','radar','curved-rail','straight-rail','rail-chain-signal','rail-signal','reactor','roboport','simple-entity','simple-entity-with-owner','simple-entity-with-force','solar-panel','spider-leg','storage-tank','train-stop','linked-belt','loader-1x1','loader','splitter','transport-belt','underground-belt','tree','turret','ammo-turret','electric-turret','fluid-turret','unit','car','artillery-wagon','cargo-wagon','fluid-wagon','locomotive','spider-vehicle','wall'}
-- We store the result of each lookup so we don't have to do it again
-- When iterating *the entire recipe table X every individual result* this is worthwhile!
local valid_entities = {}
-- This is only hit when we request an index that doesn't exist (name we haven't checked)
-- We then check if it's an entity and make an entry for that answer, followed by returning that result
setmetatable(valid_entities, {
__index = function(self, index)
local item = data.raw.item[index]
-- Place result?
if item and item.place_result then
rawset(self, index, true)
return true
end
-- Valid entity?
for _, type_name in pairs(entity_types) do
if data.raw[type_name][index] then
rawset(self, index, true)
return true
end
end
-- Otherwise, nope!
rawset(self, index, false)
return false
end
})

for _, recipe in pairs(data.raw.recipe) do
for _, result_table in pairs({
recipe.result and {recipe.result},
recipe.results,
recipe.normal and (recipe.normal.results or {recipe.normal.result}),
recipe.expensive and (recipe.expensive.results or {recipe.expensive.result})
}) do
for _, result in pairs(result_table) do -- This looks long, however we skip a lot of the logic with caching
local result_name = result[1] or result.name
if result_name and valid_entities[result_name] then
--log("Set multiplier for " .. recipe.name .. " (" .. result_name .. ")")
recipe.requester_paste_multiplier = settings.startup['rpm_entity'].value
goto continue
end
end
end
recipe.requester_paste_multiplier = settings.startup['rpm_items'].value
::continue::
end
end

RECIPE('beacon')
:add_ingredient{'sc-engine', 2}
:add_ingredient{'magnetic-ring', 10}
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pycoalprocessing",
"version": "2.1.19",
"version": "2.1.20",
"factorio_version": "1.1",
"title": "Pyanodons Coal Processing",
"author": "Pyanodon, Nexela, Kingarthur, notnotmelon, Mootykins, ShadowGlass, Archezekiel, Quintuple",
Expand Down

0 comments on commit fdc1ef5

Please sign in to comment.