1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-11-25 22:32:18 +02:00

Fix print color migrations

This commit is contained in:
Gerkiz
2025-05-18 22:42:11 +02:00
parent 5823b6d934
commit 4fbf46b608
25 changed files with 387 additions and 288 deletions

View File

@@ -52,7 +52,7 @@ local function cmd_handler(cmd)
else
p = player.print
if not player.admin then
p({'chronosphere.cmd_not_admin'}, Color.fail)
p({'chronosphere.cmd_not_admin'}, { color = Color.fail })
return
end
end

View File

@@ -8,7 +8,7 @@ local mapkeeper = '[color=blue]Mapkeeper:[/color]'
commands.add_command(
'scenario',
'Usable only for admins - controls the scenario!',
function(cmd)
function (cmd)
local p
local player = game.player
@@ -83,9 +83,9 @@ commands.add_command(
elseif param == 'reset' then
this.reset_are_you_sure = nil
if player and player.valid then
game.print(mapkeeper .. ' ' .. player.name .. ', has reset the game!', {r = 0.98, g = 0.66, b = 0.22})
game.print(mapkeeper .. ' ' .. player.name .. ', has reset the game!', { r = 0.98, g = 0.66, b = 0.22 })
else
game.print(mapkeeper .. ' server, has reset the game!', {r = 0.98, g = 0.66, b = 0.22})
game.print(mapkeeper .. ' server, has reset the game!', { r = 0.98, g = 0.66, b = 0.22 })
end
reset_map()
p('[WARNING] Game has been reset!')
@@ -97,7 +97,7 @@ commands.add_command(
commands.add_command(
'set_queue_speed',
'Usable only for admins - sets the queue speed of this map!',
function(cmd)
function (cmd)
local p
local player = game.player
local param = tonumber(cmd.parameter)
@@ -106,7 +106,7 @@ commands.add_command(
if player ~= nil then
p = player.print
if not player.admin then
p("[ERROR] You're not admin!", Color.fail)
p("[ERROR] You're not admin!", { color = Color.fail })
return
end
if not param then
@@ -126,7 +126,7 @@ commands.add_command(
commands.add_command(
'get_queue_speed',
'Usable only for admins - gets the queue speed of this map!',
function()
function ()
local p
local player = game.player
@@ -134,7 +134,7 @@ commands.add_command(
if player ~= nil then
p = player.print
if not player.admin then
p("[ERROR] You're not admin!", Color.fail)
p("[ERROR] You're not admin!", { color = Color.fail })
return
end
p(Task.get_queue_speed())

View File

@@ -31,7 +31,8 @@ local spawn_biters_token
local Public = {}
local starting_items = {
local starting_items =
{
['pistol'] = 1,
['firearm-magazine'] = 16,
['raw-fish'] = 3,
@@ -79,7 +80,8 @@ function Public.reset_game()
map_gen_settings.water = 0.10
map_gen_settings.terrain_segmentation = 3
map_gen_settings.cliff_settings = { cliff_elevation_interval = 32, cliff_elevation_0 = 32 }
map_gen_settings.autoplace_controls = {
map_gen_settings.autoplace_controls =
{
['coal'] = { frequency = 4, size = 1.5, richness = 2 },
['stone'] = { frequency = 4, size = 1.5, richness = 2 },
['copper-ore'] = { frequency = 4, size = 1.5, richness = 2 },
@@ -89,9 +91,12 @@ function Public.reset_game()
['trees'] = { frequency = 2, size = 1, richness = 1 },
['enemy-base'] = { frequency = 'none', size = 'none', richness = 'none' }
}
map_gen_settings.autoplace_settings = {
['tile'] = {
settings = {
map_gen_settings.autoplace_settings =
{
['tile'] =
{
settings =
{
['deepwater'] = { frequency = 1, size = 0, richness = 1 },
['deepwater-green'] = { frequency = 1, size = 0, richness = 1 },
['water'] = { frequency = 1, size = 0, richness = 1 },
@@ -209,12 +214,14 @@ local show_fd_stats = function (player)
end
local frame =
player.gui.left.add {
player.gui.left.add
{
type = 'frame',
name = gui_id
}
local table =
frame.add {
frame.add
{
type = 'table',
name = table_id,
column_count = 2
@@ -232,7 +239,8 @@ local show_fd_stats = function (player)
local limit = v.limit
local entry = { name, placed .. '/' .. limit }
for _, value_entry in pairs(entry) do
table.add {
table.add
{
type = 'label',
caption = value_entry
}
@@ -254,7 +262,8 @@ local add_fd_stats_button = function (player)
player.gui.top[button_id].destroy()
end
player.gui.top.add {
player.gui.top.add
{
type = 'sprite-button',
name = button_id,
sprite = 'item/submachine-gun'
@@ -281,7 +290,8 @@ local on_market_item_purchased = function ()
update_fd_stats()
end
local threat_values = {
local threat_values =
{
['small_biter'] = 1,
['medium_biter'] = 3,
['big_biter'] = 5,
@@ -296,14 +306,16 @@ local get_biter_initial_pool = function ()
local this = FDT.get()
local biter_pool
if this.wave_count > 1750 then
biter_pool = {
biter_pool =
{
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'behemoth-spitter', threat = threat_values.behemoth_spitter, weight = 1 }
}
return biter_pool
end
if this.wave_count > 1500 then
biter_pool = {
biter_pool =
{
{ name = 'big-biter', threat = threat_values.big_biter, weight = 1 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'behemoth-spitter', threat = threat_values.behemoth_spitter, weight = 1 }
@@ -311,7 +323,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if this.wave_count > 1250 then
biter_pool = {
biter_pool =
{
{ name = 'big-biter', threat = threat_values.big_biter, weight = 2 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'behemoth-spitter', threat = threat_values.behemoth_spitter, weight = 1 }
@@ -319,7 +332,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if this.wave_count > 1000 then
biter_pool = {
biter_pool =
{
{ name = 'big-biter', threat = threat_values.big_biter, weight = 3 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'behemoth-spitter', threat = threat_values.behemoth_spitter, weight = 1 }
@@ -327,14 +341,16 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.1 then
biter_pool = {
biter_pool =
{
{ name = 'small-biter', threat = threat_values.small_biter, weight = 3 },
{ name = 'small-spitter', threat = threat_values.small_spitter, weight = 1 }
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.2 then
biter_pool = {
biter_pool =
{
{ name = 'small-biter', threat = threat_values.small_biter, weight = 10 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 2 },
{ name = 'small-spitter', threat = threat_values.small_spitter, weight = 5 },
@@ -343,7 +359,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.3 then
biter_pool = {
biter_pool =
{
{ name = 'small-biter', threat = threat_values.small_biter, weight = 18 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 6 },
{ name = 'small-spitter', threat = threat_values.small_spitter, weight = 8 },
@@ -353,7 +370,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.4 then
biter_pool = {
biter_pool =
{
{ name = 'small-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 8 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 2 },
@@ -364,7 +382,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.5 then
biter_pool = {
biter_pool =
{
{ name = 'small-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 8 },
@@ -375,7 +394,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.6 then
biter_pool = {
biter_pool =
{
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 8 },
{ name = 'medium-spitter', threat = threat_values.medium_spitter, weight = 2 },
@@ -384,7 +404,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.7 then
biter_pool = {
biter_pool =
{
{ name = 'behemoth-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 12 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 20 },
@@ -395,7 +416,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.8 then
biter_pool = {
biter_pool =
{
{ name = 'behemoth-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 10 },
@@ -406,7 +428,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor <= 0.9 then
biter_pool = {
biter_pool =
{
{ name = 'big-biter', threat = threat_values.big_biter, weight = 12 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'big-spitter', threat = threat_values.big_spitter, weight = 6 },
@@ -415,7 +438,8 @@ local get_biter_initial_pool = function ()
return biter_pool
end
if game.forces.enemy.evolution_factor <= 1 then
biter_pool = {
biter_pool =
{
{ name = 'big-biter', threat = threat_values.big_biter, weight = 4 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
{ name = 'big-spitter', threat = threat_values.big_spitter, weight = 2 },
@@ -494,7 +518,8 @@ local get_x_coord_raffle_table = function ()
return t
end
local attack_group_count_thresholds = {
local attack_group_count_thresholds =
{
{ 0, 1 },
{ 50, 2 },
{ 100, 3 },
@@ -523,13 +548,15 @@ local send_unit_group = function (unit_group)
return
end
commands[#commands + 1] = {
commands[#commands + 1] =
{
type = defines.command.attack_area,
destination = { x = market.position.x, y = market.position.y },
radius = 256,
distraction = defines.distraction.by_anything
}
commands[#commands + 1] = {
commands[#commands + 1] =
{
type = defines.command.attack,
target = market,
distraction = defines.distraction.by_anything
@@ -558,7 +585,8 @@ local spawn_boss_units = function (surface)
if amount > 1000 then
amount = 1000
end
this.boss_waves[this.wave_count] = {
this.boss_waves[this.wave_count] =
{
{ name = 'behemoth-biter', count = floor(amount / 20) },
{ name = 'behemoth-spitter', count = floor(amount / 40) }
}
@@ -601,7 +629,8 @@ local wake_up_the_biters = function (surface)
surface.set_multi_command(
{
command = {
command =
{
type = defines.command.attack,
target = market,
distraction = defines.distraction.none
@@ -665,8 +694,8 @@ local biter_attack_wave = function ()
if this.spawned_biters > biter_count_limit then
wake_up_the_biters(surface)
game.print('Max biter count reached, waking up idle biters!', Color.warning)
game.print('Wave number will not increase.', Color.warning)
game.print('Max biter count reached, waking up idle biters!', { color = Color.warning })
game.print('Wave number will not increase.', { color = Color.warning })
return
end
@@ -966,22 +995,26 @@ local market_kill_visuals = function ()
surface.spill_item_stack(this.market.position, { name = 'raw-fish', count = 1024 }, true)
end
local biter_splash_damage = {
['medium-biter'] = {
local biter_splash_damage =
{
['medium-biter'] =
{
visuals = { 'blood-explosion-big', 'big-explosion' },
radius = 1.5,
damage_min = 50,
damage_max = 100,
chance = 32
},
['big-biter'] = {
['big-biter'] =
{
visuals = { 'blood-explosion-huge', 'ground-explosion' },
radius = 2,
damage_min = 75,
damage_max = 150,
chance = 48
},
['behemoth-biter'] = {
['behemoth-biter'] =
{
visuals = { 'blood-explosion-huge', 'big-artillery-explosion' },
radius = 2.5,
damage_min = 100,
@@ -1091,7 +1124,8 @@ local on_player_joined_game = function (event)
end
end
local deny_buildings_tbl = {
local deny_buildings_tbl =
{
['radar'] = true,
['roboport'] = true
}
@@ -1286,7 +1320,8 @@ local on_player_or_robot_built_tile = function (event)
if not tiles then
return
end
local area = {
local area =
{
left_top = { x = -944, y = -800 },
right_bottom = { x = 944, y = 90 }
}

View File

@@ -6,6 +6,8 @@ local WD = require 'modules.wave_defense.table'
local Discord = require 'utils.discord_handler'
local Commands = require 'utils.commands'
local mapkeeper = '[color=blue]Mapkeeper:[/color]'
local CommandColor = { r = 0.98, g = 0.66, b = 0.22 }
local gather_time_token =
Task.register(
@@ -78,10 +80,10 @@ Commands.new('scenario', 'Usable only for admins - controls the scenario!')
this.reset_are_you_sure = nil
if player and player.valid then
game.print(mapkeeper .. ' ' .. player.name .. ', has reset the game!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
Discord.send_notification_raw(Public.discord_name, player.name .. ' has reset the game!')
else
game.print(mapkeeper .. ' server, has reset the game!', { r = 0.98, g = 0.66, b = 0.22 })
game.print(mapkeeper .. ' server, has reset the game!', { color = CommandColor })
Discord.send_notification_raw(Public.discord_name, 'Server has reset the game!')
end
Public.set_task('move_players', 'Init')
@@ -114,7 +116,7 @@ Commands.new('mtn_complete_quests', 'Usable only for admins - completes all the
if args then
Task.set_timeout_in_ticks(50, gather_time_token, {})
end
game.print(mapkeeper .. player.name .. ', has forced completed all quests!', { r = 0.98, g = 0.66, b = 0.22 })
game.print(mapkeeper .. player.name .. ', has forced completed all quests!', { color = CommandColor })
player.print('Quests completed.')
end
)
@@ -129,7 +131,7 @@ Commands.new('mtn_reverse_map', 'Usable only for admins - reverses the map!')
Discord.send_notification_raw(Public.discord_name, player.name .. ' reversed the map.')
Public.set_task('move_players', 'Init')
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
player.print('Map reversed.')
end
)
@@ -144,12 +146,12 @@ Commands.new('mtn_disable_biters', 'Usable only for admins - disables wave defen
if not tbl.game_lost then
Discord.send_notification_raw(Public.discord_name, player.name .. ' disabled the wave defense module.')
game.print(mapkeeper .. ' ' .. player.name .. ', has disabled the wave_defense module!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
tbl.game_lost = true
else
Discord.send_notification_raw(Public.discord_name, player.name .. ' enabled the wave defense module.')
game.print(mapkeeper .. ' ' .. player.name .. ', has enabled the wave_defense module!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
tbl.game_lost = false
end
end
@@ -166,12 +168,12 @@ Commands.new('mtn_toggle_orbital_strikes',
if this.orbital_strikes.enabled then
Discord.send_notification_raw(Public.discord_name, player.name .. ' disabled the orbital strike module.')
game.print(mapkeeper .. ' ' .. player.name .. ', has disabled the orbital_strikes module!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
this.orbital_strikes.enabled = false
else
Discord.send_notification_raw(Public.discord_name, player.name .. ' enabled the orbital strike module.')
game.print(mapkeeper .. ' ' .. player.name .. ', has enabled the orbital_strikes module!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
this.orbital_strikes.enabled = true
end
end
@@ -194,12 +196,12 @@ Commands.new('mtn_disable_collapse', 'Usable only for admins - toggles the colla
if not Collapse.has_collapse_started() then
Collapse.start_now(true, false)
Discord.send_notification_raw(Public.discord_name, player.name .. ' has enabled collapse.')
game.print(mapkeeper .. ' ' .. player.name .. ', has enabled collapse!', { r = 0.98, g = 0.66, b = 0.22 })
game.print(mapkeeper .. ' ' .. player.name .. ', has enabled collapse!', { color = CommandColor })
else
Collapse.start_now(false, true)
Discord.send_notification_raw(Public.discord_name, player.name .. ' has disabled collapse.')
game.print(mapkeeper .. ' ' .. player.name .. ', has disabled collapse!',
{ r = 0.98, g = 0.66, b = 0.22 })
{ color = CommandColor })
end
end
)

View File

@@ -21,6 +21,7 @@ local Session = require 'utils.datastore.session_data'
local ICMinimap = require 'maps.mountain_fortress_v3.ic.minimap'
local Score = require 'utils.gui.score'
local Gui = require 'utils.gui'
local FunctionColor = { r = 0.98, g = 0.66, b = 0.22 }
local zone_settings = Public.zone_settings
local remove_boost_movement_speed_on_respawn
@@ -2216,7 +2217,7 @@ function Public.render_direction(surface, reversed)
text = text .. '\nRun: ' .. counter,
surface = surface,
target = { -0, 10 },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2228,7 +2229,7 @@ function Public.render_direction(surface, reversed)
text = text,
surface = surface,
target = { -0, 10 },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2248,7 +2249,7 @@ function Public.render_direction(surface, reversed)
text = '',
surface = surface,
target = { -0, -20 - inc },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2261,7 +2262,7 @@ function Public.render_direction(surface, reversed)
text = 'Biters will attack this area.',
surface = surface,
target = { -0, -70 },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2277,7 +2278,7 @@ function Public.render_direction(surface, reversed)
text = '',
surface = surface,
target = { -0, 20 + inc },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2290,7 +2291,7 @@ function Public.render_direction(surface, reversed)
text = 'Biters will attack this area.',
surface = surface,
target = { -0, 70 },
color = { r = 0.98, g = 0.66, b = 0.22 },
color = FunctionColor,
scale = 3,
font = 'heading-1',
alignment = 'center',
@@ -2798,7 +2799,7 @@ function Public.on_player_changed_position(event)
if player.character.health == 0 then
player.character.die()
local message = ({ 'main.death_message_' .. random(1, 7), player.name })
game.print(message, { r = 0.98, g = 0.66, b = 0.22 })
game.print(message, { color = FunctionColor })
end
end
end
@@ -2809,7 +2810,7 @@ function Public.on_player_changed_position(event)
if player.character ~= nil then
player.character.teleport({ position.x, position.y + 1 }, surface)
end
player.print(({ 'main.forcefield' }), { r = 0.98, g = 0.66, b = 0.22 })
player.print(({ 'main.forcefield' }), { color = FunctionColor })
if player.character then
player.character.health = player.character.health - 5
player.character.surface.create_entity({ name = 'water-splash', position = position })
@@ -2823,7 +2824,7 @@ function Public.on_player_changed_position(event)
if player.character ~= nil then
player.character.teleport({ position.x, position.y - 1 }, surface)
end
player.print(({ 'main.forcefield' }), { r = 0.98, g = 0.66, b = 0.22 })
player.print(({ 'main.forcefield' }), { color = FunctionColor })
if player.character then
player.character.health = player.character.health - 5
player.character.surface.create_entity({ name = 'water-splash', position = position })

View File

@@ -549,7 +549,7 @@ local function kick_player_from_surface(player, target)
else
target.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0), main_surface)
end
target.print('You were kicked out of ' .. player.name .. ' vehicle.', Color.warning)
target.print('You were kicked out of ' .. player.name .. ' vehicle.', { color = Color.warning })
end
end
end

View File

@@ -72,7 +72,8 @@ local function get_players(player, frame, all)
local selected_index = #tbl
local f = frame.add({
local f = frame.add(
{
type = 'drop-down',
name = transfer_player_select_name,
items = tbl,
@@ -276,7 +277,8 @@ local function draw_destroy_surface_name(frame)
local right_flow = bottom_flow.add({ type = 'flow' })
right_flow.style.horizontal_align = 'right'
local save_button = right_flow.add({
local save_button = right_flow.add(
{
type = 'button',
name = save_destroy_surface_button_name,
caption = ({ 'ic.save' })
@@ -386,12 +388,14 @@ local function draw_main_frame(player)
local player_list = Functions.get_trusted_system(player)
local add_player_frame = inside_table.add({ type = 'button', caption = ({ 'ic.add_player' }), name = add_player_name })
local transfer_car_frame = inside_table.add({
local transfer_car_frame = inside_table.add(
{
type = 'button',
caption = ({ 'ic.transfer_car' }),
name = transfer_car_name
})
local destroy_surface_frame = inside_table.add({
local destroy_surface_frame = inside_table.add(
{
type = 'button',
caption = ({ 'ic.destroy_surface' }),
name = destroy_surface_name
@@ -432,7 +436,8 @@ local function draw_main_frame(player)
)
local player_table =
inside_table.add {
inside_table.add
{
type = 'table',
column_count = 4,
draw_horizontal_lines = true,
@@ -488,7 +493,8 @@ local function draw_main_frame(player)
operations_label.style.minimal_width = 75
operations_label.style.horizontal_align = 'center'
local data = {
local data =
{
player_table = player_table,
add_player_frame = add_player_frame,
transfer_car_frame = transfer_car_frame,
@@ -762,12 +768,12 @@ Gui.on_click(
if player_list.notify_on_driver_change == 'right' then
player_list.notify_on_driver_change = 'left'
player.print('[IC] You will now be notified whenever someone not trusted tries to drive your car!',
Color.success)
{ color = Color.success })
else
player_list.notify_on_driver_change = 'right'
player.print(
'[IC] No notifications will be sent to you when someone not trusted tries to drive your car.',
Color.warning)
{ color = Color.warning })
end
if player.gui.screen[main_frame_name] then
@@ -812,7 +818,7 @@ Gui.on_click(
if not player_list.players[name] then
player.print('[IC] ' .. name .. ' was added to your vehicle.', { color = Color.info })
player_to_add.print(player.name .. ' added you to their vehicle. You may now enter it.', Color.info)
player_to_add.print(player.name .. ' added you to their vehicle. You may now enter it.', { color = Color.info })
increment(player_list.players, name)
else
return player.print('[IC] Target player is already trusted.', { color = Color.warning })
@@ -872,7 +878,7 @@ Gui.on_click(
else
player.print('[IC] You have successfully transferred your car to ' .. name, { color = Color.success })
player_to_add.print('[IC] You have become the rightfully owner of ' .. player.name .. "'s car!",
Color.success)
{ color = Color.success })
end
remove_main_frame(event.element)
@@ -920,7 +926,8 @@ Gui.on_click(
local misc_settings = ICT.get('misc_settings')
if not misc_settings[player.name] then
misc_settings[player.name] = {
misc_settings[player.name] =
{
first_warning = true
}
@@ -933,7 +940,7 @@ Gui.on_click(
misc_settings[player.name].final_warning = true
player.print(
'[IC] WARNING! WARNING WARNING! Pressing the save button ONE MORE TIME will DELETE your surface. This action is irreversible!',
Color.red)
{ color = Color.warning })
Task.set_timeout_in_ticks(600, clear_misc_settings, { player_name = player.name })
return
end
@@ -949,14 +956,14 @@ Gui.on_click(
local position = entity.position
local suc, count = Functions.kill_car_but_save_surface(entity)
if suc then
game.print('[IC] ' .. player.name .. ' has destroyed their surface!', Color.warning)
game.print('[IC] ' .. player.name .. ' has destroyed their surface!', { color = Color.warning })
Discord.send_notification_raw(discord_name,
player.name ..
' deleted their vehicle surface at x = ' .. position.x .. ' y = ' .. position.y .. '.')
else
player.print(
'[IC] Entities are still on the surface. Please remove any entities and retry this operation. Found ' ..
count .. ' entities!', Color.warning)
count .. ' entities!', { color = Color.warning })
end
end

View File

@@ -21,7 +21,8 @@ local round = math.round
local sub = string.sub
local playtime_required_to_drive_train = 108000 --30 minutes
local clear_items_upon_surface_entry = {
local clear_items_upon_surface_entry =
{
['entity-ghost'] = true,
['small-electric-pole'] = true,
['medium-electric-pole'] = true,
@@ -29,18 +30,21 @@ local clear_items_upon_surface_entry = {
['substation'] = true
}
local valid_armors = {
local valid_armors =
{
['modular-armor'] = true,
['power-armor'] = true,
['power-armor-mk2'] = true
}
local non_valid_vehicles = {
local non_valid_vehicles =
{
['car'] = true,
['spider-vehicle'] = true
}
local denied_train_types = {
local denied_train_types =
{
['locomotive'] = true,
['cargo-wagon'] = true,
['artillery-wagon'] = true
@@ -88,7 +92,8 @@ local function add_random_loot_to_main_market(rarity)
end
if not main_market_items[v.offer.item] then
main_market_items[v.offer.item] = {
main_market_items[v.offer.item] =
{
stack = stack,
value = value,
price = price,
@@ -103,7 +108,8 @@ local function death_effects(player)
local position = { x = player.physical_position.x - 0.75, y = player.physical_position.y - 1 }
local b = 0.75
for _ = 1, 5, 1 do
local p = {
local p =
{
(position.x + 0.4) + (b * -1 + math.random(0, b * 20) * 0.1),
position.y + (b * -1 + math.random(0, b * 20) * 0.1)
}
@@ -118,7 +124,8 @@ local function death_effects(player)
player.play_sound { path = 'utility/axe_fighting', volume_modifier = 0.9 }
end
local messages = {
local messages =
{
' likes to play in magma.',
' got melted.',
' tried to swim in lava.',
@@ -202,7 +209,7 @@ local function hurt_players_outside_of_aura()
end
if death_mode then
if entity.name == 'character' then
game.print(player.name .. messages[random(1, #messages)], { r = 200, g = 0, b = 0 })
game.print(player.name .. messages[random(1, #messages)], { color = { r = 200, g = 0, b = 0 } })
end
if entity.valid then
entity.die()
@@ -230,7 +237,7 @@ local function hurt_players_outside_of_aura()
if entity.valid then
if entity.health - damage <= 0 then
if entity.name == 'character' then
game.print(player.name .. messages[random(1, #messages)], { r = 200, g = 0, b = 0 })
game.print(player.name .. messages[random(1, #messages)], { color = { r = 200, g = 0, b = 0 } })
end
end
end
@@ -281,7 +288,8 @@ local function give_passive_xp(data)
local pos = player.physical_position
RPG.gain_xp(player, 0.5 * (rpg[player.index].bonus + upgrades.xp_points))
player.create_local_flying_text {
player.create_local_flying_text
{
text = '+' .. '',
position = { x = pos.x, y = pos.y - 2 },
color = xp_floating_text_color,
@@ -668,7 +676,8 @@ function Public.boost_players_around_train()
local unit_surface = locomotive.unit_number
local locomotive_surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
local data = {
local data =
{
surface = surface,
locomotive_surface = locomotive_surface,
rpg = rpg
@@ -705,7 +714,8 @@ function Public.is_around_train(entity)
local surface = game.surfaces[active_surface_index]
local upgrades = Public.get('upgrades')
local data = {
local data =
{
locomotive = locomotive,
surface = surface,
entity = entity,
@@ -736,7 +746,8 @@ function Public.is_inside_zone(entity)
local surface = game.surfaces[active_surface_index]
local data = {
local data =
{
locomotive = locomotive,
surface = surface,
entity = entity
@@ -770,7 +781,8 @@ function Public.render_train_hp()
Public.set(
'health_text',
rendering.draw_text {
rendering.draw_text
{
text = 'HP: ' .. locomotive_health .. ' / ' .. locomotive_max_health,
surface = surface,
target = locomotive,
@@ -784,7 +796,8 @@ function Public.render_train_hp()
Public.set(
'caption',
rendering.draw_text {
rendering.draw_text
{
text = 'Comfy Choo Choo',
surface = surface,
target = locomotive_cargo,
@@ -798,7 +811,8 @@ function Public.render_train_hp()
Public.set(
'circle',
rendering.draw_circle {
rendering.draw_circle
{
surface = surface,
target = locomotive,
color = locomotive.color,

View File

@@ -195,7 +195,7 @@ local has_the_game_ended = function ()
cause_msg = 'soft-reset'
end
game.print(({ 'main.reset_in', cause_msg, this.game_reset_tick / 60 }), { r = 0.22, g = 0.88, b = 0.22 })
game.print(({ 'main.reset_in', cause_msg, this.game_reset_tick / 60 }), { color = { r = 0.22, g = 0.88, b = 0.22 } })
end
if this.soft_reset and this.game_reset_tick == 0 then
@@ -208,7 +208,7 @@ local has_the_game_ended = function ()
if this.restart and this.game_reset_tick == 0 then
if not this.announced_message then
Public.set_scores()
game.print(({ 'entity.notify_restart' }), { r = 0.22, g = 0.88, b = 0.22 })
game.print(({ 'entity.notify_restart' }), { color = { r = 0.22, g = 0.88, b = 0.22 } })
local message = 'Soft-reset is disabled! Server will restart from scenario to load new changes.'
Server.to_discord_bold(table.concat { '*** ', message, ' ***' })
Server.start_scenario('Mountain_Fortress_v3')
@@ -219,7 +219,7 @@ local has_the_game_ended = function ()
if this.shutdown and this.game_reset_tick == 0 then
if not this.announced_message then
Public.set_scores()
game.print(({ 'entity.notify_shutdown' }), { r = 0.22, g = 0.88, b = 0.22 })
game.print(({ 'entity.notify_shutdown' }), { color = { r = 0.22, g = 0.88, b = 0.22 } })
local message = 'Soft-reset is disabled! Server will shutdown. Most likely because of updates.'
Server.to_discord_bold(table.concat { '*** ', message, ' ***' })
Server.stop_scenario()

View File

@@ -172,7 +172,7 @@ function Public.soft_reset_map(old_surface)
}
)
end
game.print(message, { r = 0.98, g = 0.66, b = 0.22 })
game.print(message, { color = { r = 0.98, g = 0.66, b = 0.22 } })
Server.to_discord_embed(message_to_discord)
return surface

View File

@@ -1574,7 +1574,7 @@ local function apply_startup_settings(settings)
game.print(message)
Server.to_discord_embed(message_discord, true)
game.print(({ 'entity.notify_shutdown' }), { r = 0.22, g = 0.88, b = 0.22 })
game.print(({ 'entity.notify_shutdown' }), { color = { r = 0.22, g = 0.88, b = 0.22 } })
local notify_shutdown = ({ 'entity.shutdown_game' })
Server.to_discord_bold(notify_shutdown, true)

View File

@@ -833,7 +833,7 @@ local function draw_orbit_gui(player)
if not this.annihilate_gui_button then
this.annihilate_gui_button = true
for _ = 1, 5 do
player.print('>> You are in orbit. Use the button to annihilate the planet.', { color = Color.warning, skip = defines.print_skip.never })
player.print('>> You are in orbit. Use the button to annihilate the planet.', { color = Color.warning })
end
end
player.gui.left.add(button)
@@ -943,24 +943,24 @@ local function on_gui_click(e)
if perks.chat_global then
elem.caption = 'NAP chat'
perks.chat_global = false
p.print('Global chat is disabled.', Color.success)
p.print('Global chat is disabled.', { color = Color.success })
else
elem.caption = 'Global chat'
perks.chat_global = true
p.print('Global chat is enabled.', Color.success)
p.print('Global chat is enabled.', { color = Color.success })
end
elseif elem.name == 'flashlight_toggle' then
if perks.flashlight_enable then
perks.flashlight_enable = false
if p.character and p.character.valid then
p.character.disable_flashlight()
p.print('Flashlight is disabled.', Color.success)
p.print('Flashlight is disabled.', { color = Color.success })
end
else
perks.flashlight_enable = true
if p.character and p.character.valid then
p.character.enable_flashlight()
p.print('Flashlight is enabled.', Color.success)
p.print('Flashlight is enabled.', { color = Color.success })
end
end
elseif elem.name == 'merchant_find' then
@@ -1002,7 +1002,7 @@ init_player = function (p, non_tp)
local surface = get_arena_map()
if #game.forces > 62 then
p.print('>> Too many players on the server. Please wait for a slot to open up.', Color.error)
p.print('>> Too many players on the server. Please wait for a slot to open up.', { color = Color.fail })
p.teleport({ 0, 0 }, surface.name)
local s = p.surface
local position = get_non_obstructed_position(s, 10)
@@ -1659,20 +1659,20 @@ local function on_player_dropped_item(e)
if game.forces[peer_force] and p.force.get_cease_fire(peer_force) then
p.print(string.format(">> You're in the NAP with %s already", peer.name), Color.warning)
p.print(string.format(">> You're in the NAP with %s already", peer.name), { color = Color.warning })
return
end
if this.last_friend[peer.name] == p.name then
p.print(string.format('>> The NAP was formed with %s', peer.name), Color.success)
peer.print(string.format('>> The NAP was formed with %s', p.name), Color.success)
p.print(string.format('>> The NAP was formed with %s', peer.name), { color = Color.success })
peer.print(string.format('>> The NAP was formed with %s', p.name), { color = Color.success })
if this.last_friend_initiated[peer.name] then
if game.forces[player_force] then
game.merge_forces(player_force, peer_force)
this.perks[p.name].merged = true
p.print(string.format('>> You merged forces with %s', peer.name), Color.success)
peer.print(string.format('>> %s merged forces with your force!', p.name), Color.success)
p.print(string.format('>> You merged forces with %s', peer.name), { color = Color.success })
peer.print(string.format('>> %s merged forces with your force!', p.name), { color = Color.success })
this.last_friend_initiated[peer.name] = nil
end
end
@@ -1685,8 +1685,8 @@ local function on_player_dropped_item(e)
this.last_friend[p.name] = peer.name
this.last_friend_initiated[p.name] = true
p.print(string.format('>> You want to form the NAP with %s', peer.name), Color.warning)
peer.print(string.format('>> %s wants to form NAP with you', p.name), Color.warning)
p.print(string.format('>> You want to form the NAP with %s', peer.name), { color = Color.warning })
peer.print(string.format('>> %s wants to form NAP with you', p.name), { color = Color.warning })
elseif ent.stack.name == 'coal' then
local ent_list =
p.surface.find_entities_filtered(
@@ -1715,7 +1715,7 @@ local function on_player_dropped_item(e)
local peer_force = get_player_force(peer)
if game.forces[peer_force] and p.force.name ~= peer_force and not p.force.get_cease_fire(peer_force) then
p.print(string.format(">> You don't have the NAP with %s", p.name), Color.warning)
p.print(string.format(">> You don't have the NAP with %s", p.name), { color = Color.warning })
return
end
@@ -1728,8 +1728,8 @@ local function on_player_dropped_item(e)
this.last_friend[p.name] = ''
this.last_friend[peer.name] = ''
p.print(string.format(">> You're no longer in the NAP with %s", peer.name), Color.warning)
peer.print(string.format(">> You're no longer in the NAP with %s", p.name), Color.warning)
p.print(string.format(">> You're no longer in the NAP with %s", peer.name), { color = Color.warning })
peer.print(string.format(">> You're no longer in the NAP with %s", p.name), { color = Color.warning })
end
end
@@ -1916,8 +1916,8 @@ local function on_market_item_purchased(e)
if o.effect_description == 'Construct a GPS receiver' then
perks.minimap = true
p.minimap_enabled = true
p.print('You bought the GPS receiver!', Color.success)
p.print('(unlocked minimap)', Color.success)
p.print('You bought the GPS receiver!', { color = Color.success })
p.print('(unlocked minimap)', { color = Color.success })
end
end
@@ -2050,14 +2050,14 @@ local function on_rocket_launch_ordered(e)
end
local entity = e.rocket and e.rocket and e.rocket.valid and e.rocket
surf.print('>> The rocket was launched', Color.warning)
surf.print('>> The rocket was launched', { color = Color.warning })
local rocket_inventory = e.rocket.cargo_pod.get_inventory(defines.inventory.cargo_unit)
local slot = rocket_inventory[1]
if slot and slot.valid and slot.valid_for_read then
if slot.name == 'satellite' then
local force = entity.force
surf.print(string.format('>> %s has won this round!', string.gsub(force.name, '_custom', '')), Color.warning)
surf.print(string.format('>> %s has won this round!', string.gsub(force.name, '_custom', '')), { color = Color.warning })
Server.to_discord_embed(string.gsub(force.name, '_custom', '') .. ' has launched the rocket and won the game!')
for _, player in pairs(force.connected_players) do

View File

@@ -184,7 +184,7 @@ local function random_color(cmd)
end
local force = player.force
if force.name == 'player' or force.name == 'rogue' then
player.print('You are not member of a town!', Color.fail)
player.print('You are not member of a town!', { color = Color.fail })
return
end
local this = ScenarioTable.get_table()

View File

@@ -132,7 +132,8 @@ local function update_score()
position.style.font_color = { r = 1, g = 1 }
end
local label =
information_table.add {
information_table.add
{
type = 'label',
caption = town_center.town_name .. ' (' .. #town_center.market.force.connected_players .. '/' .. #town_center.market.force.players .. ')'
}
@@ -145,7 +146,8 @@ local function update_score()
rank = rank + 1
if tonumber(total_age) >= this.required_time_to_win then
this.winner = {
this.winner =
{
name = town_center.town_name,
research_counter = town_center.research_counter,
upgrades = town_center.upgrades,
@@ -161,7 +163,8 @@ local function update_score()
local outlander_total = #game.forces['player'].players + #game.forces['rogue'].players
local label =
information_table.add {
information_table.add
{
type = 'label',
caption = 'Outlanders' .. ' (' .. outlander_on .. '/' .. outlander_total .. ')'
}
@@ -193,7 +196,8 @@ local function on_init()
Team.initialize()
end
local tick_actions = {
local tick_actions =
{
[60 * 0] = Radar.reset, -- each minute, at 00 seconds
[60 * 5] = Team.update_town_chart_tags, -- each minute, at 05 seconds
[60 * 10] = Team.set_all_player_colors, -- each minute, at 10 seconds
@@ -277,7 +281,7 @@ Event.add(
if player.gui.left[main_frame_name] and player.gui.left[main_frame_name].valid then
player.gui.left[main_frame_name].destroy()
end
return player.print('Comfy panel is disabled in this scenario.', Color.fail)
return player.print('Comfy panel is disabled in this scenario.', { color = Color.fail })
end
end
end

View File

@@ -585,12 +585,12 @@ local function rename_town(cmd)
end
local force = player.force
if force.name == 'player' or force.name == 'rogue' then
player.print('You are not member of a town!', Color.fail)
player.print('You are not member of a town!', { color = Color.fail })
return
end
local name = cmd.parameter
if name == nil then
player.print('Must specify new town name!', Color.fail)
player.print('Must specify new town name!', { color = Color.fail })
return
end
local this = ScenarioTable.get_table()

View File

@@ -2,21 +2,25 @@ local Color = require 'utils.color_presets'
local Event = require 'utils.event'
local Global = require 'utils.global'
local this = {
local this =
{
refill_turrets = {},
refill_chests = {index = 1, placed = 0},
refill_chests = { index = 1, placed = 0 },
full_turrets = {},
valid_chest = {
['iron-chest'] = {valid = true, limit = 4}
valid_chest =
{
['iron-chest'] = { valid = true, limit = 4 }
},
valid_turrets = {
valid_turrets =
{
['gun-turret'] = true,
['artillery-turret'] = true
},
valid_ammo = {
['firearm-magazine'] = {valid = true, priority = 1},
['piercing-rounds-magazine'] = {valid = true, priority = 2},
['uranium-rounds-magazine'] = {valid = true, priority = 3}
valid_ammo =
{
['firearm-magazine'] = { valid = true, priority = 1 },
['piercing-rounds-magazine'] = { valid = true, priority = 2 },
['uranium-rounds-magazine'] = { valid = true, priority = 3 }
},
message_limit = {},
player_settings = {},
@@ -25,7 +29,7 @@ local this = {
Global.register(
this,
function(t)
function (t)
this = t
end
)
@@ -68,7 +72,8 @@ local function get_player_data(player, remove_user_data)
end
end
if not this.player_settings[player.index] then
this.player_settings[player.index] = {
this.player_settings[player.index] =
{
placed = 0,
chests = {},
turrets = {},
@@ -216,11 +221,11 @@ local function remove_ammo(chest, entity_turret)
for item, count in pairs(contents) do
if count >= 1 then
local t = {name = item, count = count}
local t = { name = item, count = count }
if chest.can_insert(t) then
local c = chest.insert(t)
current_ammo = item
turret.remove({name = item, count = c})
turret.remove({ name = item, count = c })
return current_ammo
end
end
@@ -245,10 +250,10 @@ local function refill(entity_turret, entity_chest)
if ammo_count and ammo_count >= 10 then
goto continue
end
local t = {name = item, count = 1}
local t = { name = item, count = 1 }
local c = turret_inv.insert(t)
if (c > 0) then
chest.remove({name = item, count = c})
chest.remove({ name = item, count = c })
end
::continue::
@@ -319,9 +324,9 @@ end
local function show_text(msg, pos, color, surface)
if color == nil then
surface.create_entity({name = 'flying-text', position = pos, text = msg})
surface.create_entity({ name = 'flying-text', position = pos, text = msg })
else
surface.create_entity({name = 'flying-text', position = pos, text = msg, color = color})
surface.create_entity({ name = 'flying-text', position = pos, text = msg, color = color })
end
end
@@ -342,7 +347,7 @@ end
local function move_multiple(source, destination, stack, amount)
local ret = 0
for _, itemName in pairs(stack) do
ret = move_items(source, destination, {name = itemName, count = amount})
ret = move_items(source, destination, { name = itemName, count = amount })
if (ret > 0) then
return ret
end
@@ -356,7 +361,7 @@ local function auto_insert_into_turret(player, turret)
return
end
local ret = move_multiple(inventory, turret, {'artillery-shell', 'uranium-rounds-magazine', 'piercing-rounds-magazine', 'firearm-magazine'}, autofill_amount)
local ret = move_multiple(inventory, turret, { 'artillery-shell', 'uranium-rounds-magazine', 'piercing-rounds-magazine', 'firearm-magazine' }, autofill_amount)
if (ret > 1) then
show_text('[Autofill] Inserted ' .. ret .. '!', turret.position, Color.info, player.surface)
@@ -374,15 +379,15 @@ local function auto_insert_into_vehicle(player, vehicle)
end
if ((vehicle.name == 'car') or (vehicle.name == 'tank') or (vehicle.name == 'locomotive')) then
move_multiple(inventory, vehicle, {'nuclear-fuel', 'rocket-fuel', 'solid-fuel', 'coal', 'wood'}, 50)
move_multiple(inventory, vehicle, { 'nuclear-fuel', 'rocket-fuel', 'solid-fuel', 'coal', 'wood' }, 50)
end
if ((vehicle.name == 'car') or (vehicle.name == 'tank')) then
move_multiple(inventory, vehicle, {'uranium-rounds-magazine', 'piercing-rounds-magazine', 'firearm-magazine'}, autofill_amount)
move_multiple(inventory, vehicle, { 'uranium-rounds-magazine', 'piercing-rounds-magazine', 'firearm-magazine' }, autofill_amount)
end
if (vehicle.name == 'tank') then
move_multiple(inventory, vehicle, {'explosive-uranium-cannon-shell', 'uranium-cannon-shell', 'explosive-cannon-shell', 'cannon-shell'}, autofill_amount)
move_multiple(inventory, vehicle, { 'explosive-uranium-cannon-shell', 'uranium-cannon-shell', 'explosive-cannon-shell', 'cannon-shell' }, autofill_amount)
end
end
@@ -407,7 +412,7 @@ local function on_entity_built(event)
else
if not this.message_limit[player.index] then
this.message_limit[player.index] = true
player.print('[Autofill] Chest limit reached.', Color.warning)
player.print('[Autofill] Chest limit reached.', { color = Color.warning })
end
end
else
@@ -420,7 +425,7 @@ local function on_entity_built(event)
else
if not this.message_limit[player.index] then
this.message_limit[player.index] = true
player.print('[Autofill] Chest limit reached.', Color.warning)
player.print('[Autofill] Chest limit reached.', { color = Color.warning })
end
end
end
@@ -490,7 +495,7 @@ local function on_tick()
do_refill_turrets()
end
Public.refill_turret_callback = function(player, turret)
Public.refill_turret_callback = function (player, turret)
if this.globally_enabled then
local refill_turrets = this.refill_turrets
if turret and turret.valid then
@@ -505,7 +510,7 @@ Public.refill_turret_callback = function(player, turret)
end
end
Public.add_chest_to_refill_callback = function(player, entity)
Public.add_chest_to_refill_callback = function (player, entity)
if entity and entity.valid then
if this.globally_enabled then
local refill_chests = this.refill_chests
@@ -521,19 +526,20 @@ Public.add_chest_to_refill_callback = function(player, entity)
player_data.placed = chest_placed + 1
end
rendering.draw_text {
rendering.draw_text
{
text = '',
surface = entity.surface,
target = entity,
target_offset = {0, -0.5},
target_offset = { 0, -0.5 },
scale = 1.5,
color = {r = 0, g = 0.6, b = 1},
color = { r = 0, g = 0.6, b = 1 },
alignment = 'center'
}
end
end
Public.globally_enabled = function(value)
Public.globally_enabled = function (value)
if value then
this.globally_enabled = value
else

View File

@@ -14,7 +14,8 @@ local auto_stash_button_name = Gui.uid_name()
local floor = math.floor
local module_name = '[color=blue][Autostash][/color] '
local this = {
local this =
{
floating_text_y_offsets = {},
whitelist = {},
insert_to_neutral_chests = false,
@@ -26,7 +27,8 @@ local this = {
enabled = true
}
local Public = {
local Public =
{
}
Global.register(
@@ -36,7 +38,8 @@ Global.register(
end
)
local bps_blacklist = {
local bps_blacklist =
{
['blueprint-book'] = true,
['blueprint'] = true
}
@@ -98,7 +101,8 @@ local function create_floaty_text(surface, position, name, count)
if player.surface_index == surface.index then
player.create_local_flying_text(
{
position = {
position =
{
position.x,
position.y + this.floating_text_y_offsets[position.x .. '_' .. position.y]
},
@@ -435,7 +439,8 @@ local function insert_into_wagon_filtered(stack, chests, name, floaty_text_list)
end
local function insert_item_into_chest(stack, chests, filtered_chests, name, floaty_text_list, previous_insert)
local container = {
local container =
{
['container'] = true,
['logistic-container'] = true,
['linked-container'] = true
@@ -577,17 +582,17 @@ local function auto_stash(player, event)
local ctrl = event.control
local shift = event.shift
if not player.character then
player.print(module_name .. 'It seems that you are not in the realm of the living.', Color.warning)
player.print(module_name .. 'It seems that you are not in the realm of the living.', { color = Color.warning })
return
end
if not player.character.valid then
player.print(module_name .. 'It seems that you are not in the realm of the living.', Color.warning)
player.print(module_name .. 'It seems that you are not in the realm of the living.', { color = Color.warning })
return
end
local inventory = player.get_main_inventory()
if not inventory then return end
if inventory.is_empty() then
player.print(module_name .. 'Inventory is empty.', Color.warning)
player.print(module_name .. 'Inventory is empty.', { color = Color.warning })
return
end
@@ -608,7 +613,7 @@ local function auto_stash(player, event)
end
if not chests.chest or not chests.chest[1] then
player.print(module_name .. 'No valid nearby containers found.', Color.warning)
player.print(module_name .. 'No valid nearby containers found.', { color = Color.warning })
return
end
@@ -630,7 +635,8 @@ local function auto_stash(player, event)
end
end
local furnace_list = {
local furnace_list =
{
['coal'] = 0,
['iron-ore'] = 0,
['copper-ore'] = 0,

View File

@@ -49,7 +49,7 @@ local function check_burden(event)
Modifier.update_single_modifier(player, 'character_mining_speed_modifier', 'randomness', 0.3 - fullness)
Modifier.update_player_modifiers(player)
if fullness >= 0.9 and fullness <= 0.901 then
player.print('Maybe you should drop some of that inventory to lessen the burden.', Color.red)
player.print('Maybe you should drop some of that inventory to lessen the burden.', { color = Color.red })
end
end

View File

@@ -6,7 +6,8 @@ local m_gui = require 'mod-gui'
local mod = m_gui.get_button_flow
local SpamProtection = require 'utils.spam_protection'
local this = {
local this =
{
inf_chests = {},
inf_storage = {},
inf_gui = {},
@@ -19,7 +20,8 @@ local this = {
stack_size = {}
}
local ore_names = {
local ore_names =
{
['coal'] = true,
['stone'] = true,
['iron-ore'] = true,
@@ -166,7 +168,8 @@ local function draw_main_frame(player, target, chest_id)
end
local p = target or player
local frame =
player.gui.screen.add {
player.gui.screen.add
{
type = 'frame',
caption = p.name .. '´s private portable stash',
direction = 'vertical',
@@ -181,7 +184,8 @@ local function draw_main_frame(player, target, chest_id)
local tbl = controls.add { type = 'table', column_count = 1 }
local btn =
tbl.add {
tbl.add
{
type = 'sprite-button',
tooltip = '[color=blue]Info![/color]\nYou can easily remove an item by left/right-clicking it.\n\nItems selected in the table below will remove all stacks except one from the player inventory.\nIf the stack-size is bigger in the personal stash than the players inventory stack then the players inventory will automatically refill from the personal stash.\n\n[color=red]Usage[/color]\nPressing the following keys will do the following actions:\nCTRL: Retrieves all stacks from clicked item\nSHIFT:Retrieves a stack from clicked item.\nStack-Size slider will always ensure that you have <x> amounts of stacks in your inventory.\n\n[color=red]Deleting[/color]\nDelete Mode: Will delete the clicked item instantly.',
sprite = 'utility/questionmark'
@@ -203,7 +207,8 @@ local function draw_main_frame(player, target, chest_id)
end
local text =
tbl.add {
tbl.add
{
type = 'label',
caption = format('Stores unlimited quantity of items (up to ' .. amount_and_types .. ' types).\nRead the tooltip by hovering the question-mark above!')
}
@@ -247,7 +252,8 @@ local function draw_main_frame(player, target, chest_id)
this.viewing_player[player.index] = nil
end
end
this.inf_gui[player.index] = {
this.inf_gui[player.index] =
{
item_frame = items,
frame = frame,
updated = false,
@@ -301,7 +307,8 @@ local function update_gui()
local btn
for item_name, item_count in pairs(items) do
btn =
tbl.add {
tbl.add
{
type = 'sprite-button',
sprite = 'item/' .. item_name,
style = 'slot_button',
@@ -486,14 +493,14 @@ local function on_gui_elem_changed(event)
if this.ores_only then
if not ore_names[name] then
player.print('You can only stash ores and wood.', Color.warning)
player.print('You can only stash ores and wood.', { color = Color.warning })
goto update
end
end
if this.allow_barrels then
if string.match(name, 'barrel') then
player.print('You can´t stash barrels.', Color.warning)
player.print('You can´t stash barrels.', { color = Color.warning })
goto update
end
end
@@ -517,7 +524,8 @@ local function on_player_joined_game(event)
end
local chest_id = Gui.uid()
if not this.player_chests[player.index] then
this.player_chests[player.index] = {
this.player_chests[player.index] =
{
chest_id = chest_id
}
end
@@ -652,7 +660,7 @@ commands.add_command(
local target_player = game.players[cmd.parameter]
if target_player == player then
return player.print('Cannot open self.', Color.warning)
return player.print('Cannot open self.', { color = Color.warning })
end
if target_player.admin then
@@ -666,7 +674,7 @@ commands.add_command(
end
draw_main_frame(player, target_player, chest_id)
else
player.print('Please type a valid player name.', Color.warning)
player.print('Please type a valid player name.', { color = Color.warning })
end
end
)

View File

@@ -23,7 +23,8 @@ local floor = math.floor
local random = math.random
local abs = math.abs
local this = {
local this =
{
enabled = true,
max_count_decon = 1500,
landfill_history = {},
@@ -62,7 +63,8 @@ local this = {
admin_button_validation = {}
}
local ammo_names = {
local ammo_names =
{
['artillery-targeting-remote'] = true,
['poison-capsule'] = true,
['cluster-grenade'] = true,
@@ -72,7 +74,8 @@ local ammo_names = {
['rocket'] = true
}
local chests = {
local chests =
{
['container'] = true,
['logistic-container'] = true
}
@@ -154,13 +157,14 @@ local function damage_player(player, kill, print_to_all)
if kill then
player.character.die('enemy')
if print_to_all then
game.print(player.name .. msg, Color.yellow)
game.print(player.name .. msg, { color = Color.yellow })
end
return
end
player.character.health = player.character.health - random(50, 100)
player.character.surface.create_entity({ name = 'water-splash', position = player.position })
local messages = {
local messages =
{
'Ouch.. That hurt! Better be careful now.',
'Just a fleshwound.',
'Better keep those hands to yourself or you might loose them.'
@@ -168,7 +172,7 @@ local function damage_player(player, kill, print_to_all)
player.print(messages[random(1, #messages)], { color = Color.yellow })
if player.character.health <= 0 then
player.character.die('enemy')
game.print(player.name .. msg, Color.yellow)
game.print(player.name .. msg, { color = Color.yellow })
return
end
end
@@ -699,7 +703,8 @@ local function on_console_command(event)
return
end
local valid_commands = {
local valid_commands =
{
['r'] = true,
['whisper'] = true
}
@@ -957,7 +962,8 @@ local function on_player_deconstructed_area(event)
if next(this.filtered_types_on_decon) then
local filtered_count = surface.count_entities_filtered({ area = area, type = this.filtered_types_on_decon })
if filtered_count and filtered_count > 0 then
surface.cancel_deconstruct_area {
surface.cancel_deconstruct_area
{
area = area,
force = player.force
}
@@ -965,7 +971,8 @@ local function on_player_deconstructed_area(event)
end
if count and count >= max_count then
surface.cancel_deconstruct_area {
surface.cancel_deconstruct_area
{
area = area,
force = player.force
}
@@ -1134,11 +1141,13 @@ local function on_player_muted(event)
local player = game.get_player(event.player_index)
local message = {
local message =
{
title = 'Muted :mute:',
description = 'A player was muted.',
color = 'failure',
field1 = {
field1 =
{
text1 = 'Player:',
text2 = player.name,
inline = 'false'
@@ -1154,11 +1163,13 @@ local function on_player_unmuted(event)
local player = game.get_player(event.player_index)
local message = {
local message =
{
title = 'Unmuted :speaker:',
description = 'A player was unmuted.',
color = 'success',
field1 = {
field1 =
{
text1 = 'Player:',
text2 = player.name,
inline = 'false'

View File

@@ -206,7 +206,7 @@ Commands.new('refresh', 'Reloads game script')
:add_alias('reload')
:callback(
function (player)
game.print('Reloading game script...', Color.warning)
game.print('Reloading game script...', { color = Color.warning })
Server.to_discord_bold(player.name .. ' is reloading the game script.')
Discord.send_notification_raw(nil, player.name .. ' is reloading the game script.')
game.reload_script()
@@ -223,7 +223,7 @@ Commands.new('spaghetti', 'Toggle between disabling bots.')
function (player, args)
local force = player.force
if args == 'true' then
game.print('The world has been spaghettified!', Color.success)
game.print('The world has been spaghettified!', { color = Color.success })
force.technologies['logistic-system'].enabled = false
force.technologies['construction-robotics'].enabled = false
force.technologies['logistic-robotics'].enabled = false
@@ -242,7 +242,7 @@ Commands.new('spaghetti', 'Toggle between disabling bots.')
this.spaghetti_enabled = true
return true
elseif args == 'false' then
game.print('The world is no longer spaghett!', Color.yellow)
game.print('The world is no longer spaghett!', { color = Color.yellow })
force.technologies['logistic-system'].enabled = true
force.technologies['construction-robotics'].enabled = true
force.technologies['logistic-robotics'].enabled = true
@@ -381,7 +381,7 @@ Commands.new('creative', 'Enables creative_mode.')
function (player, args)
local force = player.force
if args == 'true' then
game.print('[CREATIVE] ' .. player.name .. ' has activated creative-mode!', Color.warning)
game.print('[CREATIVE] ' .. player.name .. ' has activated creative-mode!', { color = Color.warning })
Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has activated creative-mode!' })
Modifiers.set('creative_enabled', true)
@@ -396,7 +396,7 @@ Commands.new('creative', 'Enables creative_mode.')
end
end
elseif args == 'false' then
game.print('[CREATIVE] ' .. player.name .. ' has deactivated creative-mode!', Color.warning)
game.print('[CREATIVE] ' .. player.name .. ' has deactivated creative-mode!', { color = Color.warning })
Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has deactivated creative-mode!' })
Modifiers.set('creative_enabled', false)
@@ -442,7 +442,7 @@ Commands.new('delete_uncharted_chunks', 'Deletes all chunks that are not charted
end
local message = player.name .. ' deleted ' .. count .. ' uncharted chunks!'
game.print(message, Color.warning)
game.print(message, { color = Color.warning })
Server.to_discord_bold(table.concat { message })
end
)
@@ -465,7 +465,7 @@ local function clear_corpses(cmd)
local p = player.print
if not trusted[player.name] then
if not player.admin then
p('[ERROR] Only admins and trusted weebs are allowed to run this command!', Color.fail)
p('[ERROR] Only admins and trusted weebs are allowed to run this command!', { color = Color.fail })
return
end
end

View File

@@ -28,7 +28,7 @@ local Public = {}
-- @param color <table> the color to use for the message, defaults to white
function Public.print_except(msg, player, color)
if not color then
color = Color.white
color = { color = Color.white }
end
for _, p in pairs(game.connected_players) do
@@ -346,7 +346,7 @@ end
-- @param msg <string> The message to print
-- @param warning_prefixes <string> The name of the module/warning
function Public.action_warning(warning_prefixes, msg)
game.print(prefix .. msg, Color.yellow)
game.print(prefix .. msg, { color = Color.yellow })
msg = format('%s %s', warning_prefixes, msg)
print(msg)
Server.to_discord_bold(msg)
@@ -357,7 +357,7 @@ end
function Public.action_notify_admins(msg)
for _, p in pairs(game.connected_players) do
if p.admin then
p.print(msg, Color.yellow)
p.print(msg, { color = Color.yellow })
end
end
print(msg)
@@ -367,7 +367,7 @@ end
-- @param msg <string> The message to print
-- @param warning_prefixes <string> The name of the module/warning
function Public.action_warning_embed(warning_prefixes, msg)
game.print(prefix .. msg, Color.yellow)
game.print(prefix .. msg, { color = Color.yellow })
msg = format('%s %s', warning_prefixes, msg)
print(msg)
Server.to_discord_embed(msg)
@@ -387,7 +387,7 @@ end
-- @param warning_prefixes <string> The name of the module/warning
-- @param player <LuaPlayer> the player not to send the message to
function Public.silent_action_warning(warning_prefixes, msg, player)
Public.print_except(prefix .. msg, player, Color.yellow)
Public.print_except(prefix .. msg, player, { color = Color.yellow })
msg = format('%s %s', warning_prefixes, msg)
print(msg)
Server.to_discord_bold(msg)

View File

@@ -203,12 +203,12 @@ function Public.get_and_print_to_player(player, target_player)
local p = player.print
if not target_player then
p('[ERROR] No player was provided.', Color.fail)
p('[ERROR] No player was provided.', { color = Color.fail })
return
end
if not player.admin then
p("[ERROR] You're not admin.", Color.fail)
p("[ERROR] You're not admin.", { color = Color.fail })
return
end

View File

@@ -13,6 +13,7 @@ local Vars = require 'utils.player_list_vars'
local Utils = require 'utils.utils'
local Core = require 'utils.core'
local Inventory = require 'modules.show_inventory'
local Color = require 'utils.color_presets'
local Public =
{
@@ -297,6 +298,10 @@ Gui.on_click(
if not target or not target.valid then
return
end
if target.controller_type == defines.controllers.remote then
player.print('[Inventory] This player is currently in remote-view and has no character association. Please try again later.', { color = Color.warning })
return
end
Inventory.show_inventory(player, target)
end
end

View File

@@ -43,7 +43,7 @@ if (debug.sethook) then
if player ~= nil then
if not player.admin then
local p = player.print
p('[ERROR] Only admins are allowed to run this command!', Color.fail)
p('[ERROR] Only admins are allowed to run this command!', { color = Color.fail })
return
else
if allowed[player.name] then
@@ -61,7 +61,7 @@ if (debug.sethook) then
if player ~= nil then
if not player.admin then
local p = player.print
p('[ERROR] Only admins are allowed to run this command!', Color.fail)
p('[ERROR] Only admins are allowed to run this command!', { color = Color.fail })
return
else
if allowed[player.name] then