Retry hello until RPG_TopDown; Message cmd

This commit is contained in:
RallyBlock committed 2026-11-09 15:18:00 -05:00
1 parent 1d14820bf9
commit a806541204
1 file changed
+20 -2
+20 -2
View File
@@ -8,6 +8,7 @@ $RPGClient::Yaw = 0;
$RPGClient::Dist = 14; $RPGClient::Dist = 14;
$RPGClient::HelloPending = 0; $RPGClient::HelloPending = 0;
$RPGClient::HelloLast = ""; $RPGClient::HelloLast = "";
$RPGClient::TopDownWatchSched = 0;
function RPGClient_NormPos(%ctrl, %pos) function RPGClient_NormPos(%ctrl, %pos)
{ {
@@ -227,7 +228,7 @@ function RPGClient_SendHello()
$RPGClient::HelloLast = %now; $RPGClient::HelloLast = %now;
commandToServer('RPG_Hello', $RPGClient::Version); commandToServer('RPG_Hello', $RPGClient::Version);
commandToServer('RPGHello', $RPGClient::Version); commandToServer('RPGHello', $RPGClient::Version);
commandToServer('message', "/rpg clienthello " @ $RPGClient::Version); commandToServer('Message', "/rpg clienthello " @ $RPGClient::Version);
} }
function clientCmdRPG_Probe() function clientCmdRPG_Probe()
@@ -239,8 +240,8 @@ function clientCmdRPG_Welcome(%serverProto, %accepted)
{ {
if (%accepted && %serverProto == $RPGClient::Version) if (%accepted && %serverProto == $RPGClient::Version)
{ {
$RPGClient::Server = 1;
$RPGClient::HelloPending = 0; $RPGClient::HelloPending = 0;
schedule(2500, 0, RPGClient_TopDownWatch);
} }
else if (!%accepted) else if (!%accepted)
{ {
@@ -249,10 +250,25 @@ function clientCmdRPG_Welcome(%serverProto, %accepted)
} }
} }
function RPGClient_TopDownWatch()
{
$RPGClient::TopDownWatchSched = 0;
if ($RPGClient::Active || $RPGClient::Server || !RPGClient_CanSendCmd())
{
return;
}
$RPGClient::HelloLast = "";
RPGClient_SendHello();
$RPGClient::TopDownWatchSched = schedule(2500, 0, RPGClient_TopDownWatch);
}
function clientCmdRPG_TopDown(%on, %yaw, %dist) function clientCmdRPG_TopDown(%on, %yaw, %dist)
{ {
if (%on) if (%on)
{ {
cancel($RPGClient::TopDownWatchSched);
$RPGClient::TopDownWatchSched = 0;
$RPGClient::Server = 1;
$RPGClient::Active = 1; $RPGClient::Active = 1;
$RPGClient::Yaw = %yaw; $RPGClient::Yaw = %yaw;
$RPGClient::Dist = %dist > 0 ? %dist : 14; $RPGClient::Dist = %dist > 0 ? %dist : 14;
@@ -391,6 +407,8 @@ package RPGClient_Cleanup
$RPGClient::Server = 0; $RPGClient::Server = 0;
$RPGClient::HelloPending = 0; $RPGClient::HelloPending = 0;
$RPGClient::HelloLast = ""; $RPGClient::HelloLast = "";
cancel($RPGClient::TopDownWatchSched);
$RPGClient::TopDownWatchSched = 0;
Parent::disconnectedCleanup(%doReconnect); Parent::disconnectedCleanup(%doReconnect);
} }
}; };