mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-05 15:05:57 +02:00
Updated as per suggestions and fixed furance to furnace
- Replaced furance with furnace in all files - Attempted to fix global desync issue, but probably not right - Added server_player so /get_pollution_multiplier can be called from server
This commit is contained in:
parent
0cb766fd22
commit
759aef17b3
@ -63,7 +63,7 @@ local magic_fluid_crafters = {index = 1}
|
|||||||
local outposts = {}
|
local outposts = {}
|
||||||
local artillery_outposts = {index = 1}
|
local artillery_outposts = {index = 1}
|
||||||
local outpost_count = 0
|
local outpost_count = 0
|
||||||
local pollution_multiplier = 0
|
local pollution_multiplier = {value = 0}
|
||||||
|
|
||||||
Global.register(
|
Global.register(
|
||||||
{
|
{
|
||||||
@ -1226,16 +1226,19 @@ local function set_pollution_multiplier(args, player)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local old_multiplier = pollution_multiplier
|
local old_multiplier = pollution_multiplier.value
|
||||||
pollution_multiplier = multipliers[1]
|
pollution_multiplier.value = multiplier
|
||||||
|
local message = {player.name, ' changed magic crafter pollution multiplier from ', old_multiplier, ' to ', pollution_multiplier}
|
||||||
for _, p in pairs(game.players) do
|
for _, p in pairs(game.players) do
|
||||||
if p.admin then
|
if p.admin then
|
||||||
p.print(player.name..' changed magic crafter pollution multiplier from '..old_multiplier..' to '..pollution_multiplier)
|
p.print(message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local server_player = {name = '<server>', print = print}
|
||||||
local function get_pollution_multiplier(player)
|
local function get_pollution_multiplier(player)
|
||||||
|
player = player or server_player
|
||||||
player.print('Current pollution multiplier is: '..pollution_multiplier)
|
player.print('Current pollution multiplier is: '..pollution_multiplier)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1273,10 +1276,11 @@ local function do_magic_crafters()
|
|||||||
local fcount = floor(count)
|
local fcount = floor(count)
|
||||||
|
|
||||||
if fcount > 0 then
|
if fcount > 0 then
|
||||||
if entity.get_output_inventory().can_insert(data.item) then -- No pollution once full. Taking items out of crafters makes pollution
|
local output_inv = entity.get_output_inventory()
|
||||||
local pollution_amount = pollution_multiplier * 0.01
|
if output_inv.can_insert(data.item) then -- No pollution if full. Taking items out of crafters makes pollution
|
||||||
|
local pollution_amount = pollution_multiplier.value * 0.01
|
||||||
entity.surface.pollute(entity.position, pollution_amount)
|
entity.surface.pollute(entity.position, pollution_amount)
|
||||||
entity.get_output_inventory().insert {name = data.item, count = fcount}
|
output_inv.insert {name = data.item, count = fcount}
|
||||||
end
|
end
|
||||||
data.last_tick = tick - (count - fcount) / rate
|
data.last_tick = tick - (count - fcount) / rate
|
||||||
end
|
end
|
||||||
@ -1475,14 +1479,21 @@ Public.magic_item_crafting_callback =
|
|||||||
entity.operable = false
|
entity.operable = false
|
||||||
|
|
||||||
local recipe = callback_data.recipe
|
local recipe = callback_data.recipe
|
||||||
if recipe then
|
local has_fluid_output = callback_data.keep_active
|
||||||
|
if recipe and not has_fluid_output then -- to avoid trying to put an item into a fluid inventory
|
||||||
entity.set_recipe(recipe)
|
entity.set_recipe(recipe)
|
||||||
else
|
local output_inv = entity.get_output_inventory()
|
||||||
local furance_item = callback_data.furance_item
|
output_inv.insert {name = callback_data.output.item, count = 200}
|
||||||
if furance_item then
|
elseif not recipe then
|
||||||
|
local furnace_item = callback_data.furnace_item
|
||||||
|
if furnace_item then
|
||||||
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
|
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
|
||||||
inv.insert(furance_item)
|
inv.insert {name = furnace_item, count = 200}
|
||||||
|
local output_inv = entity.get_output_inventory()
|
||||||
|
output_inv.insert {name = callback_data.output.item, count = 200 }
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
entity.set_recipe(recipe) -- for oil refineries
|
||||||
end
|
end
|
||||||
|
|
||||||
local p = entity.position
|
local p = entity.position
|
||||||
@ -1533,11 +1544,15 @@ Public.magic_item_crafting_callback_weighted =
|
|||||||
local recipe = stack.recipe
|
local recipe = stack.recipe
|
||||||
if recipe then
|
if recipe then
|
||||||
entity.set_recipe(recipe)
|
entity.set_recipe(recipe)
|
||||||
|
local output_inv = entity.get_output_inventory()
|
||||||
|
output_inv.insert {name = stack.output.item, count = 200}
|
||||||
else
|
else
|
||||||
local furance_item = stack.furance_item
|
local furnace_item = stack.furnace_item
|
||||||
if furance_item then
|
if furnace_item then
|
||||||
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
|
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
|
||||||
inv.insert(furance_item)
|
inv.insert {name = furnace_item, count = 200}
|
||||||
|
local output_inv = entity.get_output_inventory()
|
||||||
|
output_inv.insert {name = stack.output.item, count = 200 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1939,7 +1954,7 @@ Command.add(
|
|||||||
description = {'command_description.get_pollution_multiplier'},
|
description = {'command_description.get_pollution_multiplier'},
|
||||||
required_rank = Ranks.admin,
|
required_rank = Ranks.admin,
|
||||||
capture_excess_arguments = true,
|
capture_excess_arguments = true,
|
||||||
allowed_by_server = false
|
allowed_by_server = true
|
||||||
},
|
},
|
||||||
get_pollution_multiplier
|
get_pollution_multiplier
|
||||||
)
|
)
|
||||||
|
@ -22,7 +22,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = {name = 'copper-ore', count = 100},
|
furnace_item = {name = 'copper-ore', count = 100},
|
||||||
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
|
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
@ -23,7 +23,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = {name = 'iron-ore', count = 100},
|
furnace_item = {name = 'iron-ore', count = 100},
|
||||||
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
|
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ local factory = {
|
|||||||
local factory_b = {
|
local factory_b = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = {name = 'iron-plate', count = 100},
|
furnace_item = {name = 'iron-plate', count = 100},
|
||||||
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'steel-plate'}
|
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'steel-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
@ -24,7 +24,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'stone',
|
furnace_item = 'stone',
|
||||||
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
|
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.big_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.big_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.big_factory'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'copper-ore',
|
furnace_item = 'copper-ore',
|
||||||
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
|
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furnace'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
local level3 =
|
local level3 =
|
||||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'iron-ore',
|
furnace_item = 'iron-ore',
|
||||||
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
|
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ local factory = {
|
|||||||
local factory_b = {
|
local factory_b = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = {name = 'iron-plate', count = 100},
|
furnace_item = {name = 'iron-plate', count = 100},
|
||||||
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'steel-plate'}
|
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'steel-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furnace'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
local level3 =
|
local level3 =
|
||||||
|
@ -23,7 +23,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'stone',
|
furnace_item = 'stone',
|
||||||
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
|
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.medium_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.medium_factory'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.medium_factory'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'copper-ore',
|
furnace_item = 'copper-ore',
|
||||||
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'copper-plate'}
|
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'copper-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ local turrets = require 'map_gen.maps.crash_site.outpost_data.light_gun_turrets'
|
|||||||
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
||||||
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furnace'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
local level3 =
|
local level3 =
|
||||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'iron-ore',
|
furnace_item = 'iron-ore',
|
||||||
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'iron-plate'}
|
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'iron-plate'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ local turrets = require 'map_gen.maps.crash_site.outpost_data.light_gun_turrets'
|
|||||||
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
||||||
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furnace'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
local level3 =
|
local level3 =
|
||||||
|
@ -100,7 +100,7 @@ local turrets = require 'map_gen.maps.crash_site.outpost_data.light_gun_turrets'
|
|||||||
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
local worms = require 'map_gen.maps.crash_site.outpost_data.big_worm_turrets'
|
||||||
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
worms = ob.extend_walls(worms, {max_count = 2, fallback = turrets})
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.small_chemical_plant'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.small_chemical_plant'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
@ -22,7 +22,7 @@ local loot_callback =
|
|||||||
local factory = {
|
local factory = {
|
||||||
callback = ob.magic_item_crafting_callback,
|
callback = ob.magic_item_crafting_callback,
|
||||||
data = {
|
data = {
|
||||||
furance_item = 'stone',
|
furnace_item = 'stone',
|
||||||
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'stone-brick'}
|
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'stone-brick'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ local market = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furance'
|
local base_factory = require 'map_gen.maps.crash_site.outpost_data.small_furnace'
|
||||||
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.small_factory'
|
local base_factory2 = require 'map_gen.maps.crash_site.outpost_data.small_factory'
|
||||||
|
|
||||||
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
local level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user