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()
|
function RPGClient_ApplyCamera()
|
||||||
{
|
{
|
||||||
if (!isObject(localClientConnection) || !isObject(localClientConnection.player))
|
%conn = RPGClient_GetConn();
|
||||||
|
if (!isObject(%conn))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
%body = localClientConnection.player;
|
%body = %conn.Player;
|
||||||
%cam = localClientConnection.getControlObject();
|
if (!isObject(%body))
|
||||||
|
{
|
||||||
|
%body = %conn.player;
|
||||||
|
}
|
||||||
|
if (!isObject(%body))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
%cam = %conn.getControlObject();
|
||||||
if (!isObject(%cam) || %cam.getClassName() !$= "Camera")
|
if (!isObject(%cam) || %cam.getClassName() !$= "Camera")
|
||||||
{
|
{
|
||||||
%cam = localClientConnection.camera;
|
%cam = %conn.Camera;
|
||||||
|
if (!isObject(%cam))
|
||||||
|
{
|
||||||
|
%cam = %conn.camera;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isObject(%cam))
|
if (!isObject(%cam))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localClientConnection.setControlObject(%cam);
|
%conn.setControlObject(%cam);
|
||||||
%rot = "0 0" SPC mSin($RPGClient::Yaw / 2) SPC mCos($RPGClient::Yaw / 2);
|
%rot = "0 0" SPC mSin($RPGClient::Yaw / 2) SPC mCos($RPGClient::Yaw / 2);
|
||||||
%cam.setOrbitMode(%body, %body.getTransform(), 4, 32, $RPGClient::Dist);
|
%cam.setOrbitMode(%body, %body.getTransform(), 4, 32, $RPGClient::Dist);
|
||||||
%cam.thirdPersonOnly = 1;
|
%cam.thirdPersonOnly = 1;
|
||||||
@@ -210,6 +223,19 @@ function RPGClient_CanSendCmd()
|
|||||||
return isObject(ServerConnection) || isObject(localClientConnection);
|
return isObject(ServerConnection) || isObject(localClientConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function RPGClient_GetConn()
|
||||||
|
{
|
||||||
|
if (isObject(ServerConnection))
|
||||||
|
{
|
||||||
|
return ServerConnection;
|
||||||
|
}
|
||||||
|
if (isObject(localClientConnection))
|
||||||
|
{
|
||||||
|
return localClientConnection;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
function RPGClient_SendHello()
|
function RPGClient_SendHello()
|
||||||
{
|
{
|
||||||
if ($RPGClient::Server)
|
if ($RPGClient::Server)
|
||||||
|
|||||||
Reference in new issue
Block a user