also
ok, so i changed how teleport() works
@LuaFunction
fun teleport(args: IArguments) {
val input = args.getTable(0)
var pos = this.ship.transform.positionInWorld
if (input.containsKey("pos")) {
val posTable = input["pos"]
if (posTable is Map<*, *> && isTableVector(posTable))
pos = Vector3d(posTable["x"] as Double, posTable["y"] as Double, posTable["z"] as Double)
}
var rot = this.ship.transform.shipToWorldRotation
if (input.containsKey("rot")) {
val rotTable = input["rot"]
if (rotTable is Map<*, *> && isTableQuaternion(rotTable))
rot = Quaterniond(rotTable["x"] as Double, rotTable["y"] as Double, rotTable["z"] as Double, rotTable["w"] as Double)
}
var vel = this.ship.velocity
if (input.containsKey("vel")) {
val velTable = input["vel"]
if (velTable is Map<*, *> && isTableVector(velTable))
vel = Vector3d(velTable["x"] as Double, velTable["y"] as Double, velTable["z"] as Double)
}
var omega = this.ship.omega
if (input.containsKey("omega")) {
val omegaTable = input["omega"]
if (omegaTable is Map<*, *> && isTableVector(omegaTable))
omega = Vector3d(omegaTable["x"] as Double, omegaTable["y"] as Double, omegaTable["z"] as Double)
}
var dimension: String? = null
if (input.containsKey("dimension") && input["dimension"] is String)
dimension = input["dimension"] as String
var scale = this.ship.transform.shipToWorldScaling.x()
if (input.containsKey("scale") && input["scale"] is Double)
scale = input["scale"] as Double
val teleportData = ShipTeleportDataImpl(pos, rot, vel, omega, dimension, scale)
vsCore.teleportShip(this.level.shipObjectWorld, this.ship, teleportData)
}
so now it takes in a table which you can configure like this
{
["pos"] = { x, y, z },
["rot"] = { x, y, z, w },
["vel"] = { x, y, z },
["omega"] = { x, y, z },
["dimension"] = dimension
["scale"] = scale
}