Florian Nücke
|
ab785eb3ac
|
forbid access to string metatable for sandbox; minor restructuring of libraries (mostly sorting by name); saving managed environments attached to an adapter. this is not very reliable, sadly, since there are way too many ways neighbors can change outside our control (chunks only partially loaded, types removed across games due to other mod changes, mods that move blocks such as RIM, ...); making some effort to re-attach peripherals using their previous address; removed connection code on chunk load in network manager, since this is also handled by the check in the tile entities' update function
|
2013-11-04 20:53:31 +01:00 |
|
Florian Nücke
|
fcdb75e4bc
|
rudimentary driver for computercraft peripherals: it emulates a computer that is the whole network and does not provide a lua context which may cause nullpointers. good enough to allow accessing cc disk drives and read/write floppies in them.
|
2013-11-04 17:49:42 +01:00 |
|
Florian Nücke
|
3c6d3f3b58
|
less nullpointers in buildcraft power logic; handling weird cases where the computer may not have run yet but we have to recompute the amount of memory and there is no ram; removed dead rotation logic from block activate, all handled via rotateblock; fixed computers possibly stopping after loading due to bad sleep value
|
2013-11-04 15:16:10 +01:00 |
|
Florian Nücke
|
1b5719347e
|
made all the power stuff configurable; working around power spikes when loading computer blocks (waiting for world to settle for a second before continuing execution)
|
2013-11-04 13:53:43 +01:00 |
|
Florian Nücke
|
49ced36d5f
|
computers need power to run (base level + elapsed cpu time); screens need power to change their display, different costs per operation, depends on number of 'pixels' changed; fixed distributors not balancing buffers if attached to existing network without distributor
|
2013-11-04 13:27:05 +01:00 |
|
Florian Nücke
|
301cec06d6
|
fixed adapter's network functionality. tested with latest CC and now it actually works. what a surprise.
|
2013-11-04 05:27:59 +01:00 |
|
Florian Nücke
|
59c953ec00
|
initializing network connections in tile entities' update function now (i.e. we call Network.joinOrCreateNetwork from there if we have a node and that node isn't in a network yet). this is because on block added is somewhat unreliable, in particular when other mods start getting involved - say, RIM. which is what I tested with right now, and it actually works, i.e. computers can be moved by carriages and keep running without fail. huzzah; also removed weak keys from screen renderer cache, the timeout is enough
|
2013-11-04 04:52:01 +01:00 |
|
Florian Nücke
|
60447a090e
|
localizations for power supply
|
2013-11-04 02:23:40 +01:00 |
|
Florian Nücke
|
666ab55bb3
|
fixed rendering with multiple distributors in a single network
|
2013-11-04 02:21:52 +01:00 |
|
Florian Nücke
|
fd67e2457c
|
added a simple power supply that generates power out of thin air for testing
|
2013-11-04 02:04:32 +01:00 |
|
Florian Nücke
|
f4641d59e8
|
better check for whether power redistribution is needed and reduced number of network packets generated for synchronizing average buffer fill (used for display, brightness of overlay on distributor)
|
2013-11-04 01:44:15 +01:00 |
|
Florian Nücke
|
521613f3f8
|
added option to make power optional; made it so that node creation is impossible for clients, since nodes are exclusively meant for server logic, this makes this more clear; underped buffer re-balancing computation and added check to stop if delta gets small
|
2013-11-04 01:33:29 +01:00 |
|
Florian Nücke
|
e420b0f8a2
|
moved node name from node to component, since that's where it belongs
|
2013-11-04 00:39:35 +01:00 |
|
Florian Nücke
|
734b1bd43f
|
made the node factory stuff nicer to use. the backing code has become somewhat ugly, but that's just java's fault so whatever. it is now possible to write something along the lines of api.Network.newNode(host, name, visibility).withComponent().withConnector(bufferSize).create(), which reads pretty nicely; power is back, but with a few changes. for one, the "running cost" is gone, since that was really just confusing, and would have resulted in frequent updates once the buffers are full/empty anyway (once because we'd have to check whether to fill up or not, once to check if we have enough power or not). it's just much more intuitive to just have a buffer per powered entity that can be filled/emptied as needed. also, there's no differentiation between consumers and producers anymore. producers just fill up their buffers, while consumers empty their buffers. the power distributor now simply takes care of balancing the amount of energy in all buffers connected to the same network it is connected to. multiple distributors don't need any special logic this way, either, since the first one to update simply marks all processed buffers as clean (if they were dirty due to changes); renamed PowerSupply to PowerConverter
|
2013-11-04 00:26:56 +01:00 |
|
Florian Nücke
|
f9e6439704
|
using default pcall and xpcall again in sandbox, using a trick seen in corowatch (setting hook count to 1 on timeout)
|
2013-11-01 22:30:36 +01:00 |
|
Florian Nücke
|
d92257dde3
|
fixed network messaging; pulled persist logic completely to the scala side, doing away with the boot lua script;
|
2013-11-01 19:56:35 +01:00 |
|
Florian Nücke
|
5aad6d61cf
|
cleaned up component visibility updating; some fixes
|
2013-11-01 04:30:07 +01:00 |
|
Florian Nücke
|
12081e5b31
|
some more "shortcut" functions in node interface, allows writing node.blah(..) instead of node.network.blah(node, ...), which, since normally a node reference is held, was way too common.
|
2013-11-01 02:01:14 +01:00 |
|
Florian Nücke
|
730c8f0ea4
|
restructuring network a bit, using messages more for "event like" stuff, thus removing the return values and simplifying the network manager in general quite a bit; removed "system messages", the manager now directly calls onConnect/onDisconnect in the nodes' environment, and said functions take now the relevant node as a parameter; component invoke is now directly called via component interface, not as a message anymore; stuff, i guess
|
2013-11-01 01:12:55 +01:00 |
|
Florian Nücke
|
fe446e9389
|
fixed nullpointer in disconnect of powered down computers; fixed components with a visibility lower than their reachability not being added to the list of visible components in a computer
|
2013-10-30 00:50:13 +01:00 |
|
Florian Nücke
|
d886527557
|
renamed event.wait to event.pull; removed event.fire, instead allowing generating/queuing signals from the Lua side, adding os.pushSignal and renaming os.signal to os.pullSignal. pullSignal now has no filtering capabilities, only a timeout, all filtering is done via event.pull
|
2013-10-29 23:49:28 +01:00 |
|
Florian Nücke
|
1fd375f17f
|
screw it, events are now global, i.e. they will *not* automatically be cleaned up when the program that registered them dies. instead, resort to event pulling for most cases, the nice filtering in event.wait should make that feasible for most scenarios; on the upside, waits can now be canceled (customizable via event.shouldInterrupt, queried each time os.signal returns to event.wait, defaults to ctr+alt+c being pressed), event.wait will throw an "interrupted" error in that case. this means os.sleep is also interruptable since it just calls event.wait; also updated eris to latest version
|
2013-10-29 22:43:42 +01:00 |
|
Florian Nücke
|
d52a0995c5
|
less derpy environment "sandboxing" for shell.execute, instead tracking events per thread now, and removing those of dead threads; thus, programs are now run in their own coroutines, which also allows emulation of cc's yield behavior (pulling events = signals); no label = null instead of empty string now
|
2013-10-28 23:18:14 +01:00 |
|
Florian Nücke
|
7cf9fadd88
|
allow settings fs label on construction and added read-only flag (used to forbid label change on ro systems); forbid setting label on volatile systems (in particular tmpfs); added program to manipulate fs labels; added program to display disk usage
|
2013-10-28 15:16:55 +01:00 |
|
Florian Nücke
|
c51d55172f
|
cleaned up lua stuff a bit; split off unicode stuff into extra table; some fixes (fs.exists for non-existent virtual objects, less program, other stuff i forgot); added mount and umount programs
|
2013-10-28 12:36:10 +01:00 |
|
Florian Nücke
|
30c2682105
|
cleaned up LuaCallbacks a bit, passing a context and argument wrapper instead of the message itself now
|
2013-10-27 16:23:54 +01:00 |
|
Florian Nücke
|
78a426c4fe
|
metric ton of fixes. somehow the number of touches files feels too low... anyway, also added option to LuaCallback annotation to mark callbacks as asynchronous (meaning they will be called directly from the executor thread) and synchronized the sh*t out of the network manager in the hopes that not all will crumble to pieces due to sending messages around while someone meddles with the network (program calls sth while player places/breaks block e.g.); oh, and we now take the memory baseline after loading the libs, meaning 32k is enough to run a computer again. also, loading libs is done asynchronously now, since it's loaded from the rom and nobody else should be able to access that anyway, meaning fast boot-times; command line program to manipulate redstone output and read input
|
2013-10-27 15:06:21 +01:00 |
|
Florian Nücke
|
a7ec5c0ec0
|
things are slowly beginning to work again... it's still all a big mess, though
|
2013-10-27 05:33:33 +01:00 |
|
Florian Nücke
|
af286d17fa
|
on the ever so painful path to refactoring the api... making nodes black boxes to be created via a factory and providing previous functionality to their "environment" (owning object) via other callbacks and stuff; pretty much *nothing* is working right now, yay!
|
2013-10-27 01:37:34 +02:00 |
|
Florian Nücke
|
24228a225a
|
prepping for more api->java
|
2013-10-25 13:09:45 +02:00 |
|
Florian Nücke
|
c231f61ab5
|
javaified a lot of the api, which means a lot of the documentation will probably be slightly off now, and there may be new bugs (yay!). also, component networking stuff is slightly more fugly now since a lot of stuff has to be manually boxed. will rework that next, i guess
|
2013-10-25 02:33:08 +02:00 |
|
Florian Nücke
|
c556f4044e
|
simplified redstone driver (just using the message source as the redstone input/output provider)
|
2013-10-25 00:47:15 +02:00 |
|
Florian Nücke
|
1454512860
|
pcall for event error handler; super-hacky low-level boot progress feedback (as soon as any gpu in the pc has been bound, so it'll only work after the first boot and if the hardware doesn't change between boots, but hey!); keeping leading / in absolute paths in fs.canonical; prefixing paths specified to shell.path with a / if there is none already (making them explicitly absolute); moved file handle gc to the file stream, which is more logical; increased width of minimal resolution a bit (mainly so that the lua copyright notice fits into one line :P); made more gpu driver functions return a true boolean if they were called successfully; limiting the number of open handles a single computer can have per filesystem
|
2013-10-24 21:39:21 +02:00 |
|
Florian Nücke
|
a628822d14
|
changed garbage collection of file handles a bit. although it was working, in hindsight i'm really not quite sure *how*, or rather: Lua seems to be smarter than I already gave it credit for. it apparently realized that a new reference to the object to be gc'ed was created in its finalizer, so it let it live. however, i'm not quite sure why that didn't lead to a pseudo-infinite loop. now we just keep the stream as an upvalue for the timer callback that actually closes the stream; also, removed the checks if event.timer exists. if people remove that it's really their own problem
|
2013-10-24 18:45:01 +02:00 |
|
Florian Nücke
|
4a664bb2e5
|
some cleanup; automatically restarting the shell if it stops (avoids the occasional ctrl+c shutting down the computer); added os.sleep and extended event.wait to take a filter, which basically makes it similar to cc's pullEvent with an optional timeout; determining io buffer size based on current free ram and added a minimum size; some better "sandboxing" for programs (which really isn't that, just making automatic listener cleanup as consistent as possible); using error messages in (uncaught) exceptions where possible, making for some nicer error messages, for example for out of memory errors when pushing results from the host side; made difftime a lua function; properly initializing text renderer on multi-screens; added program for paged file viewing
|
2013-10-24 18:34:15 +02:00 |
|
Florian Nücke
|
a8288b2623
|
ctrl+d for soft and ctrl+c for hard abort in term.read, resulting in 'nil' being read, signalling an eof and thus allowing the lua program to be quit that way; removed the exit() function from the lua function; added shell.parse for rudimentary argument parsing (anything starting with - is treated as an option or a list of option (each option name must be exactly one char); added key state tracking and keyboard library
|
2013-10-23 17:10:56 +02:00 |
|
Florian Nücke
|
e9f2fac861
|
cleaned up some on the lua side, moving a couple of things in to 'lib' files that they belong to (in particular io api moved over from the filesystem driver, os api reimplementation stuff and base api); switched from a set of resolutions to a maximum resolution per tier; removed the magic ram bonus that was used to avoid standard lib stuff hitting the ram requirements too much, but that got too wonky. downside is that right now we need 96k to boot a computer, will either have to bump the ram module sizes or try to reduce that.
|
2013-10-22 19:36:26 +02:00 |
|
Florian Nücke
|
010e4cccb8
|
fixed screen.fill; corrected screen aspect ratio and added code for stretched rendering
|
2013-10-22 16:16:07 +02:00 |
|
Florian Nücke
|
95e999792d
|
fixed two string.* functions (were still bxxx instead of uxxx); fixed tmp not being cleared properly. again; stripped some implementations from api traits, to make it easier to transition them to Java (which I think we should do in the long run, after all)
|
2013-10-22 13:01:01 +02:00 |
|
Florian Nücke
|
e6bbfdc801
|
multi-tier screens and gpus. three tiers, with increasing resolutions and (at some point) color starting with the second tierl; custom "Ordering" implementation so we can just sort screens by their coordinates one by one instead of hashing them; Tuple (and untested Seq) return values supported for driver callbacks (converted to tables); added a field called "n" to all "arrays" returned from driver calls (so also tuples and seqs) mimicking Lua's table.pack
|
2013-10-21 18:17:12 +02:00 |
|
Florian Nücke
|
a3c0ae683e
|
define languages via pack.mcmeta (not hardcoded in proxy)
|
2013-10-21 13:50:10 +02:00 |
|
Florian Nücke
|
519afa4d11
|
minor tweaks to alias programs
|
2013-10-21 02:47:27 +02:00 |
|
Florian Nücke
|
d25c824e1a
|
multi dir ls and -l option for ls; using shell.execute for autorun; aliases for shell; fixed interval not being cleared from shell.exec'd programs; immediately show cursor blink again when moving the cursor (left, right, home, end), makes navigating easier
|
2013-10-21 02:41:00 +02:00 |
|
Florian Nücke
|
60118f19cc
|
lua program can now be quit using 'exit()' function
|
2013-10-20 18:34:32 +02:00 |
|
Florian Nücke
|
b52cc44598
|
eris fixes (remind me to also compile for linux later...)
|
2013-10-20 18:30:32 +02:00 |
|
Florian Nücke
|
d083f34a18
|
some more and init cleanup
|
2013-10-20 14:02:26 +02:00 |
|
Florian Nücke
|
9785ab4546
|
proper shell and a bunch of utility programs
|
2013-10-20 13:35:34 +02:00 |
|
Florian Nücke
|
e582fe6259
|
changed the Persistable interface a bit to now use names "compatible" with tile entities (readFromNBT and writeToNBT) and made the overrides in the Node trait abstract. this way tile entities will *have* to implement these two functions, making it less likely to ... forget calling save on nodes. the only negative is that one still has to manually call the two different "super" implementations, the one on the tile entity explicitly (in our case usually super[Rotatable].read/write...) in addition to the usual super call. seems to work so far.
|
2013-10-19 19:02:43 +02:00 |
|
Florian Nücke
|
ccf53d6b85
|
defaulting to standard lua string functions and making unicode ones available prefixed with a u (uchar, ulen, usub, ureverse); fixed event erroring being weird; fixed wrong case check order in kernel; fixed error when netsplitting a component from a computer; fixed localization for disk drive; config for name to provide when running command in command block; increased range of keyboards; adapter blocks re-use the same addresses for the blocks attached to them to avoid computers losing track of those nodes after reloading
|
2013-10-19 15:55:59 +02:00 |
|
Florian Nücke
|
87aa1f44a9
|
redstone, oh how i loathe ye
|
2013-10-18 21:48:41 +02:00 |
|