1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

64 Commits

Author SHA1 Message Date
Jonathan Coates
2279f5044d
Nuke treasure disks
They're datapacks now. Right???
2021-06-09 09:19:21 +01:00
Jonathan Coates
46846a4fde Improve UX when a resource mount cannot be found
- Add a full example of the docs. Hopefully is a little more explicit.
 - Print a warning when the mount is empty.

Closes #762
2021-05-16 14:25:09 +02:00
Jonathan Coates
b546a10bd6 Preserve registration order of upgrades
Makes them display in a more reasonable order within JEI. Closes #647
(note, the title is an entirley separate issue)!
2021-05-16 13:51:01 +02:00
Jonathan Coates
094e0d4f33 Fix mounts being usable after a disk is ejected
This probably fails "responsible disclosure", but it's not an RCE and
frankly the whole bug is utterly hilarious so here we are...

It's possible to open a file on a disk drive and continue to read/write
to them after the disk has been removed:

    local disk = peripheral.find("drive")
    local input = fs.open(fs.combine(disk.getMountPath(), "stream"), "rb")
    local output = fs.open(fs.combine(disk.getMountPath(), "stream"), "wb")
    disk.ejectDisk()

    -- input/output can still be interacted with.

This is pretty amusing, as now it allows us to move the disk somewhere
else and repeat - we've now got a private tunnel which two computers can
use to communicate.

Fixing this is intuitively quite simple - just close any open files
belonging to this mount. However, this is where things get messy thanks
to the wonderful joy of how CC's streams are handled.

