Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Lua API Update [devtest v2.2.27.2]

#1
The latest devtest version includes a number of additions to the Lua API. Existing scripts should all still work. If not, please let me know. If you find any bugs, if things are unclear or if you have any suggestions for further additions, please let me know. 


The following is a quick summary of the changes (see the attachment for better formatting). More detailed information can be found in the 'Help' section of the Lua box.

Components:
  Block stores can now have any number of bool, int and float logics
  Added functions to set one, two or three bool, int or float logics in one call.
  BlockInfo:
    Valid
    Position
    LocalPosition
    LocalPositionRelativeToCoM
    Forwards
    LocalForwards
    Rotation
    LocalRotation
    SubConstructIdentifier  -new
    CustomName  -new
  Logic:
0  balloon;
     bool0  get/set deployed
1  drive maintainer:
     int0   get/set channel (0, 1, 2)  -new
     float0 get/set drive
2  air pump
     bool0  get/set on/off
     float0 get/set force fraction  -new
     float1 get     flooded fraction  -new
3  resource gatherer
     bool   get/set on/off
4  oil drill
     bool0  get/set on/off
5  ammo processor
     bool0  get/set on/off
6  fuel refinery -new
     bool0  get/set on/off  -new
     float0 get     dangerous gas level  -new
     float1 get     refining efficiency  -new
     float2 get     time per batch  -new
7  docking station (tractor beam)
     bool0  get/set on/off
     int0   get     unique ID of selected construct. -1 otherwise  -new
            set     select construct by unique ID  -new
     float0 get/set hold distance  -new
     float1 get/set hold azimuth  -new
     float2 get/set hold elevation  -new
8  hydrofoil
     float0 get/set angle
9  propulsion
     float0 get/set drive fracton
     float1 get     propulsion requests so far  -new
            set     add propulsion request  -new
     float2 get     total propulsion request last frame  -new
     float3 get     max force  -new
10 shield projector
     bool0  get     shield is functioning  -new
     int0   get/set shield type
     float0 get/set strength
     float1 get/set azimuth  -new
     float2 get/set elevation  -new
     float3 get/set range  -new
     float4 get/set width  -new
     float5 get/set height  -new
     float6 get/set alpha  -new
     float7 get/set red  -new
     float8 get/set green  -new
     float9 get/set blue  -new
11 helium pump
     bool0  get/set on/off
     float0 get/set force fraction  -new
     float1 get     flooded fraction  -new
12 spotlight  -new
     float0 get/set cone angle  -new
     float1 get/set azimuth angle  -new
     float2 get/set elevation angle  -new
     float3 get/set intensity  -new
     float4 get/set range  -new
     float5 get/set red  -new
     float6 get/set green  -new
     float7 get/set blue  -new
13 adv laser targetter  -new
     int0   get     attached weapon index. -1 otherwise  -new
     float0 get/set timed fuse time  -new
     float1 get     altitude fuse low altitude  -new
            set     altitude fuse  -new
     float2 get     altitude fuse high altitude  -new
14 cram laser targetter  -new
     int0   get     attached weapon index. -1 otherwise  -new
     float0 get/set timed fuse time  -new
     float1 get     altitude fuse low altitude  -new
     flaot1 set     altitude fuse  -new
     float2 get     altitude fuse high altitude  -new
15 warp drives  -new
     bool0  get     is charging  -new
     int0   set     0: start charging; 1: warp  -new
     float0 get     right jump distance  -new
     float1 get     up jump distance  -new
     float2 get     forwards jump distance  -new
     float3 get     right jump factor  -new
     float4 get     up jump factor  -new
     float5 get     forwards jump factor  -new
     float6 get     charger length  -new
     float7 get     charge duration  -new
16 particle cannon lense  -new
     int0   get     weapon index of firing piece. -1 otherwise  -new
17 steam boiler controller  -new
     float0 get/set burn rate  -new
     float1 get     boiler volume  -new
     float2 get     pressure  -new
18 fuel engine  -new
     float0 get/set max rpm  -new
     float1 get/set battery charge drive  -new
     float2 get     current rpm  -new
     float3 get     max power estimate  -new
     float4 get     fuel used  -new
    
