mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +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 artillery_outposts = {index = 1}
|
||||
local outpost_count = 0
|
||||
local pollution_multiplier = 0
|
||||
local pollution_multiplier = {value = 0}
|
||||
|
||||
Global.register(
|
||||
{
|
||||
@ -1226,16 +1226,19 @@ local function set_pollution_multiplier(args, player)
|
||||
return
|
||||
end
|
||||
|
||||
local old_multiplier = pollution_multiplier
|
||||
pollution_multiplier = multipliers[1]
|
||||
local old_multiplier = pollution_multiplier.value
|
||||
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
|
||||
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
|
||||
|
||||
local server_player = {name = '<server>', print = print}
|
||||
local function get_pollution_multiplier(player)
|
||||
player = player or server_player
|
||||
player.print('Current pollution multiplier is: '..pollution_multiplier)
|
||||
end
|
||||
|
||||
@ -1273,10 +1276,11 @@ local function do_magic_crafters()
|
||||
local fcount = floor(count)
|
||||
|
||||
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 pollution_amount = pollution_multiplier * 0.01
|
||||
local output_inv = entity.get_output_inventory()
|
||||
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.get_output_inventory().insert {name = data.item, count = fcount}
|
||||
output_inv.insert {name = data.item, count = fcount}
|
||||
end
|
||||
data.last_tick = tick - (count - fcount) / rate
|
||||
end
|
||||
@ -1475,14 +1479,21 @@ Public.magic_item_crafting_callback =
|
||||
entity.operable = false
|
||||
|
||||
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)
|
||||
else
|
||||
local furance_item = callback_data.furance_item
|
||||
if furance_item then
|
||||
local output_inv = entity.get_output_inventory()
|
||||
output_inv.insert {name = callback_data.output.item, count = 200}
|
||||
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
|
||||
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
|
||||
else
|
||||
entity.set_recipe(recipe) -- for oil refineries
|
||||
end
|
||||
|
||||
local p = entity.position
|
||||
@ -1533,11 +1544,15 @@ Public.magic_item_crafting_callback_weighted =
|
||||
local recipe = stack.recipe
|
||||
if recipe then
|
||||
entity.set_recipe(recipe)
|
||||
local output_inv = entity.get_output_inventory()
|
||||
output_inv.insert {name = stack.output.item, count = 200}
|
||||
else
|
||||
local furance_item = stack.furance_item
|
||||
if furance_item then
|
||||
local furnace_item = stack.furnace_item
|
||||
if furnace_item then
|
||||
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
|
||||
|
||||
@ -1939,7 +1954,7 @@ Command.add(
|
||||
description = {'command_description.get_pollution_multiplier'},
|
||||
required_rank = Ranks.admin,
|
||||
capture_excess_arguments = true,
|
||||
allowed_by_server = false
|
||||
allowed_by_server = true
|
||||
},
|
||||
get_pollution_multiplier
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
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'}
|
||||
}
|
||||
}
|
||||
@ -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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
@ -23,7 +23,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
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'}
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,7 @@ local factory = {
|
||||
local factory_b = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
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'}
|
||||
}
|
||||
}
|
||||
@ -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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
@ -24,7 +24,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'stone',
|
||||
furnace_item = 'stone',
|
||||
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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'copper-ore',
|
||||
furnace_item = 'copper-ore',
|
||||
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 level3 =
|
||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'iron-ore',
|
||||
furnace_item = 'iron-ore',
|
||||
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ local factory = {
|
||||
local factory_b = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
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'}
|
||||
}
|
||||
}
|
||||
@ -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 level3 =
|
||||
|
@ -23,7 +23,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'stone',
|
||||
furnace_item = 'stone',
|
||||
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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'copper-ore',
|
||||
furnace_item = 'copper-ore',
|
||||
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'
|
||||
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 level3 =
|
||||
|
@ -21,7 +21,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'iron-ore',
|
||||
furnace_item = 'iron-ore',
|
||||
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'
|
||||
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 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'
|
||||
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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
@ -22,7 +22,7 @@ local loot_callback =
|
||||
local factory = {
|
||||
callback = ob.magic_item_crafting_callback,
|
||||
data = {
|
||||
furance_item = 'stone',
|
||||
furnace_item = 'stone',
|
||||
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 level2 = ob.extend_1_way(base_factory[1], {loot = {callback = loot_callback}})
|
||||
|
Loading…
x
Reference in New Issue
Block a user