4997 Commits

Author SHA1 Message Date
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
Florian Nücke
7d73f3afc5 slight concept change in naming: "components" are now nodes that can be seen/addressed by computers via some driver; signal when redstone input changes 2013-10-18 20:38:44 +02:00
Florian Nücke
728b4281b8 made screen background (non-gui) ever so slightly less pitch-black, so it doesn't look like a black hole that much... 2013-10-18 18:59:19 +02:00
Florian Nücke
b1a9ef69c7 split computer visibility into a separate trait, to allow more standardized dynamic changing of said visibility. only used by multi-block screens for now (so that only the origin of a multi-block screen shows up in the component list); made monitor merge algorithm (more) deterministic, to avoid possibly desyncs in server and client state (it depended on the tile entity update order before). this also guarantees screens are merged the same way after loading a previously saved game 2013-10-18 18:50:29 +02:00
Florian Nücke
4556f37e7c better distance computation for screens, based on center of its bounding box and being the minimal distance to the bounding box, instead of the origin and the distance to the center of it 2013-10-17 23:17:08 +02:00
Florian Nücke
c1d247341a made some screen settings available in config; fixed monitor size limits based on config being one too small; properly sized bounding box for screen tile entity when it's a multi-block; re-added render check for screen text, this time based on player position instead of look direction 2013-10-17 22:11:23 +02:00
Florian Nücke
0320935f9a progress on multi-block screens 2013-10-17 20:31:04 +02:00
Florian Nücke
efb8f297db minor refactoring moving power related stuff to its own package; made receiver trait use provider trait instead of internal distributor implementation; made some minor things more scala-ish 2013-10-14 17:25:32 +02:00
Florian Nücke
efe25b35e8 Merge branch 'master' of cil.li:oc
Conflicts:
	li/cil/oc/common/tileentity/ComponentInventory.scala
	li/cil/oc/common/tileentity/Screen.scala
2013-10-14 16:46:45 +02:00
Florian Nücke
cbfbc2f152 refactored screen env into screen's companion object (same as already done with computer); keeping track of pressed keys client-side to send char on key-up (lwjgl doesn't seem to properly provide that, code and char always seem to be 0 on key up) and to send key up events for all still pressed keys when closing the gui. server will have to keep track of all key presses (and the players that did them) at some point, too, since clients may just disconnect, for example (or be malicious) 2013-10-14 16:43:22 +02:00
Florian Nücke
deb45f374f nicer native library loading (in particular nicer failure case) 2013-10-14 14:14:17 +02:00
Florian Nücke
db139a16a9 using slot's built-in background icon functionality in computer gui now 2013-10-14 13:51:15 +02:00
Florian Nücke
8ed48750a3 disk drive and floppy disks (disk drives are mountable and act as a "proxy" for the item in them); minor refactoring; 2013-10-14 13:26:13 +02:00
Johannes Lohrer
56cc2c3dfd updated energy distribution but not with final values 2013-10-13 19:13:04 +02:00
Johannes Lohrer
a3fa83b037 Merge branch 'master' of cil.li:oc 2013-10-13 16:25:59 +02:00