mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
roverquesting
This commit is contained in:
@@ -135,11 +135,21 @@ function getPrivateSafety(record) {
|
||||
}
|
||||
|
||||
function shouldApplyPrivateSafety(record, socket) {
|
||||
if (!isPrivateRecord(record) || !isPrivateOpen(record)) return false;
|
||||
if (!isPrivateRecord(record)) return false;
|
||||
if (isLockdownAdmin(socket)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function shouldApplyPrivateSensorSafety(record) {
|
||||
if (!isPrivateRecord(record)) return false;
|
||||
const activeDrivers = turnService.getActiveDrivers();
|
||||
const activeDriverId = activeDrivers?.[record.id];
|
||||
if (!activeDriverId) return false;
|
||||
const activeSocket = io.sockets.sockets.get(activeDriverId);
|
||||
if (!activeSocket) return true;
|
||||
return !isLockdownAdmin(activeSocket);
|
||||
}
|
||||
|
||||
function isRoverVisibleToSocket(record, socket) {
|
||||
if (!record) return false;
|
||||
if (!isPrivateRecord(record)) return true;
|
||||
@@ -639,7 +649,7 @@ function evaluatePrivateSafety(record, sensors) {
|
||||
const currentBump = bump;
|
||||
const currentCliff = cliff;
|
||||
|
||||
if (!isPrivateRecord(record) || !isPrivateOpen(record)) {
|
||||
if (!shouldApplyPrivateSensorSafety(record)) {
|
||||
state.blockedUntil = 0;
|
||||
state.lastOvercurrent = currentOver;
|
||||
state.lastBump = currentBump;
|
||||
|
||||
Reference in New Issue
Block a user