Jump to content

Helediron

Alpha Tester
  • Posts

    341
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Helediron reacted to NQ-Nomad in Alpha 2 Lua changes and novelties   
    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

     
    Hovercraft Seat

     
    Programing Board

     
    Hovercraft Seat and Programming Board widgets do stack:

     
     
    Adding/removing element widgets in Lua
     
    API:
    slot.show() slot.hide()  
    Default Cockpit LUA Script

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

     
     
    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
     

     
     
    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)
     

     
    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)
     

     
    Predefined style classes
     

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

     
    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.
     

     
    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. Like
    Helediron got a reaction from IceNine in Devblog - r0.15 Update (Part 2): Inventory Revamp!   
    That was my writing but foremost about volume: 64m3 to 4000 liters gave that exact 16:1 number.
     
    Mass reduction is not directly mentioned. They said they reduce volume and weight. Also they mention that mass carries over in crafting and in future we can transport ore in atmosphere.
     
    I checked few elements like small space engine. It weights one ton and uses about 20 tons of ore. I only looked few other examples and they all pointed to similar 1:10 or 1:20 reduction in ore mass from ore to element in r0.14. Assuming element weights don't change and they use same amount of ore in r0.15 too, this pointo to at least 1:10 reduction in ore weight.
     
    My larger freighter can lift away from planet without AG about 200 tons from Alioth, 400t from other atmo planets and 1000 tons from airless. Asuming 1:10 weight reduction in r0.15 that 200 tons would estimate to  one or two deposits refined to pure, depending on density.
     
    Hover freighters were already easy and effective, so they are not a reason to change ore weights.
     
×
×
  • Create New...