Commit Graph

1359 Commits

Author SHA1 Message Date
SquidDev 5a4375f6ac Allow changing the colour of the modem light
This now uses an integer between 0 and 15 to represent a colour, rather
than a simple on/off flag.
2017-05-07 08:09:36 +01:00
SquidDev 6020cd55b1 Added documentation and updated changelog/whatsnew 2017-05-07 08:09:36 +01:00
SquidDev 7f8100ae0f Check the offhand inventory too when searching for upgrades 2017-05-07 08:08:09 +01:00
SquidDev 22631cfc63 Add .equip and .unequip methods to pocket API. 2017-05-07 08:08:09 +01:00
SquidDev 5faceac7ba Add registry for pocket computer upgrades 2017-05-07 08:08:09 +01:00
Daniel Ratcliffe ff16868dd8 Merge pull request #206 from Lignum/update-craftos-version
Set CraftOS version to 1.8
2017-05-07 00:41:58 +01:00
Lignum 287c6f172c
Allow passing RGB8 hex values to term.setColour 2017-05-07 01:16:48 +02:00
Daniel Ratcliffe cad10fa2c7 Fixed incorrectness in os.day(). Added os.epoch() 2017-05-06 23:56:28 +01:00
Daniel Ratcliffe 58713caa73 Merge pull request #203 from SquidDev-CC/feature/turtle-models
Convert turtle rendering to use tinting
2017-05-06 23:56:13 +01:00
Daniel Ratcliffe a6e3d4fd26 Merge pull request #195 from SquidDev-CC/hotfix/selection-boxes
Fix selection boxes not being shown
2017-05-06 23:55:45 +01:00
SquidDev f34a319b79 Make cable collision boxes more accurate for cables
Each cable segment is added to the list, meaning you can get close and
snugly with the cables.
2017-05-06 23:45:15 +01:00
Lignum 1cc403191f
Add colours.rgb8(r, g, b)/colours.rgb8(hex) 2017-05-07 00:13:36 +02:00
Lignum 2c7ee1d7e7
Bump CraftOS version to 1.8 2017-05-06 23:26:45 +02:00
Daniel Ratcliffe 4b4e041f6f Merge branch 'master' into master 2017-05-06 22:25:46 +01:00
Daniel Ratcliffe 423d5af87f Merge pull request #191 from SquidDev-CC/feature/text-illumination
Make monitor text glow in the dark
2017-05-06 22:11:28 +01:00
Daniel Ratcliffe 5b6bbc3cbf Merge pull request #200 from Lignum/fs-weak-set
Replace WeakHashMap for open files with a weak set
2017-05-06 21:44:28 +01:00
Lignum a9e7acbec5
Fix monitors fetching palette when there is no terminal 2017-05-06 20:23:44 +02:00
Lignum ac2382a861
Add setColour overload with table parameter 2017-05-06 20:22:16 +02:00
SquidDev 2f93354981 Remove dye block state property
It doesn't make sense to have it now as the coloured models do not exist
any more, and so would just produce errors should we try to load them.
2017-05-06 17:41:49 +01:00
SquidDev c7f5d039b2 Use IBlockState instead of Block methods
There was a crash in RedstoneUtil when redstone state was changing next
to a full block due to the incorrect state being passed. By using
IBlockState methods we ensure that this cannot happen again.

The old IBlockState methods were also deprecated, so this reduces the
warning count a little. I've also moved string translation into
StringUtils, to reduce the number of deprecation warnings from there.
2017-05-06 15:31:06 +01:00
SquidDev d652bdb0b0 Convert turtle rendering to use tinting
This uses Minecraft's colour tinting system in order to change the
colour of turtle models. This removes the need to have 16 models and
textures for each colour, reducing texture atlas space and hopefully
memory consumption.

