Skip to content

Commit

Permalink
add support for neutons in the tailings pond
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Jan 18, 2024
1 parent 7821ba6 commit 0d24d68
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 23 deletions.
14 changes: 6 additions & 8 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.11
Date: 2024-1-??
Changes:
- Delete filter inserters but for real this time.
- Updated the Russian translation
---------------------------------------------------------------------------------------------------
Version: 2.1.10
Date: 2024-1-17
Changes:
- In order to prep for Factorio 2.0: Removed all filter inserters and filter stack inserters. Gave filter slots to all other inserters. A migration will automatically transform existing filter inserters in your base.
- Rewrote the wiki page for inserters.
- Add compatibility for Better Victory Screen (stringweasel).
- Updated the Russian translation
Pycodex:
- Fixed pycodex search (https://github.com/pyanodon/pybugreports/issues/370)
- Fixed a rare crash when trying to close the pycodex
- Pycodex gui is now bigger
- The pycodex homepage statistics are now compressiscrunchified
- Rewrote the pycodex page for inserters.
- Rewrote the pycodex page for tailings ponds.
- Added tooltips for most GUI elements in the pycodex spreadsheet pages
Tailings pond:
- Tailings pond spillage event is slightly more dramatic.
- Added a linear relationship between # of fluid spilled and # of pollution tiles created (300 fluid = 1 tile). note that this also means that the rate of change in the radius is now negative instead of 0
- Fixed constant redraws of the tailings pond fluid sprite
- To give that nice authentic oil spill experience: Tailings pond pollution tiles will now burn for way longer (hours)
- Added way more info to the pycodex about tailings ponds
- Added purest-nitrogen-gas, hot air, pressurized air, vacuum, and neon to the non polluting gasses list.
- Fixed graphical error when polluted tiles were placed next to burnt polluted tiles
- Tailings pond ALT-mode icons are now scaled to the building size instead of being microscopic
- Improved UPS of tailings ponds
- Fixed the exploit where you could void neutrons in a tailings pond.
Beacons:
- INFO: The following 2 changes are toggleable in the mod settings.
- Changed the beacon interference criteria from requiring the exact same AM and FM frequencies to instead requiring either overlapping AM or FM. This effectively reduces the max number of beacons per entity from 25 to 5.
Expand Down
11 changes: 11 additions & 0 deletions migrations/2.1.11.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
for _, surface in pairs(game.surfaces) do
for _, inserter in pairs(surface.find_entities_filtered{name={'fast-inserter', 'stack-inserter'}}) do
if not (inserter.get_control_behavior()
or next(inserter.circuit_connected_entities.red)
or next(inserter.circuit_connected_entities.green)
or inserter.get_filter(1))
then
inserter.inserter_filter_mode = 'blacklist'
end
end
end
5 changes: 4 additions & 1 deletion scripts/tailings-pond.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ end
local function scorch_earth(pond)
local entity = pond.entity
local fluidbox = entity.fluidbox
local fluid = fluidbox[1]
if fluid and fluid.name == 'neutron' then return end

local surface = entity.surface
--Vent Gasses
local fluid = empty_pond_gas(fluidbox[1], surface, entity.position)
local fluid = empty_pond_gas(fluid, surface, entity.position)
if not fluid then -- totally drained
pond.fluid_per = 0
fluidbox[1] = fluid
Expand Down
50 changes: 36 additions & 14 deletions scripts/wiki/spreadsheet-pages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ local function update_spreadsheet(gui, player, data, sort_by, asc)
local container = content.add{type = 'flow', direction = 'vertical', name = row.search_key}
local flow = container.add{type = 'flow', direction = 'horizontal', tags = row}
for i, column in pairs(columns) do
local caption = row[column.name].value
local line_item = row[column.name]
local caption = line_item.value
local elem_tooltip = line_item.elem_tooltip
local tooltip = line_item.tooltip

if i == 1 then
flow.add{type = 'label', caption = caption}.style.width = column.width + 10
flow.add{type = 'label', caption = caption, elem_tooltip = elem_tooltip, tooltip = tooltip}.style.width = column.width + 10
else
local flow = flow.add{type = 'flow'}
flow.style.horizontal_align = 'center'
flow.style.width = column.width + 10
flow.add{type = 'label', caption = caption}
flow.add{type = 'label', caption = caption, elem_tooltip = elem_tooltip, tooltip = tooltip}
end
end
container.add{type = 'line', direction = 'horizontal'}
Expand Down Expand Up @@ -108,7 +112,7 @@ local function funny_square(color)
local g = color.g * 255
local b = color.b * 255

return '[color=' .. tostring(floor(r)) .. ',' .. tostring(floor(g)) .. ',' .. tostring(floor(b)) .. ']■[/color]'
return '[color=' .. tostring(floor(r)) .. ', ' .. tostring(floor(g)) .. ', ' .. tostring(floor(b)) .. ']■[/color]'
end

local function hue(color)
Expand Down Expand Up @@ -139,6 +143,10 @@ local function brightness(color)
return (color.r + color.g + color.b) / 3
end

local function tooltipify_color(color)
return floor(color.r * 255) .. ', ' .. floor(color.g * 255) .. ', ' .. floor(color.b * 255)
end

local science_pack_names = {
'automation-science-pack',
'py-science-pack-1',
Expand Down Expand Up @@ -216,17 +224,19 @@ local function calculate_unlocked_at(required_science, name)
if jerry_check then name = fluid_name end

local required_science = required_science[name]
local required_science_pack
local required_science_pack, elem_tooltip
if not required_science then
required_science_pack = '[fluid=fluid-unknown]'
elseif required_science ~= 0 then
required_science_pack = '[item='..science_pack_names[required_science]..']'
elem_tooltip = {type = 'item', name = science_pack_names[required_science]}
end

return {
value = required_science_pack,
order = required_science or #science_pack_names + 1,
pack = science_pack_names[required_science or 0] or ''
pack = science_pack_names[required_science or 0] or '',
elem_tooltip = elem_tooltip
}
end

Expand All @@ -252,28 +262,37 @@ Spreadsheet.events.init = function()
if fluid.fuel_value ~= 0 then fuel_value = FUN.format_energy(fluid.fuel_value, 'J') end

local voidable = '[entity=tailings-pond]'
if script.active_mods['pyindustry'] then
voidable = voidable..' [entity='..((fluid.default_temperature or 15) < (fluid.gas_temperature or math.huge) and 'py-sinkhole' or 'py-gas-vent')..']'
local voidable_elem_tooltip
if fluid.name == 'neutron' then
voidable = '[entity=neutron-absorber-mk01] [entity=neutron-absorber-mk02] [entity=neutron-absorber-mk03] [entity=neutron-absorber-mk04]'
voidable_elem_tooltip = {type = 'entity', name = 'neutron-absorber-mk01'}
elseif script.active_mods['pyindustry'] then
local void_entity_name = (fluid.default_temperature or 15) < (fluid.gas_temperature or math.huge) and 'py-sinkhole' or 'py-gas-vent'
voidable = voidable .. ' [entity=' .. void_entity_name .. ']'
voidable_elem_tooltip = {type = 'entity', name = void_entity_name}
end

local unlocked_at = calculate_unlocked_at(required_science, name)

table.insert(global.fluid_spreadsheet_data.rows, {
['localised-name'] = {
value = {'', '[fluid='..name..'] ', fluid.localised_name},
order = name
order = name,
elem_tooltip = {type = 'fluid', name = name}
},
voidable = {
value = voidable,
order = voidable
order = voidable,
elem_tooltip = voidable_elem_tooltip
},
['fuel-value'] = {
value = fuel_value,
order = fluid.fuel_value
},
color = {
value = funny_square(fluid.base_color),
order = floor(hue(fluid.base_color)) + brightness(fluid.base_color) / 10
order = floor(hue(fluid.base_color)) + brightness(fluid.base_color) / 10,
tooltip = tooltipify_color(fluid.base_color)
},
['unlocked-at'] = unlocked_at,
search_key = name..'|'..unlocked_at.pack
Expand All @@ -297,18 +316,20 @@ Spreadsheet.events.init = function()

for name, item in pairs(game.item_prototypes) do
if item.fuel_category and not item.has_flag('hidden') then
local burnt_result, burnt_result_order
local burnt_result, burnt_result_order, burnt_result_tooltip
if item.burnt_result then
burnt_result = '[item='..item.burnt_result.name..']'
burnt_result_order = item.burnt_result.name
burnt_result_tooltip = {type = 'item', name = item.burnt_result.name}
end

local unlocked_at = calculate_unlocked_at(required_science, name)

table.insert(global.solid_fuel_spreadsheet_data.rows, {
['localised-name'] = {
value = {'', '[item='..name..'] ', item.localised_name},
order = name
order = name,
elem_tooltip = {type = 'item', name = name}
},
['fuel-category'] = {
value = game.fuel_category_prototypes[item.fuel_category].localised_name,
Expand All @@ -320,7 +341,8 @@ Spreadsheet.events.init = function()
},
['burnt-result'] = {
value = burnt_result,
order = burnt_result_order
order = burnt_result_order,
elem_tooltip = burnt_result_tooltip
},
['unlocked-at'] = unlocked_at,
search_key = name..'|'..item.fuel_category..'|'..(burnt_result_order or '')..'|'..unlocked_at.pack
Expand Down

0 comments on commit 0d24d68

Please sign in to comment.