1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-17 21:08:08 +02:00

Merge pull request #124 from Valansch/develop_nextmap

Current map config, moved all LUA out to separate _locale folder to keep save file size down
This commit is contained in:
Valansch 2017-11-26 17:35:57 +01:00 committed by GitHub
commit d0d0c23711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 131 additions and 63 deletions

View File

@ -329,53 +329,73 @@ end
global.old_force = {}
global.force_toggle_init = true
local function forcetoggle(cmd)
if not game.player or not (game.player.admin or is_mod(game.player.name)) then
cant_run(cmd.name)
return
end
if not game.player or not (game.player.admin or is_mod(game.player.name)) then
cant_run(cmd.name)
return
end
if global.force_toggle_init then
game.forces.enemy.research_all_technologies() --avoids losing logstics slot configuration
global.force_toggle_init = false
end
if global.force_toggle_init then
game.forces.enemy.research_all_technologies() --avoids losing logstics slot configuration
global.force_toggle_init = false
end
if game.player.force.name == "enemy" then
local old_force = global.old_force[game.player.name]
if not old_force then
game.player.force = "player"
game.player.print("Your are now on the player force.")
else
if game.forces[old_force] then
game.player.force = old_force
-- save the logistics slots
local slots = {}
local slot_counts = game.player.character.request_slot_count
if game.player.character.request_slot_count > 0 then
for i = 1, slot_counts do
slot = game.player.character.get_request_slot(i)
if slot ~= nil then
table.insert(slots, slot)
end
end
end
if game.player.force.name == "enemy" then
local old_force = global.old_force[game.player.name]
if not old_force then
game.player.force = "player"
game.player.print("You're are now on the player force.")
else
game.player.force = "player"
if game.forces[old_force] then
game.player.force = old_force
else
game.player.force = "player"
end
end
end
else
else
--Put roboports into inventory
inv = game.player.get_inventory(defines.inventory.player_armor)
if inv[1].valid_for_read
inv = game.player.get_inventory(defines.inventory.player_armor)
if inv[1].valid_for_read
then
local name = inv[1].name
if name:match("power") or name:match("modular") then
local equips = inv[1].grid.equipment
for _,equip in pairs(equips) do
if equip.name == "personal-roboport-equipment"
or equip.name == "personal-roboport-mk2-equipment"
or equip.name == "personal-laser-defense-equipment" then
if game.player.insert{name = equip.name} == 0 then
game.player.surface.spill_item_stack(game.player.position, {name = equip.name})
local name = inv[1].name
if name:match("power") or name:match("modular") then
local equips = inv[1].grid.equipment
for _,equip in pairs(equips) do
if equip.name == "personal-roboport-equipment"
or equip.name == "personal-roboport-mk2-equipment"
or equip.name == "personal-laser-defense-equipment" then
if game.player.insert{name = equip.name} == 0 then
game.player.surface.spill_item_stack(game.player.position, {name = equip.name})
end
inv[1].grid.take(equip)
end
end
inv[1].grid.take(equip)
end
end
end
end
end
global.old_force[game.player.name] = game.player.force.name
game.player.force = "enemy"
end
game.player.print("You are now on the " .. game.player.force.name .. " force.")
global.old_force[game.player.name] = game.player.force.name
game.player.force = "enemy"
end
game.player.print("You are now on the " .. game.player.force.name .. " force.")
-- Attempt to rebuild the request slots
slot_counts = game.player.character.request_slot_count
if game.player.character.request_slot_count > 0 then
for _,slot in ipairs(slots) do
game.player.character.set_request_slot(slot, _)
end
end
end
local function get_group()

View File

