1. Stormworks: Build and Rescue
  2. News
  3. v1.0.21 - The LUA Functions Update!

v1.0.21 - The LUA Functions Update!



Dear Stormworkers,

This week we are releasing a series of new and updated LUA functions that we have been developing in collaboration with players on the experimental branch!

With high demand, we have added many new functions for getting info about the world, as well as spawning and removing various objects. Many of these new functions have huge implications for what can be done with the scripting API, and many of these functions serve as a keystone for your projects.

We have been releasing these changes to the experimental branch as we have developed them. Now, with the benefit of player feedback, we are releasing them as a pack of functions in a minor update.

See the technical data below for a full list of changes to the API. This information is also reflected in the in-game API reference.



Meanwhile, we continue to work hard on the new modular engines and look forward to sharing the new features discussed last week. These new features will be released on experimental branch as we develop them, to give all players the chance to provide feedback.

We also have many new minor updates on the way, many of which use these new LUA functions!

We look forward to seeing what players build with the new API functions, as well as seeing other players complete their projects now the functions they requested are available.



As always, we look forward to your thoughts and feedback!

Much love
The Stormworks Developers

v1.0.21

Full API Changes
=================

object_id, is_success = server.spawnFire(matrix, size, magnitude, is_lit, is_initialized, is_explosive, parent_vehicle_id, explosion_magnitude)

server.addMapObject(peer_id, ui_id, POSITION_TYPE, MARKER_TYPE, x, y, z, parent_local_x, parent_local_y, parent_local_z, vehicle_id, object_id, label, vehicle_parent_id, radius, hover_label)

server.addMapLabel(peer_id, ui_id, LABEL_TYPE, name, x, y, z))

PLAYER_LIST = server.getPlayers()
PLAYER_LIST |
{ [peer_index] = { ["id"] = peer_id, ["name"] = name, ["admin"] = is_admin, ["auth"] = is_auth, ["steam_id"] = steam_id }}

is_on = server.getVehicleButton(vehicle_id, button_name)

server.setVehicleSeat(vehicle_id, seat_name, axis_w, axis_d, axis_up, axis_right, button1, button2, button3, button4, button5, button6)

server.teleportPlayer(peer_id, matrix) is_success = server.setPlayerPos(peer_id, matrix)

server.teleportVehicle(matrix, vehicle_id) is_success = server.setVehiclePos(vehicle_id, matrix)

is_success = server.setObjectPos(object_id)

EQUIPMENT_ID, is_success= server.getCharacterItem(object_id, SLOT_NUMBER)

name, is_success = server.getPlayerName(peer_id)
matrix, is_success = server.getPlayerPos(peer_id)
x, y, z , is_success = server.getPlayerLookDirection(peer_id)
object_id, is_success = server.spawnObject(matrix, OBJECT_TYPE)
object_id , is_success = server.spawnCharacter(matrix, (OUTFIT_TYPE))
object_id, is_success = server.spawnAnimal(matrix, ANIMAL_TYPE, size_multiplier)
matrix, is_success = server.getObjectPos(object_id)
vehicle_id, is_success = server.spawnVehicle(matrix, playlist_index, component_id)
vehicle_id, is_success = server.spawnVehicleSavefile(matrix, save_name)
matrix, is_success = server.getVehiclePos(vehicle_id, voxel_x = 0, voxel_y = 0, voxel_z = 0)
name, is_success = server.getVehicleName(vehicle_id)
matrix, is_success= server.spawnMissionLocation(matrix, playlist_index, location_index)
is_success = server.spawnThisPlaylistMissionLocation(name)
matrix, is_success = server.getOceanTransform(matrix, min_search_range, max_search_range)

server.createPopup(peer_id, ui_id)
server.setPopup(peer_id, ui_id, name, is_show, text, x, y, z, is_worldspace, render_distance)
server.setPopupScreen(peer_id, ui_id, name, is_show, text, horizontal_offset, vertical_offset)

object_id, is_success = server.getPlayerCharacterID(peer_id)

The following functions were reworked to be more general for player and non-player characters, this functions gives you a player's object_id

server.killPlayer(peer_id) server.killCharacter(object_id)

server.reviveCharacter(object_id)

server.setSeated(peer_id, vehicle_id, seat_name) server.setCharacterSeated(object_id, vehicle_id, seat_name)

Can now set non-player characters to be seated

server.despawnCharacter(object_id, is_instant)
server.despawnMissionObject(object_id, is_instant)