1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-11 13:39:14 +02:00

Merge branch 'develop' into develop

This commit is contained in:
hanakocz 2022-12-02 16:40:24 +01:00 committed by GitHub
commit b44a289664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 27 deletions

View File

@ -1089,11 +1089,13 @@ local function deny_building(event)
if entity.position.x >= 254 then
if entity.name ~= 'entity-ghost' then
if event.player_index then
game.get_player(event.player_index).insert({name = entity.name, count = 1})
else
local inventory = event.robot.get_inventory(defines.inventory.robot_cargo)
inventory.insert({name = entity.name, count = 1})
if not string.match(entity.name, 'rail') then
if event.player_index then
game.get_player(event.player_index).insert({name = entity.name, count = 1})
else
local inventory = event.robot.get_inventory(defines.inventory.robot_cargo)
inventory.insert({name = entity.name, count = 1})
end
end
end

View File

@ -122,9 +122,9 @@ Public.difficulty_options = {
{value = 0.9, icon = 'item/piercing-rounds-magazine', text = {'pirates.difficulty_normal'}, associated_color = {r = 255, g = 255, b = 50}},
{value = 1.3, icon = 'item/uranium-rounds-magazine', text = {'pirates.difficutly_hard'}, associated_color = {r = 255, g = 50, b = 50}},
{value = 1.4, icon = 'item/uranium-rounds-magazine', text = {'pirates.difficutly_hard'}, associated_color = {r = 255, g = 50, b = 50}},
{value = 1.8, icon = 'item/atomic-bomb', text = {'pirates.difficulty_nightmare'}, associated_color = {r = 170, g = 60, b = 60}},
{value = 2.1, icon = 'item/atomic-bomb', text = {'pirates.difficulty_nightmare'}, associated_color = {r = 170, g = 60, b = 60}},
}
function Public.get_difficulty_option_from_value(difficulty_value)
-- given a difficulty value, key in to the closesy entry in the above table. (organising things this way allows us to make changes to the 'value' keys in the above table without disrupting e.g. past highscores data)

View File

@ -8,6 +8,11 @@ local ban_by_join_enabled = false
local try_get_ban = Server.try_get_ban
local valid_commands = {
['ban'] = true,
['unban'] = true
}
local try_get_is_banned_token =
Token.register(
function(data)
@ -52,7 +57,9 @@ Event.add(
Event.add(
defines.events.on_console_command,
function(event)
Server.ban_handler(event)
if valid_commands[event.command] then
Server.ban_handler(event)
end
end
)

View File

@ -1330,11 +1330,10 @@ function Public.ban_handler(event)
return
end
if len(user) <= 2 then
if len(user) <= 1 then
return
end
local player_index
local reason
local str = ''
@ -1343,36 +1342,26 @@ function Public.ban_handler(event)
insert(t, i)
end
player_index = t[1]
local target = t[1]
for i = 2, #t do
str = str .. t[i] .. ' '
reason = str
end
if not player_index then
return print('[on_console_command] - player_index was undefined.')
end
local target
if game.get_player(player_index) then
target = game.get_player(player_index)
if not target or not target.valid then
return
end
else
return
if not target then
return print('[on_console_command] - target was undefined.')
end
if event.player_index then
local player = game.get_player(event.player_index)
if player and player.valid and player.admin then
local data = Public.build_embed_data()
data.username = target.name
data.username = target
data.admin = player.name
if cmd == 'ban' then
Public.set_data(jailed_data_set, target.name, nil) -- this is added here since we don't want to clutter the jail dataset.
Public.set_data(jailed_data_set, target, nil) -- this is added here since we don't want to clutter the jail dataset.
if not reason then
data.reason = 'Not specified.'
Public.to_banned_embed(data)
@ -1389,7 +1378,7 @@ function Public.ban_handler(event)
end
else
local data = Public.build_embed_data()
data.username = target.name
data.username = target
data.admin = '<server>'
if event.user_override then
@ -1397,7 +1386,7 @@ function Public.ban_handler(event)
end
if cmd == 'ban' then
Public.set_data(jailed_data_set, target.name, nil) -- this is added here since we don't want to clutter the jail dataset.
Public.set_data(jailed_data_set, target, nil) -- this is added here since we don't want to clutter the jail dataset.
if not reason then
data.reason = 'Not specified.'
Public.to_banned_embed(data)