mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-15 00:07:39 -04:00
useStaticObject(core,actor) usable in obj scripts
This commit is contained in:
@@ -461,6 +461,26 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
});
|
||||
|
||||
objControllerOpcodes.put(ObjControllerOpcodes.USE_STATIC_OBJECT, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer buffer) throws Exception {
|
||||
CreatureObject creature = (CreatureObject) getObject(buffer.getLong());
|
||||
if (creature == null || creature.getClient() == null) return;
|
||||
buffer.skip(4);
|
||||
SWGObject object = getObject(buffer.getLong());
|
||||
if (object == null) return;
|
||||
String filePath = "scripts/" + object.getTemplate().split(".")[0] + ".py";
|
||||
if (!FileUtilities.doesFileExist(filePath)) {
|
||||
PyObject method = core.scriptService.getMethod(filePath.substring(0, filePath.lastIndexOf("/")), filePath.substring(filePath.lastIndexOf("/") + 1).split(".")[0], "useStaticObject");
|
||||
if (method != null && method.isCallable()) {
|
||||
method.__call__(Py.java2py(core), Py.java2py(creature));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
|
||||
Reference in New Issue
Block a user