Jump to content

NQ-Nomad

Producer
  • Posts

    160
  • Joined

  • Last visited

Posts posted by NQ-Nomad

  1. Hi guys, 

     

    Following up the release of the third Alpha 2 DevBlog about Lua, we wanted to develop things further for the most curious, dedicated and skilled among you. The API has changed so you guys will have to redo a certain amount of stuff. This being said, you'll find below some documentation that will allow you to do pretty neat stuff so knock yourselves out!

     

    Thanks to NQ-Arlequin for his help and for writing this! 

     

    How does it work

     

    All ControlUnits (Cockpits, HovercraftSeats and ProgramingBoards) can display information on the screen when activated by the current player. CockpitUnits and PilotingSeats have predefined behavior that should suit most players. However advanced players can edit the ControlUnit LUA script to adapt the display to their needs.

    There are different levels of customization possible:

     

     

    • Intermediate Difficulty: Show/hide the default widget of an element linked to the Control Unit.
    • Advanced Difficulty: Mixing those widgets in custom panels. (New in Alpha 2)
    • Expert Difficulty: Create custom widgets from your own data or existing elements data. (New in Alpha 2)
    • Expert Difficulty: Create your own HTML code to display custom content on your screen. (Modified in Alpha 2)

     

     

    Default behavior

     

    Cockpit view

    x3CJXMeoLdWcuIwncPUrXA7bMxL28Wdb8nCutMWb

     

    Hovercraft Seat

    HCDczeC9xy33kHMrwLEHimiMj4e2ZXxUNOv9v8nU

     

    Programing Board

    StpudqGMBswhgMsjjYxxwhxq_pqgYhu4q6wqC0KG

     

    Hovercraft Seat and Programming Board widgets do stack:

    pjdnn7HZ60MVeuskFEKp-wyEU7posP73hj3q4XcO

     

     

    Adding/removing element widgets in Lua

     

    API:

    slot.show()
    slot.hide()

     

    Default Cockpit LUA Script

    cOdWeRNKaxukxWquvU91TA8Cuq7a_rtWXPA_-4k2

     

     

    We can instead only show the Core Unit widget, and hide the Control Unit widget (shown by default):

    core.show()
    unit.hide()

    y0vC1HWPgadb7AB5r3OTjycalOunvZ9CPrgFxwxI

     

    tSh8A8aWleSKtCg0B9xICd_frXkfdrmuYdrPf56U

     

     

    NEW - Reorganizing Element widgets within panels in Lua

     

    API:

    system.createWidgetPanel(title)  panelId
    system.destroyWidgetPanel(panelId)
    system.createWidget(panelId, type)  widgetId
    system.destroyWidget(widgetId)
    system.addDataToWidget(dataId, widgetId)
    system.removeDataFromWidget(dataId, widgetId)
    slot.getDataId()  dataId
    slot.getWidgetType()  type

     

    Instead of having all the fuel container widgets in different panels, I can create my own panel and add all fuel widgets to this panel:

    fuelPanel = system.createWidgetPanel("Fuel Tanks")
    for i=1,container_size do
        widget = system.createWidget(fuelPanel, container[i].getWidgetType())
        system.addDataToWidget(container[i].getDataId(), widget)
    end

    VYb7g8MH8Y2NcGUz-QSSTYotCS5nln2-bFPrhQLq

     

    ywDPCChVXxU-0oFcPfrjS7v1wvJbIa3jZoX8-z--

     

     

    NEW - Creating custom widgets in Lua

     

    API:

    system.createData(json)  dataId
    system.destroyData(dataId)
    system.updateData(dataId, json)
    slot.getData()  json

     

    You can finally write your own custom data, and display them using predefined custom widget types. 4 exist for now: text, title, value, and gauge.

     panel = system.createWidgetPanel("Panel")
        -- Display “Hello World”
    widgetText = system.createWidget(panel, "text")
    dataText = system.createData('{"text": "Hello World"}')
    system.addDataToWidget(dataText, widgetText)
    
    -- Display a title “Title”
    widgetTitle = system.createWidget(panel, "title")
    dataTitle = system.createData('{"text": "Title"}')
    system.addDataToWidget(dataTitle, widgetTitle)
    -- Display a gauge filled at 60%
    
    widgetGauge = system.createWidget(panel, "gauge")
    dataGauge = system.createData('{"percentage": 60}')
    system.addDataToWidget(dataGauge, widgetGauge)
    -- Display “Weight  80 kg”
    widgetValue = system.createWidget(panel, "value")
    dataValue = system.createData('{"label": "Weight", "value": "80", "unit": "kg"}')
    system.addDataToWidget(dataValue, widgetValue)

    Hq7rn-et3cAlDSxEDOAtC5ibGt1tS-oXN2HKzSuG

     

    QWfv-tFtm36ogDoav-kQXSJQCJGZGYXWFm3LgUZ3

     

    You can now combine all those methods to create your own customized panels.

     

     

    CHANGED- Customize screen using html code.

     

    API:

    system.setScreen(htmlContent)
    system.showScreen(1/0)

    You can write your own html code to change the appearance of the control unit screen. It will be displayed below the widgets, so if you want full control: you can hide all widgets.

     

    html = '<div class="monitor_left window">'
    html = html .. '<div class="center window">monitor_left</div>'
    html = html .. '</div>'
    html = html .. '<div class="monitor_right" style="background-color: red;">'
    html = html .. '<div class="center window">monitor_right</div>'
    html = html .. '</div>'
    system.setScreen(html)
    system.showScreen(1)

    tLUpYtJ52PVpfYzGnpipnw9yI9AY4gBStfjNuE99

     

    UJModMxQVFLaKUJZLgnBmSKLEScTJpPcQAibaXYC

     

    Predefined style classes
     

    DsnxNBaUrhA65dbTS2mlA5hj5a8IewZNHdCFWVRW

     

    class=”monitor_left”         defines the area of the left monitor.
    class=”monitor_right”        defines the area of the right monitor.

     

    LXZUV_hSvbhDfPiB_mqdf43B5r3tPL44IEDBCRRP

     

    class=”grid”         stacks all its child elements on an invisible wrapping vertical grid.
    class=”center”        positions an element centered to its parent. Can be the viewport.

     

    yvKo5BwAsouNIXnYT7mtWuggiFYWcEOaBs2GEQuO

     

    class=”window”        applies the Dual Universe background and border.

     

    Well, that's it for this time! We hope you'll enjoy the info here to surprise us ;)

     

    Cheers,

    Nomad

  2. Hi guys, 

     

    The idea of making a podcast has been circling in our heads for some time. We wanted to reach out to our community in a new and captivating way, and today you can discover the end result.

     

    We're very excited to bring you some behind the scenes material and invite you to join us while we discuss what's new in DU. If the community's response is positive, we may make a series out of it.

     

    You can listen to this first episode below on YouTube:

     

     

    It's also available on SoundCloud:

     

     

    Happy listening! We'd love to hear your feedback!

     

    Cheers,

    Nomad

  3. Hi guys, 

     

    On March, 6th, we organized a special stress-test with thousands of simulated players. Our objective was to showcase our unique server technology and test it under live conditions! Dozens of human Alpha players were invited and participated as well, as witnesses of the event. You can discover the details on the news here

     

    Don't hesitate to comment below!

     

    Cheers,

    The Novaquark Team

×
×
  • Create New...