1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-28 15:08:47 +00:00
Commit Graph

60 Commits

Author SHA1 Message Date
Jonathan Coates
f7fdb6e729
Backport a couple of ROM commits
- Improve REPL's handling of expressions
   (655d5aeca8)

 - Some tiny optimisations to the window API
   (4accda6b8e)

 - Be lazy in reporting errors in the lexer
   (54ab98473f)

 - Update lua.lua require logic.
   (88f0c44152)
2023-07-06 23:15:57 +01:00
Jonathan Coates
2a9f35de5e
Backport several ROM/Lua commits
- Fix GPS returning nan on duplicate positions.
 - Distinguish between all parsers passing and failing.
 - Improve several comma related parse errors.
 - Ignore metatables in textutils.serialize.
 - Detect common audio containers in "speaker".

Co-authored-by: Wojbie <Wojbie@gmail.com>
2023-05-03 23:26:44 +01:00
Jonathan Coates
9b3cadf57c
Cherry pick several changes back from 1.19.3
The main purpose of this is to backport the improved parse/runtime
errors to older versions. I think they're sufficiently useful that we
should try to make it as widely available as possible.

We've been running them for a week now on SC3 and the released version
and not seen any issues, so I think it's probably stable enough.

This is a pretty lazy commit: I ended up copying the whole ROM over and
then picking up a few other related changes along the way.

 - Trim spaces from file paths (b8fce1eecc)

 - Correctly format 12AM/PM with
   %I (9f48395596)

 - Fix http.request and htpt.websocketAsync not handling a few failure
   edge-cases correctly (3b42f22a4f).

 - Move the internal modules into the main package path, hidden under
   cc.internal (34a31abd9c).

 - Gather code coverage in Java instead of
   Lua (28a55349a9).

 - Make error messages in edit more
   obvious (8cfbfe7ceb).

 - Make mcfly's test methods global. This means we don't need to pass
   stub everywhere (7335a892b5).

 - Improve runtime and parse errors. This comes from numerous commits,
   but chiefly a12b405acf, and
   5502412181.

 - Hide the internal redirect methods in
   multishell (33b6f38339).

