mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Merge branch 'develop' of https://github.com/Valansch/RedMew into develop
This commit is contained in:
commit
3815ab3eb4
@ -23,8 +23,8 @@ local function invoke(cmd)
|
||||
player_print("Unknown player.")
|
||||
return
|
||||
end
|
||||
local pos = game.surfaces[1].find_non_colliding_position("player", game.player.position, 0, 1)
|
||||
game.players[target].teleport({pos.x, pos.y})
|
||||
local pos = game.player.surface.find_non_colliding_position("player", game.player.position, 0, 1)
|
||||
game.players[target].teleport({pos.x, pos.y}, game.player.surface)
|
||||
game.print(target .. ", get your ass over here!")
|
||||
end
|
||||
|
||||
@ -38,8 +38,9 @@ local function teleport_player(cmd)
|
||||
player_print("Unknown player.")
|
||||
return
|
||||
end
|
||||
local pos = game.surfaces[1].find_non_colliding_position("player", game.players[target].position, 0, 1)
|
||||
game.player.teleport({pos.x, pos.y})
|
||||
local surface = game.players[target].surface
|
||||
local pos = surface.find_non_colliding_position("player", game.players[target].position, 0, 1)
|
||||
game.player.teleport(pos, surface)
|
||||
game.print(target .. "! watcha doin'?!")
|
||||
end
|
||||
|
||||
@ -52,8 +53,8 @@ local function teleport_location(cmd)
|
||||
player_print("Nothing selected.")
|
||||
return
|
||||
end
|
||||
local pos = game.surfaces[1].find_non_colliding_position("player", game.player.selected.position, 0, 1)
|
||||
game.player.teleport({pos.x, pos.y})
|
||||
local pos = game.player.surface.find_non_colliding_position("player", game.player.selected.position, 0, 1)
|
||||
game.player.teleport(pos)
|
||||
end
|
||||
|
||||
local function detrain(param)
|
||||
@ -137,7 +138,6 @@ local function walkabout(cmd)
|
||||
return
|
||||
end
|
||||
global.walking[player_name:lower()] = true
|
||||
local surface = game.surfaces[1]
|
||||
local distance_max = distance * 1.05
|
||||
local distance_min = distance * 0.95
|
||||
distance_max = round(distance_max, 0)
|
||||
@ -426,7 +426,7 @@ local function get_group()
|
||||
for i=2,174 do
|
||||
group.set_allows_action(i, false)
|
||||
end
|
||||
else
|
||||
else
|
||||
game.print("This would have nearly crashed the server, please consult the next best scenario dev (valansch or TWLtriston).")
|
||||
end
|
||||
end
|
||||
|
115
fish_market.lua
115
fish_market.lua
@ -27,7 +27,7 @@ function spawn_market(cmd)
|
||||
return
|
||||
end
|
||||
local radius = 10
|
||||
local surface = game.surfaces[1]
|
||||
local surface = game.player.surface
|
||||
-- clear trees and landfill in start area
|
||||
local start_area = {left_top = {-20, -20}, right_bottom = {20, 20}}
|
||||
for _, e in pairs(surface.find_entities_filtered{area=start_area, type="tree"}) do
|
||||
@ -89,9 +89,7 @@ function spawn_market(cmd)
|
||||
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"}}
|
||||
market.add_market_item{price={{"raw-fish", 2000}}, offer={type="give-item", item="power-armor-mk2"}}
|
||||
market.add_market_item{price={{"raw-fish", 150}}, offer={type="give-item", item="personal-roboport-equipment"}}
|
||||
market.add_market_item{price={{"raw-fish", 1500}}, offer={type="give-item", item="personal-roboport-mk2-equipment"}}
|
||||
market.add_market_item{price={{"raw-fish", 50}}, offer={type="give-item", item="construction-robot", count=10}}
|
||||
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}}
|
||||
@ -103,7 +101,8 @@ end
|
||||
|
||||
local fish_market_message = {}
|
||||
|
||||
local fish_market_bonus_message = {"Why don’t fish like basketball? Cause they’re afraid of the net", "What do you get when you cross a banker with a fish? A Loan shark!", "How do you make an Octupus laugh? With ten-tickles", "What do you call a fish that needs help with his or her vocals? Autotuna", "What is the difference between a piano and a fish? You can tune a piano but you cannot tuna fish.", "What did the blind man say when he passed the fish market? Good morning ladies.", "Did you hear about the goldfish who went bankrupt? Now he’s a bronze fish.", "What happens when you put nutella on salmon? You get salmonella", "What do you call a fish with no eyes?…Fsh", "What kind of money do fishermen make?…Net profits", "What do you get if you cross a salmon, a bird’s leg and a hand?…Birdsthigh fish fingers", "Why is a fish easy to weigh?…Because it has its own scales", "Why are gold fish orange?…The water makes them rusty", "What was the Tsar of Russia’s favorite fish?…Tsardines", "Why did the dog jump into the sea?…He wanted to chase the catfish", "Which fish dresses the best?…The Swordfish – It always looks sharp", "What do you get if you cross an abbot with a trout?…Monkfish", "What do you call a big fish who makes you an offer you can’t refuse?…The Codfather", "Why is a swordfish’s nose 11 inches long?…If it were 12 inches long it would be a foot", "What do you get if you cross a trout with an apartment?…A flat fish", "Why are fish no good at tennis?…They don’t like to get too close to the net", "How do the fish get to school?…By octobus", "What fish make the best sandwich?…A peanut butter and jellyfish", "Man: Can I have a fly rod and reel for my son?…Fishing Shop Owner: Sorry sir we don’t do trades", "Where do fish keep their money?…In the river bank", "Why do fish like arcade games?…Because they are finball wizards", "What is a mermaid?…A deep-she fish", "What do you get if you cross a whale with rotten fish?…Moby Sick", "Why didn’t the lobster share his toys?…He was too shellfish", "What do fish use to make telephone calls?…a Shell phone", "Why don’t fish make very good tennis balls?…They keep getting caught in the net", "Electric eels and electric rays have enough electricity to kill a horse.", "Most fish have taste buds all over their body.", "Most brands of lipstick contain fish scales.", "A fish does not add new scales as it grows, but the scales it has increase in size. In this way, growth rings are formed and the rings reveal the age of a fish.", "An inflated porcupine fish can reach a diameter of up to 35 inches. It puffs up by swallowing water and then storing it in its stomach.", "Most fish cannot swim backwards. Those that can are mainly members of one of the eel families.", "The fastest fish is the sailfish. It can swim as fast as a car travels on the highway.","Some desert pupfish can live in hot springs that reach temperatures greater than 113° F.","Anableps, four-eyed fish, can see above and below water at the same time.","Catfish have over 27,000 taste buds. Humans have around 7,000.","One hagfish can make enough slime in one minute to fill a bucket.","A female sunfish can lay 300 million eggs each year.", "Fish feel pain and suffer stress just like mammals and birds.", "The Dwarf Seahorse is so slow you can’t see it move", "Some fish are as small as a grain of rice", "There's a species of fish called 'Slippery Dick'", "Herrings communicate through farts.", "One Puffer Fish contains enough poison to kill 30 medium-biters.", "When Anglerfish mate, they melt into each other and share their bodies forever.", "A koi fish named 'Hanako' lived for 225 years."}
|
||||
local fish_market_bonus_message = {"Why don’t fish like basketball? Cause they’re afraid of the net", "What do you get when you cross a banker with a fish? A Loan shark!", "How do you make an Octupus laugh? With ten-tickles", "What do you call a fish that needs help with his or her vocals? Autotuna", "What is the difference between a piano and a fish? You can tune a piano but you cannot tuna fish.", "What did the blind man say when he passed the fish market? Good morning ladies.", "Did you hear about the goldfish who went bankrupt? Now he’s a bronze fish.", "What happens when you put nutella on salmon? You get salmonella", "What do you call a fish with no eyes?…Fsh", "What kind of money do fishermen make?…Net profits", "What do you get if you cross a salmon, a bird’s leg and a hand?…Birdsthigh fish fingers", "Why is a fish easy to weigh?…Because it has its own scales", "Why are gold fish orange?…The water makes them rusty", "What was the Tsar of Russia’s favorite fish?…Tsardines", "Why did the dog jump into the sea?…He wanted to chase the catfish", "Which fish dresses the best?…The Swordfish – It always looks sharp", "What do you get if you cross an abbot with a trout?…Monkfish", "What do you call a big fish who makes you an offer you can’t refuse?…The Codfather", "Why is a swordfish’s nose 11 inches long?…If it were 12 inches long it would be a foot", "What do you get if you cross a trout with an apartment?…A flat fish", "Why are fish no good at tennis?…They don’t like to get too close to the net", "How do the fish get to school?…By octobus", "What fish make the best sandwich?…A peanut butter and jellyfish", "Man: Can I have a fly rod and reel for my son?…Fishing Shop Owner: Sorry sir we don’t do trades", "Where do fish keep their money?…In the river bank", "Why do fish like arcade games?…Because they are finball wizards", "What is a mermaid?…A deep-she fish", "What do you get if you cross a whale with rotten fish?…Moby Sick", "Why didn’t the lobster share his toys?…He was too shellfish", "What do fish use to make telephone calls?…a Shell phone", "Why don’t fish make very good tennis balls?…They keep getting caught in the net", "Electric eels and electric rays have enough electricity to kill a horse.", "Most fish have taste buds all over their body.", "Most brands of lipstick contain fish scales.", "A fish does not add new scales as it grows, but the scales it has increase in size. In this way, growth rings are formed and the rings reveal the age of a fish.", "An inflated porcupine fish can reach a diameter of up to 35 inches. It puffs up by swallowing water and then storing it in its stomach.", "Most fish cannot swim backwards. Those that can are mainly members of one of the eel families.", "The fastest fish is the sailfish. It can swim as fast as a car travels on the highway.","Some desert pupfish can live in hot springs that reach temperatures greater than 113° F.","Anableps, four-eyed fish, can see above and below water at the same time.","Catfish have over 27,000 taste buds. Humans have around 7,000.","One hagfish can make enough slime in one minute to fill a bucket.","A female sunfish can lay 300 million eggs each year.", "Fish feel pain and suffer stress just like mammals and birds.", "The Dwarf Seahorse is so slow you can’t see it move", "Some fish are as small as a grain of rice", "There's a species of fish called 'Slippery Dick'", "Herrings communicate through farts.", "One Puffer Fish contains enough poison to kill 30 medium-biters.", "When Anglerfish mate, they melt into each other and share their bodies forever.", "A koi fish named 'Hanako' lived for 225 years.", "What did the fish say when he posted bail? I'm off the hook!","There was a sale at the fish market today. I went to see what was the catch.","There are over 25,000 identified species of fish on the earth."
|
||||
}
|
||||
|
||||
local total_fish_market_messages = #fish_market_message
|
||||
local total_fish_market_bonus_messages = #fish_market_bonus_message
|
||||
@ -111,28 +110,30 @@ local total_fish_market_bonus_messages = #fish_market_bonus_message
|
||||
if not global.fish_market_fish_caught then global.fish_market_fish_caught = {} end
|
||||
if not global.fish_market_fish_spent then global.fish_market_fish_spent = {} end
|
||||
|
||||
local function fish_earned(event, amount)
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
local function fish_earned_index(player_index, amount)
|
||||
local player = game.players[player_index]
|
||||
player.insert { name = "raw-fish", count = amount }
|
||||
|
||||
if global.fish_market_fish_caught[event.player_index] then
|
||||
global.fish_market_fish_caught[event.player_index] = global.fish_market_fish_caught[event.player_index] + amount
|
||||
if global.fish_market_fish_caught[player_index] then
|
||||
global.fish_market_fish_caught[player_index] = global.fish_market_fish_caught[player_index] + amount
|
||||
else
|
||||
global.fish_market_fish_caught[event.player_index] = amount
|
||||
global.fish_market_fish_caught[player_index] = amount
|
||||
end
|
||||
|
||||
if global.fish_market_fish_caught[event.player_index] <= total_fish_market_messages then
|
||||
local x = global.fish_market_fish_caught[event.player_index]
|
||||
if global.fish_market_fish_caught[player_index] <= total_fish_market_messages then
|
||||
local x = global.fish_market_fish_caught[player_index]
|
||||
player.print(fish_market_message[x])
|
||||
end
|
||||
|
||||
local x = global.fish_market_fish_caught[event.player_index] % 7
|
||||
local x = global.fish_market_fish_caught[player_index] % 7
|
||||
if x == 0 then
|
||||
local z = math.random(1,total_fish_market_bonus_messages)
|
||||
player.print(fish_market_bonus_message[z])
|
||||
end
|
||||
end
|
||||
|
||||
local function fish_earned(event, amount)
|
||||
fish_earned_index( event.player_index, amount )
|
||||
end
|
||||
|
||||
local function preplayer_mined_item(event)
|
||||
@ -140,12 +141,14 @@ local function preplayer_mined_item(event)
|
||||
-- game.print(event.entity.name)
|
||||
-- game.print(event.entity.type)
|
||||
|
||||
--[[
|
||||
if event.entity.type == "resource" then
|
||||
local x = math.random(1,2)
|
||||
if x == 1 then
|
||||
fish_earned(event, 1)
|
||||
end
|
||||
end
|
||||
--]]
|
||||
|
||||
if event.entity.name == "stone-rock" then
|
||||
fish_earned(event, 10)
|
||||
@ -168,16 +171,69 @@ local function preplayer_mined_item(event)
|
||||
end
|
||||
|
||||
local function fish_drop_entity_died(event)
|
||||
local give_fish_cause = false
|
||||
local give_fish_unit = false
|
||||
local fish_amount = 0
|
||||
local fish_chance = 0 -- Out of 100
|
||||
|
||||
if event.entity.force.name == "enemy" then
|
||||
-- global.score_biter_total_kills = global.score_biter_total_kills + 1
|
||||
-- game.print(global.score_biter_total_kills)
|
||||
if global.score_biter_total_kills % 150 == 0 then
|
||||
local surface = event.entity.surface
|
||||
local x = math.random(1,2)
|
||||
surface.spill_item_stack(event.entity.position, { name = "raw-fish", count = x }, 1)
|
||||
end
|
||||
end
|
||||
if event.entity.force.name == "enemy" then
|
||||
if event.cause ~= nil then
|
||||
if event.cause.name == "gun-turret" or event.cause.name == "flamethrower-turret" then
|
||||
-- WHo's around to get free fish!?
|
||||
give_fish_cause = true
|
||||
elseif event.cause.type == "player" then
|
||||
give_fish_cause = true
|
||||
end
|
||||
else
|
||||
-- Unknown cause? Free fish! Worms have no cause
|
||||
give_fish_cause = true
|
||||
end
|
||||
if event.entity.type == "unit" then
|
||||
fish_amount = 1
|
||||
fish_chance = 1
|
||||
give_fish_unit = true
|
||||
end
|
||||
if event.entity.type == "unit-spawner" then
|
||||
fish_amount = 10
|
||||
fish_chance = 100
|
||||
give_fish_unit = true
|
||||
end
|
||||
if event.entity.type == "turret" then
|
||||
if ( event.entity.name == "small-worm-turret" ) then
|
||||
fish_amount = 10
|
||||
elseif ( event.entity.name == "medium-worm-turret" ) then
|
||||
fish_amount = 20
|
||||
elseif ( event.entity.name == "big-worm-turret" ) then
|
||||
fish_amount = 30
|
||||
end
|
||||
|
||||
fish_chance = 100
|
||||
give_fish_unit = true
|
||||
end
|
||||
|
||||
if give_fish_unit and give_fish_cause then
|
||||
local x = math.random(1,100)
|
||||
if x <= fish_chance then
|
||||
-- Find nearby players +/- 16 blocks of event
|
||||
local block_size = 64
|
||||
area = {{event.entity.position.x - block_size, event.entity.position.y - block_size}, {event.entity.position.x + block_size, event.entity.position.y + block_size}}
|
||||
player_entities = game.surfaces[1].find_entities_filtered( { area = area, type = "player", force = "player" } )
|
||||
|
||||
for _,entity in ipairs(player_entities) do
|
||||
if entity.player.afk_time < 120 then
|
||||
fish_earned_index(entity.player.index, fish_amount)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if global.score_biter_total_kills % 150 == 0 then
|
||||
local surface = event.entity.surface
|
||||
local x = math.random(1,2)
|
||||
surface.spill_item_stack(event.entity.position, { name = "raw-fish", count = x }, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -192,7 +248,7 @@ function pet(player, entity_name)
|
||||
end
|
||||
if not global.player_pets then global.player_pets = {} end
|
||||
|
||||
local surface = game.surfaces[1]
|
||||
local surface = game.player.surface
|
||||
|
||||
local pos = player.position
|
||||
pos.y = pos.y + 1
|
||||
@ -320,7 +376,7 @@ function fish_market_on_180_ticks()
|
||||
local player = game.players[pets.owner]
|
||||
if pcall(function () local x = pets.entity.name end) then
|
||||
if global.pet_command_rotation % 15 == 0 then
|
||||
local surface = game.surfaces[1]
|
||||
local surface = player.surface
|
||||
local pet_pos = pets.entity.position
|
||||
local pet_name = pets.entity.name
|
||||
local pet_direction = pets.entity.direction
|
||||
@ -351,8 +407,7 @@ function fish_built_entity (event)
|
||||
end
|
||||
|
||||
-- player_index = event.player_index
|
||||
|
||||
if entity.type == "furnace" then
|
||||
--[[ if entity.type == "furnace" then
|
||||
local x = math.random(1,5)
|
||||
if x == 1 then
|
||||
fish_earned(event, 5)
|
||||
@ -368,10 +423,18 @@ function fish_built_entity (event)
|
||||
fish_earned(event, 5)
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
function fish_player_crafted_item(event)
|
||||
local x = math.random(1,5)
|
||||
if x == 1 then
|
||||
fish_earned(event, 1)
|
||||
end
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_preplayer_mined_item, preplayer_mined_item)
|
||||
Event.register(defines.events.on_entity_died, fish_drop_entity_died)
|
||||
Event.register(defines.events.on_market_item_purchased, market_item_purchased)
|
||||
Event.register(defines.events.on_built_entity, fish_built_entity)
|
||||
Event.register(defines.events.on_player_crafted_item, fish_player_crafted_item)
|
||||
|
161
locale/gen_combined/dimentions.lua
Normal file
161
locale/gen_combined/dimentions.lua
Normal file
@ -0,0 +1,161 @@
|
||||
--Author: Valansch
|
||||
|
||||
local wrech_items_module = require "locale.gen_misc.wreck_items"
|
||||
|
||||
local resource_types = {"copper-ore", "iron-ore", "coal", "stone", "uranium-ore", "crude-oil"}
|
||||
|
||||
global.current_portal_index = 1
|
||||
global.portals = {}
|
||||
--Sample Portal:
|
||||
--{position : LuaPosition, source: LuaSurface, target : LuaPosition, target_surface : LuaSurface}
|
||||
|
||||
global.current_magic_chest_index = 1
|
||||
global.magic_chests = {}
|
||||
--{entity : LuaEntity, target : LuaEntity}
|
||||
|
||||
|
||||
global.last_tp = {}
|
||||
global.teleport_cooldown = 3
|
||||
global.portal_radius = 2
|
||||
|
||||
|
||||
local function get_nice_surface_name(name)
|
||||
name = name:gsub("-ore", ""):gsub("-oil", " Oil")
|
||||
return name:sub(1,1):upper() .. name:sub(2)
|
||||
end
|
||||
|
||||
--Creates autoplace_controls with only one resource type enabled
|
||||
local function create_resource_setting(resource)
|
||||
local settings = game.surfaces[1].map_gen_settings
|
||||
for _,type in pairs(resource_types) do
|
||||
settings.autoplace_controls[type] = {frequency = "none", size = "none", richness = "none"}
|
||||
end
|
||||
settings.autoplace_controls[resource] = {frequency = "normal", size = "big", richness = "good"}
|
||||
return settings
|
||||
end
|
||||
local function init()
|
||||
if not game.surfaces[2] then
|
||||
for _,type in pairs(resource_types) do
|
||||
game.create_surface(get_nice_surface_name(type), create_resource_setting(type))
|
||||
end
|
||||
local enemy_settings = create_resource_setting("enemy-base")
|
||||
enemy_settings.autoplace_controls["enemy-base"] = {frequency = "very-high", size = "very-big", richness = "very-good"}
|
||||
game.create_surface("Zerus", enemy_settings)
|
||||
game.create_surface("Nihil", create_resource_setting("copper-ore"))
|
||||
end
|
||||
end
|
||||
|
||||
local function generate_nihil(event)
|
||||
for _,e in pairs(event.surface.find_entities_filtered{}) do
|
||||
if e.type ~= "player" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
local tiles = {}
|
||||
for x = event.area.left_top.x, event.area.right_bottom.x do
|
||||
for y = event.area.left_top.y, event.area.right_bottom.y do
|
||||
table.insert(tiles,{name="lab-dark-1", position = {x,y}})
|
||||
end
|
||||
end
|
||||
event.surface.set_tiles(tiles)
|
||||
end
|
||||
|
||||
function run_combined_module(event)
|
||||
init()
|
||||
if event.surface.name == "Zerus" then
|
||||
wrech_items_module.on_chunk_generated(event)
|
||||
elseif event.surface.name == "Nihil" then
|
||||
generate_nihil(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function teleport_nearby_players(portal)
|
||||
for _, player_character in pairs(portal.source.find_entities_filtered{area = {{portal.position.x - global.portal_radius,portal.position.y - global.portal_radius},{portal.position.x + global.portal_radius,portal.position.y + global.portal_radius}}, name = "player", type = "player"}) do
|
||||
local player = player_character.player
|
||||
if not global.last_tp[player.name] or global.last_tp[player.name] + global.teleport_cooldown * 60 < game.tick then
|
||||
player.teleport(portal.target, portal.target_surface)
|
||||
global.last_tp[player.name] = game.tick
|
||||
player.print("Wooosh! You are now in the " .. portal.target_surface.name .. " dimention.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function teleport_players()
|
||||
local num_portals = #global.portals
|
||||
if num_portals > 0 then
|
||||
local portal = global.portals[global.current_portal_index]
|
||||
if portal.target then
|
||||
teleport_nearby_players(portal)
|
||||
end
|
||||
global.current_portal_index = (global.current_portal_index) % num_portals + 1 --Next portal
|
||||
end
|
||||
end
|
||||
|
||||
local function teleport_stuff()
|
||||
local num_chests = #global.magic_chests
|
||||
if num_chests > 0 then
|
||||
local chest = global.magic_chests[global.current_magic_chest_index]
|
||||
if chest.entity and chest.target and chest.entity.valid and chest.target.valid then
|
||||
local inv = chest.entity.get_inventory(defines.inventory.chest)
|
||||
local target_inv = chest.target.get_inventory(defines.inventory.chest)
|
||||
if inv and target_inv then
|
||||
for item, count in pairs(inv.get_contents()) do
|
||||
local n_inserted = target_inv.insert{name = item, count = count}
|
||||
if n_inserted > 0 then
|
||||
inv.remove{name = item, count = n_inserted}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
global.current_magic_chest_index = (global.current_magic_chest_index) % num_chests + 1 --Next magic chest
|
||||
end
|
||||
end
|
||||
|
||||
local function dim_on_tick(event)
|
||||
if game.tick % 2 == 0 then
|
||||
teleport_stuff()
|
||||
else
|
||||
teleport_players()
|
||||
end
|
||||
end
|
||||
|
||||
global.chest_selected = false
|
||||
local function linkchests()
|
||||
if game.player and game.player.admin and game.player.selected and (game.player.selected.type == "logistic-container" or game.player.selected.type == "container") then
|
||||
game.player.selected.destructible = false
|
||||
game.player.selected.minable = false
|
||||
if global.chest_selected then
|
||||
global.magic_chests[#global.magic_chests].target = game.player.selected
|
||||
game.print("Link established.")
|
||||
else
|
||||
table.insert(global.magic_chests, {entity = game.player.selected})
|
||||
game.print("Selected first chest.")
|
||||
end
|
||||
global.chest_selected = not global.chest_selected
|
||||
else
|
||||
game.print("failed.")
|
||||
end
|
||||
end
|
||||
|
||||
global.portal_selected = false
|
||||
local function linkportals()
|
||||
if game.player and game.player.admin then
|
||||
if global.portal_selected then
|
||||
global.portals[#global.portals].target = game.player.position
|
||||
global.portals[#global.portals].target_surface = game.player.surface
|
||||
--Way back home:
|
||||
table.insert(global.portals, {position = game.player.position, target = global.portals[#global.portals].position, source = game.player.surface, target_surface = global.portals[#global.portals].source})
|
||||
game.print("Portal link established.")
|
||||
else
|
||||
table.insert(global.portals, {position = game.player.position, source = game.player.surface})
|
||||
game.print("Selected first portal.")
|
||||
end
|
||||
global.portal_selected = not global.portal_selected
|
||||
else
|
||||
game.print("failed.")
|
||||
end
|
||||
end
|
||||
|
||||
commands.add_command("linkchests", "Select a chest to link to another. Run this command again to select the other one.", linkchests)
|
||||
commands.add_command("linkportals", "Select a portal to link to another. Run this command again to select the other one.", linkportals)
|
||||
Event.register(defines.events.on_tick, dim_on_tick)
|
@ -3,7 +3,7 @@
|
||||
-- adds some wrecked items around the map, good for MP, reduces total resources pulled from factory, and adds incentive to push out
|
||||
|
||||
wreck_item_pool = {}
|
||||
wreck_item_pool = {{name="iron-gear-wheel", count=32},{name="iron-plate", count=64},{name="rocket-control-unit", count=1},{name="rocket-fuel", count=7} ,{name="coal", count=8},{name="rocket-launcher", count=1},{name="rocket", count=32},{name="copper-cable", count=128},{name="land-mine", count=64},{name="railgun", count=1},{name="railgun-dart", count=128},{name="fast-inserter", count=8},{name="stack-filter-inserter", count=2},{name="belt-immunity-equipment", count=1},{name="fusion-reactor-equipment", count=1},{name="electric-engine-unit", count=8},{name="exoskeleton-equipment", count=1},{name="rocket-fuel", count=10},{name="used-up-uranium-fuel-cell", count=3},{name="uranium-fuel-cell", count=2},{name="power-armor", count=1},{name="modular-armor", count=1},{name="water-barrel", count=4},{name="sulfuric-acid-barrel", count=6},{name="crude-oil-barrel", count=8},{name="energy-shield-equipment", count=1},{name="explosive-rocket", count=32}}
|
||||
wreck_item_pool = {{name="iron-gear-wheel", count=32},{name="iron-plate", count=64},{name="rocket-control-unit", count=1},{name = "atomic-bomb", count = 1},{name="rocket-fuel", count=7} ,{name="coal", count=8},{name="rocket-launcher", count=1},{name="rocket", count=32},{name="copper-cable", count=128},{name="land-mine", count=64},{name="railgun", count=1},{name="railgun-dart", count=128},{name="fast-inserter", count=8},{name="stack-filter-inserter", count=2},{name="belt-immunity-equipment", count=1},{name="fusion-reactor-equipment", count=1},{name="electric-engine-unit", count=8},{name="exoskeleton-equipment", count=1},{name="rocket-fuel", count=10},{name="used-up-uranium-fuel-cell", count=3},{name="uranium-fuel-cell", count=2},{name="power-armor", count=1},{name="modular-armor", count=1},{name="water-barrel", count=4},{name="sulfuric-acid-barrel", count=6},{name="crude-oil-barrel", count=8},{name="energy-shield-equipment", count=1},{name="explosive-rocket", count=32}}
|
||||
|
||||
local function place_entities(surface, entity_list)
|
||||
local directions = {defines.direction.north, defines.direction.east, defines.direction.south, defines.direction.west}
|
||||
|
@ -53,7 +53,7 @@ local function fillVanillaConfig()
|
||||
|
||||
spawns_per_region={min=1, max=1},
|
||||
size={min=15, max=25},
|
||||
richness=1300,
|
||||
richness=13000,
|
||||
min_amount=500,
|
||||
|
||||
starting={richness=6000, size=20, probability=1},
|
||||
@ -103,7 +103,7 @@ local function fillVanillaConfig()
|
||||
allotment=70,
|
||||
spawns_per_region={min=1, max=2},
|
||||
richness={min=240000, max=400000}, -- richness per resource spawn
|
||||
size={min=2, max=5},
|
||||
size={min=5, max=25},
|
||||
|
||||
starting={richness=400000, size=3, probability=1},
|
||||
|
||||
|
@ -10,6 +10,7 @@ in this file and your run_*type*_module(event) function will be called.
|
||||
--require "locale.gen_combined.island_resort"
|
||||
--require "locale.gen_combined.red_planet_v2"
|
||||
--require "locale.gen_combined.borg_planet_v2"
|
||||
--require "locale.gen_combined.dimentions"
|
||||
--require "locale.gen_combined.dagobah_swamp"
|
||||
|
||||
--grilledham's maps
|
||||
@ -18,10 +19,10 @@ in this file and your run_*type*_module(event) function will be called.
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.creation_of_adam"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.manhattan"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.mona_lisa"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.connected_dots"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.cage"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.maori"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.goat"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.connected_dots"
|
||||
|
||||
--shapes--
|
||||
--require "locale.gen_shape.right"
|
||||
|
@ -29,20 +29,37 @@ local function on_player_deconstructed_area(event)
|
||||
end
|
||||
end
|
||||
|
||||
local init = true
|
||||
local function log_on_player_mined_entity(str, event)
|
||||
game.write_file("on_player_mined_entity_debug", game.tick .. " (" .. game.players[event.player_index].name .. ") " .. str .. "\n", true, 0)
|
||||
end
|
||||
|
||||
global.on_player_mined_item_enabled = true
|
||||
global.on_player_mined_item_init = true
|
||||
|
||||
local function on_player_mined_item(event)
|
||||
if init then
|
||||
game.forces.enemy.research_all_technologies() --avoids losing logstics slot configuration on force toggle
|
||||
init = false
|
||||
end
|
||||
if event.entity.force.name ~= "enemy" and event.entity.force.name ~= "neutral" and event.entity.name ~= "entity-ghost" then
|
||||
local entity_name = event.entity.name
|
||||
if entity_name == "pipe-to-ground" then entity_name = "pipe" end
|
||||
local ghost = game.surfaces[1].create_entity{name = "entity-ghost", position = event.entity.position, inner_name = entity_name, expires = false, force = "enemy", direction = event.entity.direction}
|
||||
ghost.last_user = event.player_index
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: entry", event)
|
||||
if global.on_player_mined_item_enabled then
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: enabled", event)
|
||||
if global.on_player_mined_item_init then
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: init", event)
|
||||
game.forces.enemy.research_all_technologies() --avoids losing logstics slot configuration on force toggle
|
||||
global.on_player_mined_item_init = false
|
||||
end
|
||||
local entity = event.entity
|
||||
if entity.force.name ~= "enemy" and entity.force.name ~= "neutral" and entity.name ~= "entity-ghost" and entity.type ~= "logistic-robot" and entity.type ~= "construction-robot" then
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: in body", event)
|
||||
local entity_name = entity.name
|
||||
if entity_name == "pipe-to-ground" then entity_name = "pipe" end
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: before ghost placement", event)
|
||||
local ghost = event.entity.surface.create_entity{name = "entity-ghost", position = event.entity.position, inner_name = entity_name, expires = false, force = "enemy", direction = event.entity.direction}
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: ghost placed", event)
|
||||
ghost.last_user = event.player_index
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: last user set", event)
|
||||
end
|
||||
end
|
||||
log_on_player_mined_entity("nuke_control.on_player_mined_item: exit", event)
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_player_ammo_inventory_changed, ammo_changed)
|
||||
Event.register(defines.events.on_player_deconstructed_area, on_player_deconstructed_area)
|
||||
--Event.register(defines.events.on_player_mined_entity, on_player_mined_item)
|
||||
Event.register(defines.events.on_player_mined_entity, on_player_mined_item)
|
||||
|
@ -399,12 +399,23 @@ function player_list_on_12_seconds()
|
||||
end
|
||||
end
|
||||
|
||||
local function player_list_on_player_died( event_player, cause )
|
||||
player = game.players[event_player.player_index]
|
||||
local function log_on_player_died_debug(str, event)
|
||||
local cause = event.cause or {name = "no cause"}
|
||||
game.write_file("on_player_died_debug", game.tick .. " (" .. game.players[event.player_index].name .. ", cause: " .. cause.name .. ") " .. str .. "\n", true, 0)
|
||||
end
|
||||
|
||||
local function player_list_on_player_died(event)
|
||||
log_on_player_died_debug("entry", event)
|
||||
local player = game.players[event.player_index]
|
||||
log_on_player_died_debug("player", event)
|
||||
if not global.scenario.variables.player_deaths[player.name] then
|
||||
log_on_player_died_debug("if", event)
|
||||
global.scenario.variables.player_deaths[player.name] = 0
|
||||
log_on_player_died_debug("deaths zero", event)
|
||||
end
|
||||
log_on_player_died_debug("deaths ++", event)
|
||||
global.scenario.variables.player_deaths[player.name] = global.scenario.variables.player_deaths[player.name] + 1
|
||||
log_on_player_died_debug("exit", event)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user