@ -59,6 +59,7 @@ function spawn_market(cmd)
market.add_market_item{price={{"raw-fish", 10}}, offer={type="give-item", item="discharge-defense-remote"}}
market.add_market_item{price={{"raw-fish", 30}}, offer={type="give-item", item="small-plane"}}
market.add_market_item{price={{"raw-fish", 10}}, offer={type="give-item", item="wood"}}
market.add_market_item{price={{"raw-fish", 1}}, offer={type="give-item", item="rail", count=2}}
market.add_market_item{price={{"raw-fish", 2}}, offer={type="give-item", item="rail-signal"}}
market.add_market_item{price={{"raw-fish", 2}}, offer={type="give-item", item="rail-chain-signal"}}
@ -85,7 +86,7 @@ function spawn_market(cmd)
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="loader"}}
market.add_market_item{price={{"raw-fish", 175}}, offer={type="give-item", item="fast-loader"}}
market.add_market_item{price={{"raw-fish", 250}}, offer={type="give-item", item="express-loader"}}
market.add_market_item{price={{"raw-fish", 1000}}, offer={type="give-item", item="belt-immunity-equipment"}}
market.add_market_item{price={{"raw-fish", 500}}, offer={type="give-item", item="belt-immunity-equipment"}}
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="night-vision-equipment"}}
market.add_market_item{price={{"raw-fish", 200}}, offer={type="give-item", item="modular-armor"}}
market.add_market_item{price={{"raw-fish", 500}}, offer={type="give-item", item="power-armor"}}
@ -94,7 +95,7 @@ function spawn_market(cmd)
market.add_market_item{price={{"raw-fish", 50}}, offer={type="give-item", item="solar-panel-equipment", count=1}}
market.add_market_item{price={{"raw-fish", 50}}, offer={type="give-item", item="battery-equipment", count=1}}
market.add_market_item{price={{"raw-fish", 750}}, offer={type="give-item", item="battery-mk2-equipment", count=1}}
market.add_market_item{price={{"raw-fish", 2000}}, offer={type="give-item", item="fusion-reactor-equipment", count=1}}
market.add_market_item{price={{"raw-fish", 1000}}, offer={type="give-item", item="fusion-reactor-equipment", count=1}}
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="exoskeleton-equipment"}}
end
@ -189,7 +190,7 @@ local function fish_drop_entity_died(event)
give_fish_cause = true
end
if event.entity.type == "unit" then
fish_amount = 1
fish_amount = 3
fish_chance = 1
give_fish_unit = true
end
@ -200,11 +201,11 @@ local function fish_drop_entity_died(event)
end
if event.entity.type == "turret" then
if ( event.entity.name == "small-worm-turret" ) then
fish_amount = 10
fish_amount = 5
elseif ( event.entity.name == "medium-worm-turret" ) then
fish_amount = 20
fish_amount = 10
elseif ( event.entity.name == "big-worm-turret" ) then
fish_amount = 30
fish_amount = 15
end
fish_chance = 100
@ -293,6 +294,36 @@ local function boost_player_runningspeed(player)
end
end
local function reset_player_miningspeed(player)
player.character_mining_speed_modifier = 1
global.player_mining_boost_records[player.index] = nil
end
local function boost_player_miningspeed(player)
if global.player_mining_boost_records == nil then global.player_mining_boost_records = {} end
if global.player_mining_boost_records[player.index] == nil then
global.player_mining_boost_records[player.index] = {
start_tick = game.tick,
pre_mining_boost_modifier = player.character_mining_speed_modifier,
boost_lvl = 0
}
end
local boost_msg = {
[1] = "%s is going on a tree harvest!",
[2] = "In search of a sharper axe, %s got a lv.2 mining boost!",
[3] = "Wood fiend, %s, has picked up a massive chain saw and is awarded a lv.3 mining boost!",
[4] = "Better learn to control that saw, %s, chopped off their legs. Oops."
}
global.player_mining_boost_records[player.index].boost_lvl = 1 + global.player_mining_boost_records[player.index].boost_lvl
player.character_mining_speed_modifier = 1 + player.character_mining_speed_modifier
game.print(string.format(boost_msg[global.player_mining_boost_records[player.index].boost_lvl], player.name))
if global.player_mining_boost_records[player.index].boost_lvl >= 4 then
reset_player_miningspeed(player)
player.character.die()
end
end
local function market_item_purchased(event)
local player = game.players[event.player_index]
@ -303,11 +334,16 @@ local function market_item_purchased(event)
fish_cost = market_item.price[1].amount * event.count
global.fish_market_fish_spent[event.player_index] = global.fish_market_fish_spent[event.player_index] + fish_cost
if event.offer_index == 1 then -- exoskeleton-equipment
if event.offer_index == 1 then -- exoskeleton-equipment
player.get_inventory(defines.inventory.player_main).remove({name="exoskeleton-equipment", count=event.count})
boost_player_runningspeed(player)
end
if event.offer_index == 3 then -- exoskeleton-equipment
player.get_inventory(defines.inventory.player_main).remove({name="wood", count=event.count})
boost_player_miningspeed(player)
end
if event.offer_index == 2 then
player.get_inventory(defines.inventory.player_main).remove({name="small-plane", count=event.count})
local chance = 4
@ -362,14 +398,21 @@ if not global.pet_command_rotation then global.pet_command_rotation = 1 end
function fish_market_on_180_ticks()
if game.tick % 900 == 0 then
if global.player_speed_boost_records then
for k,v in pairs(global.player_speed_boost_records) do
if game.tick - v.start_tick > 3000 then
reset_player_runningspeed(game.players[k])
end
end
end
end
if global.player_speed_boost_records then
for k,v in pairs(global.player_speed_boost_records) do
if game.tick - v.start_tick > 3000 then
reset_player_runningspeed(game.players[k])
end
end
end
if global.player_mining_boost_records then
for k,v in pairs(global.player_mining_boost_records) do
if game.tick - v.start_tick > 6000 then
reset_player_miningspeed(game.players[k])
end
end
end
end
if global.player_pets then
for _, pets in pairs(global.player_pets) do
@ -427,7 +470,7 @@ function fish_built_entity (event)
end
function fish_player_crafted_item(event)
local x = math.random(1,5)
local x = math.random(1,50)
if x == 1 then
fish_earned(event, 1)
end