Note this does /not/ include the shebang changes (sorry Emma!). I've
tried to avoid adding any user-controllable features, mostly because I
don't know how to handle the versioning otherwise :).
2023-02-14 09:45:03 +00:00
Jonathan Coates
5e701f73d6
Use the correct import path in import.lua
Backported from 1.19.3
2022-12-14 21:52:32 +00:00
Ivo Leal
4b0988768d
Add include_hidden option to fs.complete (#1194) 2022-11-01 14:50:15 +00:00
Jonathan Coates
f5b89982de
Don't unnecessarily scroll in edit run wrapper (#1195) 2022-10-30 15:17:33 +00:00
Jonathan Coates
97387556fe
Handle file transfers inside CraftOS (#1190)
- Add a new file_transfer event. This has the signature
   "file_transfer", TransferredFiles.

   TransferredFiles has a single method getFiles(), which returns a list
   of all transferred files.

 - Add a new "import" program which waits for a file_transfer event and
   writes files to the current directory.

 - If a file_transfer event is not handled (i.e. its getFiles() method
   is not called) within 5 seconds on the client, we display a toast
   informing the user on how to upload a file.
2022-10-29 12:01:23 +01:00
Jonathan Coates
371f931140
Always add HTTP programs to the path (#1172) 2022-09-30 09:00:07 +00:00
Jonathan Coates
d22e138413
Fix numerous off-by-one errors in help program
We clamped various values to the height of the screen, rather than the
height of the content box (height-1). We didn't notice this most of the
time as the last line of a file is empty - it only really mattered when
a file was the same height as the computer's screen.

We now do the following:
 - Strip the trailing new line from a file when reading.
 - Replace most usages of height with height-1.
2022-09-11 14:57:34 +01:00
JackMacWindows
bd5de11ad5
Add WAV support to speaker program (#1112) 2022-07-09 08:59:35 +01:00
Wojbie
a7536ea4fa Add important leading /
Fixes #1094
2022-05-10 22:30:10 +02:00
Jonathan Coates
ad228e94a3
Merge remote-tracking branch 'origin/mc-1.16.x' into mc-1.16.x
I hate doing this, but I have too many merges in progress to rebase.
2022-04-26 22:43:22 +01:00
Jonathan Coates
aa62c1f206
Remove redundant CSS in src/web/styles.css
Moved to illuaminate itself
2022-04-26 16:20:04 +01:00
Hasaabitt
739d6813c0
Fixed typo
"Instead, it is a standard program, which its API into the programs that it launches."
becomes
"Instead, it is a standard program, which injects its API into the programs that it launches."
2022-04-24 16:56:31 -04:00
Jonathan Coates
bed2e0b658
Write an introduction to the turtle API
It's better at least, I just don't know if it's good.
2021-12-21 11:53:46 +00:00
Jonathan Coates
b048b6666d
Add arbitrary audio support to speakers (#982)
Speakers can now play arbitrary PCM audio, sampled at 48kHz and with a
resolution of 8 bits. Programs can build up buffers of audio locally,
play it using `speaker.playAudio`, where it is encoded to DFPWM, sent
across the network, decoded, and played on the client.

`speaker.playAudio` may return false when a chunk of audio has been
submitted but not yet sent to the client. In this case, the program
should wait for a speaker_audio_empty event and try again, repeating
until it works.

While the API is a little odd, this gives us fantastic flexibility (we
can play arbitrary streams of audio) while still being resilient in the
presence of server lag (either TPS or on the computer thread).

Some other notes:
 - There is a significant buffer on both the client and server, which
   means that sound take several seconds to finish after playing has
   started. One can force it to be stopped playing with the new
  `speaker.stop` call.

 - This also adds a `cc.audio.dfpwm` module, which allows encoding and
   decoding DFPWM1a audio files.

 - I spent so long writing the documentation for this. Who knows if it'll
   be helpful!
2021-12-13 22:56:59 +00:00
Jonathan Coates
e16f66e128
Some bits of rednet cleanup
- Remove all the hungrarian notation in variables. Currently leaving
   the format of rednet messages for now, while I work out whether this
   counts as part of the public API or not.

 - Fix the "repeat" program failing with broadcast packets. This was
   introduced in #900, but I don't think anybody noticed. Will be more
   relevant when #955 is implemented though.
2021-12-13 14:30:13 +00:00
Jonathan Coates
53811f8169
Allow peripherals to have multiple types (#963)
Peripherals can now have multiple types:
 - A single primary type. This is the same as the current idea of a
   type - some identifier which (mostly) uniquely identifies this kind
   of peripheral. For instance, "speaker" or "minecraft:chest".

 - 0 or more "additional" types. These are more like traits, and
   describe what other behaviour the peripheral has - is it an
   inventory? Does it supply additional peripherals (like a wired
   modem)?.

This is mostly intended for the generic peripheral system, but it might
prove useful elsewhere too - we'll have to see!

 - peripheral.getType (and modem.getTypeRemote) now returns 1 or more
   values, rather than exactly one.
 - Add a new peripheral.hasType (and modem.hasTypeRemote) function which
   determines if a peripheral has the given type (primary or
   additional).
 - Change peripheral.find and all internal peripheral methods to use
   peripheral.hasType instead.
 - Update the peripherals program to show all types

This effectively allows you to do things like
`peripheral.find("inventory")` to find all inventories.

This also rewrites the introduction to the peripheral API, hopefully
making it a little more useful.
2021-11-29 17:37:30 +00:00
Jonathan Coates
045472577a
Improve motd a hundred fold
Yes, I know this is a terrible feature. But it's been a long week and
I'm so tired.

Also fix the ordering in motd_spec. Who thought putting the month first
was reasonable?
2021-10-08 20:49:37 +01:00
JackMacWindows
9f539dbd59
Add about program for easier version identification (#936) 2021-10-08 11:29:52 +01:00
Alessandro
297426419b
Fix computer IDs greater than 65535 crashing Rednet (#900) 2021-09-26 17:13:26 +01:00
JackMacWindows
340ade170f
Add the rest of the feature introduction versions to the docs (#908) 2021-08-26 08:02:58 +01:00
Jonathan Coates
8aa7695fdd
Some doc updates
- Fix some spacing in code blocks
 - Rewrite the index page
 - You can't see it, but update illuaminate.
2021-08-13 22:35:08 +01:00
Jonathan Coates
2dc970a8bb
Don't error when given a malformed URL
Sometimes the pattern fails to match and so the file name ends up being
nil.
2021-07-28 16:00:31 +01:00
Jonathan Coates
03396cf07a
Fix help crashing on terminal resize
Closes #870. Woops.
2021-07-24 22:58:23 +01:00
Jonathan Coates
c489d4bc4f
Fix exiting paint typing "e" in the shell
When exiting paint via the keyboard by typing "Ctrl" then "E"
separately, we consume the "key" event within paint, leaving the shell
to consume "read".

To avoid this, we run a sleep(0) to gobble any other left-over events.

Note, it's generally not enough to run a queueEvent/pullEvent here, as
the char event may not have ended up on the queue yet. Alas, as this
solution is pretty ugly.
2021-06-19 15:13:26 +01:00
Jonathan Coates
a735f23e1f
Fix a couple of bugs with wget
- Provide a friendly message when writing to a file fails.
 - Correctly write empty files

Fixes #832, closes #833
2021-06-19 11:59:15 +01:00
Jonathan Coates
d71bf225cc
Add very simple markdown support to the help viewer (#819)
- Allow help files to use the ".md" suffix, and move changelog/whatsnew
   to use them.

 - When files end with ".md", the "help" program attempts to highlight
   them. This involves:
   - Colour code blocks with a lightGrey background.
   - Replace lists to use bullet points instead of "-"/"*".
   - Colours headings yellow.
   The implementation of this is a bit janky because a) I wrote this and
   b) we need to run this step before text wrapping, but preserve
   colours and section positions over wrapping (thanks to Jack for
   getting this working).

 - Add section navigation to the help viewer, with left/right to move to
   the next/previous section.

Closes #569
2021-06-12 19:48:41 +01:00
JackMacWindows
53efd6b303
Fixed error handling in scale subcommand (#816) 2021-06-07 20:47:15 +01:00
Matthew Wilbern
f8074636bc
Allow craft program to craft unlimited items (#807) 2021-06-06 06:52:01 +01:00
JackMacWindows
e0e194099c
Add a scale subcommand to monitor.lua (#623) 2021-05-29 16:55:55 +01:00
Jonathan Coates
b0e30fdce1 Use lightGrey for folders on normal computers
This way we still get some differences between files and folders on
normal computers. I did try with just green, but I think the contrast is
too low.

Closes #656
2021-05-05 22:10:19 +01:00
Wojbie
32d956bbe7 Fix missing term.setCursorBlink(true) in edit.lua 2021-03-19 16:07:20 +01:00
Wojbie
1f70ed6985
Make edit display errors/results of execution and handle require. (#723) 2021-02-23 20:50:19 +00:00
Wojbie
c83eeb16a8
id.lua now handles more disk types (#677)
Co-authored-by: Lupus590 <lupussolitarius590@gmail.com>
2021-01-15 19:30:21 +00:00
Wojbie
1f84480a80
Make rightAlt only close menu, never open it. (#672)
Fixes #669
2021-01-11 21:59:29 +00:00
Wojbie
b2e5401486
Added Numpad Enter Support in rom lua programs. (#657) 2021-01-07 21:41:04 +00:00
Jonathan Coates
ed3913c1f4
Manually wrap strings for help (#602)
This saves us writing to a buffer multiple times, and so makes things much,
much faster.
2020-12-23 16:33:58 +00:00
JackMacWindows
24d3777722
Added improved help viewer (#595)
- Pagination, with (page) up/down, q(uit) and scrolling support.
 - Render markdown style bullets ('-'/'*') using a '•' instead.
2020-12-02 19:22:12 +00:00
SquidDev
c35707725f More examples
Yay!
2020-11-20 21:59:17 +00:00
SquidDev
aab0cd34cd Use term.blit on original paint render
This makes it super speedy, meaning an initial refresh doesn't take ages
to load.
2020-11-20 15:06:47 +00:00
Luca
d2a1a00dc4
Clear gets an option to reset the palette (#582)
Fixes #555.
2020-11-17 12:53:20 +00:00
SquidDev
7f90f2f7ca Clean up some examples a little bit
Would be good if they didn't crash and burn on entry :).
2020-11-12 19:40:18 +00:00
Lupus590
d13bd2cce8
use arg[0] in all usage printouts (#571) 2020-11-04 14:03:08 +00:00
JackMacWindows
d5368d0719
Add date-specific MOTDs (like Minecraft) (#533) 2020-09-04 17:35:46 +01:00
SquidDev
906280225e Merge branch 'master' into mc-1.14.x 2020-05-15 10:19:57 +01:00
SquidDev
4be0b15afa Merge branch 'master' into mc-1.14.x 2020-05-13 14:04:28 +01:00
SquidDev
052cf8ee7d Merge branch 'master' into mc-1.14.x 2020-05-04 09:39:54 +01:00
SquidDev
358289b5f9 Merge branch 'master' into mc-1.14.x 2020-04-29 17:37:36 +01:00
SquidDev
a049502d12 Merge branch 'master' into mc-1.14.x 2020-04-23 10:03:45 +01:00