19 sail block -new
     int0   get     sail type  -new
     float0 get     mast winch setting  -new
            set     winch mast towards  -new
     float1 get     boom winch setting  -new
            set     winch boom towards  -new
     float2 get     mast height  -new
     float3 get     boom length  -new
20 adv cannon ammo intake  -new
     int0   get/set unique id of ammo controller  -new
     int1   get/set component index of ammo controller  -new
     int2   get     weapon index of firing piece  -new
21 ammo controller  -new
     int0   get     unique id  -new
   
22 AI wireless receiver  -new
     int0   get/set channel  -new
   
23 AI wireless transmitter  -new
     int0   get/set channel  -new
24 AI aimpoint card  -new
     int0   get/set aimpoint selection type  -new
     float0 get/set max retarget time  -new
  
25 detection component  -new
     bool0  get/set on/off  -new
  
26 AI mainframe  -new
     int0   get/set ai mode  -new
27 laser combiner  -new
     float0 get/set red  -new
     float1 get/set green  -new
     float2 get/set blue  -new
28 laser missile defence  -new
     float0 get/set red  -new
     float1 get/set green  -new
     float2 get/set blue  -new
29 particle cannon  -new
     float0 get/set red  -new
     float1 get/set green  -new
     float2 get/set blue  -new
30 light fitting  -new
     float0 get/set intensity  -new
     float1 get/set range  -new
     float2 get/set red  -new
     float3 get/set green  -new
     float4 get/set blue  -new
31 simple laser  -new
     float0 get/set red  -new
     float1 get/set green  -new
     float2 get/set blue  -new
32 smoke generator  -new
     float0 get/set particle speed  -new
     float1 get/set particle size  -new
     float2 get/set red  -new
     float3 get/set green  -new
     float4 get/set blue  -new
33 hologram projector  -new
     bool0  get/set on/off  -new
     bool1  get/set mirrored  -new
     float0 get/set width  -new
     float1 get/set height  -new
     float2 get/set distance  -new
     float3 get/set right translation  -new
     float4 get/set up translation  -new
     float5 get/set azimuth  -new
     float6 get/set elevation  -new
     float7 get/set rotation  -new
34 poster holder  -new
     float0 get/set width  -new
     float1 get/set height  -new
35 electric engine  -new
     float0 get/set power  -new

---- everything after this is new ----

Weapons:
  GlobalFirePoint added to weapon info
  LocalFirePoint added to weapon info
    position where projectile/beam is spawned when the weapon fires
  GetWeaponBlockInfo(WeaponIndex)
    get the BlockInfo object of the weapon
  GetWeaponBlockInfoOnSubConstruct(SubConstructIdentifier, WeaponIndex)
    get the BlockInfo object of the weapon on the given subconstruct
  GetWeaponConstraints(WeaponIndex)
    get the WeaponConstraints information of the weapon
  GetWeaponConstraintsOnSubConstruct(SubConstructIdentifier, WeaponIndex)
    get the WeaponConstraints information of the weapon on the given subconstruct
 
  WeaponConstraints:
    bool Valid
    float MinAzimuth
    flaot MaxAzimuth
    float MinElevation
    float MaxElevation
    bool FlipAzimuth
    bool InParentConstructSpace
SubConstructs:
  GetSubconstructIdleRotation
    get the rotation of the subconstruct relative to its parent as it was when first placed
Self awareness:
  GetEnergyFraction
    get the fraction of the energy left in batteries
  GetBlueprintName
    get the blueprint name of this construct
  GetUniqueId
    get the unique id of this construct
Misc:
  GetWindDirectionAndMagnitude
    get wind direction and magnitude
Friendlies:
  EnergyFraction added to friendly info
Fleets:
  fixed bug in Fleet:GetMemberIndex
Components:
  SetHologramProjectorURL(index, url)
    set the url of hologram projector specified by the index
  SetPosterHolderURL(index, url)
    set the url of poster holder specified by the index


Attached Files
.txt   Lua_changes_1.txt (Size: 7.92 KB / Downloads: 21)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)