mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-29 21:02:59 +00:00 
			
		
		
		
	Merge branch 'mc-1.14.x' into mc-1.15.x
This commit is contained in:
		| @@ -19,6 +19,36 @@ function getFreeSpace(path) end | |||||||
| function find(pattern) end | function find(pattern) end | ||||||
| function getDir(path) end | function getDir(path) end | ||||||
|  |  | ||||||
|  | --- Get the capacity of the drive at the given path. | ||||||
|  | -- | ||||||
|  | -- This may be used in conjunction with @{getFreeSpace} to determine what | ||||||
|  | -- percentage of this drive has been used. | ||||||
|  | -- | ||||||
|  | -- @tparam string path The path of the drive to get. | ||||||
|  | -- @treturn number This drive's capacity. This will be 0 for "read-only" drives, | ||||||
|  | -- such as the ROM or treasure disks. | ||||||
|  | function getCapacity(path) end | ||||||
|  |  | ||||||
|  | --- Get attributes about a specific file or folder. | ||||||
|  | -- | ||||||
|  | -- The returned attributes table contains information about the size of the | ||||||
|  | -- file, whether it is a directory, and when it was created and last modified. | ||||||
|  | -- | ||||||
|  | -- The creation and modification times are given as the number of milliseconds | ||||||
|  | -- since the UNIX epoch. This may be given to @{os.date} in order to convert it | ||||||
|  | -- to more usable form. | ||||||
|  | -- | ||||||
|  | -- @tparam string path The path to get attributes for. | ||||||
|  | -- @treturn { size = number, isDir = boolean, created = number, modified = number } | ||||||
|  | -- The resulting attributes. | ||||||
|  | -- @throws If the path does not exist. | ||||||
|  | -- @see getSize If you only care about the file's size. | ||||||
|  | -- @see isDir If you only care whether a path is a directory or not. | ||||||
|  | function attributes(path) end | ||||||
|  |  | ||||||
|  | -- Defined in bios.lua | ||||||
|  | function complete(sPath, sLocation, bIncludeFiles, bIncludeDirs) end | ||||||
|  |  | ||||||
| --- A file handle which can be read from. | --- A file handle which can be read from. | ||||||
| -- | -- | ||||||
| -- @type ReadHandle | -- @type ReadHandle | ||||||
|   | |||||||
| @@ -15,3 +15,10 @@ function cancelTimer(id) end | |||||||
| function cancelAlarm(id) end | function cancelAlarm(id) end | ||||||
| function epoch(timezone) end | function epoch(timezone) end | ||||||
| function date(format, time) end | function date(format, time) end | ||||||
|  |  | ||||||
|  | -- Defined in bios.lua | ||||||
|  | function loadAPI(path) end | ||||||
|  | function pullEvent(filter) end | ||||||
|  | function pullEventRaw(filter) end | ||||||
|  | function version() end | ||||||
|  | function run(env, path, ...) end | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								doc/stub/pocket.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								doc/stub/pocket.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | --[[- | ||||||
|  | Control the current pocket computer, adding or removing upgrades. | ||||||
|  |  | ||||||
|  | This API is only available on pocket computers. As such, you may use its | ||||||
|  | presence to determine what kind of computer you are using: | ||||||
|  |  | ||||||
|  | ```lua | ||||||
|  | if pocket then | ||||||
|  |   print("On a pocket computer") | ||||||
|  | else | ||||||
|  |   print("On something else") | ||||||
|  | end | ||||||
|  | ``` | ||||||
|  | ]] | ||||||
|  |  | ||||||
|  | --- Search the player's inventory for another upgrade, replacing the existing | ||||||
|  | -- one with that item if found. | ||||||
|  | -- | ||||||
|  | -- This inventory search starts from the player's currently selected slot, | ||||||
|  | -- allowing you to prioritise upgrades. | ||||||
|  | -- | ||||||
|  | -- @throws If an upgrade cannot be found. | ||||||
|  | function equipBack() end | ||||||
|  |  | ||||||
|  | --- Remove the pocket computer's current upgrade. | ||||||
|  | -- | ||||||
|  | -- @throws If this pocket computer does not currently have an upgrade. | ||||||
|  | function unequipBack() end | ||||||
| @@ -11,4 +11,4 @@ setAnalogueOutput = setAnalogOutput | |||||||
| function getAnalogOutput(sid) end | function getAnalogOutput(sid) end | ||||||
| getAnalogueOutput = getAnalogOutput | getAnalogueOutput = getAnalogOutput | ||||||
| function getAnalogInput(side) end | function getAnalogInput(side) end | ||||||
| getAnalogueInput = getAnaloguInput | getAnalogueInput = getAnalogInput | ||||||
|   | |||||||
| @@ -15,14 +15,14 @@ isColor = isColour | |||||||
| function getTextColour() end | function getTextColour() end | ||||||
| getTextColor = getTextColor | getTextColor = getTextColor | ||||||
| function getBackgroundColour() end | function getBackgroundColour() end | ||||||
| getBackgroundColour = getBackgroundColour | getBackgroundColor = getBackgroundColour | ||||||
| function blit(text, text_colours, background_colours) end | function blit(text, text_colours, background_colours) end | ||||||
| function setPaletteColour(colour, ...) end | function setPaletteColour(colour, ...) end | ||||||
| setPaletteColour = setPaletteColour | setPaletteColor = setPaletteColour | ||||||
| function getPaletteColour(colour, ...) end | function getPaletteColour(colour, ...) end | ||||||
| getPaletteColour = getPaletteColour | getPaletteColor = getPaletteColour | ||||||
| function nativePaletteColour(colour) end | function nativePaletteColour(colour) end | ||||||
| nativePaletteColour = nativePaletteColour | nativePaletteColor = nativePaletteColour | ||||||
|  |  | ||||||
| --- @type Redirect | --- @type Redirect | ||||||
| local Redirect = {} | local Redirect = {} | ||||||
|   | |||||||
| @@ -33,17 +33,27 @@ | |||||||
|  |  | ||||||
|     ;; It's useful to name arguments for documentation, so we allow this. It'd |     ;; It's useful to name arguments for documentation, so we allow this. It'd | ||||||
|     ;; be good to find a compromise in the future, but this works for now. |     ;; be good to find a compromise in the future, but this works for now. | ||||||
|     -var:unused-arg |     -var:unused-arg) | ||||||
|  |  | ||||||
|     ;; Some APIS (keys, colour and os mainly) are incomplete right now. |  | ||||||
|     -var:unresolved-member) |  | ||||||
|   (lint |   (lint | ||||||
|     (bracket-spaces |     (bracket-spaces | ||||||
|       (call no-space) |       (call no-space) | ||||||
|       (function-args no-space) |       (function-args no-space) | ||||||
|       (parens no-space) |       (parens no-space) | ||||||
|       (table space) |       (table space) | ||||||
|       (index no-space)))) |       (index no-space)) | ||||||
|  |  | ||||||
|  |     ;; colours imports from colors, and we don't handle that right now. | ||||||
|  |     ;; keys is entirely dynamic, so we skip it. | ||||||
|  |     (dynamic-modules colours keys) | ||||||
|  |  | ||||||
|  |     (globals | ||||||
|  |       :max | ||||||
|  |       _CC_DEFAULT_SETTINGS | ||||||
|  |       _CC_DISABLE_LUA51_FEATURES | ||||||
|  |       ;; Ideally we'd pick these up from bios.lua, but illuaminate currently | ||||||
|  |       ;; isn't smart enough. | ||||||
|  |       sleep write printError read rs))) | ||||||
|  |  | ||||||
| ;; We disable the unused global linter in bios.lua and the APIs. In the future | ;; We disable the unused global linter in bios.lua and the APIs. In the future | ||||||
| ;; hopefully we'll get illuaminate to handle this. | ;; hopefully we'll get illuaminate to handle this. | ||||||
| @@ -82,3 +92,9 @@ | |||||||
|    /src/main/resources/*/computercraft/lua/rom/programs/advanced/multishell.lua |    /src/main/resources/*/computercraft/lua/rom/programs/advanced/multishell.lua | ||||||
|    /src/main/resources/*/computercraft/lua/rom/programs/shell.lua) |    /src/main/resources/*/computercraft/lua/rom/programs/shell.lua) | ||||||
|   (linters -doc:unresolved-reference)) |   (linters -doc:unresolved-reference)) | ||||||
|  |  | ||||||
|  | (at /src/test/resources/test-rom | ||||||
|  |   (lint | ||||||
|  |     (globals | ||||||
|  |       :max sleep write | ||||||
|  |       cct_test describe expect howlci fail it pending stub))) | ||||||
|   | |||||||
| @@ -279,7 +279,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT | |||||||
|             if( offset.equals( neighbour ) ) |             if( offset.equals( neighbour ) ) | ||||||
|             { |             { | ||||||
|                 updateSideInput( computer, dir, offset ); |                 updateSideInput( computer, dir, offset ); | ||||||
|                 break; |                 return; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -334,7 +334,11 @@ end | |||||||
|  |  | ||||||
| local bRunning = false | local bRunning = false | ||||||
|  |  | ||||||
| --- @local | --- Listen for modem messages and converts them into rednet messages, which may | ||||||
|  | -- then be @{receive|received}. | ||||||
|  | -- | ||||||
|  | -- This is automatically started in the background on computer startup, and | ||||||
|  | -- should not be called manually. | ||||||
| function run() | function run() | ||||||
|     if bRunning then |     if bRunning then | ||||||
|         error("rednet is already running", 2) |         error("rednet is already running", 2) | ||||||
|   | |||||||
| @@ -207,7 +207,7 @@ function load(sPath) | |||||||
|     for k, v in pairs(tFile) do |     for k, v in pairs(tFile) do | ||||||
|         local ty_v = type(k) |         local ty_v = type(k) | ||||||
|         if type(k) == "string" and (ty_v == "string" or ty_v == "number" or ty_v == "boolean" or ty_v == "table") then |         if type(k) == "string" and (ty_v == "string" or ty_v == "number" or ty_v == "boolean" or ty_v == "table") then | ||||||
|             local opt = details[name] |             local opt = details[k] | ||||||
|             if not opt or not opt.type or ty_v == opt.type then |             if not opt or not opt.type or ty_v == opt.type then | ||||||
|                 set_value(k, v) |                 set_value(k, v) | ||||||
|             end |             end | ||||||
|   | |||||||
| @@ -5,7 +5,12 @@ | |||||||
| if not turtle then | if not turtle then | ||||||
|     error("Cannot load turtle API on computer", 2) |     error("Cannot load turtle API on computer", 2) | ||||||
| end | end | ||||||
| native = turtle.native or turtle --- @local |  | ||||||
|  | --- The builtin turtle API, without any generated helper functions. | ||||||
|  | -- | ||||||
|  | -- Generally you should not need to use this table - it only exists for | ||||||
|  | -- backwards compatibility reasons. | ||||||
|  | native = turtle.native or turtle | ||||||
|  |  | ||||||
| local function addCraftMethod(object) | local function addCraftMethod(object) | ||||||
|     if peripheral.getType("left") == "workbench" then |     if peripheral.getType("left") == "workbench" then | ||||||
|   | |||||||
| @@ -384,7 +384,7 @@ local function pretty_impl(obj, tracking) | |||||||
|         end |         end | ||||||
|  |  | ||||||
|         tracking[obj] = nil |         tracking[obj] = nil | ||||||
|         return group(concat(obrace, nest(2, concat(table.unpack(doc, 1, n))), space_line, cbrace)) |         return group(concat(obrace, nest(2, concat(table.unpack(doc, 1, doc.n))), space_line, cbrace)) | ||||||
|     end |     end | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ local function createShellEnv(sDir) | |||||||
|     package.path = "?;?.lua;?/init.lua;/rom/modules/main/?;/rom/modules/main/?.lua;/rom/modules/main/?/init.lua" |     package.path = "?;?.lua;?/init.lua;/rom/modules/main/?;/rom/modules/main/?.lua;/rom/modules/main/?/init.lua" | ||||||
|     if turtle then |     if turtle then | ||||||
|         package.path = package.path .. ";/rom/modules/turtle/?;/rom/modules/turtle/?.lua;/rom/modules/turtle/?/init.lua" |         package.path = package.path .. ";/rom/modules/turtle/?;/rom/modules/turtle/?.lua;/rom/modules/turtle/?/init.lua" | ||||||
|     elseif command then |     elseif commands then | ||||||
|         package.path = package.path .. ";/rom/modules/command/?;/rom/modules/command/?.lua;/rom/modules/command/?/init.lua" |         package.path = package.path .. ";/rom/modules/command/?;/rom/modules/command/?.lua;/rom/modules/command/?/init.lua" | ||||||
|     end |     end | ||||||
|     package.config = "/\n;\n?\n!\n-" |     package.config = "/\n;\n?\n!\n-" | ||||||
|   | |||||||
| @@ -93,18 +93,10 @@ end | |||||||
| print("Press any key to stop the groove") | print("Press any key to stop the groove") | ||||||
|  |  | ||||||
| parallel.waitForAny( | parallel.waitForAny( | ||||||
|     function() |     function() os.pullEvent("key") end, | ||||||
|         while not bEnd do |  | ||||||
|             local _, key = os.pullEvent("key") |  | ||||||
|             if key ~= keys.escape then |  | ||||||
|                 return |  | ||||||
|             end |  | ||||||
|         end |  | ||||||
|     end, |  | ||||||
|     function() |     function() | ||||||
|         while true do |         while true do | ||||||
|             local fnMove = tMoves[math.random(1, #tMoves)] |             tMoves[math.random(1, #tMoves)]() | ||||||
|             fnMove() |  | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
| ) | ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SquidDev
					SquidDev