mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-11-06 09:09:26 +02:00
Formatting (#420)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local Event = require "utils.event"
|
||||
local Event = require 'utils.event'
|
||||
|
||||
-- Uncomment the desired day/night cycle
|
||||
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
|
||||
local drivers_group = "Drivers"
|
||||
local drivers_group = 'Drivers'
|
||||
|
||||
local function transfer_body(player)
|
||||
-- Remove the player from their character and place them in a car.
|
||||
local surface = player.surface
|
||||
local force = player.force
|
||||
local pos = force.get_spawn_position(surface)
|
||||
|
||||
|
||||
-- Choose a random direction for the car to face
|
||||
local dir = math.random (0,7)
|
||||
|
||||
local dir = math.random(0, 7)
|
||||
|
||||
-- Remove the players' character
|
||||
if player.character then
|
||||
player.character.destroy()
|
||||
end
|
||||
|
||||
|
||||
--Find a place for a car, place a car, and place fuel+ammo in it
|
||||
local car_pos = surface.find_non_colliding_position('car', pos, 0, 3)
|
||||
local car = surface.create_entity {name = 'car', position = car_pos, direction = dir, force = force}
|
||||
car.insert({name="coal", count=50})
|
||||
car.insert({name="firearm-magazine", count=10})
|
||||
car.insert({name = 'coal', count = 50})
|
||||
car.insert({name = 'firearm-magazine', count = 10})
|
||||
car.set_driver(player)
|
||||
|
||||
end
|
||||
|
||||
local function player_created(event)
|
||||
@@ -42,16 +41,16 @@ local function player_created(event)
|
||||
-- Disable leaving a vehicle
|
||||
permission_group.set_allows_action(defines.input_action.toggle_driving, false)
|
||||
end
|
||||
|
||||
|
||||
-- Add player to drivers group
|
||||
permission_group.add_player(player)
|
||||
permission_group.add_player(player)
|
||||
|
||||
-- Put the new player into a car.
|
||||
transfer_body(player)
|
||||
|
||||
|
||||
-- Disable the god mode spotlight.
|
||||
player.disable_flashlight()
|
||||
|
||||
|
||||
-- Welcome message to the player.
|
||||
player.print('As though a dream, you find yourself without a body and instead as a sentient car. Strange...')
|
||||
end
|
||||
|
||||
@@ -4,7 +4,6 @@ local replacement_tiles
|
||||
local tile_count
|
||||
local random = math.random
|
||||
|
||||
|
||||
Event.add(
|
||||
defines.events.on_player_built_tile,
|
||||
function(event)
|
||||
@@ -16,7 +15,7 @@ Event.add(
|
||||
if event.item.name == 'landfill' then
|
||||
local tiles = event.tiles
|
||||
for i = 1, #tiles do
|
||||
tiles[i].name = replacement_tiles[random(1,tile_count)]
|
||||
tiles[i].name = replacement_tiles[random(1, tile_count)]
|
||||
end
|
||||
local surface = game.surfaces[event.surface_index]
|
||||
surface.set_tiles(tiles)
|
||||
@@ -25,6 +24,6 @@ Event.add(
|
||||
)
|
||||
|
||||
return function(tiles)
|
||||
replacement_tiles = tiles or {"sand-1"}
|
||||
replacement_tiles = tiles or {'sand-1'}
|
||||
tile_count = #replacement_tiles
|
||||
end
|
||||
|
||||
@@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
Biters in polluted areas become more aggressive at night.
|
||||
TODO: Look into triggering existing unit groups to attack in unison with the groups we generate.
|
||||
]]--
|
||||
|
||||
local Event = require 'utils.event'
|
||||
--basic interval for checks
|
||||
local timeinterval = 2689 --2700 is ~45 seconds at 60 UPS
|
||||
@@ -30,7 +31,7 @@ local insert = table.insert
|
||||
local function biter_attack()
|
||||
local maxindex = #global.bases
|
||||
local surface = game.surfaces[1]
|
||||
for i=global.c_index, global.c_index+processchunk, 1 do
|
||||
for i = global.c_index, global.c_index + processchunk, 1 do
|
||||
if i > maxindex then
|
||||
-- we're done here
|
||||
global.state = IDLE
|
||||
@@ -38,17 +39,17 @@ local function biter_attack()
|
||||
end
|
||||
if random() < surface.darkness then
|
||||
local base = global.bases[i]
|
||||
local group=surface.create_unit_group{position=base}
|
||||
local group = surface.create_unit_group {position = base}
|
||||
for _, biter in ipairs(surface.find_enemy_units(base, 16)) do
|
||||
group.add_member(biter)
|
||||
end
|
||||
if #group.members==0 then
|
||||
if #group.members == 0 then
|
||||
group.destroy()
|
||||
else
|
||||
--autonomous groups will attack polluted areas independently
|
||||
group.set_autonomous()
|
||||
if _DEBUG then
|
||||
game.print("sending biters")
|
||||
game.print('sending biters')
|
||||
end
|
||||
--group.set_command{ type=defines.command.attack_area, destination=game.players[1].position, radius=200, distraction=defines.distraction.by_anything }
|
||||
end
|
||||
@@ -62,11 +63,11 @@ local function biter_attack()
|
||||
end
|
||||
end
|
||||
|
||||
local function shuffle_table( t )
|
||||
assert( t, "shuffle_table() expected a table, got nil" )
|
||||
local function shuffle_table(t)
|
||||
assert(t, 'shuffle_table() expected a table, got nil')
|
||||
local iterations = #t
|
||||
local j
|
||||
|
||||
|
||||
for i = iterations, 2, -1 do
|
||||
j = random(i)
|
||||
t[i], t[j] = t[j], t[i]
|
||||
@@ -80,7 +81,7 @@ local function find_bases()
|
||||
global.bases = {}
|
||||
end
|
||||
local maxindex = #global.chunklist
|
||||
for i=global.c_index, global.c_index+processchunk, 1 do
|
||||
for i = global.c_index, global.c_index + processchunk, 1 do
|
||||
if i > maxindex then
|
||||
-- we're done with the search
|
||||
global.state = ATTACKING
|
||||
@@ -88,9 +89,13 @@ local function find_bases()
|
||||
end
|
||||
if get_pollution(global.chunklist[i]) > 0.1 then
|
||||
local chunkcoord = global.chunklist[i]
|
||||
if (count_entities_filtered{area={{chunkcoord.x-16, chunkcoord.y-16},{chunkcoord.x+16, chunkcoord.y+16}},
|
||||
type = "unit-spawner"}) > 0 then
|
||||
insert(global.bases,chunkcoord)
|
||||
if
|
||||
(count_entities_filtered {
|
||||
area = {{chunkcoord.x - 16, chunkcoord.y - 16}, {chunkcoord.x + 16, chunkcoord.y + 16}},
|
||||
type = 'unit-spawner'
|
||||
}) > 0
|
||||
then
|
||||
insert(global.bases, chunkcoord)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -100,7 +105,7 @@ local function find_bases()
|
||||
global.c_index = 1
|
||||
shuffle_table(global.bases)
|
||||
if _DEBUG then
|
||||
game.print("bases added: " .. tostring(#global.bases))
|
||||
game.print('bases added: ' .. tostring(#global.bases))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -112,8 +117,8 @@ local function on_chunk_generated(event)
|
||||
if event.surface == game.surfaces[1] then
|
||||
local chunk = {}
|
||||
local coords = event.area.left_top
|
||||
chunk.x = coords.x+16
|
||||
chunk.y = coords.y+16
|
||||
chunk.x = coords.x + 16
|
||||
chunk.y = coords.y + 16
|
||||
insert(global.chunklist, chunk)
|
||||
end
|
||||
end
|
||||
@@ -130,26 +135,22 @@ local function on_tick()
|
||||
end
|
||||
|
||||
local function on_interval()
|
||||
if game.surfaces[1].darkness > 0.5
|
||||
and global.state == IDLE
|
||||
and game.tick >= global.lastattack + timeinterval
|
||||
and random() > 0.5
|
||||
then
|
||||
if game.surfaces[1].darkness > 0.5 and global.state == IDLE and game.tick >= global.lastattack + timeinterval and random() > 0.5 then
|
||||
-- Search for bases, then attack
|
||||
global.state = BASE_SEARCH
|
||||
if _DEBUG then
|
||||
game.surfaces[1].print("entering attack mode") --for debug
|
||||
game.surfaces[1].print('entering attack mode') --for debug
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_init()
|
||||
global.bases = {}
|
||||
global.chunklist = {}
|
||||
global.state = IDLE
|
||||
--prevents attacks from happening too often
|
||||
global.lastattack = 0
|
||||
global.c_index=1
|
||||
global.bases = {}
|
||||
global.chunklist = {}
|
||||
global.state = IDLE
|
||||
--prevents attacks from happening too often
|
||||
global.lastattack = 0
|
||||
global.c_index = 1
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,180 +1,192 @@
|
||||
local Event = require "utils.event"
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
|
||||
Event.on_init(function()
|
||||
|
||||
global.players = {}
|
||||
|
||||
game.forces.enemy.set_cease_fire(game.forces.player ,true);
|
||||
game.forces.player.disable_research();
|
||||
game.forces.player.disable_all_prototypes();
|
||||
game.forces.player.set_ammo_damage_modifier("rocket", -3);
|
||||
Event.on_init(
|
||||
function()
|
||||
global.players = {}
|
||||
|
||||
end)
|
||||
game.forces.enemy.set_cease_fire(game.forces.player, true)
|
||||
game.forces.player.disable_research()
|
||||
game.forces.player.disable_all_prototypes()
|
||||
game.forces.player.set_ammo_damage_modifier('rocket', -3)
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(defines.events.on_player_created, function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
--player.print("Info: PVP server mod 'Bearded Snails' (c) byte");
|
||||
guiNewPlayer(player.gui.left);
|
||||
printNewPlayer(player);
|
||||
|
||||
player.insert{name="heavy-armor", count=1}
|
||||
player.insert{name="iron-plate", count=8}
|
||||
player.insert{name="pistol", count=1}
|
||||
player.insert{name="firearm-magazine", count=10}
|
||||
player.insert{name="burner-mining-drill", count = 1}
|
||||
player.insert{name="stone-furnace", count = 1}
|
||||
player.insert{name="shotgun", count = 1}
|
||||
player.insert{name="shotgun-shell", count = 10}
|
||||
player.character.character_running_speed_modifier = 0.5
|
||||
player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}})
|
||||
end)
|
||||
Event.add(
|
||||
defines.events.on_player_created,
|
||||
function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
--player.print("Info: PVP server mod 'Bearded Snails' (c) byte");
|
||||
guiNewPlayer(player.gui.left)
|
||||
printNewPlayer(player)
|
||||
|
||||
Event.add(defines.events.on_player_respawned, function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
|
||||
player.insert{name="heavy-armor", count=1}
|
||||
player.insert{name="pistol", count=1}
|
||||
player.insert{name="firearm-magazine", count=10}
|
||||
player.insert{name="shotgun", count = 1}
|
||||
player.insert{name="shotgun-shell", count = 10}
|
||||
player.character.character_running_speed_modifier = 0.5
|
||||
end)
|
||||
player.insert {name = 'heavy-armor', count = 1}
|
||||
player.insert {name = 'iron-plate', count = 8}
|
||||
player.insert {name = 'pistol', count = 1}
|
||||
player.insert {name = 'firearm-magazine', count = 10}
|
||||
player.insert {name = 'burner-mining-drill', count = 1}
|
||||
player.insert {name = 'stone-furnace', count = 1}
|
||||
player.insert {name = 'shotgun', count = 1}
|
||||
player.insert {name = 'shotgun-shell', count = 10}
|
||||
player.character.character_running_speed_modifier = 0.5
|
||||
player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}})
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(defines.events.on_rocket_launched, function(event)
|
||||
local force = event.rocket.force
|
||||
if event.rocket.get_item_count("satellite") > 0 then
|
||||
if global.satellite_sent == nil then
|
||||
global.satellite_sent = {}
|
||||
end
|
||||
if global.satellite_sent[force.name] == nil then
|
||||
game.set_game_state{game_finished=true, player_won=true, can_continue=true}
|
||||
global.satellite_sent[force.name] = 1
|
||||
else
|
||||
global.satellite_sent[force.name] = global.satellite_sent[force.name] + 1
|
||||
end
|
||||
for index, player in pairs(force.players) do
|
||||
if player.gui.left.rocket_score == nil then
|
||||
local frame = player.gui.left.add{name = "rocket_score", type = "frame", direction = "horizontal", caption={"gui.score"}}
|
||||
frame.add{name="rocket_count_label", type = "label", caption={"", {"gui.rockets-sent"}, ":"}}
|
||||
frame.add{name="rocket_count", type = "label", caption=tostring(global.satellite_sent[force.name])}
|
||||
else
|
||||
player.gui.left.rocket_score.rocket_count.caption = tostring(global.satellite_sent[force.name])
|
||||
end
|
||||
end
|
||||
else
|
||||
for index, player in pairs(force.players) do
|
||||
player.print({"msg.gui-rocket-silo.rocket-launched-without-satellite"})
|
||||
end
|
||||
end
|
||||
end)
|
||||
Event.add(
|
||||
defines.events.on_player_respawned,
|
||||
function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
|
||||
Event.add(defines.events.on_gui_click, function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
local gui = player.gui.left;
|
||||
player.insert {name = 'heavy-armor', count = 1}
|
||||
player.insert {name = 'pistol', count = 1}
|
||||
player.insert {name = 'firearm-magazine', count = 10}
|
||||
player.insert {name = 'shotgun', count = 1}
|
||||
player.insert {name = 'shotgun-shell', count = 10}
|
||||
player.character.character_running_speed_modifier = 0.5
|
||||
end
|
||||
)
|
||||
|
||||
if player.force == game.forces.player and event.element.name == "new_button" then
|
||||
if neForceNear(player.position) then
|
||||
local force = game.create_force(player.name);
|
||||
force.set_spawn_position(player.position, game.surfaces[1]);
|
||||
player.force = force;
|
||||
killBitters(player.position);
|
||||
player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}})
|
||||
player.force.set_ammo_damage_modifier("rocket", -3);
|
||||
player.force.research_all_technologies();
|
||||
gui.new_force.destroy();
|
||||
guiForcePlayer(gui);
|
||||
player.print{"msg.force-created"}
|
||||
printForcePlayer(player)
|
||||
else
|
||||
player.print{"msg.close-position"}
|
||||
Event.add(
|
||||
defines.events.on_rocket_launched,
|
||||
function(event)
|
||||
local force = event.rocket.force
|
||||
if event.rocket.get_item_count('satellite') > 0 then
|
||||
if global.satellite_sent == nil then
|
||||
global.satellite_sent = {}
|
||||
end
|
||||
if global.satellite_sent[force.name] == nil then
|
||||
game.set_game_state {game_finished = true, player_won = true, can_continue = true}
|
||||
global.satellite_sent[force.name] = 1
|
||||
else
|
||||
global.satellite_sent[force.name] = global.satellite_sent[force.name] + 1
|
||||
end
|
||||
for index, player in pairs(force.players) do
|
||||
if player.gui.left.rocket_score == nil then
|
||||
local frame = player.gui.left.add {name = 'rocket_score', type = 'frame', direction = 'horizontal', caption = {'gui.score'}}
|
||||
frame.add {name = 'rocket_count_label', type = 'label', caption = {'', {'gui.rockets-sent'}, ':'}}
|
||||
frame.add {name = 'rocket_count', type = 'label', caption = tostring(global.satellite_sent[force.name])}
|
||||
else
|
||||
player.gui.left.rocket_score.rocket_count.caption = tostring(global.satellite_sent[force.name])
|
||||
end
|
||||
end
|
||||
else
|
||||
for index, player in pairs(force.players) do
|
||||
player.print({'msg.gui-rocket-silo.rocket-launched-without-satellite'})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif event.element.name == "inv_button" then
|
||||
local name = gui.own_force.inv_name.text;
|
||||
if name ~= nil and validPlayer(name) then
|
||||
local iplayer = Game.get_player_by_index(name);
|
||||
local igui = iplayer.gui.left;
|
||||
|
||||
iplayer.force = player.force;
|
||||
iplayer.teleport(player.force.get_spawn_position(game.surfaces[1]));
|
||||
|
||||
igui.new_force.destroy();
|
||||
guiForcePlayer(igui);
|
||||
player.print{"msg.player-invated", name}
|
||||
iplayer.print{"msg.you-invated", player.name}
|
||||
else
|
||||
player.print{"msg.invalid-name"}
|
||||
)
|
||||
|
||||
Event.add(
|
||||
defines.events.on_gui_click,
|
||||
function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
local gui = player.gui.left
|
||||
|
||||
if player.force == game.forces.player and event.element.name == 'new_button' then
|
||||
if neForceNear(player.position) then
|
||||
local force = game.create_force(player.name)
|
||||
force.set_spawn_position(player.position, game.surfaces[1])
|
||||
player.force = force
|
||||
killBitters(player.position)
|
||||
player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}})
|
||||
player.force.set_ammo_damage_modifier('rocket', -3)
|
||||
player.force.research_all_technologies()
|
||||
gui.new_force.destroy()
|
||||
guiForcePlayer(gui)
|
||||
player.print {'msg.force-created'}
|
||||
printForcePlayer(player)
|
||||
else
|
||||
player.print {'msg.close-position'}
|
||||
end
|
||||
elseif event.element.name == 'inv_button' then
|
||||
local name = gui.own_force.inv_name.text
|
||||
if name ~= nil and validPlayer(name) then
|
||||
local iplayer = Game.get_player_by_index(name)
|
||||
local igui = iplayer.gui.left
|
||||
|
||||
iplayer.force = player.force
|
||||
iplayer.teleport(player.force.get_spawn_position(game.surfaces[1]))
|
||||
|
||||
igui.new_force.destroy()
|
||||
guiForcePlayer(igui)
|
||||
player.print {'msg.player-invated', name}
|
||||
iplayer.print {'msg.you-invated', player.name}
|
||||
else
|
||||
player.print {'msg.invalid-name'}
|
||||
end
|
||||
elseif event.element.name == 'leave_button' and gui.own_force.inv_name.text == 'leave' then
|
||||
if #player.force.players == 1 then
|
||||
game.merge_forces(player.force.name, game.forces.player.name)
|
||||
gui.own_force.destroy()
|
||||
guiNewPlayer(gui)
|
||||
player.print {'msg.force-destroyed'}
|
||||
elseif #player.force.players > 1 then
|
||||
player.force = game.forces.player
|
||||
player.character.die()
|
||||
gui.own_force.destroy()
|
||||
guiNewPlayer(gui)
|
||||
player.print {'msg.force-leave'}
|
||||
end
|
||||
elseif event.element.name == 'leave_button' and gui.own_force.inv_name.text ~= 'leave' then
|
||||
player.print {'msg.force-leave-confim'}
|
||||
end
|
||||
end
|
||||
elseif event.element.name == "leave_button" and gui.own_force.inv_name.text == "leave" then
|
||||
if #player.force.players == 1 then
|
||||
game.merge_forces(player.force.name, game.forces.player.name);
|
||||
gui.own_force.destroy();
|
||||
guiNewPlayer(gui);
|
||||
player.print{"msg.force-destroyed"}
|
||||
elseif #player.force.players > 1 then
|
||||
player.force = game.forces.player;
|
||||
player.character.die();
|
||||
gui.own_force.destroy();
|
||||
guiNewPlayer(gui);
|
||||
player.print{"msg.force-leave"}
|
||||
end
|
||||
elseif event.element.name == "leave_button" and gui.own_force.inv_name.text ~= "leave" then
|
||||
player.print{"msg.force-leave-confim"}
|
||||
end
|
||||
end)
|
||||
)
|
||||
|
||||
function neForceNear(pos)
|
||||
for k, v in pairs(game.forces) do
|
||||
if dist(pos, v.get_spawn_position(game.surfaces[1])) <= 50 then
|
||||
return false;
|
||||
for k, v in pairs(game.forces) do
|
||||
if dist(pos, v.get_spawn_position(game.surfaces[1])) <= 50 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true;
|
||||
return true
|
||||
end
|
||||
|
||||
function killBitters(pos)
|
||||
for k, v in pairs(game.surfaces[1].find_entities_filtered({area={{pos.x - 250, pos.y - 250}, {pos.x + 250, pos.y + 250}}, force= "enemy"})) do
|
||||
v.destroy();
|
||||
end
|
||||
for k, v in pairs(game.surfaces[1].find_entities_filtered({area = {{pos.x - 250, pos.y - 250}, {pos.x + 250, pos.y + 250}}, force = 'enemy'})) do
|
||||
v.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function dist(position1, position2)
|
||||
return ((position1.x - position2.x)^2 + (position1.y - position2.y)^2)^0.5
|
||||
return ((position1.x - position2.x) ^ 2 + (position1.y - position2.y) ^ 2) ^ 0.5
|
||||
end
|
||||
|
||||
function validPlayer(name)
|
||||
if name ~= nil and Game.get_player_by_index(name) ~= nil and Game.get_player_by_index(name).force == game.forces.player then
|
||||
return true;
|
||||
end
|
||||
return false;
|
||||
if name ~= nil and Game.get_player_by_index(name) ~= nil and Game.get_player_by_index(name).force == game.forces.player then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function guiNewPlayer(gui)
|
||||
local frame = gui.add{type="frame", name="new_force", caption={"gui.create-force"}, direction="vertical"}
|
||||
frame.add{type="button", name="new_button", caption={"gui.new-force"}}
|
||||
local frame = gui.add {type = 'frame', name = 'new_force', caption = {'gui.create-force'}, direction = 'vertical'}
|
||||
frame.add {type = 'button', name = 'new_button', caption = {'gui.new-force'}}
|
||||
end
|
||||
|
||||
function guiForcePlayer(gui)
|
||||
local frame = gui.add{type="frame", name="own_force", caption={"gui.force"}, direction="vertical"}
|
||||
frame.add{type="textfield", name="inv_name"}
|
||||
frame.add{type="button", name="inv_button", caption={"gui.invite"}}
|
||||
frame.add{type="button", name="leave_button", caption={"gui.leave"}}
|
||||
local frame = gui.add {type = 'frame', name = 'own_force', caption = {'gui.force'}, direction = 'vertical'}
|
||||
frame.add {type = 'textfield', name = 'inv_name'}
|
||||
frame.add {type = 'button', name = 'inv_button', caption = {'gui.invite'}}
|
||||
frame.add {type = 'button', name = 'leave_button', caption = {'gui.leave'}}
|
||||
end
|
||||
|
||||
function printNewPlayer(player)
|
||||
--player.print{"msg.info13"}
|
||||
--player.print{"msg.info14"}
|
||||
player.print{"msg.info1"}
|
||||
player.print{"msg.info2"}
|
||||
player.print{"msg.info3"}
|
||||
player.print{"msg.info4"}
|
||||
player.print{"msg.info5"}
|
||||
--player.print{"msg.info6"}
|
||||
--player.print{"msg.info7"}
|
||||
--player.print{"msg.info8"}
|
||||
--player.print{"msg.info13"}
|
||||
--player.print{"msg.info14"}
|
||||
player.print {'msg.info1'}
|
||||
player.print {'msg.info2'}
|
||||
player.print {'msg.info3'}
|
||||
player.print {'msg.info4'}
|
||||
player.print {'msg.info5'}
|
||||
--player.print{"msg.info6"}
|
||||
--player.print{"msg.info7"}
|
||||
--player.print{"msg.info8"}
|
||||
end
|
||||
|
||||
function printForcePlayer(player)
|
||||
player.print{"msg.info11"}
|
||||
player.print{"msg.info12"}
|
||||
player.print {'msg.info11'}
|
||||
player.print {'msg.info12'}
|
||||
end
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
local b = require "map_gen.shared.builders"
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
local size = 8 * 32
|
||||
|
||||
local concrete = b.tile("concrete")
|
||||
local hazard = b.change_tile(b.rectangle(size - 4, size - 4), true, "hazard-concrete-left")
|
||||
local stone = b.change_tile(b.rectangle(size- 6, size -6), true, "stone-path")
|
||||
local empty = b.rectangle(size-8, size-8)
|
||||
local concrete = b.tile('concrete')
|
||||
local hazard = b.change_tile(b.rectangle(size - 4, size - 4), true, 'hazard-concrete-left')
|
||||
local stone = b.change_tile(b.rectangle(size - 6, size - 6), true, 'stone-path')
|
||||
local empty = b.rectangle(size - 8, size - 8)
|
||||
|
||||
local shape = b.any{stone, hazard, concrete}
|
||||
local shape = b.any {stone, hazard, concrete}
|
||||
shape = b.subtract(shape, empty)
|
||||
|
||||
shape = b.single_pattern(shape, size, size)
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
-- adds some wrecked items around the map, good for MP, reduces total resources pulled from factory, and adds incentive to push out
|
||||
|
||||
local Token = require "utils.global_token"
|
||||
local Token = require 'utils.global_token'
|
||||
|
||||
local 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}
|
||||
{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 entity_list = {
|
||||
{name = "big-ship-wreck-1", chance = 35000, force = "player"},
|
||||
{name = "big-ship-wreck-2", chance = 45000, force = "player"},
|
||||
{name = "big-ship-wreck-3", chance = 55000, force = "player"}
|
||||
{name = 'big-ship-wreck-1', chance = 35000, force = 'player'},
|
||||
{name = 'big-ship-wreck-2', chance = 45000, force = 'player'},
|
||||
{name = 'big-ship-wreck-3', chance = 55000, force = 'player'},
|
||||
}
|
||||
|
||||
local callback =
|
||||
Token.register(
|
||||
function(entity)
|
||||
entity.health = math.random(entity.health)
|
||||
Token.register(
|
||||
function(entity)
|
||||
entity.health = math.random(entity.health)
|
||||
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
end
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
end
|
||||
)
|
||||
|
||||
return function(x, y, world)
|
||||
local ship = entity_list[math.random(#entity_list)]
|
||||
local ship = entity_list[math.random(#entity_list)]
|
||||
|
||||
if math.random(ship.chance) ~= 1 then
|
||||
return nil
|
||||
end
|
||||
if math.random(ship.chance) ~= 1 then
|
||||
return nil
|
||||
end
|
||||
|
||||
ship.callback = callback
|
||||
ship.callback = callback
|
||||
|
||||
return ship
|
||||
return ship
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user