1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-31 05:33:00 +00:00

Merge branch 'mc-1.15.x' into mc-1.16.x

This commit is contained in:
Jonathan Coates
2021-03-12 09:26:15 +00:00
71 changed files with 4054 additions and 149 deletions

View File

@@ -1,3 +1,12 @@
# New features in CC: Tweaked 1.95.3
Several bug fixes:
* Correctly serialise sparse arrays into JSON (livegamer999)
* Fix hasAudio/playAudio failing on record discs.
* Fix rs.getBundledInput returning the output instead (SkyTheCodeMaster)
* Programs run via edit are now a little better behaved (Wojbie)
* Add User-Agent to a websocket's headers.
# New features in CC: Tweaked 1.95.2
* Add `isReadOnly` to `fs.attributes` (Lupus590)

View File

@@ -1,14 +1,10 @@
New features in CC: Tweaked 1.95.2
* Add `isReadOnly` to `fs.attributes` (Lupus590)
* Many more programs now support numpad enter (Wojbie)
New features in CC: Tweaked 1.95.3
Several bug fixes:
* Fix some commands failing to parse on dedicated servers.
* Fix all disk recipes appearing to produce a white disk in JEI/recipe book.
* Hopefully improve edit's behaviour with AltGr on some European keyboards.
* Prevent files being usable after their mount was removed.
* Fix the `id` program crashing on non-disk items (Wojbie).
* Preserve registration order of turtle/pocket upgrades when displaying in JEI.
* Correctly serialise sparse arrays into JSON (livegamer999)
* Fix hasAudio/playAudio failing on record discs.
* Fix rs.getBundledInput returning the output instead (SkyTheCodeMaster)
* Programs run via edit are now a little better behaved (Wojbie)
* Add User-Agent to a websocket's headers.
Type "help changelog" to see the full version history.

View File

@@ -1,5 +1,5 @@
Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks!
View the documentation at https://wiki.computercraft.cc
View the documentation at https://tweaked.cc
Show off your programs or ask for help at our forum: https://forums.computercraft.cc
You can disable these messages by running "set motd.enable false".
Use "pastebin put" to upload a program to pastebin.

View File

@@ -47,6 +47,30 @@ else
stringColour = colours.white
end
local runHandler = [[multishell.setTitle(multishell.getCurrent(), %q)
local current = term.current()
local ok, err = load(%q, %q, nil, _ENV)
if ok then ok, err = pcall(ok, ...) end
term.redirect(current)
term.setTextColor(term.isColour() and colours.yellow or colours.white)
term.setBackgroundColor(colours.black)
term.setCursorBlink(false)
local _, y = term.getCursorPos()
local _, h = term.getSize()
if not ok then
printError(err)
end
if ok and y >= h then
term.scroll(1)
end
term.setCursorPos(1, h)
if ok then
write("Program finished. ")
end
write("Press any key to continue")
os.pullEvent('key')
]]
-- Menus
local bMenu = false
local nMenuItem = 1
@@ -89,7 +113,7 @@ local function load(_sPath)
end
end
local function save(_sPath)
local function save(_sPath, fWrite)
-- Create intervening folder
local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len())
if not fs.exists(sDir) then
@@ -101,8 +125,8 @@ local function save(_sPath)
local function innerSave()
file, fileerr = fs.open(_sPath, "w")
if file then
for _, sLine in ipairs(tLines) do
file.write(sLine .. "\n")
if file then
fWrite(file)
end
else
error("Failed to open " .. _sPath)
@@ -293,7 +317,11 @@ local tMenuFuncs = {
if bReadOnly then
sStatus = "Access denied"
else
local ok, _, fileerr = save(sPath)
local ok, _, fileerr = save(sPath, function(file)
for _, sLine in ipairs(tLines) do
file.write(sLine .. "\n")
end
end)
if ok then
sStatus = "Saved to " .. sPath
else
@@ -390,8 +418,18 @@ local tMenuFuncs = {
bRunning = false
end,
Run = function()
local sTempPath = "/.temp"
local ok = save(sTempPath)
local sTitle = fs.getName(sPath)
if sTitle:sub(-4) == ".lua" then
sTitle = sTitle:sub(1, -5)
end
local sTempPath = bReadOnly and ".temp." .. sTitle or fs.combine(fs.getDir(sPath), ".temp." .. sTitle)
if fs.exists(sTempPath) then
sStatus = "Error saving to " .. sTempPath
return
end
local ok = save(sTempPath, function(file)
file.write(runHandler:format(sTitle, table.concat(tLines, "\n"), "@" .. fs.getName(sPath)))
end)
if ok then
local nTask = shell.openTab(sTempPath)
if nTask then