Skip to content

Commit

Permalink
Added open/close SFX to machines
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Apr 13, 2024
1 parent 522fe5f commit 0f2de46
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Date: ?
Changes:
- Made sure very early techs are not effected by tech cost multiplier (https://github.com/pyanodon/pybugreports/issues/467)
- Fixed duplicate "affected-by-productivity" text on recipe descriptions when combined with the extended-descriptions mod.
- Added open/close SFX to all machines (https://github.com/pyanodon/pybugreports/issues/421)
---------------------------------------------------------------------------------------------------
Version: 0.2.21
Date: 2024-4-1
Expand Down
43 changes: 26 additions & 17 deletions data-updates.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local py_utils = require("prototypes.functions.utils")
local py_utils = require('prototypes.functions.utils')
require('__stdlib__/stdlib/data/data').Util.create_data_globals()

local function set_underground_recipe(underground, belt, prev_underground, prev_belt)
Expand All @@ -16,32 +16,32 @@ local function set_underground_recipe(underground, belt, prev_underground, prev_
RECIPE(underground):remove_ingredient(ing.name)
:add_ingredient{ type = ing.type, name = ing.name, amount = ing.amount * prev_dist / belt_count}

if ing.type == "fluid" then fluid = true end
if ing.type == 'fluid' then fluid = true end
end
end

if fluid and (RECIPE(underground).category or "crafting") == "crafting" then
RECIPE(underground):set_fields{ category = "crafting-with-fluid" }
if fluid and (RECIPE(underground).category or 'crafting') == 'crafting' then
RECIPE(underground):set_fields{ category = 'crafting-with-fluid' }
end
end

RECIPE(underground):remove_ingredient(belt):add_ingredient{ type = "item", name = belt, amount = dist - prev_dist}
RECIPE(underground):remove_ingredient(belt):add_ingredient{ type = 'item', name = belt, amount = dist - prev_dist}
end


-- Set underground belt recipes
set_underground_recipe("underground-belt", "transport-belt", nil, nil)
set_underground_recipe("fast-underground-belt", "fast-transport-belt", "underground-belt", "transport-belt")
set_underground_recipe("express-underground-belt", "express-transport-belt", "fast-underground-belt", "fast-transport-belt")
set_underground_recipe('underground-belt', 'transport-belt', nil, nil)
set_underground_recipe('fast-underground-belt', 'fast-transport-belt', 'underground-belt', 'transport-belt')
set_underground_recipe('express-underground-belt', 'express-transport-belt', 'fast-underground-belt', 'fast-transport-belt')

local big_recipe_icons_blacklist = {
["rc-mk01"] = true,
["rc-mk02"] = true,
["rc-mk03"] = true,
["rc-mk04"] = true,
['rc-mk01'] = true,
['rc-mk02'] = true,
['rc-mk03'] = true,
['rc-mk04'] = true,
}

for _, prototype in pairs{"assembling-machine", "furnace"} do
for _, prototype in pairs{'assembling-machine', 'furnace'} do
for _, entity in pairs(data.raw[prototype]) do
if not entity.name or big_recipe_icons_blacklist[entity.name] then goto continue end
local box = entity.selection_box or entity.collision_box
Expand All @@ -55,9 +55,9 @@ for _, prototype in pairs{"assembling-machine", "furnace"} do
end
end

if settings.startup["pypp-big-inventory-gui"].value then
data.raw["utility-constants"]["default"].select_slot_row_count = 17
data.raw["utility-constants"]["default"].select_group_row_count = 100
if settings.startup['pypp-big-inventory-gui'].value then
data.raw['utility-constants']['default'].select_slot_row_count = 17
data.raw['utility-constants']['default'].select_group_row_count = 100
end

-- make sure very early techs are not effected by the tech cost multiplier
Expand All @@ -75,4 +75,13 @@ prevent_cost_multiplier('botany-mk01')
prevent_cost_multiplier('glass')
prevent_cost_multiplier('mining-with-fluid')
prevent_cost_multiplier('steel-processing')
prevent_cost_multiplier('coal-processing-1')
prevent_cost_multiplier('coal-processing-1')

-- Add open/close SFX to machines

for _, type in pairs{'assembling-machine', 'furnace', 'lab', 'rocket-silo', 'beacon', 'mining-drill'} do
for _, entity in pairs(data.raw[type]) do
if not entity.open_sound then entity.open_sound = { filename = '__base__/sound/machine-open.ogg', volume = 0.5 } end
if not entity.close_sound then entity.close_sound = { filename = '__base__/sound/machine-close.ogg', volume = 0.5 } end
end
end

0 comments on commit 0f2de46

Please sign in to comment.