See #145
2017-05-06 15:06:02 +01:00
Tim Ittermann f1c4634dfa os.time( ... ) now returns float 2017-05-06 14:52:02 +02:00
Tim Ittermann f89bbeee54 Remove import 2017-05-06 14:30:19 +02:00
Tim Ittermann e0e81a9b18 Put time functions into the OS API 2017-05-06 14:24:48 +02:00
Lignum bfa5f6ec9c
Make palettes work properly with the window API 2017-05-05 20:23:57 +02:00
Lignum 988e9f10db
Fix compiler error 2017-05-05 19:13:52 +02:00
Lignum b0ac48b9a3
Use some sweet tricks to have a weak set to store open files 2017-05-05 19:11:59 +02:00
Lignum 3de674dfb1
Simplify the palette payload to an int array 2017-05-05 18:47:43 +02:00
Lignum 39a56c8e55
Get rid of the PaletteColour class
It just took up a bunch of space. We're storing an array of float[3] now.
2017-05-05 18:22:48 +02:00
Daniel Ratcliffe 06b63980eb Merge pull request #196 from SquidDev-CC/feature/docs
Fix several documentation warnings
2017-05-05 17:19:26 +01:00
Lignum 6997471280
Add palette functions to monitor peripheral 2017-05-05 18:12:33 +02:00
SquidDev 4b95ed5d53 Do not reset redstone inputs when adding peripherals
As of 8abff95441, peripherals no longer
block redstone input. As this is no longer the case, redstone levels
should not be reset.
2017-05-05 17:00:44 +01:00
Lignum 088dab799e
Network the colour palette
Which means it actually has a visible effect! 🎉
2017-05-05 17:21:53 +02:00
SquidDev 0cdd0ea21a Change license headers to block comments
This means they do not get picked up by Javadoc and friends
2017-05-05 16:16:09 +01:00
SquidDev 76e926c090 Document several undocumented arguments and exceptions 2017-05-05 16:07:18 +01:00
SquidDev d87b0e9435 Fix selection boxes not being shown
getSelectedBoundingBox expects a bounding box relative to (0, 0, 0) but
we were returning one relative to the current block. Instead we allow
the default behaviour to continue, which will call getBoundingBox and
offset it.
2017-05-05 15:25:07 +01:00
Lignum b0f0d8fd71
Add getColour/setColour to the window api 2017-05-05 16:14:13 +02:00
SquidDev 7b07921a73 General improvements to the documentation
- Add documentation for all undocumented methods and enums.
 - Use @code, @link and @see where appropriate.
 - Fix spelling in a couple of cases.
2017-05-05 14:59:11 +01:00
Lignum 56c9dec687
Add term.setColour/term.getColour 2017-05-05 15:52:21 +02:00
Lignum 936a531cd5
Add a palette class and use it for rendering 2017-05-05 15:24:29 +02:00
Daniel Ratcliffe 09215daa03 FileSystem uses a WeakHashMap to store it's open file handles
This means if lua code forgets to free a handle, the java GC will still
be able to collect the stream (andclose the file in the finaliser in the
process)
2017-05-05 00:54:24 +01:00
Daniel Ratcliffe 42f2235d45 Made the black colour on monitors, terminals, block and item graphics darker
0x111111 is now used throughout, previously there was quite a bit of
variance
2017-05-05 00:54:24 +01:00
Daniel Ratcliffe 2436d813e6 Treat a maximumFilesOpen values of 0 as unlimited 2017-05-05 00:54:23 +01:00
Lignum 4b8493baab
Terminal cursor bounds checking 2017-05-05 00:08:10 +02:00
Lignum 4e3def39e0
Render terminal cursor in a less awkward way
The previous way seemed weird enough to seem to have had a purpose, but I can't tell. Revert this if it turns out that there was.
2017-05-04 23:53:43 +02:00
Lignum 7e71045c7b
Remove texture coordinates from text background part 2017-05-04 23:49:08 +02:00
Lignum 2d5d5e3a9e
Use GL_TRIANGLES in FixedWidthFontRenderer 2017-05-04 23:43:05 +02:00
Lignum c104eabcdd
Use GlStateManager where necessary, replace GL_QUADS with GL_TRIANGLE_STRIP 2017-05-04 23:38:24 +02:00
SquidDev 933bdcc6b7 Make monitor text glow in the dark 2017-05-04 22:24:39 +01:00
Tim Ittermann 45803e4a49 Replace get...() functions with properties. NOT ALL TESTED YET! 2017-05-04 23:18:03 +02:00
Daniel Ratcliffe 8abff95441 Peripherals no longer break turtle<->redstone connectivity
I can't think of a good reason for this feature tbh
2017-05-04 22:13:14 +01:00
Daniel Ratcliffe f99caed4f2 Merge pull request #169 from Lignum/fd-limit
Configurable file descriptor limit
2017-05-04 22:12:50 +01:00
Daniel Ratcliffe 4b0a976bd6 Merge pull request #182 from SquidDev-CC/feature/turtle-upgrade-both
Allow turtle upgrades to act as tools and peripherals
2017-05-04 22:02:09 +01:00
Lignum 30d191df0b
Avoid casts with generic type args 2017-05-04 23:00:02 +02:00
Daniel Ratcliffe 17a3e120e8 Merge pull request #180 from boq/master
Handle tile entity changes
2017-05-04 21:42:34 +01:00
Daniel Ratcliffe 55b160e1bb Merge pull request #164 from SquidDev-CC/hotfix/turtle-connectivity
Fix redstone connectivity on turtles
2017-05-04 21:28:08 +01:00
Daniel Ratcliffe fa99305914 Merge pull request #168 from SquidDev-CC/hotfix/modem-model-rotation
Various model improvements
2017-05-04 21:08:51 +01:00
Daniel Ratcliffe 27ef182294 Merge pull request #158 from SquidDev-CC/feature/require-container
Require the player to be interacting with the computer when typing
2017-05-04 21:08:34 +01:00
Daniel Ratcliffe 82e76d9872 Merge pull request #184 from SquidDev-CC/hotfix/sort-list
Sort the result of FileSystem.list
2017-05-04 21:06:26 +01:00
Daniel Ratcliffe 2a0556fa4c Merge pull request #185 from SquidDev-CC/hotfix/unpack-length
Manually specify the number of values to unpack
2017-05-04 21:05:14 +01:00
Daniel Ratcliffe 22e36fc35d Merge pull request #178 from boq/patch-1
Fix compilation error
2017-05-04 21:04:14 +01:00
Daniel Ratcliffe 655a328b86 Merge pull request #174 from SquidDev-CC/hotfix/shutdown-abort
Send termination signals unless the computer is off
2017-05-04 21:03:40 +01:00
SquidDev bd14223ea8 Manually specify the number of values to unpack
table.unpack will often stop at the first nil value, meaning some event
arguments may be discarded. By storing the number of arguments through
table.pack, and then using that count when unpacking, we can ensure all
values are returned/resumed with.
2017-05-04 10:49:41 +01:00
SquidDev 72dfb0e7cc Sort the result of FileSystem.list
This ensures fs.list and fs.find always return the same result.

