[Fix] Scriptlib.TransPlayerToPos also has an optional sceneId parameter

This commit is contained in:
hartie95 2024-10-11 10:41:25 +02:00
parent 7edfd59aa9
commit 4a156222eb
2 changed files with 27 additions and 2 deletions

View File

@ -728,6 +728,19 @@ public class ScriptLib {
return context.getScriptLibHandler().MovePlayerToPos(context, targets, pos, rot, radius, isSkipUi); return context.getScriptLibHandler().MovePlayerToPos(context, targets, pos, rot, radius, isSkipUi);
} }
/**
* Signalises that the server should transport the players with the specified uids to the specified position
* @param context the Group Lua context
* @param transportationParamsTable the table containing the parameters for the transportation. This includes
* `uid_list` - the list of uids of the players to transport
* `pos` - table with the position to transport the players to
* `rot` - table with the rotation the players should be placed in
* `radius` - the radius around the position the players should be placed in
* `is_skip_ui` -
* `scene_id` - the scene id to transport the players to, if not specified the current scene is used
*
* @return
*/
public static int TransPlayerToPos(GroupEventLuaContext context, Object transportationParamsTable) { public static int TransPlayerToPos(GroupEventLuaContext context, Object transportationParamsTable) {
val transportationParams = context.getEngine().getTable(transportationParamsTable); val transportationParams = context.getEngine().getTable(transportationParamsTable);
val targetsTable = transportationParams.getTable("uid_list"); val targetsTable = transportationParams.getTable("uid_list");
@ -735,6 +748,7 @@ public class ScriptLib {
val luaRot = transportationParams.getTable("rot"); val luaRot = transportationParams.getTable("rot");
val radius = transportationParams.optInt("radius", -1); val radius = transportationParams.optInt("radius", -1);
val isSkipUi = transportationParams.optBoolean("is_skip_ui", false); val isSkipUi = transportationParams.optBoolean("is_skip_ui", false);
val sceneId = transportationParams.optInt("scene_id", -1);
if(targetsTable==null || targetsTable.getSize() ==0 || luaPos == null){ if(targetsTable==null || targetsTable.getSize() ==0 || luaPos == null){
@ -746,7 +760,7 @@ public class ScriptLib {
val rot = luaToPos(luaRot); val rot = luaToPos(luaRot);
val targets = targetsTable.getAsIntArray(); val targets = targetsTable.getAsIntArray();
return context.getScriptLibHandler().TransPlayerToPos(context, targets, pos, rot, radius, isSkipUi); return context.getScriptLibHandler().TransPlayerToPos(context, targets, pos, rot, radius, isSkipUi, sceneId);
} }
public static int PlayCutScene(GroupEventLuaContext context, int cutsceneId, int var2){ public static int PlayCutScene(GroupEventLuaContext context, int cutsceneId, int var2){

View File

@ -252,7 +252,18 @@ public interface ScriptLibHandler<GroupEventContext extends GroupEventLuaContext
int MovePlayerToPos(GroupEventContext context, int[] targetUIds, Vector pos, Vector rot, int radius, boolean isSkipUi); int MovePlayerToPos(GroupEventContext context, int[] targetUIds, Vector pos, Vector rot, int radius, boolean isSkipUi);
int TransPlayerToPos(GroupEventContext context, int[] targetUIds, Vector pos, Vector rot, int radius, boolean isSkipUi); /**
* This teleports the player to another position.
* @param context a group event lua context
* @param targetUIds the uids of the players to teleport
* @param pos the position to teleport to
* @param rot the rotation to teleport with
* @param radius The radius around the target to place the target players in. -1 if the players should be placed at the exact position
* @param isSkipUi
* @param sceneId if this -1, the sceneId was not set, and the teleport target is in the same Scene the target is in
* @return
*/
int TransPlayerToPos(GroupEventContext context, int[] targetUIds, Vector pos, Vector rot, int radius, boolean isSkipUi, int sceneId);
int PlayCutScene(GroupEventContext context, int cutsceneId, int var2); int PlayCutScene(GroupEventContext context, int cutsceneId, int var2);