Commit Graph

730 Commits

Author SHA1 Message Date
Florian Nücke
d6a93605a8 Fix devices not being released when computer is destroyed while running. 2022-01-30 15:10:21 +01:00
Florian Nücke
ab69c6977a Fixed disk drives being read-only. Fixes #103. 2022-01-30 14:44:47 +01:00
Florian Nücke
f8899d361e Update Forge and simplify mixin stuff. 2022-01-28 18:33:20 +01:00
Florian Nücke
7be40b02e2 Can be an assert. 2022-01-28 13:26:33 +01:00
Florian Nücke
dc6089d347 Made block entity ticking a little nicer. 2022-01-28 13:26:01 +01:00
Florian Nücke
4793aee54a Update docs. 2022-01-28 10:07:29 +01:00
Florian Nücke
b4dc58edbd Fix computer running sound not stopping when stopped before initial delay expired. 2022-01-28 02:40:24 +01:00
Florian Nücke
a1217ba819 Various cleanup.
Removed pointless VMLifeCycleEvent.
Initialize block devices asynchronously.
2022-01-28 02:28:10 +01:00
Florian Nücke
cbb19eff70 Small rename. 2022-01-28 00:58:59 +01:00
Florian Nücke
b75f5cbca2 Simplify network device run state switching.
Can't remember why all the events were needed before.
Joining worker thread should be enough, since when unmounting one, we unmount all. So there should be no way to read/write from network device after vm devices were unmounted (and memory closed).
2022-01-28 00:56:32 +01:00
Florian Nücke
ae13fca2e9 Rework VMDevice to be more intuitive for typical cases.
unmount() is now called in addition to when suspend() was called before. dispose() is called after unmount() if cleanup is required (machine stopped, device removed).
2022-01-28 00:55:16 +01:00
Florian Nücke
82a6702b33 Rework RPCDevice to be more intuitive for typical cases.
unmount() is now called in addition to when suspend() was called before. dispose() is called after unmount() if cleanup is required (machine stopped, device removed).
2022-01-27 20:10:41 +01:00
Florian Nücke
bd1b46882e Mark chunk lazy dirty when charger charged something, so its stored energy changed. 2022-01-27 11:16:39 +01:00
Florian Nücke
a5cf919f23 Mark chunk dirty when bus interface name changes. 2022-01-27 11:15:58 +01:00
Florian Nücke
28304b1a28 Make some more block entities use custom base class for consistency. 2022-01-27 11:15:38 +01:00
Florian Nücke
1ab2b8ea24 Run firmware check first, as quasi-early exit, before checking vm devices. 2022-01-27 11:15:14 +01:00
Florian Nücke
d9c86cbca5 Add system to mark chunks as "lazy unsaved".
Avoids serialization of chunks with computers in them every single tick.
Since computers state changes every tick they're running, flagging the chunk unsaved every chunk would be necessary. However, this is undesirable, because it triggers an NBT serialization ever tick. Which is slow.
To avoid this, we now track a "lazy unsaved" flag for chunks, which computers can set. This flag is applied to the real unsaved flag during explicit saves, right before the unsaved flag is checked. Explicit saves include chunk unloads, pausing in single-player, server stopping and the save command, for example.
2022-01-27 11:13:22 +01:00
Florian Nücke
9410781c25 [BREAKING] Reworked RPC method API to be more flexible.
RPCDevices now return a list of RPCMethodGroups instead of RPCMethods directly.
RPCMethodGroups can be queried for a method based on an invocation. They can also optionally provide a list of all overloads, for documentation purposes (queried by VM).
Overloads are the old RPCMethods, now taking the same invocation information the lookup method takes.
For convenience, RPCMethods are also singleton RPCMethodGroups.
2022-01-26 03:13:30 +01:00
Florian Nücke
f2d69c1cd2 Add missing forwards in AbstractItemRPCDevice. 2022-01-26 00:18:52 +01:00
Florian Nücke
ba3bc7776c Add never called overrides with exception for clarity. 2022-01-26 00:16:07 +01:00
Florian Nücke
ded98fc652 Fixed synthetic devices being collected from sides that should not collect devices.
No real effect (ignored in method gathering because empty), but still unnecessary clutter.
2022-01-26 00:14:46 +01:00
Florian Nücke
5f892f2341 Fixed no bus scan being triggered when bus cable is placed after bus interface. 2022-01-26 00:13:59 +01:00
Florian Nücke
79ab0f08e0 Fix missing space in documentation. 2022-01-26 00:12:58 +01:00
Florian Nücke
929f13d240 fixup! Add option to clean up stuff (via unmount) when devices go missing. For block devices, this can happen when the block is broken while the computer is unloaded, for example. For items this is more esoteric, but it theoretically means items disappear while the container managing the item as a device is unloaded. 2022-01-25 20:29:17 +01:00
Florian Nücke
dbab733c77 Explicitly use RPCDeviceList type for tracked list devices, for clarity. 2022-01-25 20:28:15 +01:00
Florian Nücke
0c271732cb Add option to clean up stuff (via unmount) when devices go missing.
For block devices, this can happen when the block is broken while the computer is unloaded, for example. For items this is more esoteric, but it theoretically means items disappear while the container managing the item as a device is unloaded.
2022-01-25 19:57:43 +01:00
Florian Nücke
57a1dc9522 Make absolutely sure floppy data is saved to item on disk drive save. 2022-01-25 18:42:00 +01:00
Florian Nücke
28d3159963 Mark DiskDrive chunk dirty when contents change. 2022-01-25 18:37:08 +01:00
Florian Nücke
f483f14205 Recordify. 2022-01-25 18:24:05 +01:00
Florian Nücke
b6a06c9185 Fixed sided connectivity of disk drive. 2022-01-25 18:23:55 +01:00
Florian Nücke
6c96c096ac Reduce max relative tick time for VMRunner to avoid server slowdowns. 2022-01-25 18:23:03 +01:00
Florian Nücke
ddeff66132 Cable rendertype can be static. 2022-01-23 13:37:07 +01:00
Florian Nücke
c96e52ad16 Thou shalt not change things after testing them. 2022-01-23 12:10:58 +01:00
Florian Nücke
9d73df19ce Mention the JsonArray special case on the getParameters method. 2022-01-23 11:58:12 +01:00
Florian Nücke
0f9eb58a9e Fixed side being used in block device queries being flipped. 2022-01-23 11:56:10 +01:00
Florian Nücke
520323e7e1 Add readme to API with an overview and some examples. 2022-01-22 23:18:48 +01:00
Florian Nücke
5547527090 Make names for capability devices more specific. 2022-01-22 23:18:17 +01:00
Florian Nücke
d132eca165 Allow providing Devices as Capabilities on BlockEntities. 2022-01-22 19:44:21 +01:00
Florian Nücke
1fadb9e49e Rethrow directly, skip util method. 2022-01-22 19:44:20 +01:00
Sangar
a503549e94 Fixed interface name in lifecycle diagram. 2022-01-22 15:18:54 +01:00
Florian Nücke
b2bbd2f9a0 Set board run state to stopped, don't just reset. 2022-01-17 22:53:04 +01:00
Florian Nücke
71e426940f Only serialize state of running VMs.
State when stopped is completely implicit and does not need serializing, pointlessly eats space and time.
2022-01-17 22:49:57 +01:00
Florian Nücke
4d68997253 Avoid redundant serialization of VM state. 2022-01-17 22:42:12 +01:00
Florian Nücke
12b606908a Fix depth of tooltips in inventory uis. 2022-01-17 22:31:49 +01:00
Florian Nücke
d424265cda Make sure robots can't be used for recursive item storage. 2022-01-17 21:18:24 +01:00
Florian Nücke
5d54c63569 Remove obsolete overhead in fake player init. 2022-01-15 19:40:14 +01:00
Florian Nücke
8a3add0223 Remove obsolete null check. 2022-01-15 19:40:01 +01:00
Florian Nücke
2ba854ca27 Rework int sized ContainerData stuff. 2022-01-15 19:39:51 +01:00
Florian Nücke
903d772b07 More null paranoia. 2022-01-15 19:39:23 +01:00
Florian Nücke
f84e1308da Remove unused logger instance. 2022-01-15 19:38:52 +01:00