1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-06 18:16:23 +00:00
Commit Graph

2345 Commits

Author SHA1 Message Date
Jonathan Coates
0e1e8dfa8c
Add recipes to more pages
Might be better if we had pages for each block, but this'll do for now.
2022-06-05 12:20:07 +01:00
Jonathan Coates
a1cbc1d803
Fix turtles not preserving their lock when moving 2022-06-04 15:30:42 +01:00
Jonathan Coates
0b6dc25607
Fix command quoting for Windows
Thanks Lupus for finding this. I really need to redo how some of these
commands are run - maybe use npm scripts instead.
2022-06-01 14:33:23 +01:00
Jonathan Coates
b91809bfc7
Move some eldritch horrors to another directory
Also fix make-doc.sh uploading the wrong file.
2022-06-01 01:02:26 +01:00
Jonathan Coates
178126725e
Add more eldritch horrors to the build system
- Add a basic data exporter to the test mod, run via a /ccexport
   command. This dumps all of CC's recipes, and the item icons needed to
   display those recipes.

 - Post-process our illuaminate HTML, applying several transforms:
    - Apply syntax highlighting to code blocks. We previously did this
      at runtime, so this shaves some bytes off the bundle.

    - Convert a mc-recipe custom element into a recipe grid using
      react/react-dom.

 - Add a recipe to the speaker page. I'll probably clean this up in the
   future (though someone else is free to too!), but it's a nice
   start and proof-of-concept.

I tried so hard here to use next.js and MDX instead of rolling our own
solution again, but it's so hard to make it play well with "normal"
Markdown, which isn't explicitly written for MDX.
2022-06-01 00:48:36 +01:00
Jonathan Coates
cd76425877
Tiny bits and bobs
Oh my, what good commit discipline!

 - Remove unused method in NetworkHandler.
 - Correctly pass the transformation to ComputerBorderRenderer.
2022-05-30 17:42:33 +01:00
Jonathan Coates
4411756b06
Use a queue rather than a set in TickScheduler
We now track whether a tile is enqueued or not via an atomic boolean on
the block entity itself, rather than using a hash set. This is
significantly faster (>10x).

This is mostly intended for monitors, as they're the only peripheral
likely to call TickScheduler.schedule lots of times (rather than modems,
which just invoke it when opening/closing a channel[^1])[^2]. This
change is enough to allow me to update 120 monitors each tick without
any major tearing.

[^1]: GPS does do this on each gps.locate call, so it will help there,
but modems are typically limited by other computers sending messages,
not peripheral calls themselves.

[^2]: Note that montitors implement their own change tracking, so still
only call this once per tick. But it's enough to introduce some latency!
2022-05-30 14:25:51 +01:00
Jonathan Coates
1fd57a874f
Send terminal text and colours separately
This gives us slightly better compression, as backgrounds will often be
a single run of colours while the foreground won't be.

In practice, this is rarely an issue, as most terminals are small, but
worth doing anyway.
2022-05-30 13:44:11 +01:00
Jonathan Coates
3f0704624e
Fix location of DFPWM test 2022-05-30 13:36:36 +01:00
Jonathan Coates
3b6cd783cb
Don't allow modems to be used in adventure mode
This (along with computer locking) should be Good Enough for BlanketCon.
2022-05-28 09:23:23 +01:00
Jonathan Coates
a07bba4ece
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-05-27 22:28:55 +01:00
Jonathan Coates
ab22726883
Preserve on-state of pocket computers
This is far less robust than block-based computers, but I don't think it
needs to be. Fixes #1097 Or closes? Unclear - I'm counting this as a
bug.
2022-05-27 22:23:04 +01:00
Jonathan Coates
2efad38f53
Allow computers and inventories to be locked
Just like vanilla locking, this isn't accessible in survival.

