mirror of
https://github.com/Anime-Game-Servers/AnimeGamesLua.git
synced 2024-11-23 04:19:41 +00:00
[ScriptLib] Added some handler methods
* PrintGroupWarning * CreateGadgetByConfigIdByPos * CreateGadgetByParamTable * CreateVehicle
This commit is contained in:
parent
6a219ea971
commit
a3f63ecd94
@ -43,6 +43,9 @@ public class ScriptLib {
|
||||
/**
|
||||
* GroupEventLuaContext functions
|
||||
*/
|
||||
public static void PrintGroupWarning(GroupEventLuaContext context, String msg) {
|
||||
context.getScriptLibHandler().PrintGroupWarning(context, msg);
|
||||
}
|
||||
|
||||
public static int SetGadgetStateByConfigId(GroupEventLuaContext context, int configId, int gadgetState) {
|
||||
return context.getScriptLibHandler().SetGadgetStateByConfigId(context, configId, gadgetState);
|
||||
@ -266,6 +269,34 @@ public class ScriptLib {
|
||||
return context.getScriptLibHandler().CreateGadget(context, table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn a gadget from the caller group at the specified position
|
||||
* @param configId The config id of the gadget in the calling group
|
||||
* @param posTable The position to spawn the gadget at
|
||||
* @param rotTable The rotation of the gadget when spawned
|
||||
*/
|
||||
public static int CreateGadgetByConfigIdByPos(GroupEventLuaContext context, int configId, Object posTable, Object rotTable){
|
||||
val luaPos = context.getEngine().getTable(posTable);
|
||||
val luaRot = context.getEngine().getTable(rotTable);
|
||||
return context.getScriptLibHandler().CreateGadgetByConfigIdByPos(context, configId, luaToPos(luaPos), luaToPos(luaRot));
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO parse the table before passing it to the handler
|
||||
* Spawns a gadget based on the caller groups gadget with cfg id matching the specified id. It also applies additional parameters based on the parameters
|
||||
* @param creationParamsTable parameters to spawn a gadget with
|
||||
*/
|
||||
public static int CreateGadgetByParamTable(GroupEventLuaContext context, Object creationParamsTable){
|
||||
val table = context.getEngine().getTable(creationParamsTable);
|
||||
return context.getScriptLibHandler().CreateGadget(context, table);
|
||||
}
|
||||
|
||||
public static int CreateVehicle(GroupEventLuaContext context, int uid, int gadgetId, Object posTable, Object rotTable){
|
||||
val luaPos = context.getEngine().getTable(posTable);
|
||||
val luaRot = context.getEngine().getTable(rotTable);
|
||||
return context.getScriptLibHandler().CreateVehicle(context, uid, gadgetId, luaToPos(luaPos), luaToPos(luaRot));
|
||||
}
|
||||
|
||||
public static int CheckRemainGadgetCountByGroupId(GroupEventLuaContext context, Object rawTable) {
|
||||
val table = context.getEngine().getTable(rawTable);
|
||||
return context.getScriptLibHandler().CheckRemainGadgetCountByGroupId(context, table);
|
||||
|
@ -24,6 +24,7 @@ public interface ScriptLibHandler<GroupEventContext extends GroupEventLuaContext
|
||||
* GroupEventContext functions
|
||||
*/
|
||||
|
||||
void PrintGroupWarning(LuaContext context, String msg);
|
||||
int SetGadgetStateByConfigId(GroupEventContext context, int configId, int gadgetState);
|
||||
int SetGroupGadgetStateByConfigId(GroupEventContext context, int groupId, int configId, int gadgetState);
|
||||
int SetWorktopOptionsByGroupId(GroupEventContext context, int groupId, int configId, LuaTable options);
|
||||
@ -111,6 +112,31 @@ public interface ScriptLibHandler<GroupEventContext extends GroupEventLuaContext
|
||||
|
||||
int CreateGadget(GroupEventContext context, LuaTable table);
|
||||
|
||||
/**
|
||||
* Spawn a gadget from the caller group at the specified position
|
||||
* @param configId The config id of the gadget in the calling group
|
||||
* @param pos The position to spawn the gadget at
|
||||
* @param rot The rotation of the gadget when spawned
|
||||
*/
|
||||
int CreateGadgetByConfigIdByPos(GroupEventContext context, int configId, Position pos, Position rot);
|
||||
|
||||
|
||||
/**
|
||||
* TODO preparsed parameters
|
||||
* Spawns a gadget based on the caller groups gadget with cfg id matching the specified id. It also applies additional parameters based on the parameters
|
||||
* @param creationParams parameters to spawn a gadget with
|
||||
*/
|
||||
int CreateGadgetByParamTable(GroupEventContext context, LuaTable creationParams);
|
||||
|
||||
/**
|
||||
* Spawn a vehicle gadget with the given parameters
|
||||
* @param uid The uid that will become the owner of the vehicle
|
||||
* @param gadgetId The gadgetId of the vehicle gadget to spawn
|
||||
* @param position The position to spawn the vehicle at
|
||||
* @param rot The rotation to spawn the vehicle with
|
||||
*/
|
||||
int CreateVehicle(GroupEventContext context, int uid, int gadgetId, Position position, Position rot);
|
||||
|
||||
int CheckRemainGadgetCountByGroupId(GroupEventContext context, LuaTable table);
|
||||
|
||||
int GetGadgetStateByConfigId(GroupEventContext context, int groupId, int configId);
|
||||
|
Loading…
Reference in New Issue
Block a user