WASD: force cam sync; host local fly mirror
This commit is contained in:
1 parent
c9c595e449
commit
836fb2ac3a
1 file changed
+46
-4
@@ -166,7 +166,7 @@ function RPGClient_EyeRay(%nx, %ny)
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
%p = %body.getHackPosition();
|
%p = %body.getPosition();
|
||||||
%cx = getWord(%p, 0);
|
%cx = getWord(%p, 0);
|
||||||
%cy = getWord(%p, 1);
|
%cy = getWord(%p, 1);
|
||||||
%cz = getWord(%p, 2) + 1.0;
|
%cz = getWord(%p, 2) + 1.0;
|
||||||
@@ -361,9 +361,24 @@ function RPGClient_RaiseMouseOverlay()
|
|||||||
PlayGui.pushToFront(RPGClient_Mouse);
|
PlayGui.pushToFront(RPGClient_Mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function RPGClient_LocalCamMirror()
|
||||||
|
{
|
||||||
|
if (!isObject(ServerConnection))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
%addr = ServerConnection.getAddress();
|
||||||
|
if (%addr $= "" || %addr $= "local")
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
%host = getWord(%addr, 0);
|
||||||
|
return %host $= "127.0.0.1" || %host $= "0.0.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
function RPGClient_NetCam()
|
function RPGClient_NetCam()
|
||||||
{
|
{
|
||||||
return $RPGClient::Active && isObject(ServerConnection);
|
return $RPGClient::Active && isObject(ServerConnection) && !RPGClient_LocalCamMirror();
|
||||||
}
|
}
|
||||||
|
|
||||||
function RPGClient_CameraTick()
|
function RPGClient_CameraTick()
|
||||||
@@ -400,7 +415,7 @@ function RPGClient_CameraTick()
|
|||||||
}
|
}
|
||||||
if (%changed || $RPGClient::MvF || $RPGClient::MvB || $RPGClient::MvL || $RPGClient::MvR)
|
if (%changed || $RPGClient::MvF || $RPGClient::MvB || $RPGClient::MvL || $RPGClient::MvR)
|
||||||
{
|
{
|
||||||
RPGClient_ApplyCamera(0);
|
RPGClient_ApplyCamera(1);
|
||||||
}
|
}
|
||||||
$RPGClient::CamTickSched = schedule(50, 0, RPGClient_CameraTick);
|
$RPGClient::CamTickSched = schedule(50, 0, RPGClient_CameraTick);
|
||||||
}
|
}
|
||||||
@@ -709,6 +724,33 @@ function RPGClient_ApplyCamera(%forceSync)
|
|||||||
$RPGClient::PanX = 0;
|
$RPGClient::PanX = 0;
|
||||||
$RPGClient::PanY = 0;
|
$RPGClient::PanY = 0;
|
||||||
commandToServer('RPG_CamSync', $RPGClient::Yaw, $RPGClient::Dist, 0, 0, $RPGClient::Pitch);
|
commandToServer('RPG_CamSync', $RPGClient::Yaw, $RPGClient::Dist, 0, 0, $RPGClient::Pitch);
|
||||||
|
if (RPGClient_NetCam())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
%conn = ServerConnection;
|
||||||
|
%body = RPGClient_BodyForCamera(%conn);
|
||||||
|
if (!isObject(%body))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
%cam = %conn.Camera;
|
||||||
|
if (!isObject(%cam))
|
||||||
|
{
|
||||||
|
%cam = %conn.camera;
|
||||||
|
}
|
||||||
|
if (!isObject(%cam))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
%conn.setControlObject(%cam);
|
||||||
|
$mvFreeLook = 0;
|
||||||
|
$firstPerson = 0;
|
||||||
|
%xfm = RPGClient_ViewTransform(%body, $RPGClient::Yaw, $RPGClient::Dist, 0, 0);
|
||||||
|
%cam.unmountImage(0);
|
||||||
|
%cam.setMode("Fly", 0);
|
||||||
|
%cam.setTransform(%xfm);
|
||||||
|
%cam.mode = "Fly";
|
||||||
}
|
}
|
||||||
|
|
||||||
function RPGClient_ScheduleCamera()
|
function RPGClient_ScheduleCamera()
|
||||||
@@ -1214,7 +1256,7 @@ package RPGClient_Input
|
|||||||
{
|
{
|
||||||
%sens = $pref::Input::MouseSensitivity;
|
%sens = $pref::Input::MouseSensitivity;
|
||||||
$RPGClient::Yaw = $RPGClient::Yaw + %val * %sens * 0.004;
|
$RPGClient::Yaw = $RPGClient::Yaw + %val * %sens * 0.004;
|
||||||
RPGClient_ApplyCamera(0);
|
RPGClient_ApplyCamera(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Parent::yaw(%val);
|
Parent::yaw(%val);
|
||||||
|
|||||||
Reference in new issue
Block a user