Skip to content

Commit

Permalink
Unit Exporter DCS-gRPC#209: Fix error when group nil as unit becomes …
Browse files Browse the repository at this point in the history
…static on death
  • Loading branch information
martinco committed Apr 18, 2023
1 parent a8f1853 commit 517590d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/DCS-gRPC/exporters/object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ GRPC.exporters.position = function(pos)
end

GRPC.exporters.unit = function(unit)

local group = unit:getGroup()
if group then
group = GRPC.exporters.group(group)
end

return {
id = tonumber(unit:getID()),
name = unit:getName(),
callsign = unit:getCallsign(),
coalition = unit:getCoalition() + 1, -- Increment for non zero-indexed gRPC enum
type = unit:getTypeName(),
playerName = Unit.getPlayerName(unit),
group = GRPC.exporters.group(Unit.getGroup(unit)),
group = group,
numberInGroup = unit:getNumber(),
rawTransform = GRPC.exporters.rawTransform(unit),
}
Expand Down

0 comments on commit 517590d

Please sign in to comment.