mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 03:00:30 +00:00
Add MOTD (#175)
This commit is contained in:
parent
0ec3884e98
commit
ad33acd7d1
@ -982,6 +982,8 @@ settings.set( "edit.default_extension", "lua" )
|
||||
settings.set( "paint.default_extension", "nfp" )
|
||||
settings.set( "lua.autocomplete", true )
|
||||
settings.set( "list.show_hidden", false )
|
||||
settings.set( "motd.enable", false )
|
||||
settings.set( "motd.path", "/rom/motd.txt:/motd.txt" )
|
||||
if term.isColour() then
|
||||
settings.set( "bios.use_multishell", true )
|
||||
end
|
||||
|
4
src/main/resources/assets/computercraft/lua/rom/motd.txt
Normal file
4
src/main/resources/assets/computercraft/lua/rom/motd.txt
Normal file
@ -0,0 +1,4 @@
|
||||
View the source code at https://github.com/SquidDev-CC/CC-Tweaked
|
||||
View the documentation at https://wiki.computercraft.cc
|
||||
Visit the forum at https://forums.computercraft.cc
|
||||
You can disable these messages by running "set motd.enable false"
|
@ -0,0 +1,15 @@
|
||||
local tMotd = {}
|
||||
|
||||
for sPath in string.gmatch(settings.get( "motd.path" ), "[^:]+") do
|
||||
if fs.exists(sPath) then
|
||||
for sLine in io.lines(sPath) do
|
||||
table.insert(tMotd,sLine)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #tMotd == 0 then
|
||||
print("missingno")
|
||||
else
|
||||
print(tMotd[math.random(1,#tMotd)])
|
||||
end
|
@ -269,6 +269,11 @@ local function findStartups( sBaseDir )
|
||||
return tStartups
|
||||
end
|
||||
|
||||
-- Show MOTD
|
||||
if settings.get( "motd.enable" ) then
|
||||
shell.run( "motd" )
|
||||
end
|
||||
|
||||
-- Run the user created startup, either from disk drives or the root
|
||||
local tUserStartups = nil
|
||||
if settings.get( "shell.allow_startup" ) then
|
||||
|
Loading…
Reference in New Issue
Block a user