View File

@ -0,0 +1 @@
-- This folder should remain blank in the repo, copy the specific file you need from the _locale folder

View File

@ -104,7 +104,7 @@ function run_combined_module(event)
e.destroy()
end
for _, e in pairs(surface.find_entities_filtered{area=area, type="tree"}) do
e.destroy()
-- e.destroy() -- Leaving the trees/forests
end
for _, e in pairs(surface.find_entities_filtered{area=area, type="simple-entity"}) do
e.destroy()

View File

@ -7,7 +7,7 @@ local function fillVanillaConfig()
-- general spawn params
allotment=100, -- how common resource is
spawns_per_region={min=1, max=2}, --number of chunks
richness=18000, -- resource_ore has only one richness value - resource-liquid has min/max
richness=12000, -- resource_ore has only one richness value - resource-liquid has min/max
size={min=20, max=50}, -- rough radius of area, too high value can produce square shaped areas
min_amount=500,
@ -31,7 +31,7 @@ local function fillVanillaConfig()
allotment=100,
spawns_per_region={min=1, max=2},
richness=16000,
richness=11000,
size={min=20, max=50},
min_amount=500,
@ -53,7 +53,7 @@ local function fillVanillaConfig()
spawns_per_region={min=1, max=1},
size={min=15, max=25},
richness=13000,
richness=8000,
min_amount=500,
starting={richness=6000, size=20, probability=1},
@ -71,7 +71,7 @@ local function fillVanillaConfig()
allotment=60,
spawns_per_region={min=1, max=1},
richness=11000,
richness=5000,
size={min=15, max=20},
min_amount=250,
@ -90,7 +90,7 @@ local function fillVanillaConfig()
allotment=40,
spawns_per_region={min=1, max=1},
richness=6000,
richness=4000,
size={min=10, max=15},
min_amount=500,
@ -99,10 +99,10 @@ local function fillVanillaConfig()
config["crude-oil"] = {
type="resource-liquid",
minimum_amount=240000,
minimum_amount=200000,
allotment=70,
spawns_per_region={min=1, max=2},
richness={min=240000, max=400000}, -- richness per resource spawn
spawns_per_region={min=1, max=1},
richness={min=200000, max=300000}, -- richness per resource spawn
size={min=5, max=20},
starting={richness=400000, size=3, probability=1},

View File

@ -0,0 +1 @@
-- This folder should remain blank in the repo, copy the specific file you need from the _locale folder

View File

@ -15,6 +15,9 @@ in this file and your run_*type*_module(event) function will be called.
--require "locale.gen_combined.UK"
--grilledham's map gen
-- Need to copy the file you want from the _locale folder to this one for it to be included
-- only get what you need, otherwise the save file is too big!
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.mobius_strip"
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.antfarm"
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.creation_of_adam"