For some reason, the ComputerCraft jar was being packaged differently on
some platforms, causing files to appear in a different order. As
computers depend on the colors API being loaded before colours, we need
to ensure that they are loaded in a consistent order.
2017-05-03 22:29:57 +01:00
Tim Ittermann b2cc6ec82a Add TimeAPI to Computers APIs 2017-05-03 23:12:48 +02:00
Tim Ittermann c1d5ae2a09 Rename src/main/java/dan200.computercraft/core/apis/TimeAPI.java to src/main/java/dan200/computercraft/core/apis/TimeAPI.java 2017-05-03 23:11:52 +02:00
Tim Ittermann 627524dcb7 Create TimeAPI.java 2017-05-03 23:10:58 +02:00
SquidDev 6b6829e22b Use tonumber when validating message format 2017-05-03 18:39:32 +01:00
SquidDev 67eecd4b1c Use tonumber instead of checking type 2017-05-03 18:21:14 +01:00
SquidDev a021a072b5 Allow turtle upgrades to act as tools and peripherals
This may be useful when you want your tool to also provide additional
methods. For instance, a pickaxe could provide methods to check whether
it can break the block in front.
2017-05-03 17:28:54 +01:00
SquidDev 7e5970673f Ensure GPS coordinates are numbers
Fixes #138
2017-05-03 16:35:45 +01:00
Bartek Bok 4eb4bb933f
Different fix for shadow turtles 2017-05-03 16:03:47 +02:00
Bartek Bok 5284b145f8
Handle tile entity changes 2017-05-03 11:36:55 +02:00
Bartek Bok bd8769f300 Fix compilation error 2017-05-02 23:40:31 +02:00
Lignum 994dcd9f58
Localise the maximumFilesOpen setting 2017-05-02 18:29:50 +02:00
Lignum 2bfb53227a
Merge master into fd-limit 2017-05-02 18:26:45 +02:00
SquidDev ba761a15b6 Send termination signals unless the computer is off
If a shutdown has been queued, then the abort message was not set. This
allowed for programs to run for a significantly longer period of time.
2017-05-02 14:04:48 +01:00
Daniel Ratcliffe 58e6e9ea46 Fixed a typo 2017-05-02 13:56:24 +01:00
Daniel Ratcliffe 4825aefccf Merge pull request #167 from SquidDev-CC/hotfix/limit-label
Impose additional limitations on disk and computer labels
2017-05-02 13:54:43 +01:00
Daniel Ratcliffe 3a360a50b0 Merge pull request #166 from SquidDev-CC/feature/config-gui
Add config GUI
2017-05-02 13:46:01 +01:00
SquidDev 65ef8a0937 Add config GUI description to changelog/whatsnew 2017-05-02 13:35:05 +01:00
SquidDev 14d3a182d9 Fix NPE when clearing disk label 2017-05-02 13:32:53 +01:00
Daniel Ratcliffe 800e448264 Improved the wording of some of the labels in the Config UI 2017-05-02 13:28:54 +01:00
SquidDev 2fef772f3d Use '?' for unprintable characters 2017-05-02 13:24:42 +01:00
SquidDev c537c4fa78 Swap from builtin/generated to item/generated
This model has more sane defaults, meaning items are scaled to the
appropriate size.
2017-05-02 02:12:51 +01:00
Jonathan Leitschuh 2a01883177
Make threads daemon threads
Threads that aren't daemon threads can keep the JVM from shutting down.
I'm certain that this doesn't happen very often but if one of these
threads hangs it can cause the rest of the JVM to not shut down
when the main thread exits.
By making all threads daemon threads if the main thread terminates
the rest of these threads will shut down.
2017-05-01 20:34:28 -04:00
SquidDev c190ec5147 Do not limit labels to the ASCII range.
This should accept all printable characters that ComputerCraft can
handle.
2017-05-02 00:20:46 +01:00
Lignum 6ff9db89cc
Fix file handle leak 2017-05-02 00:44:33 +02:00
Lignum 2a1e110a65
Make the file descriptor limit configurable 2017-05-02 00:17:16 +02:00
SquidDev d08b47db93 Preserve default values in configuration
Before we were setting the default as the previous value each time. Here
we store each property in a separate field, allowing us to access them
without setting a default.
2017-05-01 23:14:06 +01:00
Lignum 2d0690e625
Add file descriptor limit 2017-05-02 00:05:42 +02:00
SquidDev 876df68294 Rotate modem models 180 degrees
Or pi radians. Or tau/2 radians.

