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
24 changes: 21 additions & 3 deletions internal/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,24 @@ func (s *Service) LogProjectileEvent(data []string) (model.ProjectileEvent, erro
}
}

// [17] sim - simulation type (optional, may not be present in older data)
if len(data) > 17 {
projectileEvent.SimulationType = data[17]
}

// [18] isSub - is submunition (optional)
if len(data) > 18 {
isSub, err := strconv.ParseBool(data[18])
if err == nil {
projectileEvent.IsSubmunition = isSub
}
}

// [19] magazineIcon - magazine icon path (optional)
if len(data) > 19 {
projectileEvent.MagazineIcon = data[19]
}

return projectileEvent, nil
}

Expand Down Expand Up @@ -1361,11 +1379,11 @@ func (s *Service) LogAce3UnconsciousEvent(data []string) (model.Ace3UnconsciousE
}
unconsciousEvent.SoldierObjectID = uint16(ocapID)

isAwake, err := strconv.ParseBool(data[2])
isUnconscious, err := strconv.ParseBool(data[2])
if err != nil {
return unconsciousEvent, fmt.Errorf(`error converting isAwake to bool: %v`, err)
return unconsciousEvent, fmt.Errorf(`error converting isUnconscious to bool: %v`, err)
}
unconsciousEvent.IsAwake = isAwake
unconsciousEvent.IsUnconscious = isUnconscious

return unconsciousEvent, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/model/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ func Ace3DeathEventToCore(e model.Ace3DeathEvent) core.Ace3DeathEvent {
// Ace3UnconsciousEventToCore converts a GORM Ace3UnconsciousEvent to a core.Ace3UnconsciousEvent
func Ace3UnconsciousEventToCore(e model.Ace3UnconsciousEvent) core.Ace3UnconsciousEvent {
return core.Ace3UnconsciousEvent{
ID: e.ID,
ID: e.ID,
MissionID: e.MissionID,
SoldierID: uint(e.SoldierObjectID), // ObjectID -> uint for core model
Time: e.Time,
CaptureFrame: e.CaptureFrame,
IsAwake: e.IsAwake,
IsUnconscious: e.IsUnconscious,
}
}

Expand Down
14 changes: 7 additions & 7 deletions internal/model/convert/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,21 +551,21 @@ func TestAce3UnconsciousEventToCore(t *testing.T) {
now := time.Now()

gormEvent := model.Ace3UnconsciousEvent{
ID: 1,
MissionID: 1,
ID: 1,
MissionID: 1,
SoldierObjectID: 5,
Time: now,
CaptureFrame: 100,
IsAwake: false,
Time: now,
CaptureFrame: 100,
IsUnconscious: true, // Unit went unconscious
}

coreEvent := Ace3UnconsciousEventToCore(gormEvent)

if coreEvent.SoldierID != 5 {
t.Errorf("expected SoldierID=5, got %d", coreEvent.SoldierID)
}
if coreEvent.IsAwake {
t.Error("expected IsAwake=false")
if !coreEvent.IsUnconscious {
t.Error("expected IsUnconscious=true")
}
}

Expand Down
12 changes: 6 additions & 6 deletions internal/model/core/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ type Ace3DeathEvent struct {

// Ace3UnconsciousEvent represents ACE3 unconscious state change
type Ace3UnconsciousEvent struct {
ID uint
MissionID uint
SoldierID uint
Time time.Time
CaptureFrame uint
IsAwake bool
ID uint
MissionID uint
SoldierID uint
Time time.Time
CaptureFrame uint
IsUnconscious bool // true = went unconscious, false = regained consciousness
}

// TimeState represents mission time synchronization data
Expand Down
Loading
Loading