Skip to content

Commit

Permalink
Merge branch 'master' into Frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
kingarthur91 authored Sep 2, 2024
2 parents 66d819e + 5fab0a0 commit 4e5eeba
Show file tree
Hide file tree
Showing 171 changed files with 7,683 additions and 19,403 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
name: Luacheck
jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Date: 2024-8-26
Version: 2.1.29
Date: 2024-6-18
Changes:
- Fixed that tailings ponds spills created 16x too much pollution in certain cases.
- Fixed that tailings ponds spills created 16x too much pollution in certain cases
- Fixed that tailings ponds spills would overwrite water
- Added tailings pond to the squeak through blacklist. (https://github.com/pyanodon/pybugreports/issues/525)
- Fixed beacon interference not updating properly (https://github.com/pyanodon/pybugreports/issues/528)
Expand Down
58 changes: 13 additions & 45 deletions control.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
_G.gui_events = {
[defines.events.on_gui_click] = {},
[defines.events.on_gui_confirmed] = {},
[defines.events.on_gui_text_changed] = {},
[defines.events.on_gui_checked_state_changed] = {},
[defines.events.on_gui_selection_state_changed] = {},
[defines.events.on_gui_checked_state_changed] = {},
[defines.events.on_gui_elem_changed] = {},
[defines.events.on_gui_value_changed] = {},
[defines.events.on_gui_location_changed] = {},
[defines.events.on_gui_selected_tab_changed] = {},
[defines.events.on_gui_switch_state_changed] = {}
}
local function process_gui_event(event)
if event.element and event.element.valid then
for pattern, f in pairs(gui_events[event.name]) do
if event.element.name:match(pattern) then f(event); return end
end
end
end
for event, _ in pairs(gui_events) do
script.on_event(event, process_gui_event)
end
require '__pypostprocessing__.lib'

require 'scripts.wiki.wiki'
require 'scripts.wiki.text-pages'
Expand Down Expand Up @@ -60,7 +38,7 @@ script.on_init(function()
end
end)

script.on_event(defines.events.on_research_finished, function(event)
py.on_event(defines.events.on_research_finished, function(event)
if global.finished then return end
local tech = event.research
if tech.name == 'pyrrhic' and game.tick ~= 0 then
Expand All @@ -83,45 +61,33 @@ script.on_event(defines.events.on_research_finished, function(event)
end
end)

script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity, defines.events.script_raised_built, defines.events.script_raised_revive}, function(event)
py.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity, defines.events.script_raised_built, defines.events.script_raised_revive}, function(event)
Inserters.events.on_built(event)
Beacons.events.on_built(event)
Pond.events.on_built(event)
end)

script.on_event({defines.events.on_player_mined_entity, defines.events.on_robot_mined_entity, defines.events.script_raised_destroy},
py.on_event({defines.events.on_player_mined_entity, defines.events.on_robot_mined_entity, defines.events.script_raised_destroy},
Beacons.events.on_destroyed
)

script.on_event(defines.events.on_entity_died, function(event)
py.on_event(defines.events.on_entity_died, function(event)
Pond.events.on_entity_died(event)
Beacons.events.on_destroyed(event)
end)

script.on_event(defines.events.on_gui_opened, function(event)
py.on_event(defines.events.on_gui_opened, function(event)
Beacons.events.on_gui_opened(event)
end)

script.on_event({defines.events.on_gui_closed, defines.events.on_player_changed_surface}, function(event)
py.on_event({defines.events.on_gui_closed, defines.events.on_player_changed_surface}, function(event)
Wiki.events.on_gui_closed(event)
end)

script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.print({"messages.welcome"})
local autoplace_controls = game.surfaces['nauvis'].map_gen_settings.autoplace_controls
if autoplace_controls['stone'] and autoplace_controls['stone'].richness <= 1 then
player.print({"messages.warning-no-preset", {"map-gen-preset-name.py-recommended"}})
end
if autoplace_controls['enemy-base'] and autoplace_controls['enemy-base'].size > 0 then
player.print({"messages.warning-biters"})
end

Wiki.events.on_player_created(event)
end)
py.on_event(defines.events.on_player_created, Wiki.events.on_player_created)

script.on_nth_tick(153, Pond.events[153])
script.on_nth_tick(154, Pond.events[154])
py.on_nth_tick(153, Pond.events[153])
py.on_nth_tick(154, Pond.events[154])

-- grumble grumble filters apply for the whole mod
for _, event in pairs({defines.events.on_built_entity, defines.events.on_robot_built_entity, defines.events.script_raised_built, defines.events.script_raised_revive}) do
Expand All @@ -146,4 +112,6 @@ for _, event in pairs({defines.events.on_built_entity, defines.events.on_robot_b
mode = 'or'
},
})
end
end

py.finalize_events()
33 changes: 17 additions & 16 deletions data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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 or settings.startup['overload'].value ~= 0 then
Expand Down Expand Up @@ -46,20 +46,14 @@ if settings.startup['rpm_entity'].value ~= 30 or settings.startup['rpm_items'].v
})

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
recipe.overload_multiplier = settings.startup['overload'].value
goto continue
end
recipe:standardize()
for _, result in pairs(recipe.results) do -- This looks long, however we skip a lot of the logic with caching
local result_name = 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
recipe.overload_multiplier = settings.startup['overload'].value
goto continue
end
end
recipe.requester_paste_multiplier = settings.startup['rpm_items'].value
Expand All @@ -68,4 +62,11 @@ if settings.startup['rpm_entity'].value ~= 30 or settings.startup['rpm_items'].v
end
end

data.raw["utility-constants"].default.minimum_recipe_overload_multiplier = 1
data.raw['utility-constants'].default.minimum_recipe_overload_multiplier = 1

for _, recipe in pairs(data.raw.recipe) do
if recipe.category == 'tar' and not recipe.crafting_machine_tint then
error('Recipe ' .. recipe.name .. ' is missing crafting_machine_tint. Please fill out this field.')
end
end

Loading

0 comments on commit 4e5eeba

Please sign in to comment.