This ensures the main modem texture is facing towards the screen.
2017-05-01 22:39:18 +01:00
SquidDev b1efbdad95 Impose additional limitations on disk and computer labels
Closes #147
2017-05-01 22:23:54 +01:00
SquidDev 230b578a98 Add config GUI
This allows you to modify various settings in-game.
2017-05-01 22:14:45 +01:00
SquidDev 02ce111d9e Invert side when checking connectivity
The side marks the direction relative to the wire, rather than the side
of the block it is attempting to connect to. Therefore needs to be
flipped.

Closes #149
2017-05-01 21:44:48 +01:00
SquidDev ae04070915 Update documentation to include HTTP API changes 2017-05-01 18:05:04 +01:00
SquidDev f2596a8547 Return string->string headers instead, joining fields with a comma. 2017-05-01 18:00:53 +01:00
SquidDev 29952d5b4f Various extensions to the HTTP API
- A response is returned on the event of a HTTP error (such as 404).
 - Responses include the response headers.
2017-05-01 17:35:06 +01:00
SquidDev b2542289f0 Require the player to be interacting with the computer when typing
Packets will be discarded if the sending player is not currently
interacting with the appropriate computer. This ensures players cannot
control other people's computers.

This is enforced by checking if the current container is a "computer
container", and this container holds the correct computer.
2017-05-01 17:07:32 +01:00
SquidDev b3760f58e6 Performance improvements to fs.find
If the path includes no wildcards then it just checks it exists.
If it does, instead of scanning the entire tree, it works out the last
directory before the wildcard and starts scanning from there.

Closes #89
2017-05-01 16:45:41 +01:00
SquidDev bbbbccf63d Fire all entity interaction events in TurtlePlaceCommand
This allows turtles to interact with entities correctly.
2017-05-01 16:14:05 +01:00
SquidDev d050ca9849 Fix advanced computer's item model 2017-05-01 16:10:45 +01:00
SquidDev 77d225d1fe Listen to correct block update
We now listen to neighborChanged instead of onNeighborChange. This means
computers correctly detect redstone updates.

However, this leads to issues when moving turtles, so we defer the block
update until the turtle has finished moving.
2017-05-01 16:08:27 +01:00
SquidDev 9b5f4a877c Fix null bounding box being returned
Its usage is not always checked for null, so it is safer to return a
full block.
2017-05-01 16:04:42 +01:00
SquidDev 34cb75dfc3 Fix various tile entities not syncing correctly
This ensures the tile state is sent and received when it changes. This
fixes turtles facing the wrong direction and computers not turning on.
2017-05-01 16:04:36 +01:00
SquidDev 43d68db349 Add missing classes 2017-05-01 16:02:47 +01:00
Daniel Ratcliffe b202b7b8a5 Converted tabs to spaces throughout 2017-05-01 15:48:44 +01:00
Daniel Ratcliffe 7d497f2835 ComputerCraft 1.80pr0
Updated the source code to the version shipped as the 1.80pr0 alpha
release. Also removed some unnecessary files from the LuaJ subfolder
which were bulking up the repository.
2017-05-01 14:51:26 +01:00
Daniel Ratcliffe e85cdacbc5 ComputerCraft 1.79 initial upload
Added the complete source code to ComputerCraft 1.79 for Minecraft
1.8.9, plus newly written README and LICENSE files for the open source
release.
2017-05-01 14:32:39 +01:00