1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00

Merge pull request #189 from grilledham/master

Triangle of death map + tag_group changes
This commit is contained in:
grilledham 2018-06-16 17:39:46 +01:00 committed by GitHub
commit 089344f00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 1971 additions and 686 deletions

View File

@ -19,7 +19,7 @@ require 'bot'
require 'info'
require 'player_list'
require 'poll'
require 'band'
require 'tag_group'
require 'tasklist'
require 'blueprint_helper'
require 'paint'
@ -57,7 +57,7 @@ for _, w in pairs(hodor_messages) do
message_weight_sum = message_weight_sum + w[2]
end
global.naughty_words_enabled = true
global.naughty_words_enabled = false
global.naughty_words = {
['ass'] = true,
['bugger'] = true,
@ -137,7 +137,6 @@ end
Event.add(defines.events.on_player_created, player_joined)
Event.add(defines.events.on_console_chat, hodor)
Event.add(
defines.events.on_player_joined_game,
function(event)

View File

@ -145,14 +145,14 @@ local function pre_player_mined_item(event)
end
local entity_drop_amount = {
['small-biter'] = {low = -62, high = 1},
--[[['small-biter'] = {low = -62, high = 1},
['small-spitter'] = {low = -62, high = 1},
['medium-biter'] = {low = -14, high = 1},
['medium-spitter'] = {low = -14, high = 1},
['big-biter'] = {low = -2, high = 1},
['big-spitter'] = {low = -2, high = 1},
['behemoth-biter'] = {low = 1, high = 1},
['behemoth-spitter'] = {low = 1, high = 1},
['behemoth-spitter'] = {low = 1, high = 1}, ]]
['biter-spawner'] = {low = 5, high = 15},
['spitter-spawner'] = {low = 5, high = 15},
['small-worm-turret'] = {low = 2, high = 8},

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,64,},
{1,29,2,6,1,29,},
{1,29,2,7,1,28,},
{1,28,2,8,1,28,},
{1,27,2,10,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,13,1,25,},
{1,25,2,14,1,25,},
{1,25,2,15,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,23,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,26,1,19,},
{1,18,2,28,1,18,},
{1,18,2,16,1,2,2,10,1,18,},
{1,17,2,16,1,5,2,9,1,17,},
{1,17,2,15,1,7,2,9,1,16,},
{1,16,2,15,1,9,2,8,1,16,},
{1,15,2,15,1,11,2,8,1,15,},
{1,15,2,14,1,13,2,7,1,15,},
{1,14,2,14,1,16,2,6,1,14,},
{1,14,2,13,1,11,2,4,1,3,2,5,1,14,},
{1,13,2,13,1,11,2,4,1,4,2,6,1,13,},
{1,13,2,12,1,11,2,4,1,4,2,7,1,13,},
{1,12,2,12,1,10,2,5,1,4,2,9,1,12,},
{1,11,2,12,1,10,2,5,1,4,2,11,1,11,},
{1,11,2,11,1,10,2,5,1,4,2,12,1,11,},
{1,10,2,11,1,10,2,5,1,4,2,14,1,10,},
{1,10,2,10,1,10,2,5,1,3,2,16,1,10,},
{1,9,2,10,1,10,2,5,1,3,2,18,1,9,},
{1,9,2,9,1,10,2,5,1,3,2,19,1,9,},
{1,8,2,9,1,10,2,5,1,3,2,21,1,8,},
{1,8,2,8,1,10,2,5,1,3,2,23,1,7,},
{1,7,2,9,1,9,2,5,1,3,2,24,1,7,},
{1,6,2,9,1,9,2,5,1,3,2,26,1,6,},
{1,6,2,10,1,7,2,5,1,3,2,27,1,6,},
{1,5,2,11,1,6,2,5,1,3,2,29,1,5,},
{1,5,2,11,1,7,2,3,1,3,2,30,1,5,},
{1,4,2,13,1,11,2,32,1,4,},
{1,4,2,15,1,8,2,33,1,4,},
{1,3,2,18,1,5,2,35,1,3,},
{1,2,2,21,1,2,2,37,1,2,},
{1,2,2,60,1,2,},
{1,1,2,62,1,1,},
{1,1,2,62,1,1,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,1,2,61,1,2,},
{1,64,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,15,1,24,},
{1,24,2,16,1,24,},
{1,24,2,17,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,10,1,4,2,11,1,19,},
{1,19,2,10,1,6,2,10,1,19,},
{1,18,2,10,1,8,2,10,1,18,},
{1,18,2,10,1,8,2,10,1,18,},
{1,17,2,11,1,8,2,11,1,17,},
{1,17,2,11,1,8,2,11,1,17,},
{1,16,2,12,1,8,2,12,1,16,},
{1,16,2,12,1,8,2,13,1,15,},
{1,15,2,13,1,8,2,13,1,15,},
{1,15,2,13,1,8,2,14,1,14,},
{1,14,2,14,1,8,2,14,1,14,},
{1,13,2,15,1,8,2,15,1,13,},
{1,13,2,15,1,8,2,15,1,13,},
{1,12,2,16,1,8,2,16,1,12,},
{1,12,2,16,1,8,2,16,1,12,},
{1,11,2,17,1,8,2,17,1,11,},
{1,11,2,17,1,8,2,18,1,10,},
{1,10,2,18,1,8,2,18,1,10,},
{1,9,2,19,1,8,2,19,1,9,},
{1,9,2,19,1,8,2,19,1,9,},
{1,8,2,21,1,6,2,21,1,8,},
{1,8,2,21,1,6,2,21,1,8,},
{1,7,2,24,1,2,2,24,1,7,},
{1,7,2,51,1,6,},
{1,6,2,52,1,6,},
{1,5,2,24,1,6,2,24,1,5,},
{1,5,2,23,1,8,2,23,1,5,},
{1,4,2,24,1,8,2,24,1,4,},
{1,4,2,24,1,8,2,24,1,4,},
{1,3,2,25,1,8,2,25,1,3,},
{1,3,2,25,1,8,2,25,1,3,},
{1,2,2,27,1,6,2,27,1,2,},
{1,1,2,29,1,4,2,29,1,1,},
{1,1,2,62,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,61,1,2,},
{1,64,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,19,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,27,1,18,},
{1,18,2,28,1,18,},
{1,18,2,29,1,17,},
{1,17,2,30,1,17,},
{1,16,2,6,1,2,2,16,1,2,2,6,1,16,},
{1,16,2,5,1,4,2,14,1,4,2,5,1,16,},
{1,15,2,5,1,6,2,12,1,6,2,5,1,15,},
{1,15,2,4,1,8,2,10,1,8,2,4,1,15,},
{1,14,2,4,1,10,2,8,1,10,2,4,1,14,},
{1,14,2,3,1,12,2,6,1,12,2,4,1,13,},
{1,13,2,5,1,12,2,4,1,12,2,5,1,13,},
{1,12,2,7,1,12,2,2,1,12,2,7,1,12,},
{1,12,2,8,1,24,2,8,1,12,},
{1,11,2,10,1,22,2,10,1,11,},
{1,11,2,11,1,20,2,11,1,11,},
{1,10,2,13,1,18,2,13,1,10,},
{1,10,2,14,1,16,2,15,1,9,},
{1,9,2,16,1,14,2,16,1,9,},
{1,8,2,17,1,14,2,17,1,8,},
{1,8,2,17,1,14,2,17,1,8,},
{1,7,2,17,1,16,2,17,1,7,},
{1,7,2,16,1,18,2,16,1,7,},
{1,6,2,16,1,20,2,16,1,6,},
{1,6,2,15,1,22,2,15,1,6,},
{1,5,2,15,1,24,2,15,1,5,},
{1,5,2,14,1,12,2,2,1,12,2,15,1,4,},
{1,4,2,14,1,12,2,4,1,12,2,14,1,4,},
{1,3,2,14,1,12,2,6,1,12,2,14,1,3,},
{1,3,2,15,1,10,2,8,1,10,2,15,1,3,},
{1,2,2,17,1,8,2,10,1,8,2,17,1,2,},
{1,2,2,18,1,6,2,12,1,6,2,18,1,2,},
{1,1,2,20,1,4,2,14,1,4,2,20,1,1,},
{1,1,2,21,1,2,2,16,1,2,2,22,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,5,1,29,},
{1,30,2,6,1,28,},
{1,29,2,8,1,27,},
{1,28,2,9,1,27,},
{1,28,2,10,1,26,},
{1,27,2,11,1,26,},
{1,27,2,12,1,25,},
{1,26,2,13,1,25,},
{1,26,2,14,1,24,},
{1,25,2,15,1,24,},
{1,24,2,17,1,23,},
{1,24,2,18,1,22,},
{1,23,2,19,1,22,},
{1,23,2,20,1,21,},
{1,22,2,21,1,21,},
{1,22,2,22,1,20,},
{1,21,2,6,1,3,2,6,1,2,2,6,1,20,},
{1,21,2,6,1,3,2,5,1,4,2,6,1,19,},
{1,20,2,7,1,3,2,5,1,4,2,7,1,18,},
{1,19,2,8,1,3,2,5,1,4,2,7,1,18,},
{1,19,2,8,1,3,2,5,1,4,2,8,1,17,},
{1,18,2,9,1,3,2,5,1,4,2,8,1,17,},
{1,18,2,9,1,4,2,4,1,4,2,9,1,16,},
{1,17,2,6,1,20,2,5,1,16,},
{1,17,2,6,1,20,2,6,1,15,},
{1,16,2,8,1,18,2,8,1,14,},
{1,15,2,9,1,17,2,9,1,14,},
{1,15,2,9,1,17,2,10,1,13,},
{1,14,2,10,1,17,2,10,1,13,},
{1,14,2,10,1,17,2,11,1,12,},
{1,13,2,11,1,17,2,11,1,12,},
{1,13,2,11,1,17,2,12,1,11,},
{1,12,2,13,1,16,2,13,1,10,},
{1,11,2,14,1,15,2,14,1,10,},
{1,11,2,20,1,4,2,20,1,9,},
{1,10,2,21,1,3,2,21,1,9,},
{1,10,2,21,1,3,2,22,1,8,},
{1,9,2,22,1,3,2,22,1,8,},
{1,9,2,22,1,3,2,23,1,7,},
{1,8,2,23,1,3,2,23,1,7,},
{1,7,2,24,1,3,2,24,1,6,},
{1,7,2,24,1,3,2,25,1,5,},
{1,6,2,25,1,3,2,25,1,5,},
{1,6,2,25,1,3,2,26,1,4,},
{1,5,2,26,1,3,2,10,1,3,2,13,1,4,},
{1,5,2,26,1,4,2,8,1,4,2,14,1,3,},
{1,4,2,27,1,4,2,8,1,4,2,14,1,3,},
{1,3,2,29,1,5,2,4,1,5,2,16,1,2,},
{1,3,2,29,1,14,2,17,1,1,},
{1,2,2,31,1,12,2,18,1,1,},
{1,2,2,32,1,10,2,20,},
{1,1,2,35,1,6,2,22,},
{1,1,2,63,},
{1,1,2,63,},
{1,1,2,63,},
{1,1,2,63,},
{1,2,2,62,},
{1,4,2,58,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,64,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,8,1,28,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,26,2,13,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,21,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,26,1,19,},
{1,18,2,11,1,8,2,9,1,18,},
{1,18,2,11,1,9,2,9,1,17,},
{1,17,2,11,1,9,2,10,1,17,},
{1,16,2,12,1,9,2,11,1,16,},
{1,16,2,12,1,8,2,12,1,16,},
{1,15,2,12,1,9,2,13,1,15,},
{1,15,2,12,1,8,2,14,1,15,},
{1,14,2,12,1,9,2,15,1,14,},
{1,14,2,12,1,8,2,16,1,14,},
{1,13,2,13,1,8,2,17,1,13,},
{1,13,2,12,1,8,2,19,1,12,},
{1,12,2,13,1,16,2,11,1,12,},
{1,11,2,14,1,15,2,13,1,11,},
{1,11,2,13,1,15,2,14,1,11,},
{1,10,2,14,1,14,2,16,1,10,},
{1,10,2,14,1,14,2,16,1,10,},
{1,9,2,14,1,14,2,18,1,9,},
{1,9,2,21,1,6,2,20,1,8,},
{1,8,2,21,1,6,2,21,1,8,},
{1,7,2,22,1,6,2,22,1,7,},
{1,7,2,22,1,5,2,23,1,7,},
{1,6,2,22,1,5,2,25,1,6,},
{1,6,2,22,1,4,2,26,1,6,},
{1,5,2,23,1,4,2,27,1,5,},
{1,5,2,23,1,3,2,28,1,5,},
{1,4,2,23,1,3,2,30,1,4,},
{1,3,2,24,1,2,2,32,1,3,},
{1,3,2,24,1,2,2,32,1,3,},
{1,2,2,24,1,2,2,34,1,2,},
{1,2,2,24,1,1,2,35,1,2,},
{1,1,2,62,1,1,},
{1,1,2,62,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,17,1,23,},
{1,23,2,18,1,23,},
{1,23,2,19,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,25,1,19,},
{1,19,2,26,1,19,},
{1,19,2,27,1,18,},
{1,18,2,28,1,18,},
{1,17,2,14,1,2,2,14,1,17,},
{1,17,2,13,1,4,2,13,1,17,},
{1,16,2,14,1,4,2,14,1,16,},
{1,16,2,14,1,5,2,13,1,16,},
{1,15,2,14,1,6,2,14,1,15,},
{1,15,2,14,1,6,2,15,1,14,},
{1,14,2,14,1,8,2,14,1,14,},
{1,13,2,15,1,8,2,15,1,13,},
{1,13,2,14,1,3,2,1,1,6,2,14,1,13,},
{1,12,2,15,1,3,2,1,1,6,2,15,1,12,},
{1,12,2,14,1,3,2,2,1,7,2,14,1,12,},
{1,11,2,15,1,3,2,2,1,7,2,15,1,11,},
{1,11,2,14,1,3,2,2,1,9,2,15,1,10,},
{1,10,2,15,1,3,2,2,1,10,2,14,1,10,},
{1,10,2,14,1,3,2,3,1,10,2,15,1,9,},
{1,9,2,15,1,3,2,3,1,11,2,14,1,9,},
{1,8,2,15,1,4,2,3,1,11,2,15,1,8,},
{1,8,2,15,1,3,2,4,1,11,2,15,1,8,},
{1,7,2,16,1,3,2,5,1,11,2,15,1,7,},
{1,7,2,16,1,3,2,5,1,11,2,15,1,7,},
{1,6,2,17,1,3,2,5,1,10,2,17,1,6,},
{1,6,2,17,1,4,2,4,1,10,2,18,1,5,},
{1,5,2,18,1,4,2,3,1,11,2,18,1,5,},
{1,4,2,20,1,16,2,20,1,4,},
{1,4,2,21,1,15,2,20,1,4,},
{1,3,2,23,1,13,2,22,1,3,},
{1,3,2,24,1,10,2,24,1,3,},
{1,2,2,27,1,6,2,27,1,2,},
{1,2,2,61,1,1,},
{1,1,2,62,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,19,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,27,1,18,},
{1,18,2,28,1,18,},
{1,17,2,6,1,15,2,9,1,17,},
{1,17,2,5,1,17,2,2,1,2,2,4,1,17,},
{1,16,2,6,1,17,2,3,1,2,2,4,1,16,},
{1,16,2,6,1,17,2,3,1,3,2,3,1,16,},
{1,15,2,7,1,3,2,11,1,3,2,4,1,3,2,3,1,15,},
{1,15,2,7,1,3,2,11,1,3,2,4,1,4,2,2,1,15,},
{1,14,2,8,1,3,2,11,1,3,2,4,1,4,2,3,1,14,},
{1,14,2,8,1,3,2,11,1,3,2,4,1,4,2,4,1,13,},
{1,13,2,9,1,3,2,11,1,3,2,5,1,3,2,4,1,13,},
{1,12,2,10,1,3,2,11,1,3,2,6,1,2,2,5,1,12,},
{1,12,2,10,1,3,2,11,1,5,2,5,1,1,2,5,1,12,},
{1,11,2,11,1,20,2,4,1,1,2,6,1,11,},
{1,11,2,11,1,17,2,1,1,2,2,4,1,1,2,6,1,11,},
{1,10,2,12,1,17,2,2,1,1,2,4,1,1,2,7,1,10,},
{1,10,2,12,1,17,2,2,1,1,2,4,1,1,2,8,1,9,},
{1,9,2,13,1,17,2,2,1,1,2,4,1,1,2,8,1,9,},
{1,8,2,14,1,17,2,2,1,1,2,4,1,1,2,9,1,8,},
{1,8,2,14,1,17,2,2,1,1,2,4,1,1,2,9,1,8,},
{1,7,2,15,1,17,2,2,1,1,2,4,1,1,2,10,1,7,},
{1,7,2,15,1,17,2,2,1,1,2,4,1,1,2,10,1,7,},
{1,6,2,16,1,17,2,2,1,1,2,4,1,1,2,11,1,6,},
{1,6,2,16,1,17,2,2,1,1,2,4,1,1,2,11,1,6,},
{1,5,2,17,1,17,2,2,1,2,2,2,1,2,2,12,1,5,},
{1,4,2,18,1,17,2,3,1,4,2,14,1,4,},
{1,4,2,18,1,17,2,21,1,4,},
{1,3,2,19,1,17,2,22,1,3,},
{1,3,2,17,1,21,2,20,1,3,},
{1,2,2,18,1,21,2,21,1,2,},
{1,2,2,18,1,21,2,21,1,2,},
{1,1,2,19,1,21,2,22,1,1,},
{1,1,2,63,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,3,2,58,1,3,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,19,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,27,1,18,},
{1,18,2,28,1,18,},
{1,17,2,30,1,17,},
{1,17,2,13,1,4,2,13,1,17,},
{1,16,2,14,1,4,2,14,1,16,},
{1,16,2,14,1,4,2,14,1,16,},
{1,15,2,7,1,3,2,3,1,8,2,4,1,2,2,7,1,15,},
{1,15,2,6,1,22,2,6,1,15,},
{1,14,2,7,1,22,2,7,1,14,},
{1,14,2,8,1,20,2,9,1,13,},
{1,13,2,10,1,18,2,10,1,13,},
{1,12,2,10,1,20,2,10,1,12,},
{1,12,2,10,1,20,2,10,1,12,},
{1,11,2,10,1,8,2,6,1,8,2,10,1,11,},
{1,11,2,10,1,7,2,8,1,7,2,10,1,11,},
{1,10,2,8,1,10,2,8,1,10,2,8,1,10,},
{1,10,2,8,1,10,2,8,1,10,2,9,1,9,},
{1,9,2,9,1,10,2,8,1,10,2,9,1,9,},
{1,8,2,10,1,10,2,8,1,10,2,10,1,8,},
{1,8,2,14,1,7,2,7,1,7,2,13,1,8,},
{1,7,2,15,1,8,2,4,1,8,2,15,1,7,},
{1,7,2,15,1,20,2,15,1,7,},
{1,6,2,17,1,18,2,17,1,6,},
{1,6,2,16,1,20,2,16,1,6,},
{1,5,2,17,1,21,2,16,1,5,},
{1,4,2,17,1,22,2,17,1,4,},
{1,4,2,18,1,3,2,2,1,10,2,2,1,3,2,18,1,4,},
{1,3,2,20,1,1,2,6,1,5,2,5,1,1,2,20,1,3,},
{1,3,2,27,1,4,2,27,1,3,},
{1,2,2,28,1,4,2,28,1,2,},
{1,2,2,28,1,4,2,28,1,2,},
{1,1,2,62,1,1,},
{1,1,2,63,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,3,2,58,1,3,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,5,1,29,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,17,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,25,1,19,},
{1,19,2,26,1,19,},
{1,19,2,27,1,18,},
{1,18,2,28,1,18,},
{1,17,2,30,1,17,},
{1,17,2,30,1,17,},
{1,16,2,32,1,16,},
{1,16,2,32,1,16,},
{1,15,2,34,1,15,},
{1,15,2,11,1,1,2,23,1,14,},
{1,14,2,8,1,1,2,3,1,13,2,2,1,2,2,7,1,14,},
{1,13,2,8,1,2,2,3,1,13,2,2,1,2,2,8,1,13,},
{1,13,2,7,1,3,2,3,1,3,2,6,1,3,2,3,1,3,2,7,1,13,},
{1,12,2,8,1,3,2,3,1,3,2,7,1,2,2,4,1,2,2,8,1,12,},
{1,12,2,7,1,4,2,3,1,2,2,8,1,2,2,4,1,3,2,7,1,12,},
{1,11,2,8,1,4,2,3,1,2,2,8,1,2,2,4,1,4,2,7,1,11,},
{1,11,2,7,1,4,2,4,1,3,2,6,1,3,2,4,1,4,2,8,1,10,},
{1,10,2,8,1,4,2,4,1,5,2,2,1,5,2,4,1,5,2,7,1,10,},
{1,9,2,8,1,5,2,4,1,12,2,4,1,5,2,8,1,9,},
{1,9,2,8,1,5,2,4,1,12,2,4,1,5,2,8,1,9,},
{1,8,2,9,1,5,2,4,1,12,2,4,1,5,2,9,1,8,},
{1,8,2,9,1,5,2,4,1,13,2,3,1,5,2,9,1,8,},
{1,7,2,10,1,5,2,3,1,14,2,3,1,5,2,10,1,7,},
{1,7,2,10,1,5,2,3,1,14,2,4,1,4,2,10,1,7,},
{1,6,2,11,1,4,2,4,1,14,2,4,1,4,2,11,1,6,},
{1,5,2,12,1,4,2,4,1,14,2,4,1,4,2,12,1,5,},
{1,5,2,12,1,4,2,4,1,15,2,3,1,4,2,12,1,5,},
{1,4,2,13,1,3,2,5,1,15,2,4,1,3,2,13,1,4,},
{1,4,2,13,1,3,2,4,1,16,2,4,1,3,2,13,1,4,},
{1,3,2,14,1,3,2,4,1,16,2,4,1,3,2,14,1,3,},
{1,3,2,14,1,3,2,4,1,16,2,4,1,3,2,14,1,3,},
{1,2,2,15,1,2,2,5,1,17,2,4,1,2,2,15,1,2,},
{1,1,2,16,1,2,2,5,1,17,2,4,1,2,2,16,1,1,},
{1,1,2,16,1,2,2,4,1,2,2,15,1,1,2,4,1,2,2,16,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,5,1,29,},
{1,29,2,7,1,28,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,15,1,24,},
{1,24,2,16,1,24,},
{1,24,2,17,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,25,1,19,},
{1,19,2,26,1,19,},
{1,18,2,28,1,18,},
{1,18,2,28,1,18,},
{1,17,2,8,1,11,2,11,1,17,},
{1,17,2,6,1,13,2,11,1,17,},
{1,16,2,7,1,13,2,12,1,16,},
{1,16,2,7,1,13,2,13,1,15,},
{1,15,2,8,1,14,2,12,1,15,},
{1,15,2,7,1,18,2,10,1,14,},
{1,14,2,6,1,9,2,6,1,6,2,9,1,14,},
{1,13,2,6,1,8,2,10,1,5,2,9,1,13,},
{1,13,2,6,1,8,2,11,1,4,2,9,1,13,},
{1,12,2,7,1,16,2,3,1,4,2,10,1,12,},
{1,12,2,7,1,16,2,3,1,4,2,11,1,11,},
{1,11,2,8,1,22,2,12,1,11,},
{1,11,2,8,1,22,2,13,1,10,},
{1,10,2,9,1,27,2,8,1,10,},
{1,9,2,13,1,25,2,8,1,9,},
{1,9,2,13,1,25,2,8,1,9,},
{1,8,2,14,1,21,2,1,1,3,2,9,1,8,},
{1,8,2,14,1,18,2,5,1,2,2,9,1,8,},
{1,7,2,15,1,17,2,6,1,1,2,11,1,7,},
{1,7,2,15,1,17,2,19,1,6,},
{1,6,2,16,1,16,2,20,1,6,},
{1,5,2,17,1,17,2,20,1,5,},
{1,5,2,17,1,17,2,3,1,2,2,15,1,5,},
{1,4,2,18,1,22,2,16,1,4,},
{1,4,2,19,1,12,2,1,1,7,2,17,1,4,},
{1,3,2,21,1,6,2,7,1,5,2,19,1,3,},
{1,3,2,22,1,4,2,9,1,2,2,22,1,2,},
{1,2,2,60,1,2,},
{1,1,2,62,1,1,},
{1,1,2,62,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,59,1,3,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,8,1,28,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,26,2,13,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,16,1,24,},
{1,23,2,18,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,21,1,21,},
{1,21,2,22,1,21,},
{1,21,2,23,1,20,},
{1,20,2,24,1,20,},
{1,19,2,26,1,19,},
{1,19,2,26,1,19,},
{1,18,2,8,1,2,2,8,1,2,2,8,1,18,},
{1,18,2,8,1,2,2,8,1,2,2,9,1,17,},
{1,17,2,8,1,3,2,8,1,3,2,8,1,17,},
{1,17,2,8,1,3,2,8,1,3,2,9,1,16,},
{1,16,2,9,1,4,2,6,1,4,2,9,1,16,},
{1,15,2,10,1,14,2,10,1,15,},
{1,15,2,10,1,14,2,10,1,15,},
{1,14,2,11,1,14,2,11,1,14,},
{1,14,2,12,1,12,2,12,1,14,},
{1,13,2,14,1,10,2,14,1,13,},
{1,13,2,15,1,8,2,16,1,12,},
{1,12,2,16,1,8,2,16,1,12,},
{1,11,2,17,1,8,2,17,1,11,},
{1,11,2,17,1,8,2,17,1,11,},
{1,10,2,18,1,8,2,18,1,10,},
{1,10,2,18,1,8,2,18,1,10,},
{1,9,2,19,1,8,2,19,1,9,},
{1,9,2,19,1,8,2,20,1,8,},
{1,8,2,20,1,8,2,20,1,8,},
{1,8,2,20,1,8,2,21,1,7,},
{1,7,2,21,1,8,2,21,1,7,},
{1,6,2,22,1,8,2,22,1,6,},
{1,6,2,21,1,10,2,21,1,6,},
{1,5,2,21,1,12,2,21,1,5,},
{1,5,2,21,1,12,2,21,1,5,},
{1,4,2,21,1,14,2,21,1,4,},
{1,4,2,21,1,14,2,22,1,3,},
{1,3,2,22,1,4,2,6,1,4,2,22,1,3,},
{1,2,2,23,1,4,2,7,1,3,2,23,1,2,},
{1,2,2,23,1,3,2,8,1,3,2,23,1,2,},
{1,1,2,24,1,3,2,8,1,3,2,24,1,1,},
{1,1,2,25,1,2,2,8,1,2,2,25,1,1,},
{2,27,1,1,2,8,1,1,2,27,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,30,2,4,1,30,},
{1,29,2,6,1,29,},
{1,28,2,8,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,26,2,12,1,26,},
{1,26,2,12,1,26,},
{1,25,2,14,1,25,},
{1,25,2,14,1,25,},
{1,24,2,16,1,24,},
{1,24,2,17,1,23,},
{1,23,2,18,1,23,},
{1,22,2,20,1,22,},
{1,22,2,20,1,22,},
{1,21,2,22,1,21,},
{1,21,2,22,1,21,},
{1,20,2,24,1,20,},
{1,20,2,25,1,19,},
{1,19,2,26,1,19,},
{1,19,2,11,1,5,2,11,1,18,},
{1,18,2,12,1,5,2,11,1,18,},
{1,17,2,13,1,5,2,12,1,17,},
{1,17,2,10,1,10,2,10,1,17,},
{1,16,2,8,1,16,2,8,1,16,},
{1,16,2,7,1,18,2,7,1,16,},
{1,15,2,8,1,18,2,8,1,15,},
{1,15,2,8,1,8,2,5,1,5,2,9,1,14,},
{1,14,2,9,1,7,2,6,1,5,2,9,1,14,},
{1,13,2,10,1,7,2,5,1,6,2,10,1,13,},
{1,13,2,10,1,6,2,6,1,6,2,10,1,13,},
{1,12,2,11,1,6,2,5,1,7,2,11,1,12,},
{1,12,2,11,1,6,2,5,1,7,2,11,1,12,},
{1,11,2,12,1,5,2,6,1,7,2,12,1,11,},
{1,11,2,12,1,5,2,5,1,8,2,13,1,10,},
{1,10,2,13,1,5,2,10,1,3,2,13,1,10,},
{1,9,2,14,1,4,2,10,1,4,2,14,1,9,},
{1,9,2,14,1,4,2,9,1,5,2,14,1,9,},
{1,8,2,15,1,4,2,9,1,5,2,15,1,8,},
{1,8,2,15,1,8,2,4,1,6,2,15,1,8,},
{1,7,2,16,1,7,2,4,1,7,2,16,1,7,},
{1,7,2,16,1,7,2,3,1,8,2,16,1,7,},
{1,6,2,17,1,7,2,2,1,9,2,17,1,6,},
{1,5,2,18,1,6,2,3,1,9,2,18,1,5,},
{1,5,2,18,1,6,2,2,1,10,2,18,1,5,},
{1,4,2,19,1,6,2,1,1,11,2,19,1,4,},
{1,4,2,19,1,5,2,1,1,12,2,19,1,4,},
{1,3,2,20,1,5,2,1,1,12,2,20,1,3,},
{1,3,2,20,1,18,2,20,1,3,},
{1,2,2,22,1,17,2,21,1,2,},
{1,1,2,23,1,16,2,23,1,1,},
{1,1,2,24,1,14,2,24,1,1,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{2,64,},
{1,1,2,62,1,1,},
{1,2,2,60,1,2,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,71 @@
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 64,
width = 64,
data = {
{1,64,},
{1,64,},
{1,64,},
{1,31,2,3,1,30,},
{1,29,2,6,1,29,},
{1,29,2,7,1,28,},
{1,28,2,9,1,27,},
{1,27,2,10,1,27,},
{1,27,2,11,1,26,},
{1,26,2,12,1,26,},
{1,26,2,13,1,25,},
{1,25,2,15,1,24,},
{1,25,2,15,1,24,},
{1,24,2,17,1,23,},
{1,24,2,17,1,23,},
{1,23,2,19,1,22,},
{1,22,2,6,1,10,2,4,1,22,},
{1,22,2,4,1,14,2,3,1,21,},
{1,21,2,4,1,3,2,10,1,3,2,3,1,20,},
{1,21,2,4,1,2,2,12,1,2,2,3,1,20,},
{1,20,2,10,1,6,2,9,1,19,},
{1,20,2,8,1,9,2,8,1,19,},
{1,19,2,9,1,2,2,6,1,1,2,9,1,18,},
{1,18,2,28,1,18,},
{1,18,2,13,1,3,2,13,1,17,},
{1,17,2,14,1,3,2,14,1,16,},
{1,17,2,31,1,16,},
{1,16,2,33,1,15,},
{1,16,2,8,1,1,2,14,1,1,2,9,1,15,},
{1,15,2,8,1,2,2,14,1,2,2,9,1,14,},
{1,15,2,7,1,2,2,16,1,2,2,8,1,14,},
{1,14,2,7,1,2,2,18,1,2,2,8,1,13,},
{1,13,2,7,1,3,2,18,1,3,2,8,1,12,},
{1,13,2,6,1,4,2,3,1,13,2,2,1,4,2,7,1,12,},
{1,12,2,8,1,3,2,2,1,5,2,3,1,7,2,1,1,3,2,9,1,11,},
{1,12,2,9,1,7,2,4,1,2,2,3,1,6,2,10,1,11,},
{1,11,2,10,1,6,2,4,1,2,2,5,1,5,2,11,1,10,},
{1,11,2,4,1,2,2,5,1,6,2,3,1,2,2,6,1,3,2,12,1,10,},
{1,10,2,6,1,2,2,4,1,4,2,2,1,9,2,2,1,4,2,4,1,1,2,7,1,9,},
{1,10,2,7,1,2,2,2,1,5,2,6,1,1,2,3,1,8,2,2,1,2,2,8,1,8,},
{1,9,2,9,1,1,2,2,1,5,2,6,1,2,2,4,1,6,2,1,1,2,2,9,1,8,},
{1,8,2,10,1,2,2,1,1,6,2,4,1,2,2,4,1,9,2,11,1,7,},
{1,8,2,10,1,11,2,1,1,2,2,4,1,10,2,11,1,7,},
{1,7,2,11,1,29,2,11,1,6,},
{1,7,2,11,1,29,2,11,1,6,},
{1,6,2,12,1,29,2,12,1,5,},
{1,6,2,13,1,27,2,13,1,5,},
{1,5,2,17,1,21,2,17,1,4,},
{1,4,2,18,1,21,2,18,1,3,},
{1,4,2,18,1,20,2,19,1,3,},
{1,3,2,19,1,20,2,20,1,2,},
{1,3,2,19,1,20,2,20,1,2,},
{1,2,2,21,1,19,2,21,1,1,},
{1,2,2,21,1,19,2,21,1,1,},
{1,1,2,23,1,17,2,23,},
{2,25,1,15,2,24,},
{2,26,1,13,2,25,},
{2,26,1,12,2,26,},
{2,27,1,10,2,27,},
{1,1,2,63,},
{1,2,2,61,1,1,},
{1,64,},
{1,64,},
{1,64,},
}
})

View File

@ -0,0 +1,286 @@
local b = require 'map_gen.shared.builders'
local Random = require 'map_gen.shared.random'
local Perlin = require 'map_gen.shared.perlin_noise'
local Token = require 'utils.global_token'
-- change these to change the pattern.
local seed1 = 6000
local seed2 = 12000
local perlin_seed = 420420
local function square(x, y)
return x > 0 and y > 0
end
square = b.rotate(square, degrees(-45))
square = b.scale(square, 5 / 12, 1)
local map = b.translate(square, 0, -10)
local sea = b.translate(map, 0, -6)
sea = b.change_tile(sea, true, 'water')
sea = b.fish(sea, 0.075)
map = b.any {map, sea}
local icons = {
b.picture(require 'map_gen.data.presets.ammo-icon'),
b.picture(require 'map_gen.data.presets.danger-icon'),
b.picture(require 'map_gen.data.presets.destroyed-icon'),
b.picture(require 'map_gen.data.presets.electricity-icon'),
b.picture(require 'map_gen.data.presets.electricity-icon-unplugged'),
b.picture(require 'map_gen.data.presets.fluid-icon'),
b.picture(require 'map_gen.data.presets.fuel-icon'),
b.picture(require 'map_gen.data.presets.no-building-material-icon'),
b.picture(require 'map_gen.data.presets.no-storage-space-icon'),
b.picture(require 'map_gen.data.presets.not-enough-construction-robots-icon'),
b.picture(require 'map_gen.data.presets.not-enough-repair-packs-icon'),
b.picture(require 'map_gen.data.presets.recharge-icon'),
b.picture(require 'map_gen.data.presets.too-far-from-roboport-icon')
}
local icons_count = #icons
local value = b.manhattan_value
local function non_transform(shape)
return shape
end
local function uranium_transform(shape)
return b.scale(shape, 0.5)
end
local function oil_transform(shape)
shape = b.scale(shape, 0.5)
return b.throttle_world_xy(shape, 1, 4, 1, 4)
end
local function empty_transform()
return b.empty_shape
end
local ores = {
{transform = non_transform, resource = 'iron-ore', value = value(500, 0.1), weight = 16},
{transform = non_transform, resource = 'copper-ore', value = value(400, 0.1), weight = 10},
{transform = non_transform, resource = 'stone', value = value(250, 0.1), weight = 3},
{transform = non_transform, resource = 'coal', value = value(400, 0.1), weight = 5},
{transform = uranium_transform, resource = 'uranium-ore', value = value(200, 0.1), weight = 3},
{transform = oil_transform, resource = 'crude-oil', value = value(100000, 50), weight = 6},
{transform = empty_transform, weight = 100}
}
local random = Random.new(seed1, seed2)
local total_weights = {}
local t = 0
for _, v in ipairs(ores) do
t = t + v.weight
table.insert(total_weights, t)
end
local p_cols = 50
local p_rows = 50
local pattern = {}
for _ = 1, p_rows do
local row = {}
table.insert(pattern, row)
for _ = 1, p_cols do
local shape = icons[random:next_int(1, icons_count)]
local i = random:next_int(1, t)
local index = table.binary_search(total_weights, i)
if (index < 0) then
index = bit32.bnot(index)
end
local ore_data = ores[index]
shape = ore_data.transform(shape)
local ore = b.resource(shape, ore_data.resource, ore_data.value)
table.insert(row, ore)
end
end
local ore_shape = b.project_pattern(pattern, 96, 1.1, 50, 50)
ore_shape = b.scale(ore_shape, 0.2)
local start_ore = icons[2]
local start_iron = b.resource(start_ore, 'iron-ore', value(600, 0))
local start_copper = b.resource(start_ore, 'copper-ore', value(600, 0))
local start_coal = b.resource(start_ore, 'coal', value(1300, 0))
local start_stone = b.resource(start_ore, 'stone', value(900, 0))
start_ore = b.segment_pattern({start_coal, start_stone, start_copper, start_iron})
start_ore = b.translate(start_ore, 0, 64)
ore_shape = b.choose(b.rectangle(224, 224), start_ore, ore_shape)
local item_pool = {
{name = 'firearm-magazine', count = 200, weight = 1250},
{name = 'land-mine', count = 100, weight = 250},
{name = 'shotgun-shell', count = 200, weight = 1250},
{name = 'piercing-rounds-magazine', count = 200, weight = 833.3333},
{name = 'science-pack-1', count = 200, weight = 100},
{name = 'science-pack-2', count = 200, weight = 100},
{name = 'grenade', count = 100, weight = 500},
{name = 'defender-capsule', count = 50, weight = 500},
{name = 'railgun-dart', count = 100, weight = 500},
{name = 'piercing-shotgun-shell', count = 200, weight = 312.5},
{name = 'steel-axe', count = 5, weight = 166.6667},
{name = 'submachine-gun', count = 1, weight = 166.6667},
{name = 'shotgun', count = 1, weight = 166.6667},
{name = 'uranium-rounds-magazine', count = 200, weight = 166.6667},
{name = 'cannon-shell', count = 100, weight = 166.6667},
{name = 'rocket', count = 100, weight = 166.6667},
{name = 'distractor-capsule', count = 25, weight = 166.6667},
{name = 'railgun', count = 1, weight = 100},
{name = 'flamethrower-ammo', count = 50, weight = 100},
{name = 'military-science-pack', count = 200, weight = 100},
{name = 'science-pack-3', count = 200, weight = 100},
{name = 'explosive-rocket', count = 100, weight = 100},
{name = 'explosive-cannon-shell', count = 100, weight = 100},
{name = 'cluster-grenade', count = 100, weight = 100},
{name = 'poison-capsule', count = 100, weight = 100},
{name = 'slowdown-capsule', count = 100, weight = 100},
{name = 'construction-robot', count = 50, weight = 100},
{name = 'solar-panel-equipment', count = 5, weight = 833.3333},
{name = 'artillery-targeting-remote', count = 1, weight = 50},
{name = 'tank-flamethrower', count = 1, weight = 33.3333},
{name = 'explosive-uranium-cannon-shell', count = 100, weight = 33.3333},
{name = 'destroyer-capsule', count = 10, weight = 33.3333},
{name = 'artillery-shell', count = 10, weight = 25},
{name = 'battery-equipment', count = 5, weight = 25},
{name = 'night-vision-equipment', count = 2, weight = 25},
{name = 'exoskeleton-equipment', count = 2, weight = 166.6667},
{name = 'rocket-launcher', count = 1, weight = 14.2857},
{name = 'combat-shotgun', count = 1, weight = 10},
{name = 'flamethrower', count = 1, weight = 10},
{name = 'tank-cannon', count = 1, weight = 10},
{name = 'modular-armor', count = 1, weight = 100},
{name = 'belt-immunity-equipment', count = 1, weight = 10},
{name = 'personal-roboport-equipment', count = 1, weight = 100},
{name = 'energy-shield-equipment', count = 2, weight = 100},
{name = 'personal-laser-defense-equipment', count = 2, weight = 100},
{name = 'battery-mk2-equipment', count = 1, weight = 40},
{name = 'tank-machine-gun', count = 1, weight = 3.3333},
{name = 'power-armor', count = 1, weight = 33.3333},
{name = 'fusion-reactor-equipment', count = 1, weight = 33.3333},
{name = 'production-science-pack', count = 200, weight = 100},
{name = 'high-tech-science-pack', count = 200, weight = 100},
{name = 'artillery-turret', count = 1, weight = 2.5},
{name = 'artillery-wagon-cannon', count = 1, weight = 1},
{name = 'atomic-bomb', count = 1, weight = 1},
{name = 'space-science-pack', count = 200, weight = 10}
}
local total_weights = {}
local t = 0
for _, v in ipairs(item_pool) do
t = t + v.weight
table.insert(total_weights, t)
end
local callback =
Token.register(
function(entity, data)
local count = math.random(3, 8)
for _ = 1, count do
local i = math.random() ^ data * t
local index = table.binary_search(total_weights, i)
if (index < 0) then
index = bit32.bnot(index)
end
local loot = item_pool[index]
entity.insert(loot)
end
end
)
local loot_power = 500
local function loot(x, y)
if math.random(4096) ~= 1 then
return nil
end
local d = math.sqrt(x * x + y * y)
local name
if d < 600 then
name = 'car'
else
if math.random(5) == 1 then
name = 'tank'
else
name = 'car'
end
end
-- neutral stops the biters attacking them.
local entity = {name = name, force = 'neutral', callback = callback, data = loot_power / d}
return entity
end
local worm_names = {'small-worm-turret', 'medium-worm-turret', 'big-worm-turret'}
local spawner_names = {'biter-spawner', 'spitter-spawner'}
local factor = 8 / (1024 * 32)
local max_chance = 1 / 8
local scale_factor = 32
local sf = 1 / scale_factor
local m = 1.125 / 1000
local function enemy(x, y, world)
local d = math.sqrt(world.x * world.x + world.y * world.y)
if d < 300 then
return nil
end
local threshold = 1 - d * m
threshold = math.max(threshold, -0.125)
x, y = x * sf, y * sf
if Perlin.noise(x, y, perlin_seed) > threshold then
if math.random(8) == 1 then
local lvl
if d < 400 then
lvl = 1
elseif d < 650 then
lvl = 2
else
lvl = 3
end
local chance = math.min(max_chance, d * factor)
if math.random() < chance then
local worm_id
if d > 1000 then
local power = 1000 / d
worm_id = math.ceil((math.random() ^ power) * lvl)
else
worm_id = math.random(lvl)
end
return {name = worm_names[worm_id]}
end
else
local chance = math.min(max_chance, d * factor)
if math.random() < chance then
local spawner_id = math.random(2)
return {name = spawner_names[spawner_id]}
end
end
end
end
map = b.apply_entity(map, ore_shape)
map = b.apply_entity(map, loot)
map = b.apply_entity(map, enemy)
map = b.change_map_gen_collision_tile(map, 'water-tile', 'grass-1')
return map

View File

@ -483,6 +483,38 @@ function Builders.project(shape, size, r)
end
end
function Builders.project_pattern(pattern, size, r, columns, rows)
local ln_r = math.log(r)
local r2 = 1 / (r - 1)
local a = 1 / size
local half_size = size / 2
return function(x, y, world)
local offset = 0.5 * size
local sn = math.ceil(y + offset)
local n = math.ceil(math.log((r - 1) * sn * a + 1) / ln_r - 1)
local rn = r ^ n
local rn2 = 1 / rn
local c = size * rn
local sn_upper = size * (r ^ (n + 1) - 1) * r2
x = x * rn2
y = (y - (sn_upper - 0.5 * c) + offset) * rn2
local row_i = n % rows + 1
local row = pattern[row_i]
local x2 = ((x + half_size) % size) - half_size
local col_pos = math.floor(x / size + 0.5)
local col_i = col_pos % columns + 1
local shape = row[col_i]
return shape(x2, y, world)
end
end
function Builders.project_overlap(shape, size, r)
local ln_r = math.log(r)
local r2 = 1 / (r - 1)

View File

@ -86,7 +86,7 @@ local function do_place_entities(data)
local entity = surface.create_entity(e)
if entity and e.callback then
local callback = Token.get(e.callback)
callback(entity)
callback(entity, e.data)
end
end
end

View File

@ -90,7 +90,7 @@ local function do_place_entities(data)
local entity = surface.create_entity(e)
if entity and e.callback then
local callback = Token.get(e.callback)
callback(entity)
callback(entity, e.data)
end
end
end

View File

@ -65,6 +65,7 @@ local tiles_per_tick = 32
--shape = require "map_gen.presets.square_spiral"
--shape = require "map_gen.presets.beach"
--shape = require "map_gen.presets.factory"
--shape = require "map_gen.presets.triangle_of_death"
--shape = require "map_gen.presets.test"
--shapes--

View File

@ -1,201 +0,0 @@
-- A part of band.lua
-- Feel free to edit.
return {
['Trooper'] = {
paths = {'item/tank'},
tooltips = {
'Incoming!!!',
"If the facts don't fit the theory, change the facts.",
'I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.',
"There's a fine line between genius and insanity. I have erased this line."
},
verbs = {
'strengthened'
}
},
['Mining'] = {
paths = {
'item/iron-axe',
'item/steel-axe',
'item/iron-ore',
'item/copper-ore'
},
tooltips = {
'Mine or not to mine',
'The nation behaves well if it treats the natural resources as assets which\n it must turn over to the next generation increased, and not impaired, in value.'
},
verbs = {
'enriched'
-- "smelted"
}
},
['Smelting'] = {
paths = {
'item/stone-furnace',
'item/steel-furnace'
},
tooltips = {
'Mirrors are ice which do not melt: what melts are those who admire themselves in them.',
"It's as certain that as long as fossil fuels are the cheapest energy, we will just keep burning them."
},
verbs = {
'fused'
}
},
['Production'] = {
paths = {
'item/assembling-machine-1',
'item/assembling-machine-2',
'item/assembling-machine-3'
},
tooltips = {
"When every physical and mental resources is focused, one's power to solve a problem multiplies tremendously.",
'The production of too many useful things results in too many useless people. ',
'Everything must be made as simple as possible. But not simpler.'
},
verbs = {
'enhanced'
}
},
['Science'] = {
paths = {
'item/science-pack-1',
'item/science-pack-2',
'item/science-pack-3',
'item/military-science-pack',
'item/production-science-pack',
'item/high-tech-science-pack',
'item/space-science-pack'
},
tooltips = {
'Science without religion is lame, religion without science is blind',
'If we knew what it was we were doing, it would not be called research, would it?',
'Somewhere, something incredible is waiting to be known.',
"I'm sure the universe is full of intelligent life. It's just been too intelligent to come here."
},
verbs = {
'advanced'
}
},
['Wizard'] = {
paths = {
'item/arithmetic-combinator',
'item/green-wire',
'item/red-wire',
'item/decider-combinator'
},
tooltips = {
"Without mathematics, there's nothing you can do. Everything around you is mathematics. Everything around you is numbers.",
'Pure mathematics is, in its way, the poetry of logical ideas.',
'God used beautiful mathematics in creating the world.',
'The numbers may be said to rule the whole world of quantity, and the four rules of arithmetic may be regarded as the complete equipment of the mathematician.',
'But if the technological Singularity can happen, it will.'
--"One day it will have a mind of it´s own!."
},
verbs = {
'combinated',
'equaled'
}
},
['Trains'] = {
paths = {
'item/locomotive',
'entity/curved-rail',
'item/cargo-wagon',
'item/fluid-wagon',
'item/rail-signal',
'item/rail'
},
tooltips = {
'Ch, ch, choooo!',
'The only way of catching a train I have ever discovered is to miss the train before. ',
"If a trainstation is where the train stops, what's a workstation...?"
},
verbs = {
'expanded',
'derailed'
}
},
['Oil'] = {
paths = {
'item/pumpjack',
'item/storage-tank',
'item/oil-refinery',
'item/chemical-plant',
'fluid/crude-oil'
},
tooltips = {
"We're running out of oil!",
'Black gold',
"Naturally occurring, yellow-to-black liquid found in geological formations beneath the Earth's surface, which is commonly refined into various types of fuels.",
'Components of petroleum are separated using a technique called fractional distillation.',
'The petroleum industry generally classifies crude oil by the geographic location it is produced in (e.g. West Texas Intermediate, Brent, or Oman), its API gravity (an oil industry measure of density), and its sulfur content.'
},
verbs = {
'lubricated',
'sulfured'
}
},
['Powah!'] = {
paths = {'item/steam-engine', 'item/nuclear-reactor', 'item/solar-panel'},
tooltips = {
'I ve Got The power!',
'Power Overwhelming!!!111',
'Its Over 9000!!!',
'If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.'
},
verbs = {
'amplified',
'teslaed',
'electrified'
}
},
['Spaceman'] = {
paths = {'item/rocket-silo', 'item/rocket-fuel'},
tooltips = {
"That's one small step for a man, one giant leap for mankind.",
"The sky is the limit only for those who aren't afraid to fly!",
'Apocalyptic explosions, dead reactors, terrorists, mass murder, death-slugs, and now a blindness plague. This is a terrible planet. We should not have come here.',
'A still more glorious dawn awaits. Not a sunrise, but a galaxy rise. A morning filled with 400 billion suns. The rising of the milky way',
'The Universe is under no obligation to make sense to you.'
},
verbs = {
'warped'
}
},
['Cat'] = {
paths = {'item/raw-fish'},
tooltips = {
'=^.^=',
'Meow',
"In a cat's eye, all things belong to cats.",
"Cats don't like change without their consent.",
'Heard melodies are sweet, but those unheard, are sweeter'
},
verbs = {
'mewed',
'purred',
'miaowed'
}
},
['Dog'] = {
paths = {
'entity/small-biter',
'entity/medium-biter',
'entity/big-biter',
'entity/behemoth-biter'
},
tooltips = {
'Not a cat',
'Friend',
"It's not the size of the dog in the fight, it's the size of the fight in the dog.",
'When what you want is a relationship, and not a person, get a dog',
'A dog has one aim in life... to bestow his heart.'
},
verbs = {
'woofed',
'howled'
}
}
}

View File

@ -19,17 +19,17 @@ return {
{price = {{'raw-fish', 75}}, offer = {type = 'give-item', item = 'tank-flamethrower'}},
{price = {{'raw-fish', 2500}}, offer = {type = 'give-item', item = 'artillery-wagon-cannon'}},
{price = {{'raw-fish', 1}}, offer = {type = 'give-item', item = 'firearm-magazine'}},
{price = {{'raw-fish', 3}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
{price = {{'raw-fish', 5}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
{price = {{'raw-fish', 20}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
{price = {{'raw-fish', 2}}, offer = {type = 'give-item', item = 'shotgun-shell'}},
{price = {{'raw-fish', 8}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
{price = {{'raw-fish', 10}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
{price = {{'raw-fish', 5}}, offer = {type = 'give-item', item = 'railgun-dart'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo'}},
{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'rocket'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
{price = {{'raw-fish', 2500}}, offer = {type = 'give-item', item = 'atomic-bomb'}},
{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'cannon-shell'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
{price = {{'raw-fish', 20}}, offer = {type = 'give-item', item = 'cannon-shell'}},
{price = {{'raw-fish', 30}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
{price = {{'raw-fish', 75}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
{price = {{'raw-fish', 100}}, offer = {type = 'give-item', item = 'artillery-shell'}},
{price = {{'raw-fish', 1}}, offer = {type = 'give-item', item = 'land-mine'}},
@ -38,14 +38,14 @@ return {
{price = {{'raw-fish', 5}}, offer = {type = 'give-item', item = 'defender-capsule'}},
--{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'distractor-capsule'}}, Removed so we dont have 51 items and they are useless anyways
{price = {{'raw-fish', 75}}, offer = {type = 'give-item', item = 'destroyer-capsule'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'poison-capsule'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'slowdown-capsule'}},
{price = {{'raw-fish', 35}}, offer = {type = 'give-item', item = 'poison-capsule'}},
{price = {{'raw-fish', 35}}, offer = {type = 'give-item', item = 'slowdown-capsule'}},
{price = {{'raw-fish', 50}}, offer = {type = 'give-item', item = 'artillery-targeting-remote'}},
{price = {{'raw-fish', 1000}}, offer = {type = 'give-item', item = 'artillery-turret'}},
{price = {{'raw-fish', 250}}, offer = {type = 'give-item', item = 'modular-armor'}},
{price = {{'raw-fish', 750}}, offer = {type = 'give-item', item = 'power-armor'}},
{price = {{'raw-fish', 30}}, offer = {type = 'give-item', item = 'solar-panel-equipment'}},
{price = {{'raw-fish', 750}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment'}},
{price = {{'raw-fish', 350}}, offer = {type = 'give-item', item = 'modular-armor'}},
{price = {{'raw-fish', 875}}, offer = {type = 'give-item', item = 'power-armor'}},
{price = {{'raw-fish', 40}}, offer = {type = 'give-item', item = 'solar-panel-equipment'}},
{price = {{'raw-fish', 875}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment'}},
{price = {{'raw-fish', 100}}, offer = {type = 'give-item', item = 'battery-equipment'}},
{price = {{'raw-fish', 625}}, offer = {type = 'give-item', item = 'battery-mk2-equipment'}},
{price = {{'raw-fish', 250}}, offer = {type = 'give-item', item = 'belt-immunity-equipment'}},
@ -53,7 +53,14 @@ return {
{price = {{'raw-fish', 150}}, offer = {type = 'give-item', item = 'exoskeleton-equipment'}},
{price = {{'raw-fish', 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'construction-robot'}},
{price = {{'raw-fish', 250}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
{price = {{'raw-fish', 250}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
{price = {{'raw-fish', 1}}, offer = {type = 'give-item', item = 'refined-hazard-concrete'}}
{price = {{'raw-fish', 350}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
{price = {{'raw-fish', 350}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
{price = {{'raw-fish', 1}}, offer = {type = 'give-item', item = 'refined-hazard-concrete'}},
--[[ {price = {{'raw-fish', 5}}, offer = {type = 'give-item', item = 'science-pack-1'}},
{price = {{'raw-fish', 10}}, offer = {type = 'give-item', item = 'science-pack-2'}},
{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'science-pack-3'}},
{price = {{'raw-fish', 15}}, offer = {type = 'give-item', item = 'military-science-pack'}},
{price = {{'raw-fish', 20}}, offer = {type = 'give-item', item = 'production-science-pack'}},
{price = {{'raw-fish', 25}}, offer = {type = 'give-item', item = 'high-tech-science-pack'}}, ]]
}

View File

@ -1,320 +1,326 @@
return {
['helpower2'] = true,
['rorror'] = true,
['medival3'] = true,
['dpoba'] = true,
['cheeselicker'] = true,
['cpaca0'] = true,
['utidi'] = true,
['jokerofthez'] = true,
['saltlands'] = true,
['maniah'] = true,
['cool'] = true,
['boail'] = true,
['hunter117x'] = true,
['tonytroll'] = true,
['highinfiberoptics'] = true,
['atoms'] = true,
['adlmr'] = true,
['rayijin'] = true,
['sephir'] = true,
['inator1192'] = true,
['tezwo'] = true,
['neumond'] = true,
['bhenoa'] = true,
['jbc363'] = true,
['kaig3n'] = true,
['factorioio'] = true,
['bawz'] = true,
['crazystephen'] = true,
['eithel'] = true,
['coyote101'] = true,
['jedifan'] = true,
['xsidd'] = true,
['maxthespunkymunk'] = true,
['tarpon907'] = true,
['bighamster'] = true,
['sir'] = true,
['arnietom'] = true,
['animal'] = true,
['banakeg'] = true,
['philip017'] = true,
['ninjrkillr'] = true,
['marckhardt'] = true,
['brainclot'] = true,
['blzz'] = true,
['watchinghawk'] = true,
['farcear'] = true,
['selen'] = true,
['trekie4747'] = true,
['gizan'] = true,
['slastraf'] = true,
['zacman0510'] = true,
['theorangeangle'] = true,
['williambellwisdo'] = true,
['extraxyz'] = true,
['markupolioncz'] = true,
['bjhunter'] = true,
['ztx'] = true,
['bigglesthepirate'] = true,
['g-h-o-s-t'] = true,
['wekkka'] = true,
['beelzemon'] = true,
['rododendro'] = true,
['mrkoss'] = true,
['koretego'] = true,
['cogito123'] = true,
['palulukan'] = true,
['radianraze'] = true,
['kostrahb'] = true,
['mafisch3'] = true,
['cydes'] = true,
['ccaspanello'] = true,
['wickvitaminc'] = true,
['newcott'] = true,
['craigrood'] = true,
['lillepallt'] = true,
['skykittena'] = true,
['rico2403'] = true,
['claude47'] = true,
['mrsjaakbraak'] = true,
['heretek'] = true,
['factorian12321'] = true,
['steponitnicejob'] = true,
['cchpucky'] = true,
['rulerofdabacon'] = true,
['tcp'] = true,
['marucan'] = true,
['twltriston'] = true,
['bemm'] = true,
['lordxleasy'] = true,
['judaires'] = true,
['flowild'] = true,
['aalexx'] = true,
['zila'] = true,
['pyroguy'] = true,
['tickterd'] = true,
['trevoqr'] = true,
['pietloke'] = true,
['bloodydevil'] = true,
['mike-_-'] = true,
['asddsa76'] = true,
['tomymy'] = true,
['geckozila'] = true,
['starlite'] = true,
['ducktaperules'] = true,
['tvardero'] = true,
['thethane'] = true,
['lejnel'] = true,
['griffinonetwo'] = true,
['stat0x00'] = true,
['gynox'] = true,
['miniman10000'] = true,
['aliiien0110'] = true,
['gespenstdermaschine'] = true,
['brathahn'] = true,
['leadhades27'] = true,
['sl'] = true,
['phountix'] = true,
['yago2003'] = true,
['saneman'] = true,
['mesohorknee'] = true,
['brl_chacal'] = true,
['spechok'] = true,
['everlord'] = true,
['chessindustries'] = true,
['petebra11'] = true,
['collin08'] = true,
['cybernoise'] = true,
['sholvo'] = true,
['nexarius'] = true,
['jinnjuice'] = true,
['corlin'] = true,
['xeoxius'] = true,
['altech'] = true,
['dq_shell'] = true,
['terz42'] = true,
['fullfruntall'] = true,
['heaser'] = true,
['terradus'] = true,
['wesoly1234'] = true,
['sholax'] = true,
['thadius856'] = true,
['oliveawesomesauz'] = true,
['rafaelvalim'] = true,
['terarink'] = true,
['ruslan_kc'] = true,
['bobbje'] = true,
['snerktk'] = true,
['aplavins'] = true,
['gotze'] = true,
['rikkert'] = true,
['fire3231'] = true,
['roghurricane'] = true,
['ballbuster'] = true,
['shimmshamm'] = true,
['procrastinator_diedz'] = true,
['legionmammal978'] = true,
['merssedes'] = true,
['passepartout911'] = true,
['arizon'] = true,
['settdigger'] = true,
['m_m0'] = true,
['spatbee'] = true,
['forge36'] = true,
['fynko'] = true,
['i-make-robots'] = true,
['chunhung'] = true,
['apolomir'] = true,
['grandstore256'] = true,
['zehir'] = true,
['shaun_das_schaf'] = true,
['crisbk'] = true,
['kev007'] = true,
['sonopard'] = true,
['li7ro'] = true,
['rascher'] = true,
['sangria_louie'] = true,
['toledini'] = true,
['moo_cowman'] = true,
['lord_kill'] = true,
['mithril_ryder'] = true,
['grahamm'] = true,
['luk4kasz'] = true,
['joe32'] = true,
['assemblystorm'] = true,
['adobewallhacks'] = true,
['bufferoverflow'] = true,
['mcschnee'] = true,
['pirion'] = true,
['xanting'] = true,
['exp11235'] = true,
['sharpshot2566'] = true,
['coogan'] = true,
['hazelnuthead'] = true,
['pilypas'] = true,
['zoigo'] = true,
['ground_walker'] = true,
['alvinmj'] = true,
['spacecat-chan'] = true,
['iexyi'] = true,
['argetlam_elda'] = true,
['swampd0nkey'] = true,
['furancebob'] = true,
['fish'] = true,
['sovietdefender'] = true,
['xaddr'] = true,
['fana13'] = true,
['vonlam999'] = true,
['warnotte'] = true,
['beriev'] = true,
['zijkhal'] = true,
['samy_the_samy'] = true,
['bazul'] = true,
['rickeyhb'] = true,
['tigrium'] = true,
['ansible32'] = true,
['binzerle'] = true,
['davoud'] = true,
['copperbotte'] = true,
['eaglesight'] = true,
['fremiamagus'] = true,
['struppi'] = true,
['xatev'] = true,
['xalpha1989'] = true,
['jono777'] = true,
['toof_kitty'] = true,
['nekobaron'] = true,
['empirebuilder1'] = true,
['delta124'] = true,
['lupigaming'] = true,
['sergeant_steve'] = true,
['wd_steve2'] = true,
['teondar'] = true,
['harmlessbeltbot'] = true,
['noodletrains'] = true,
['cmdrrat'] = true,
['lunastarwarp'] = true,
['brikir'] = true,
['bobucles'] = true,
['vincentmonster'] = true,
['kingdud'] = true,
['theelvengamer'] = true,
['fuzz_pucker'] = true,
['dichromium'] = true,
['tuttifrectte'] = true,
['xdihe'] = true,
['circit'] = true,
['bissi'] = true,
['paul1998'] = true,
['timmypwn'] = true,
['pogomand'] = true,
['stig219'] = true,
['leviculus'] = true,
['tommy17'] = true,
['virusgamesplay'] = true,
['ajdiller88'] = true,
['rlidwka'] = true,
['simonflapse'] = true,
['kidflash'] = true,
['the_squid'] = true,
['dimava'] = true,
['ralp'] = true,
['damian0816'] = true,
['chukles'] = true,
['frissi'] = true,
['df1229'] = true,
['actitishypoleucos'] = true,
['angus100'] = true,
['morgan3rd'] = true,
['kyte'] = true,
['olexn'] = true,
['acolyteofcthulu'] = true,
['mariocraft2001'] = true,
['krul'] = true,
['b4x'] = true,
['firebunnie'] = true,
['derdu'] = true,
['nibu'] = true,
['artman40'] = true,
['junhinhow'] = true,
['ireasonless1'] = true,
['grufe'] = true,
['patton1918'] = true,
['redlabel'] = true,
['crusher_sut'] = true,
['leon55'] = true,
['thelaughingcheese'] = true,
['maximuskylus'] = true,
['nbituk'] = true,
['mh'] = true,
['vintageaura'] = true,
['wurzeltroll42'] = true,
['esperiom'] = true,
['standaardstefan'] = true,
['mauerstein10'] = true,
['vengefulpm'] = true,
['skilledspacepolice'] = true,
['the_ledgendary'] = true,
['capitansky'] = true,
['barnaba'] = true,
['drlloyd1337'] = true,
['twinotter'] = true,
['zaen'] = true,
['jbev2'] = true,
['wadiyatalkinabeet'] = true,
['builder101'] = true,
['brftjx'] = true,
['baronting'] = true,
['Haribo112'] = true,
['ZjosH'] = true,
['NbITUK'] = true,
['heardofsnails'] = true,
['JinNJuice'] = true,
['VERBUGA'] = true,
['dmaonk'] = true,
['Drlloyd1337'] = true,
['rhobes'] = true,
['cpenguinred'] = true,
['SimonFlapse'] = true
}
Aliiien0110 = true,
Altech = true,
Angus100 = true,
Animal = true,
Atoms = true,
Bazul = true,
Bemm = true,
Chunhung = true,
CmdrRat = true,
Copperbotte = true,
Drlloyd1337 = true,
Factorian12321 = true,
Fire3231 = true,
Gizan = true,
Gotze = true,
Haribo112 = true,
HighInFiberOptics = true,
JinNJuice = true,
Kyte = true,
Maniah = true,
Mariocraft2001 = true,
Namelesshunter = true,
NbITUK = true,
NekoBaron = true,
Newcott = true,
Nexarius = true,
PogomanD = true,
Ralp = true,
Redcrafter100 = true,
Ruslan_kc = true,
Sangria_louie = true,
Sholvo = true,
SimonFlapse = true,
TheElvenGamer = true,
TheOrangeAngle = true,
TheThane = true,
Tommy17 = true,
VERBUGA = true,
Zehir = true,
ZjosH = true,
_Joe_ = true,
aalexx = true,
acolyteofcthulu = true,
actitishypoleucos = true,
adidas = true,
adlmr = true,
adobewallhacks = true,
ajdiller88 = true,
alvinmj = true,
ansible32 = true,
aplavins = true,
apolomir = true,
argetlam_elda = true,
arizon = true,
arnietom = true,
artman40 = true,
asddsa76 = true,
assemblystorm = true,
b4x = true,
ballbuster = true,
banakeg = true,
barnaba = true,
baronting = true,
bawz = true,
beelzemon = true,
beriev = true,
bhenoa = true,
bigglesthepirate = true,
bighamster = true,
binzerle = true,
bissi = true,
bjhunter = true,
bloodydevil = true,
blzz = true,
boail = true,
bobbje = true,
bobucles = true,
brainclot = true,
brathahn = true,
brftjx = true,
brikir = true,
brl_chacal = true,
bufferoverflow = true,
builder101 = true,
capitansky = true,
ccaspanello = true,
cchpucky = true,
cheeselicker = true,
chessindustries = true,
chukles = true,
circit = true,
claude47 = true,
cogito123 = true,
collin08 = true,
coogan = true,
cool = true,
corlin = true,
coyote101 = true,
cpaca0 = true,
cpenguinred = true,
craigrood = true,
crazystephen = true,
crisbk = true,
crusher_sut = true,
cybernoise = true,
cydes = true,
damian0816 = true,
davoud = true,
delta124 = true,
derdu = true,
df1229 = true,
dichromium = true,
dimava = true,
dmaonk = true,
dpoba = true,
dq_shell = true,
ducktaperules = true,
eaglesight = true,
eithel = true,
empirebuilder1 = true,
esperiom = true,
everlord = true,
exp11235 = true,
extraxyz = true,
factorioio = true,
fana13 = true,
farcear = true,
firebunnie = true,
fish = true,
flowild = true,
forge36 = true,
franc_ist = true,
fremiamagus = true,
frissi = true,
fullfruntall = true,
furancebob = true,
fuzz_pucker = true,
fynko = true,
["g-h-o-s-t"] = true,
geckozila = true,
gespenstdermaschine = true,
grahamm = true,
grandstore256 = true,
griffinonetwo = true,
ground_walker = true,
grufe = true,
gynox = true,
hackguy = true,
harmlessbeltbot = true,
hazelnuthead = true,
heardofsnails = true,
heaser = true,
helpower2 = true,
heretek = true,
hunter117x = true,
["i-make-robots"] = true,
iexyi = true,
inator1192 = true,
ireasonless1 = true,
jbc363 = true,
jbev2 = true,
jedifan = true,
jinnjuice = true,
joe32 = true,
jokerofthez = true,
jono777 = true,
judaires = true,
junhinhow = true,
kaig3n = true,
kev007 = true,
kevinma = true,
kidflash = true,
kingdud = true,
koretego = true,
kostrahb = true,
krul = true,
leadhades27 = true,
legionmammal978 = true,
lejnel = true,
leon55 = true,
leviculus = true,
li7ro = true,
lillepallt = true,
lord_kill = true,
lordxleasy = true,
luk4kasz = true,
lunastarwarp = true,
lupigaming = true,
m_m0 = true,
mafisch3 = true,
marckhardt = true,
markupolioncz = true,
marucan = true,
mauerstein10 = true,
maximuskylus = true,
maxthespunkymunk = true,
mcschnee = true,
medival3 = true,
merssedes = true,
mesohorknee = true,
mh = true,
["mike-_-"] = true,
miniman10000 = true,
mithril_ryder = true,
moo_cowman = true,
morgan3rd = true,
mrkoss = true,
mrsjaakbraak = true,
nbituk = true,
neumond = true,
nibu = true,
ninjrkillr = true,
noodletrains = true,
olexn = true,
oliveawesomesauz = true,
palulukan = true,
passepartout911 = true,
patton1918 = true,
paul1998 = true,
petebra11 = true,
pfg = true,
philip017 = true,
phountix = true,
pietloke = true,
pilypas = true,
pirion = true,
procrastinator_diedz = true,
pyroguy = true,
radianraze = true,
rafaelvalim = true,
rascher = true,
rayijin = true,
redlabel = true,
rhobes = true,
rickeyhb = true,
rico2403 = true,
rikkert = true,
rlidwka = true,
rododendro = true,
roghurricane = true,
rorror = true,
rulerofdabacon = true,
saltlands = true,
samy_the_samy = true,
saneman = true,
selen = true,
sephir = true,
sergeant_steve = true,
settdigger = true,
sharpshot2566 = true,
shaun_das_schaf = true,
shimmshamm = true,
sholax = true,
sir = true,
skilledspacepolice = true,
skykittena = true,
sl = true,
slastraf = true,
snerktk = true,
sonopard = true,
sovietdefender = true,
["spacecat-chan"] = true,
spatbee = true,
spechok = true,
standaardstefan = true,
starlite = true,
stat0x00 = true,
steponitnicejob = true,
stig219 = true,
struppi = true,
swampd0nkey = true,
tarpon907 = true,
tcp = true,
teondar = true,
terarink = true,
terradus = true,
terz42 = true,
tezwo = true,
thadius856 = true,
the_ledgendary = true,
the_squid = true,
thelaughingcheese = true,
tickterd = true,
tigrium = true,
timmypwn = true,
toledini = true,
tomymy = true,
tonytroll = true,
toof_kitty = true,
trekie4747 = true,
trevoqr = true,
tuttifrectte = true,
tvardero = true,
twinotter = true,
twltriston = true,
utidi = true,
vengefulpm = true,
vincentmonster = true,
vintageaura = true,
virusgamesplay = true,
vonlam999 = true,
wadiyatalkinabeet = true,
warnotte = true,
watchinghawk = true,
wd_steve2 = true,
wekkka = true,
wesoly1234 = true,
wickvitaminc = true,
williambellwisdo = true,
wurzeltroll42 = true,
xaddr = true,
xalpha1989 = true,
xanting = true,
xatev = true,
xdihe = true,
xeoxius = true,
xsidd = true,
yago2003 = true,
zacman0510 = true,
zaen = true,
zijkhal = true,
zila = true,
zoigo = true,
ztx = true
}

53
resources/tag_groups.lua Normal file
View File

@ -0,0 +1,53 @@
-- A part of band.lua
-- Feel free to edit.
return {
['Trooper'] = {
path = 'item/tank',
verb = 'strengthened'
},
['Mining'] = {
path = 'item/electric-mining-drill',
verb = 'enriched'
},
['Smelting'] = {
path = 'item/stone-furnace',
verb = 'fused'
},
['Production'] = {
path = 'item/assembling-machine-2',
verb = 'enhanced'
},
['Science'] = {
path = 'item/science-pack-3',
verb = 'advanced'
},
['Wizard'] = {
path = 'item/green-wire',
verb = 'combinated'
},
['Trains'] = {
path = 'item/locomotive',
verb = 'derailed'
},
['Oil'] = {
path = 'fluid/crude-oil',
verb = 'lubricated'
},
['Powah!'] = {
path = 'item/steam-engine',
verb = 'electrified'
},
['Spaceman'] = {
path = 'item/rocket-silo',
verb = 'warped'
},
['Cat'] = {
path = 'item/raw-fish',
verb = 'mewed'
},
['Dog'] = {
path = 'entity/medium-biter',
verb = 'woofed'
}
}

View File

@ -1,29 +1,39 @@
local Event = require 'utils.event'
local Gui = require 'utils.gui'
local Token = require 'utils.global_token'
local Global = require 'utils.global'
local UserGroups = require 'user_groups'
local band_roles = require 'resources.band_roles'
local band_roles_token = Token.register_global(band_roles)
local deafult_verb = 'expanded'
local tag_groups = require 'resources.tag_groups'
local player_tags = {}
local player_tags_token = Token.register_global(player_tags)
local no_notify_players = {}
Event.on_load(
function()
band_roles = Token.get_global(band_roles_token)
player_tags = Token.get_global(player_tags_token)
Global.register(
{tag_groups = tag_groups, player_tags = player_tags, no_notify_players = no_notify_players},
function(data)
tag_groups = data.tag_groups
player_tags = data.player_tags
no_notify_players = data.no_notify_players
end
)
local function change_player_tag(player, band_name)
local function notify_players(message)
for _, p in ipairs(game.connected_players) do
if p.valid and not no_notify_players[p.index] then
p.print(message)
end
end
end
local function change_player_tag(player, tag_name, silent)
local old_tag = player.tag
if band_name == '' and old_tag == '' then
if tag_name == '' and old_tag == '' then
return false
end
local tag_name = '[' .. band_name .. ']'
if old_tag == tag_name then
local tag = '[' .. tag_name .. ']'
if old_tag == tag then
return false
end
@ -34,36 +44,34 @@ local function change_player_tag(player, band_name)
end
end
if band_name == '' then
if tag_name == '' then
player.tag = ''
if not silent then
notify_players(player.name .. ' has left the ' .. old_tag .. ' squad')
end
return true
end
local band = band_roles[band_name]
if not band then
local tag_data = tag_groups[tag_name]
if not tag_data then
return false
end
local players = player_tags[tag_name]
local players = player_tags[tag]
if not players then
players = {}
player_tags[tag_name] = players
player_tags[tag] = players
end
players[player.index] = true
player.tag = tag_name
player.tag = tag
local verbs = band.verbs
local verb
if verbs then
verb = verbs[math.random(#verbs)]
else
verb = 'expanded'
local verb = tag_data.verb or deafult_verb
if not silent then
notify_players(tag .. ' squad has `' .. verb .. '` with ' .. player.name)
end
game.print(tag_name .. ' squad has `' .. verb .. '` with ' .. player.name)
return true
end
@ -94,19 +102,20 @@ end
local main_button_name = Gui.uid_name()
local main_frame_name = Gui.uid_name()
local band_button_name = Gui.uid_name()
local band_label_name = Gui.uid_name()
local main_frame_content_name = Gui.uid_name()
local tag_button_name = Gui.uid_name()
local tag_label_name = Gui.uid_name()
local clear_button_name = Gui.uid_name()
local create_tag_button_name = Gui.uid_name()
local delete_tag_button_name = Gui.uid_name()
local edit_tag_button_name = Gui.uid_name()
local notify_checkbox_name = Gui.uid_name()
local create_tag_frame_name = Gui.uid_name()
local create_tag_choose_icon_name = Gui.uid_name()
local create_tag_icon_type_name = Gui.uid_name()
local close_create_tag_name = Gui.uid_name()
local confirm_create_tag_name = Gui.uid_name()
local main_frame_content_name = Gui.uid_name()
local delete_tag_name = Gui.uid_name()
local close_create_tag_name = Gui.uid_name()
local function player_joined(event)
local player = game.players[event.player_index]
@ -123,40 +132,48 @@ end
local function draw_main_frame_content(parent)
local player = parent.gui.player
local grid = parent.add {type = 'table', column_count = 1}
grid.style.vertical_spacing = 0
for band_name, band_data in pairs(band_roles) do
local tag_name = '[' .. band_name .. ']'
local players = player_tags[tag_name]
for tag_name, tag_data in pairs(tag_groups) do
local tag = '[' .. tag_name .. ']'
local players = player_tags[tag]
local size = get_size(players)
local path = band_data.paths[math.random(#band_data.paths)]
local tooltip = band_data.tooltips[math.random(#band_data.tooltips)]
local path = tag_data.path
local row = parent.add {type = 'flow', direction = 'horizontal'}
row.style.top_padding = 0
row.style.bottom_padding = 0
local row = grid.add {type = 'table', column_count = 4}
row.style.horizontal_spacing = 0
if player.admin then
local delete_button =
row.add {type = 'sprite-button', name = delete_tag_button_name, sprite = 'utility/remove'}
delete_button.tooltip = 'Delete tag group'
delete_button.style.top_padding = 0
delete_button.style.bottom_padding = 0
delete_button.style.maximal_height = 32
Gui.set_data(delete_button, band_name)
if player.admin or UserGroups.is_regular(player.name) then
local edit_button =
row.add {
type = 'sprite-button',
name = edit_tag_button_name,
sprite = 'utility/rename_icon_normal',
tooltip = 'Edit tag group'
}
edit_button.style.top_padding = 0
edit_button.style.bottom_padding = 0
edit_button.style.maximal_height = 32
Gui.set_data(edit_button, tag_name)
end
local button = row.add {type = 'sprite-button', name = band_button_name, sprite = path}
button.tooltip = tooltip
button.style.top_padding = 0
button.style.bottom_padding = 0
button.style.maximal_height = 32
Gui.set_data(button, band_name)
local tag_button =
row.add {
type = 'sprite-button',
name = tag_button_name,
sprite = path,
tooltip = tag_name
}
local role_label = row.add {type = 'label', name = band_label_name, caption = band_name .. size}
role_label.style.top_padding = 4
role_label.style.minimal_width = 120
Gui.set_data(role_label, {band_name = band_name, path = path})
tag_button.style.maximal_height = 32
Gui.set_data(tag_button, tag_name)
local tag_label = row.add {type = 'label', name = tag_label_name, caption = tag_name .. size}
tag_label.style.left_padding = 4
tag_label.style.minimal_width = 120
Gui.set_data(tag_label, {tag_name = tag_name, path = path})
local list = row.add {type = 'flow', direction = 'horizontal'}
@ -197,17 +214,34 @@ local function draw_main_frame(player)
draw_main_frame_content(scroll_pane)
local flow = main_frame.add {type = 'flow'}
flow.add {type = 'button', name = main_button_name, caption = 'Close'}
flow.add {type = 'button', name = clear_button_name, caption = 'Clear Tag'}
main_frame.add {
type = 'checkbox',
name = notify_checkbox_name,
caption = 'Notify me when tag groups change.',
state = not no_notify_players[player.index],
tooltip = 'Receive a message when a player enters or leaves a tag group or when a tag group is created, edited or deleted.'
}
local bottom_flow = main_frame.add {type = 'flow', direction = 'horizontal'}
local left_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
left_flow.style.align = 'left'
left_flow.style.horizontally_stretchable = true
left_flow.add {type = 'button', name = main_button_name, caption = 'Close'}
local right_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
right_flow.style.align = 'right'
right_flow.add {type = 'button', name = clear_button_name, caption = 'Clear Tag'}
if player.admin or UserGroups.is_regular(player.name) then
flow.add {type = 'button', name = create_tag_button_name, caption = 'Create Tag'}
right_flow.add {type = 'button', name = create_tag_button_name, caption = 'Create Tag'}
end
end
local function redraw_main_frame()
for _, p in ipairs(game.connected_players) do
for _, p in pairs(game.players) do
local main_frame = p.gui.left[main_frame_name]
if main_frame and main_frame.valid then
local content = main_frame[main_frame_content_name]
@ -215,7 +249,9 @@ local function redraw_main_frame()
Gui.remove_data_recursivly(content)
content.clear()
draw_main_frame_content(content)
if p.connected then
draw_main_frame_content(content)
end
end
end
end
@ -223,7 +259,7 @@ end
local function redraw_main_button(player, path)
local main_button = player.gui.top[main_button_name]
if path == '' then
if path == '' or path == nil then
main_button.sprite = 'utility/pump_cannot_connect_icon'
main_button.caption = 'tag'
else
@ -253,20 +289,54 @@ local choices = {
'recipe'
}
local function draw_create_tag_frame(event)
local center = event.player.gui.center
local function draw_create_tag_frame(event, tag_data)
local name
local verb
local path
local spirte_type
local frame_caption
local confirm_caption
if tag_data then
name = tag_data.name
verb = tag_data.verb
path = tag_data.path
if center[create_tag_frame_name] then
return
if path and path ~= '' then
spirte_type, path = path:match('([^/]+)/([^/]+)')
if spirte_type == 'virtual-signal' then
spirte_type = 'signal'
path = {type = 'virtual', name = path}
end
else
spirte_type = choices[1]
path = nil
end
frame_caption = 'Edit Tag'
confirm_caption = 'Edit'
else
name = ''
verb = 'expanded'
spirte_type = choices[1]
frame_caption = 'Create A New Tag'
confirm_caption = 'Create'
end
local frame =
center.add {type = 'frame', name = create_tag_frame_name, caption = 'Create A New Tag', direction = 'vertical'}
local player = event.player
local center = player.gui.center
local frame = center[create_tag_frame_name]
if frame then
Gui.remove_data_recursivly(frame)
frame.destroy()
end
frame = center.add {type = 'frame', name = create_tag_frame_name, caption = frame_caption, direction = 'vertical'}
local main_table = frame.add {type = 'table', column_count = 2}
main_table.add {type = 'label', caption = 'Name'}
local name_field = main_table.add {type = 'textfield'}
local name_field = main_table.add {type = 'textfield', text = name}
Gui.set_data(name_field, frame)
main_table.add {type = 'label', caption = 'Icon'}
@ -274,16 +344,16 @@ local function draw_create_tag_frame(event)
local selection_flow = icons_flow.add {type = 'flow'}
local focus
for i, value in ipairs(choices) do
for _, value in ipairs(choices) do
local radio =
selection_flow.add({type = 'flow'}).add {
type = 'radiobutton',
name = create_tag_icon_type_name,
caption = value,
state = i == 1
state = value == spirte_type
}
if i == 1 then
if value == spirte_type then
focus = radio
end
@ -294,71 +364,93 @@ local function draw_create_tag_frame(event)
icons_flow.add {
type = 'choose-elem-button',
name = create_tag_choose_icon_name,
elem_type = choices[1]
elem_type = spirte_type
}
if path then
choose.elem_value = path
end
Gui.set_data(choose, frame)
main_table.add {type = 'label', caption = 'Verb'}
local verb_field = main_table.add {type = 'textfield', text = 'expanded'}
local verb_field = main_table.add {type = 'textfield', text = verb}
Gui.set_data(verb_field, frame)
local flow = frame.add {type = 'flow', direction = 'horizontal'}
local bottom_flow = frame.add {type = 'flow', direction = 'horizontal'}
local close_button = flow.add {type = 'button', name = close_create_tag_name, caption = 'Close'}
local left_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
left_flow.style.align = 'left'
left_flow.style.horizontally_stretchable = true
local close_button = left_flow.add {type = 'button', name = close_create_tag_name, caption = 'Close'}
Gui.set_data(close_button, frame)
local confirm_button = flow.add {type = 'button', name = confirm_create_tag_name, caption = 'Confirm'}
local right_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
right_flow.style.align = 'right'
if tag_data then
local delete_button = right_flow.add {type = 'button', name = delete_tag_name, caption = 'Delete'}
Gui.set_data(delete_button, frame)
end
local confirm_button = right_flow.add {type = 'button', name = confirm_create_tag_name, caption = confirm_caption}
Gui.set_data(confirm_button, frame)
Gui.set_data(
frame,
{
focus = focus,
choose = choose,
icons_flow = icons_flow,
name = name_field,
verb = verb_field
}
)
local data = {
focus = focus,
choose = choose,
icons_flow = icons_flow,
name = name_field,
verb = verb_field,
tag_data = tag_data
}
Gui.set_data(frame, data)
event.player.opened = frame
player.opened = frame
end
Gui.on_click(main_button_name, toggle)
Gui.on_click(
band_button_name,
function(event)
local tag = Gui.get_data(event.element)
local path = event.element.sprite
if change_player_tag(event.player, tag) then
redraw_main_frame()
redraw_main_button(event.player, path)
end
end
)
Gui.on_click(
band_label_name,
function(event)
local data = Gui.get_data(event.element)
local tag = data.band_name
local path = data.path
if change_player_tag(event.player, tag) then
redraw_main_frame()
redraw_main_button(event.player, path)
end
end
)
Gui.on_click(
delete_tag_button_name,
tag_button_name,
function(event)
local tag_name = Gui.get_data(event.element)
local path = event.element.sprite
if not band_roles[tag_name] then
if change_player_tag(event.player, tag_name) then
redraw_main_frame()
redraw_main_button(event.player, path)
end
end
)
Gui.on_click(
tag_label_name,
function(event)
local data = Gui.get_data(event.element)
local tag_name = data.tag_name
local path = data.path
if change_player_tag(event.player, tag_name) then
redraw_main_frame()
redraw_main_button(event.player, path)
end
end
)
Gui.on_click(
delete_tag_name,
function(event)
local frame = Gui.get_data(event.element)
local data = Gui.get_data(frame)
local tag_data = data.tag_data
local tag_name = tag_data.name
Gui.remove_data_recursivly(frame)
frame.destroy()
if not tag_groups[tag_name] then
event.player.print("Sorry, Tag name '" .. tag_name .. "' not found.")
return
end
@ -366,7 +458,7 @@ Gui.on_click(
local tag = '[' .. tag_name .. ']'
for _, player in pairs(game.players) do
if player.tag == tag then
if player.valid and player.tag == tag then
change_player_tag(player, '')
if player.connected then
@ -375,11 +467,45 @@ Gui.on_click(
end
end
band_roles[tag_name] = nil
tag_groups[tag_name] = nil
redraw_main_frame()
game.print(event.player.name .. ' has deleted the ' .. tag_name .. ' tag group')
notify_players(event.player.name .. ' has deleted the ' .. tag_name .. ' tag group')
end
)
Gui.on_click(
edit_tag_button_name,
function(event)
local tag_name = Gui.get_data(event.element)
local tag_data = tag_groups[tag_name]
if not tag_data then
event.player.print("Sorry, Tag name '" .. tag_name .. "' not found.")
return
end
tag_data.name = tag_name
draw_create_tag_frame(event, tag_data)
end
)
Gui.on_click(
notify_checkbox_name,
function(event)
local player_index = event.player_index
local checkbox = event.element
local new_state
if checkbox.state then
new_state = nil
else
new_state = true
end
no_notify_players[player_index] = new_state
end
)
@ -427,16 +553,17 @@ Gui.on_click(
local player = event.player
local frame = Gui.get_data(event.element)
local data = Gui.get_data(frame)
local old_tag_data = data.tag_data
local name = data.name.text
local tag_name = data.name.text
if name == '' then
if tag_name == '' then
player.print('Sorry, the tag needs a name')
return
end
if band_roles[name] then
player.print('Sorry, tag ' .. data.name .. ' is already in use.')
if not old_tag_data and tag_groups[tag_name] then
player.print('Sorry, tag ' .. tag_name .. ' is already in use.')
return
end
@ -445,37 +572,65 @@ Gui.on_click(
local path
if not sprite or sprite == '' then
path = 'utility/pump_cannot_connect_icon'
path = nil
elseif type == 'signal' then
path = 'virtual-signal/' .. data.choose.elem_value.name
else
path = type .. '/' .. data.choose.elem_value
end
if not frame.gui.is_valid_sprite_path(path) then
if path and not frame.gui.is_valid_sprite_path(path) then
player.print('Sorry, ' .. path .. ' is not a valid sprite')
return
end
local verb = data.verb.text
if verb == '' then
verb = 'expanded'
verb = deafult_verb
end
local band_role = {
paths = {path},
verbs = {verb},
tooltips = {name}
}
band_roles[name] = band_role
redraw_main_frame()
Gui.remove_data_recursivly(frame)
frame.destroy()
game.print(player.name .. ' has made a new tag group called ' .. name)
local tag_data = {
path = path,
verb = verb
}
tag_groups[tag_name] = tag_data
local message
if old_tag_data then
local old_name = old_tag_data.name
if old_name == tag_name and old_tag_data.path == path and old_tag_data.verb == verb then
return
end
if old_name ~= tag_name then
message = player.name .. ' has edited the ' .. tag_name .. ' (formerly ' .. old_name .. ') tag group'
local old_tag = '[' .. old_name .. ']'
for _, p in pairs(game.players) do
if p.valid and p.tag == old_tag then
change_player_tag(p, tag_name, true)
if p.connected then
redraw_main_button(player, '')
end
end
end
tag_groups[old_name] = nil
else
message = player.name .. ' has edited the ' .. tag_name .. ' tag group'
end
else
message = player.name .. ' has made a new tag group called ' .. tag_name
end
redraw_main_frame()
notify_players(message)
end
)
@ -530,7 +685,7 @@ local function tag_command(cmd)
end
local tag_name = string.sub(cmd.parameter, params[1]:len() + 2)
local tag = band_roles[tag_name]
local tag = tag_groups[tag_name]
if tag == nil then
player_print("Tag '" .. tag_name .. "' does not exist. Create the tag first by clicking Tag -> Create Tag.")
@ -544,4 +699,4 @@ local function tag_command(cmd)
end
end
commands.add_command('tag', '<player> <tag> Sets a players tag. (Admins only)', tag_command)
commands.add_command('tag', "<player> <tag> Sets a player's tag. (Admins only)", tag_command)

24
utils/global.lua Normal file
View File

@ -0,0 +1,24 @@
local Event = require 'utils.event'
local Token = require 'utils.global_token'
Global = {}
local data = {}
function Global.register(tbl, callback)
local token = Token.register_global(tbl)
table.insert(data, {tbl = tbl, callback = callback, token = token})
end
Event.on_load(
function()
for _, d in ipairs(data) do
local tbl = Token.get_global(d.token)
d.callback(tbl)
end
data = nil
end
)
return Global