Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Request uses `dcs.common.v0.ObjectCategory[]` and `SearchVolume` (with `InputPosition` for geo points).
- Response returns `dcs.common.v0.Target[]` for consistent object union across services.
- Lua implementation unwraps grpcui oneof wrapper (`volume.shape`) and supports both wrapped and flattened shapes.
- Added `coalition`, `player_name`, and `to_all` fields to `PlayerSendChatEvent`.

## [0.8.1] 2024-11-05

Expand Down
18 changes: 14 additions & 4 deletions lua/DCS-gRPC/grpc-hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,29 @@ end
-- None of these methods should return anything as doing so breaks other scripts attempting to
-- react to the hook as well.

function handler.onPlayerTrySendChat(playerID, msg)
function handler.onPlayerTrySendChat(playerID, msg, all)
-- note: currently `all` (third parameter) will always `=true` regardless if the target is to the coalition/team
-- or to everybody. When ED fixes this, implementation should determine the dcs.common.v0.Coalition

local playerInfo = net.get_player_info(playerID)
local coalition, playerName
if playerInfo ~= nil then
coalition = net.get_player_info(playerID, "side")
playerName = net.get_player_info(playerID, "name")
end
local toAll = true
if coalition ~= nil then coalition = coalition + 1 end
if all == -2 then toAll = false end
grpc.event({
time = DCS.getModelTime(),
event = {
type = "playerSendChat",
playerId = playerID,
message = msg
message = msg,
coalition = coalition,
playerName = playerName,
toAll = toAll
},
})

end

function handler.onPlayerTryConnect(addr, name, ucid, id)
Expand Down
6 changes: 6 additions & 0 deletions protos/dcs/mission/v0/mission.proto
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ message StreamEventsResponse {
uint32 player_id = 1;
// what was typed
string message = 2;
// player's coalition
dcs.common.v0.Coalition coalition = 3;
// player's name
string player_name = 4;
// sent to all chat
bool to_all = 5;
}

// fired when the player changes across to a slot
Expand Down
11 changes: 6 additions & 5 deletions src/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ impl RequestInterceptor for AuthInterceptor {
}
}

if client.is_some() {
log::debug!("Authenticated client: {}", client.unwrap());
Ok(req)
} else {
Err(Status::unauthenticated("Unauthenticated"))
match client {
Some(client_name) => {
log::debug!("Authenticated client: {}", client_name);
Ok(req)
}
_ => Err(Status::unauthenticated("Unauthenticated")),
}
}
_ => Err(Status::unauthenticated("Unauthenticated")),
Expand Down
1 change: 1 addition & 0 deletions src/rpc/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl CustomService for MissionRpc {
Ok(Response::new(custom::v0::EvalResponse { json }))
}

#[allow(clippy::result_large_err)]
async fn get_magnetic_declination(
&self,
request: Request<custom::v0::GetMagneticDeclinationRequest>,
Expand Down
Loading