feat: Support for G2O v0.3.3

This commit is contained in:
AURUMVORXX
2025-08-14 21:04:40 +05:00
parent 35350efcd1
commit 2ee00d1842
7 changed files with 40 additions and 6 deletions

View File

@@ -595,3 +595,15 @@ addEventHandler("onPlayerUnspawnForPlayer", function(playerid, spawnid)
if (_globalInstance != -1)
_globalInstance._send("event", data);
});
addEventHandler("onPlayerChangeChunk", function(playerid, chunk_index)
{
local data = {
event = "onPlayerChangeChunk",
playerid = playerid,
chunk_index = chunk_index
}
if (_globalInstance != -1)
_globalInstance._send("event", data);
});

View File

@@ -90,6 +90,8 @@ class PyG2O
return "ItemGround";
else if (object instanceof Vec3)
return "Vec3";
else if (object instanceof Vec2i)
return "Vec2i";
return null;
}

View File

@@ -11,6 +11,12 @@ function _message_call(data)
data["data"]["y"] <- result.y;
data["data"]["z"] <- result.z;
}
else if (className == "Vec2i")
{
data["data"] = {};
data["data"]["x"] <- result.x;
data["data"]["y"] <- result.y;
}
else if (className != null)
{
data["data"] = {};

View File

@@ -1,6 +1,6 @@
[project]
name = "PyG2O"
version = "2.3.2"
version = "2.3.3"
description = ""
readme = "README.md"
requires-python = ">=3.13"

View File

@@ -29,6 +29,13 @@ async def getHostname() -> str:
result = await server.make_request(data)
return result
async def getOnlinePlayers():
data = f'return {get_call_repr()}'
server = await PythonWebsocketServer.get_server()
result = await server.make_request(data)
return result
async def getMaxSlots() -> int:
"""
This function will get the max number of slots available on the server.

View File

@@ -272,6 +272,13 @@ async def getPlayerCameraPosition(id : int) -> Optional[tuple]:
result = await server.make_request(data)
return (result['x'], result['y'], result['z']) if result is not None else (None, None, None)
async def getPlayerChunk(id: int):
data = f'return {get_call_repr()}'
server = await PythonWebsocketServer.get_server()
result = await server.make_request(data)
return (result['x'], result['y']) if result is not None else (None, None)
async def getPlayerCollision(id : int) -> bool:
"""
This function will get the player collision.

View File

@@ -2,7 +2,7 @@ from ..server import PythonWebsocketServer
from ..call_repr import get_call_repr
from typing import Optional
async def getNearestWaypoint(world : str, x : int, y : int, z : int) -> Optional[tuple]:
async def getNearestWaypoint(world : str, x : int, y : int, z : int, distance: int = -1) -> Optional[tuple]:
"""
This function is used to retrieve the information about nearest waypoint from the specified position.
Original: [getNearestWaypoint](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/waypoint/getNearestWaypoint/)