Add startable legacy code

This commit is contained in:
Cooldude2606
2024-09-22 23:38:58 +01:00
parent 65145b5d34
commit 2a1206c498
163 changed files with 756 additions and 2573 deletions

View File

@@ -1,14 +1,23 @@
--- This file defines the different triggers for the chat bot
-- @config Chat-Reply
local Async = require 'expcore.async'
local format_time = _C.format_time --- @dep expcore.common
local ExpUtil = require("modules/exp_util")
local Async = require("modules/exp_util/async")
-- eg Async(async_message, is_command or player, message)
local async_message = Async.register(function(player, message)
if player == true then game.print(message) else player.print(message) end
local send_message_async =
Async.register(function(player, message)
if player == true then
game.print(message)
else
player.print(message)
end
end)
local afk_time_units = {
minutes = true,
seconds = true,
}
-- luacheck:ignore 212/player 212/is_command
return {
allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed
@@ -37,7 +46,7 @@ return {
max = next_player
end
end
return {'chat-bot.afk', max.name, format_time(max.afk_time, {minutes = true, seconds = true, long = true})}
return {'chat-bot.afk', max.name, ExpUtil.format_locale_time(max.afk_time, "long", afk_time_units)}
end,
['players'] = function(_player, _is_command)
return {'chat-bot.players', #game.players}
@@ -74,46 +83,46 @@ return {
end,
['makepopcorn'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-popcorn-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-popcorn-2', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-popcorn-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-popcorn-2', player.name}})
end,
['passsomesnaps'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, player, {'chat-bot.reply', {'chat-bot.get-snaps-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-snaps-2', player.name}})
Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.get-snaps-3', player.name}})
send_message_async(player, {'chat-bot.reply', {'chat-bot.get-snaps-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-snaps-2', player.name}})
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.get-snaps-3', player.name}})
end,
['makecocktail'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-2', player.name}})
Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-3', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-cocktail-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-cocktail-2', player.name}})
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.get-cocktail-3', player.name}})
end,
['makecoffee'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-coffee-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.make-coffee-2', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.make-coffee-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.make-coffee-2', player.name}})
end,
['orderpizza'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-2', player.name}})
Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-3', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.order-pizza-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.order-pizza-2', player.name}})
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.order-pizza-3', player.name}})
end,
['maketea'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-tea-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.make-tea-2', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.make-tea-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.make-tea-2', player.name}})
end,
['meadplease'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-mead-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-mead-2', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-mead-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-mead-2', player.name}})
end,
['passabeer'] = function(player, _is_command)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-1'}})
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-2', player.name}})
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-beer-1'}})
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-beer-2', player.name}})
end
}
}

View File

@@ -3,7 +3,7 @@
-- either way you can change the requirements to be "admin" if you wanted to
-- @config Commands-Auth-Admin
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
-- luacheck:ignore 212/command
Commands.add_authenticator(function(player, command, tags, reject)

View File

@@ -1,8 +1,8 @@
--- This will make commands only work if the role has been allowed it in the role config
-- @config Commands-Auth-Roles
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Roles = require 'expcore.roles' --- @dep expcore.roles
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
-- luacheck:ignore 212/tags
Commands.add_authenticator(function(player, command, tags, reject)

View File

@@ -1,8 +1,8 @@
--- This will make commands only work when a valid color from the presets has been selected
-- @config Commands-Color-Parse
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
local Colours = require("modules/exp_util/include/color")
Commands.add_parse('color',function(input, _, reject)
if not input then return end

View File

@@ -19,7 +19,7 @@ see ./expcore/commands.lua for more details
surface
]]
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
-- luacheck:ignore 212/player
Commands.add_parse('boolean',function(input, player)

View File

@@ -7,10 +7,10 @@
player-role-alive
]]
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Roles = require 'expcore.roles' --- @dep expcore.roles
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
local auto_complete = _C.auto_complete --- @dep expcore.common
require 'config.expcore.command_general_parse'
require("modules.exp_legacy.config.expcore.command_general_parse")
-- luacheck:ignore 212/player
Commands.add_parse('role',function(input, player, reject)

View File

@@ -2,11 +2,11 @@
-- this config adds Commands.disable and Commands.enable to enable and disable commands for all users
-- @config Commands-Auth-Runtime-Disable
local Commands = require 'expcore.commands' --- @dep expcore.commands
local Global = require 'utils.global' --- @dep utils.global
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
local Storage = require("modules/exp_util/storage")
local disabled_commands = {}
Global.register(disabled_commands, function(tbl)
Storage.register(disabled_commands, function(tbl)
disabled_commands = tbl
end)

View File

@@ -4,8 +4,8 @@
-- then use :allow{} and :disallow{} to specify certain actions to allow/disallow
-- @config Permission-Groups
--local Event = require 'utils.event' -- @dep utils.event
local Permission_Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups
--local Event = require("modules/exp_legacy/utils/event") -- @dep utils.event
local Permission_Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep expcore.permission_groups
Permission_Groups.new_group('Admin')
:allow_all()
@@ -60,7 +60,7 @@ Permission_Groups.new_group('Standard')
'admin_action', -- trusted
'change_programmable_speaker_alert_parameters', -- standard
'drop_item',
'set_auto_launch_rocket'
'change_rocket_silo_mode'
}
Permission_Groups.new_group('Guest')
@@ -81,7 +81,7 @@ Permission_Groups.new_group('Guest')
'admin_action', -- trusted
'change_programmable_speaker_alert_parameters', -- standard
'drop_item',
'set_auto_launch_rocket',
'change_rocket_silo_mode',
'change_programmable_speaker_parameters', -- guest
'change_train_stop_station',
--'deconstruct',
@@ -89,10 +89,10 @@ Permission_Groups.new_group('Guest')
'remove_train_station',
'reset_assembling_machine',
'rotate_entity',
'use_artillery_remote',
--'use_artillery_remote', -- not in 2.0
'launch_rocket',
'cancel_research',
'activate_cut',
--'activate_cut', -- not in 2.0
'flush_opened_entity_fluid',
'flush_opened_entity_specific_fluid'
}

View File

@@ -1,8 +1,8 @@
--- This is the main config file for the role system; file includes defines for roles and role flags and default values
-- @config Roles
local Roles = require 'expcore.roles' --- @dep expcore.roles
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
local Statistics = PlayerData.Statistics
--- Role flags that will run when a player changes roles

View File

@@ -1,7 +1,7 @@
--- This file contains all the different settings for the autofill system and gui
-- @config Autofill
local table = require 'overrides.table' -- @dep overrides.table
local table = require("modules.exp_legacy.overrides.table") -- @dep overrides.table
local config = {
-- General config

View File

@@ -5,12 +5,12 @@
-- the key used for the name of the button is the permission name used by the role system;
-- @config Player-List
local Gui = require 'expcore.gui' --- @dep expcore.gui
local Roles = require 'expcore.roles' --- @dep expcore.roles
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
local Gui = require("modules.exp_legacy.expcore.gui") --- @dep expcore.gui
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
local Colors = require("modules/exp_util/include/color")
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
local SelectedPlayer, SelectedAction