Commit Graph

1581 Commits

Author SHA1 Message Date
Matthew Wilbern f8074636bc
Allow craft program to craft unlimited items (#807) 2021-06-06 06:52:01 +01:00
Jonathan Coates 0f6db63020
Remove "*Proxy" classes
- Move registry code into the various *Registry classes.

   I'm not sure this is any more sensible, but things being registered
   in different places kinda irked me.

 - Everything else (i.e. event listeners) goes in a {Client,Common}Hooks
   class right now. It's not ideal, but I don't think we can split it up
   much.
2021-06-05 10:09:28 +01:00
Jonathan Coates 51fcd83b87
Clean up turtle model loading code
Looks like Forge has had hooks for this for years, I've just never
noticed.
2021-06-05 09:14:18 +01:00
Jonathan Coates c2190e1318
Improve error message for SSL failures
Fixes #803
2021-06-01 22:10:11 +01:00
Ronan Hanley c40a13558c
Fixed side input consistency issue when a turtle upgrade is removed (#743) 2021-06-01 19:12:35 +01:00
Jonathan Coates 02695aea51
Reduce some block updates
- Fix double updateOutput() call in TileComputerBase - I guess a
   merge/rebase gone wrong in the past.
 - Don't call updateBlock() when creating a server computer. This used
   to be needed when we sent the computer to the client, but this is no
   longer the case.
 - Don't call updateBlock() on TileMonitors when updating from the
   client. We don't need to do a redraw here, as this is all stored in
   the block state now.
 - Don't update the block when reading turtle upgrades. See #643 for
   some background here.

See #658
2021-06-01 18:55:12 +01:00
Jonathan Coates d5be1aca0e
Always accept command output for command computers
Fixes #799
2021-05-31 19:36:43 +01:00
Jonathan Coates 8ff8b78ed8
Better error handling in treasure disks
- Return a more sensible string for empty treasure disks (i.e. those
   given by /give). This should help identify packs which are giving
   items in non-supported ways.
 - Fix NPE when the treasure mount doesn't exist.

Fixes #801
2021-05-31 19:24:38 +01:00
Matthew Wilbern 7fc55aa9a0
Add __eq metamethod and equals method to the vector api. (#800) 2021-05-31 13:58:46 +01:00
magiczocker10 38335ca187
Add some options for textutils.serialize (#664) 2021-05-29 17:46:58 +01:00
JackMacWindows e0e194099c
Add a scale subcommand to monitor.lua (#623) 2021-05-29 16:55:55 +01:00
Ronan Hanley 8063059764
Unit tests for Terminal (#740) 2021-05-29 16:24:42 +01:00
Jonathan Coates f96d923b2a
Allow cleaning dyed turtles in a cauldron
Fixes #771. This does not allow clearing pocket computers or disks right
now - neither normally responds very well to water!
2021-05-29 15:18:53 +01:00
Jonathan Coates 9142ccfc93
Rewrite turtle placing logic
- Simplify how the turtle's inventory is processed. We now copy all
   items into the player inventory, attempt to place, and then copy the
   items back.

   This also fixes the problem where turtle.place() wouldn't (always)
   update the item which was placed.

   I'm also hoping this is more "correct" in how we process drops from
   entities and whatnot. Though I've not had any reports of issues, so
   it's probably fine.

 - Replace the "error message" string array with an actual object. It'd
   be nicer all these functions returned a TurtleCommandResult, but
   merging error messages from that is a little harder.

Fun facts: the test suite was actually helpful here, and caught the fact
that hoeing was broken!
2021-05-29 15:18:26 +01:00
Jonathan Coates 9f7cc00fcb
Add button to view computer's folder
Implementation is a little awkward, as we can't send OPEN_FILE links
from the server, so we ensure the client runs a
/computercraft open-computer ID command instead. We then intercept this
on the client side and use that to open the folder.
2021-05-28 22:19:04 +01:00
Jonathan Coates b129ae627b
Make cc.pretty internals more opaque
I wish I had an actual type system.
2021-05-28 21:28:56 +01:00
Jonathan Coates f9fb0619fa
Swap CSS over to use illuaminate's variables
Closes #797
2021-05-28 21:18:38 +01:00
Weblate 58ea7a275e Translations for French
Translations for French

Translations for German

Co-authored-by: Anavrins <xanavrins@gmail.com>
Co-authored-by: Jummit <jummit@web.de>
Co-authored-by: Naheulf <newheulf@gmail.com>
2021-05-24 01:01:57 +00:00
Jonathan Coates 8487a13764
Remove some funky buildscript code
- Strip out proguard
 - Drop the json compression code

I /think/ this may have had a bigger impact at the time, but Cobalt is
slimmer than it was.
2021-05-21 22:11:25 +01:00
Jonathan Coates 5d0daf9b2d Remove dependencies from gradle 2021-05-20 19:03:30 +01:00
Jonathan Coates 1f385f5b35 Bump version to 1.94.0 2021-05-20 18:29:57 +01:00
Jonathan Coates 34baa09b6c Set stack size when crafting coloured items
Fixes #793
2021-05-20 18:12:30 +01:00
Jonathan Coates b21866fbff
Merge pull request #794 from MCJack123/patch-7
Add the ability to call `cc.expect` directly
2021-05-20 09:23:28 +01:00
JackMacWindows e0a288bcb9
Add the ability to call cc.expect directly 2021-05-19 20:14:13 -04:00
Jonathan Coates 4592534a18 Fix mount suggestion always being printed out 2021-05-18 09:44:11 +00:00
Lupus590 28165bfcd6
Add cc.expect.range (#790) 2021-05-17 17:49:48 +01:00
Jonathan Coates 953b94fd08 Add problem matchers for Github actions
- Add a basic problem matcher for illuaminate errors.
 - Add a script (tools/parse-reports.py) which parses the XML reports
   generated by checkstyle and junit, extracts source locations, and
   emits them in a manner which can be consumed by another set of
   matchers.

This should make it a little easier to see problems for folks who just
rely on CI to test things (though also, please don't do this if you can
help it).
2021-05-17 16:31:58 +00:00
Jonathan Coates e10e30f82b Use a separate region for the bottom pocket computer border
This is definitely not a good solution, but it's probably the best we
can do right now given resizable computers are a thing.

Fixes #775, closes #776
2021-05-16 18:40:18 +01:00
Jonathan Coates aeb1fa0e7e Optimise all textures
using "optipng -o7 -strip all". I ran this a few years ago and had some
issues, but aren't seeing any problems now. I don't know if this is a
graphics card change, or just optipng fixed some bugs.

These are fairly minimal changes, but hopefully save a few bytes!
2021-05-16 18:00:47 +01:00
Jonathan Coates 349a7543b0 Fix build failures
- Add license headers. Also check these during pre-commit.
 - Fix javadoc issue.
2021-05-15 21:27:48 +01:00
Jonathan Coates 3d589eda4a Expose GenericSource to the public API
- Remove the service provider code and require people to explicitly
   register these. This is definitely more ugly, but easier than people
   pulling in AutoService or similar!
 - Add an API for registering capabilities.
 - Expand the doc comments a little. Not sure how useful they'll be, but
   let's see!

There's still so much work to be done on this, but it's a "good enough"
first step.
2021-05-15 21:11:09 +01:00
Jonathan Coates de646b66b6 Allow turtles to use compostors 2021-05-14 18:32:52 +01:00
Jonathan Coates 4f0d311df7 Add example to turtle.inspect
A pretty common but non-trivial API, so worth having something. Even if
not perfect.
2021-05-14 18:06:51 +01:00
Jonathan Coates d6e3c9a7fa Add inventory.getItemLimit
Closes #781
2021-05-13 18:12:49 +01:00
Jonathan Coates a7a724f134 Bump Cobalt version 2021-05-13 18:09:08 +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
Jonathan Coates 4e15afa254 Add tests for placing monitors from turtles (#691) 2021-05-05 21:49:25 +01:00
Jonathan Coates 84bac06178 Merge remote-tracking branch 'baeuric/mc-1.15.x' into mc-1.15.x 2021-05-05 21:46:47 +01:00
Jonathan Coates 1fecb995c9 Don't close file handles from ResourceMounts
Unlike short handles, we don't read these immediately, and so we can't
close it right away. Otherwise the file is considered empty!

Fixes SquidDev-CC/treasure-programs#1
2021-05-05 21:26:17 +01:00
Euric 99b719299c Defer monitor tile update when placed by another TE 2021-05-04 14:24:58 -07:00
Jonathan Coates fb9590467d Add some examples to inventory methods
Closes #761. It's not perfect, but it's a little better. Maybe??
2021-05-04 19:23:35 +01:00
Jonathan Coates bc8e090873 Simplify our overrides of load/loadstring
- Remove auto-prefixing of load/loadstring
 - Use Cobalt's normal load implementation, with a simple hook to
   set _ENV on the environment.
2021-05-04 18:30:28 +01:00
Jonathan Coates cf0f67265f Correctly handle sparse arrays in cc.pretty
This also swaps the order we display mixed array/maps in, so that the
array part comes first. I think this is more sensible.

Closes #777
2021-05-04 18:05:56 +01:00
Jonathan Coates 53dd15a213 Clean up language scripts 2021-04-28 21:28:52 +01:00
Jonathan Coates eb2d617ed8 Add a pre commit hook to lint code
This uses pre-commit [1] to check patches are well formed and run
several linters on them. We currently do some boring things (check files
are syntactically valid) as well as some project-specific ones:
 - Run illuaminate on the Lua files
 - Run checkstyle on Java

[1]: https://pre-commit.com/
2021-04-28 21:24:27 +01:00
Jonathan Coates 74dae4ec17 That's it, I'm adding pre-commit hooks 2021-04-28 08:19:09 +01:00
Jonathan Coates abbc46877b Remove mavenLocal() repository
Hopefully should bump to the latest Cobalt version too
2021-04-28 08:05:58 +01:00
Jonathan Coates 3cb25b3525 Various VM tests
These are largely copied across from Cobalt's test suite, with some
minor tweaks. It actually exposed one bug in Cobalt, which is pretty
nice.

One interesting thing from the coroutine tests, is that Lua 5.4 (and
one assumes 5.2/5.3) doesn't allow yielding from within the error
handler of xpcall - I rather thought it might.

This doesn't add any of the PUC Lua tests yet - I got a little
distracted.

Also:
 - Allow skipping "keyword" tests, in the style of busted. This is
   implemented on the Java side for now.
 - Fix a bug with os.date("%I", _) not being 2 characters wide.
2021-04-27 22:25:46 +01:00
Jonathan Coates 92b45b1868 Switch to using maven-publish
The old maven package is removed in Gradle 7.0. Instead, we publish to
squiddev.cc using WebDAV (ewww).
2021-04-24 11:26:04 +01:00
Jonathan Coates 003c7ec2e8 Fix Forge maven location
1.16 is going to be sad for a while, as I need to work out FG 4 woes.
2021-04-23 22:40:20 +01:00