Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

LemADEC

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by LemADEC

  1. While updating my WarpDrive mod preloaded LUA scripts, I've noted a few issues.

    Issue #1:
    As of OC 1.7.10-1.6.0-beta.1, autorun.lua scripts provided by my mod were automatically executed.
    As of OC 1.7.10-1.6.2, the same scripts are no longer loaded when starting the computer. However, they'll run if I break/place my block.
    From a LUA console, filesystem autorun is reported as enabled (filesystem.isAutorunEnabled() returns true).
    If I "install" them, they are copied in / but still won't autorun. Same goes if I copy them in /home.

    How are we supposed to have autorun now with OpenOS? Is there a wiki on how the boot sequence works?

    Issue #2:
    When connecting multiple version of the same block, each one will provide the same read-only filesystem from the same location.
    However, OC API doesn't seem to detect them as equals and create a lot of filesystem components while only one is actually necessary.
    Is it the intended behavior? How can I declare the filesystem as being actually the same?

    Here's a simplified version of my TileEntity code:

    Quote
    
     
    
    Node     OC_node = null;
    boolean  OC_addedToNetwork = false;
    ManagedEnvironment OC_fileSystem = null;
    
    public void updateEntity() {
       super.updateEntity();
       
       if (!OC_addedToNetwork) {
          OC_addedToNetwork = true;
          Network.joinOrCreateNetwork(this);
       }
    }
    
    
    
    public void validate() {
       OC_node = Network.newNode(this, Visibility.Network).withComponent(peripheralName).create();
    
    
       OC_fileSystem = FileSystem.asManagedEnvironment(FileSystem.fromClass(getClass(), WarpDrive.MODID.toLowerCase(), "lua.OpenComputers/" + peripheralName), peripheralName);
       ((Component) OC_fileSystem.node()).setVisibility(Visibility.Network);
    
    
       super.validate();
    }
    
    public void onConnectif instanceof OC_fileSystem;
    public void onDisconnectif instanceof // Disconnecting from a single computer
    OC_fileSystem;
    else if OC_node// Disconnecting from the network
    OC_fileSystem;
       
    

    Issue #3:

    I've added a common library to all my scripts. When placed next to the autorun.lua script, it'll only find it when I change to that folder first.

    It appears the autorun is called without setting current directory to it, is that intended?

    Using the OpenOS install command does copy some files, but the library doesn't get installed in /lib or something.

    How can I install my library automatically?

  2. I've updated the mod with a OC script for the ship controller, available here: https://github.com/LemADEC/WarpDrive/blob/MC1.7/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveShipController/startup.lua

    Thanks for showing me here the part I was missing on data saving.

     

    Any idea how to rename a computer from a LUA script, as seen here https://github.com/LemADEC/WarpDrive/blob/MC1.7/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveShipController/startup.lua#L355 ?

     

    Regarding variables values lost, it might be due to node being reset when ship jump, should be fixed in next update.

     

    Last but not least, any idea how to have the startup.lua script actually run automatically?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.