Camera bind via ServerConnection Player
This commit is contained in:
1 parent
a806541204
commit
87e735f892
1 file changed
+31
-5
@@ -144,21 +144,34 @@ function RPGClient_DisableOverlay()
|
||||
|
||||
function RPGClient_ApplyCamera()
|
||||
{
|
||||
if (!isObject(localClientConnection) || !isObject(localClientConnection.player))
|
||||
%conn = RPGClient_GetConn();
|
||||
if (!isObject(%conn))
|
||||
{
|
||||
return;
|
||||
}
|
||||
%body = localClientConnection.player;
|
||||
%cam = localClientConnection.getControlObject();
|
||||
%body = %conn.Player;
|
||||
if (!isObject(%body))
|
||||
{
|
||||
%body = %conn.player;
|
||||
}
|
||||
if (!isObject(%body))
|
||||
{
|
||||
return;
|
||||
}
|
||||
%cam = %conn.getControlObject();
|
||||
if (!isObject(%cam) || %cam.getClassName() !$= "Camera")
|
||||
{
|
||||
%cam = localClientConnection.camera;
|
||||
%cam = %conn.Camera;
|
||||
if (!isObject(%cam))
|
||||
{
|
||||
%cam = %conn.camera;
|
||||
}
|
||||
}
|
||||
if (!isObject(%cam))
|
||||
{
|
||||
return;
|
||||
}
|
||||
localClientConnection.setControlObject(%cam);
|
||||
%conn.setControlObject(%cam);
|
||||
%rot = "0 0" SPC mSin($RPGClient::Yaw / 2) SPC mCos($RPGClient::Yaw / 2);
|
||||
%cam.setOrbitMode(%body, %body.getTransform(), 4, 32, $RPGClient::Dist);
|
||||
%cam.thirdPersonOnly = 1;
|
||||
@@ -210,6 +223,19 @@ function RPGClient_CanSendCmd()
|
||||
return isObject(ServerConnection) || isObject(localClientConnection);
|
||||
}
|
||||
|
||||
function RPGClient_GetConn()
|
||||
{
|
||||
if (isObject(ServerConnection))
|
||||
{
|
||||
return ServerConnection;
|
||||
}
|
||||
if (isObject(localClientConnection))
|
||||
{
|
||||
return localClientConnection;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function RPGClient_SendHello()
|
||||
{
|
||||
if ($RPGClient::Server)
|
||||
|
||||
Reference in new issue
Block a user