> "im retired! im retired!!", i continue to insist as i slowly shrink
> and transform into a corn cob.
2022-05-27 22:22:54 +01:00
Jonathan Coates
83a1af6526
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-05-27 18:55:51 +01:00
Drew Edwards
8b89d88d04
Allow other mods to provide extra item/block details (#1101) 2022-05-24 22:21:18 +01:00
Jonathan Coates
36635662f1
Merge pull request #1100 from Lemmmy/lemmmy/extendable-computer-screen
Make ComputerScreenBase methods extendable
2022-05-23 18:04:30 +01:00
Drew Edwards
bbc0afa111 Make ComputerScreenBase methods extendable 2022-05-23 17:13:17 +01:00
Drew Edwards
34dc915d57
Add validation to printer slots (#1099) 2022-05-23 16:02:12 +00:00
Jonathan Coates
24ed0ca723
Try to remove some flakiness in tests
- Make assertions a little more relaxed
 - Increase timeouts of computer tests (again :D:).
 - Log where we're up to in computer tests, to make tracking stalls a
   little easier
2022-05-23 10:26:18 +01:00
Jonathan Coates
5052718428
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-05-22 15:03:01 +01:00
Jonathan Coates
431e4c9419
Some reformatting to config comments
- Rewrap everything at 80 columns. To make this tolerable I'm using
   IDEA's language fragment support - hence the absurd line lengths.

 - Add full stops to all comments.

 - Clarify that HTTP rules are applied in-order.
2022-05-22 14:34:31 +01:00
Jonathan Coates
2639b84eb2
Deprecate IArguments.releaseImmediate
This is only ever defined (and called) within the ILuaMachine-specific
code. Not sure why I ever made this public.
2022-05-22 14:05:04 +01:00
Jonathan Coates
d631111610
Improvements to contribution generation
- Parse Co-authored-by lines too. There's several contributors (mostly
   via weblate, but a few GH ones too) who weren't credited otherwise.

 - Add support for git mailmap, remapping some emails to a canonnical
   username. This allows us to remove some duplicates - nobody needs
   both SquidDev and "Jonathan Coates."

   I'm not making this file public, as it contains email addresses. This
   does mean that CI builds will still contain the full list with
   duplicates.
2022-05-19 14:09:08 +01:00
Jonathan Coates
c981c75b7c
Merge pull request #1096 from FayneAldan/patch-1
Fix typo in documentation
2022-05-13 21:05:01 +01:00
Fayne Aldan
f05a539443
Fix typo in documentation 2022-05-13 13:41:52 -06:00
Jonathan Coates
d8a7ab540a
Merge pull request #1095 from Wojbie/mc-1.16.x
Add important leading /
2022-05-10 21:42:40 +01:00
Wojbie
a7536ea4fa Add important leading /
Fixes #1094
2022-05-10 22:30:10 +02:00
Chick Chicky
d9e75d7c47
Added parse_empty_array to textutils.unserialiseJSON (#1092)
Fixes #1089.
2022-05-08 09:53:02 +00:00
Jonathan Coates
78334c4cb1
Fix counts in /computercraft {turn-on,shutdown}
We were using the size of the selectors (which is normally 1) rather
than the number of computers.
2022-05-07 20:17:44 +01:00
JackMacWindows
f5f0c7990a
Add note about special JSON values in docs for textutils.unserializeJSON (#1058) 2022-05-07 10:10:25 +00:00
Jonathan Coates
87a1c1a525
Some minor documentation fixes
- Add a TOC to the Local IPs page.
 - Increase the echo delay in our speaker audio page to 1.5s. This
   sounds much better and is less clashy than 1s. Also add a
   sleep(0) (eww, I know) to fix timeouts on some browsers/computers.
 - Move Lua feature compat to a new "reference" section. Still haven't
   figured out how to structure these docs - open to any ideas really.
 - Mention FFmpeg as an option for converting to DFPWM (closes #1075).
 - Allow data-mount to override built-in files. See my comment in #1069.
2022-05-05 13:27:33 +01:00
Jonathan Coates
be45b718b3
Correctly mark reify as CLIENT 2022-05-05 00:23:38 +01:00
Jonathan Coates
ad2d1d6a05
Merge branch 'feature/optimise-timeouts' into mc-1.16.x 2022-05-04 18:29:08 +01:00
Jonathan Coates
65a7370db1
Rethink how computer timeouts are handled
Previously we would compute the current timeout flags every 128
instructions of the Lua machine. While computing these flags is
_relatively_ cheap (just get the current time), it still all adds up.

Instead we now set the timeout flags from the computer monitor/watchdog
thread. This does mean that the monitor thread needs to wake up more
often[^1] _if the queue is full_, otherwise we can sleep for 100ms as
before.

This does mean that pausing is a little less accurate (can technically
take up 2*period instead). This isn't great, but in practice it seems
fine - I've not noticed any playability issues.

This offers a small (but measurable!) boost to computer performance.

[^1]: We currently sleep for scaledPeriod, but we could choose to do less.
2022-05-04 12:33:14 +01:00
Jonathan Coates
03b0244084
Minor improvements to resetting code
- Reset state while the server is starting rather than once it has
   started. Hopefully fixes a weird issue where wireless modems wouldn't
   be "connected" on server startup.

 - Correctly reset the MainThread metrics on server start/stop.
2022-05-04 11:31:59 +01:00
Jonathan Coates
6322e72110
Add a test harness for ComputerThread
Geesh, this is nasty. Because ComputerThread is incredibly stateful, and
we want to run tests in isolation, we run each test inside its own
isolated ClassLoader (and thus ComputerThread instance).

Everything else is less nasty, though still a bit ... yuck. We also
define a custom ILuaMachine which just runs lambdas[^1], and some
utilities for starting those.

This is then tied together for four very basic tests. This is sufficient
for the changes I want to make, but might be nice to test some more
comprehensive stuff later on (e.g. timeouts after pausing).

[^1]: Which also means the ILuaMachine implementation can be changed by
other mods[^2], if someone wants to have another stab at LuaJIT :p.

[^2]: In theory. I doubt its possible in practice because so much is
package private.
2022-05-03 22:58:28 +01:00
Jonathan Coates
7ad6132494
Move VarargArguments factory to VarargArguments itself 2022-05-03 18:51:34 +01:00
Jonathan Coates
e2189535b8
Fix several thread-unsafe client registrations
Also remove deprecated usage of DeferredWorkQueue. Oh goodness, some of
this code is so old now.

Fixes #1084
2022-05-03 18:48:08 +01:00
Jonathan Coates
79467499e6
Use ByteBuffers in term.blit
This is about 5-6x faster than using a String as we don't need to
allocate and copy multiple times. In the grand scheme of things, still
vastly overshadowed by the Lua interpreter, but worth doing.
2022-05-03 12:47:34 +01:00
Jonathan Coates
074793090d
Fix Optifine detection
I really should have tested this. And not expected Optifine to be
normal.
2022-05-03 11:57:35 +01:00
Jonathan Coates
cbbab26bf3
Some minor documentation improvements
- Start making the summary lines for modules a little better. Just say
   what the module does, rather than "The X API does Y" or "Provides Y".
   There's still a lot of work to be done here.

 - Bundle prism.js on the page, so we can highlight non-Lua code.

 - Copy our local_ips wiki page to the main docs.
2022-05-02 17:49:32 +01:00
Jonathan Coates
9cb7091ce7
Fix several deprecated warnings 2022-05-02 16:21:56 +01:00
Sr_endi
e909e11e05
[1.16] Make blocks rotatable for structures (#1083) 2022-05-01 12:09:38 +01:00
JackMacWindows
6239dbe9ca
Add documentation on full list of 5.2/5.3 features (#1071) 2022-05-01 08:29:43 +01:00
Jonathan Coates
49601f0b7c
Bump Cobalt version
Oh deary me.
2022-04-29 22:35:41 +01:00
Jonathan Coates
caa412b7d2
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-04-28 20:27:48 +01:00
Jonathan Coates
9cb7a5bec7
Track owning entity when sending sounds
This allows us to sync the position to the entity immediately, rather
than the sound jumping about.

Someone has set up rick-rolling pocket computers (<3 to whoever did
this), and the lag on them irritates me enough to fix this.

Fixes #1074
2022-04-28 19:59:31 +01:00
Cloud Chagnon
118b89ea41
Fix off by one error in printout renderer
Fixes printouts being drawn slightly offset to the left in all cases,
noticeable mainly when in item frames.
2022-04-28 17:42:04 +01:00
Jonathan Coates
f2474bbfa2
Remove redundant class 2022-04-28 17:41:07 +01:00
Jonathan Coates
159f90896e
Merge branch 'mc-1.16.x' into mc-1.18.x 2022-04-27 13:52:11 +01:00