As things stand, the filesystem effectively does the following flow::
 - There is a function `open : String -> Channel' (file modes are
   irrelevant here).

 - Once a file is opened, we transform it into some <T extends
   Closeable>. This is, for instance, a BufferedReader.

 - We generate a "token" (i.e. FileSystemWrapper<T>), which we generate
   a week reference to and map it to a tuple of our Channel and T. If
   this token is ever garbage collected (someone forgot to call close()
   on a file), then we close our T and Channel.

 - This token and T are returned to the calling function, which then
   constructs a Lua object.

The problem here is that if we close the underlying Channel+T before the
Lua object calls .close(), then it won't know the underlying channel is
closed, and you get some pretty ugly errors (e.g. "Stream Closed"). So
we've moved the "is open" state into the FileSystemWrapper<T>.

The whole system is incredibly complex at this point, and I'd really
like to clean it up. Ideally we could treat the HandleGeneric as the
token instead - this way we could potentially also clean up
FileSystemWrapperMount.

BBut something to play with in the future, and not when it's 10:30pm.

---

All this wall of text, and this isn't the only bug I've found with disks
today :/.
2021-05-16 13:23:37 +02:00
Wojbie
df40adce20 Make rightAlt only close menu, never open it. (#672)
Fixes #669
2021-05-16 09:22:11 +02:00
Jummit
e12ce95b2d Update to 1.16.4 2021-05-16 09:18:02 +02:00
Jonathan Coates
bcc0effd00 Fix impostor recipes for disks
Well, this is embarrassing. See #652
2021-05-16 07:57:06 +02:00
Jonathan Coates
64f3aa2dba Fix problem with RepeatArgumentType
The whole "flatten" thing can probably be dropped TBH. We don't use it
anywhere. Fixes #661
2021-05-16 07:48:07 +02:00
Jummit
95794fdaf3 Add back command computer block drops
This has been broken for almost a year (28th Jan 2020), and I never
noticed. Good job me.

Fixes #641, closes #648 (basically the same, but targetting 1.15.x)
2021-05-16 07:40:43 +02:00
Jonathan Coates
53ae689468 Fix licence issues
I knew I shouldn't do modding on things which aren't my main computer.

I actually did run checkstyleMain before committing, but entirely forgot
about this one. Go me.
2021-05-16 01:26:21 +02:00
Jonathan Coates
58cd5e3df7 Fix copy-paste error in inventory docs
I'm a very silly squid.
2021-05-16 00:10:19 +02:00
Jonathan Coates
5922d7548c Merge pull request #606 from TheWireLord/numpadenter-support
Added Numpad Enter Support - bios.lua
2021-05-16 00:06:13 +02:00
Jummit
70eff6aa63 Skip "Docs for energy and inventory methods" 2021-05-15 20:34:30 +02:00
SquidDev
45ac601946 Generate docs for generic peripherals
This was the easy bit. Now I've got to write them!
2021-05-15 20:21:15 +02:00
SquidDev
d6c5a5bd27 Some sanity checks for get{Direction,Orientation}
Silly bodge, but should fix #600.
2021-05-15 20:18:04 +02:00
SquidDev
02c7903cb7 Remove a couple of todos 2021-05-15 20:06:21 +02:00
Jummit
37e856efdc Skip 737b3cb5
Don't use capabilities for generic peripherals
2021-05-15 20:04:51 +02:00
JackMacWindows
1d1d6227eb Added improved help viewer (#595)
- Pagination, with (page) up/down, q(uit) and scrolling support.
 - Render markdown style bullets ('-'/'*') using a '•' instead.
2021-05-14 21:36:08 +02:00
Jummit
d5eb82db60 Allow $private HTTP rule to block any private IP
This is a little magic compared with our previous approach of "list
every private IP range", but given then the sheer number we were
missing[1][2] this feels more reasonable.

Also refactor out some of the logic into separate classes, hopefully to
make things a little cleaner.
2021-05-14 21:31:03 +02:00
JackMacWindows
3575654d02 Added documentation for global functions (#592) 2021-05-14 19:37:54 +02:00
Jonathan Coates
79fcc7241b Remove <!-- -->s in usages
We fixed the bug in illuaminate, so this should be redundant now.
2021-05-14 18:51:10 +02:00
Merith-TK
b203d3aa0a Try to handle a turtle being broken while ticked
Hopefully fixes #585. Hopefully.
2021-05-07 15:05:00 -07:00
Merith-TK
f1176af9d1 Make fs.combine accept multiple arguments
Means we can now do fs.combine("a", "b", "c"). Of course, one may just
write "a/b/c" in this case, but it's definitely useful elsewhere.

This is /technically/ a breaking change as fs.combine(a, b:gsub(...))
will no longer function (as gsub returns multiple arguments). However,
I've done a quick search through GH and my Pastebin archives and can't
find any programs which would break. Fingers crossed.
2021-05-07 13:27:04 -07:00
Merith-TK
717686d855 Allow strings or numbers in textutils.*tabulate
Allow strings or numbers in textutils.*tabulate

A little dubious, but apparently CC used to support it. This means we're
consistent with methods like io.write or string.len which accept strings
or numbers.

Fixes #591
2021-05-07 11:26:24 -07:00
Merith-TK
f8a58dbcb1 Fixed length check on function name in expect (#589) 2021-04-22 11:54:56 -07:00
Merith-TK
98aabe2cfb Remove extra space (#586) 2021-04-22 11:43:58 -07:00
Merith-TK
f938ed9779 Strict Globals (#583) 2021-04-22 11:35:15 -07:00
Merith-TK
03c9274b27 More examples
Yay!
2021-04-22 11:23:31 -07:00
Merith-TK
92c94ac039 Cleanup examples for the various modules 2021-04-21 19:32:03 -07:00
Merith-TK
5c6fd80b0c Use term.blit on original paint render
This makes it super speedy, meaning an initial refresh doesn't take ages to load.
2021-04-21 08:57:32 -07:00
Merith-TK
f1ec59df15 Clear gets an option to reset the palette (#582)
Fixes #555.
2021-04-21 08:32:34 -07:00
Merith-TK
624b23c7ac Fix epoch documentation to use milliseconds (#580) 2021-04-09 20:45:59 -07:00
Merith-TK
31a1027401 Clean up some examples a little bit
Would be good if they didn't crash and burn on entry :).
2021-03-02 23:12:53 -08:00
Merith-TK
e0fc994819 [TODO] Auto-generate monitor models
I didn't think it was worth it, and then I found myself needing to
update a dozen of them. The code isn't especially pretty, but it works,
so that's fine.

Also fixes several issues with us using the wrong texture (closes #572).
I've put together a wiki page[1] which describes each texture in a
little more detail.

[1] https://github.com/SquidDev-CC/CC-Tweaked/wiki/Monitor-texture-reference
2021-03-02 22:47:44 -08:00
Merith-TK
43408bf085 CC:R 1.94.0 2021-03-02 19:21:12 -08:00
Merith-TK
d28f42e8b7 use arg[0] in all usage printouts (#571) 2021-03-02 18:22:26 -08:00
Merith-TK
ac452582c1 Use blit to draw boxes, add colors.toBlit (#570) 2021-02-22 18:49:39 -08:00
Merith-TK
7e65c6b25c Fix JSON objects failing to pass 2021-02-22 18:11:27 -08:00
Merith-TK
457a863842 Dont fail when codecov is being finicky 2021-02-22 18:09:31 -08:00
Merith-TK
eef36e1358 Various SNBT parsing improvements 2021-02-22 17:45:44 -08:00
Merith-TK
feda08b915 Draw in-hand pocket computers with blending 2021-02-22 17:43:54 -08:00
Merith-TK
0240ce50ce Bump cct-javadoc version 2021-02-22 17:34:20 -08:00
Merith-TK
592b83e784 [TODO] Fix players not getting advancements when they own turtles 2021-02-22 17:32:26 -08:00
Merith-TK
5d91491ec7 Remove superfluous imports 2021-02-22 12:25:13 -08:00
Merith-TK
7326d1110d Make generic peripherals on by default 2021-02-22 12:17:03 -08:00
Merith-TK
0aa6ac05a0 Add function to get window visibility 2021-02-22 11:56:22 -08:00
Merith-TK
27a2c063b9 Update configuration to match latest illuaminate 2021-02-22 11:50:33 -08:00
Merith-TK
0e5fd4e8e0 Fix TBO norm issues on old GPUs 2021-02-22 10:56:52 -08:00
Merith-TK
aa4ec53bb6 Bump JEI/crafttweaker versions 2021-02-22 10:50:57 -08:00
Merith-TK
6b49327462 Document remaining OS functions (#554) 2021-02-22 10:49:52 -08:00