Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
sp4ce-cowboy committed Apr 16, 2024
1 parent 9f623ff commit b5bc89b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ struct DamageEvent: TFEvent {
}

if let statsSystem = target.system(ofType: StatisticSystem.self) {
if player != .ownPlayer {
statsSystem.notify(for: self)
}
statsSystem.notify(for: self)
}

return EventOutput()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ final class TotalDamageDealtStatistic: Statistic {
self.maximumCurrentValue = maxCurrentValue
}

/*func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
let eventType = TFEventTypeWrapper(type: DamageEvent.self)
let updateActor: StatisticUpdateActor = { statistic in statistic.updateCurrentValue(by: ) }
let eventUpdateDictionary = [eventType: updateActor]
let statsLink = StatisticUpdateLinkDatabase(statisticUpdateLinks: eventUpdateDictionary)

return statsLink
}*/

func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
let eventType = TFEventTypeWrapper(type: DamageEvent.self)
let eventUpdateClosure: (Statistic, DamageEvent?) -> Void = { statistic, event in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ final class TotalDeathsStatistic: Statistic {
self.maximumCurrentValue = maxCurrentValue
}

/*func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
let eventType = TFEventTypeWrapper(type: DeathEvent.self)
let updateActor: StatisticUpdateActor = { statistic in statistic.updateCurrentValue(by: 1.0) }
let eventUpdateDictionary = [eventType: updateActor]
let statsLink = StatisticUpdateLinkDatabase(statisticUpdateLinks: eventUpdateDictionary)

return statsLink
}*/

/// The total deaths statistic no longer requires the DeathEvent, it is able
/// to directly parse a KillEvent to determine whe
func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
Expand All @@ -47,8 +38,7 @@ final class TotalDeathsStatistic: Statistic {

let statisticUpdateActor = StatisticUpdateActor<KillEvent>(action: eventUpdateClosure)
let anyStatisticUpdateActorWrapper = AnyStatisticUpdateActorWrapper(statisticUpdateActor)
// let anyStatisticUpdateActorWrapper =
// AnyStatisticUpdateActorWrapper(updateStatistic: eventUpdateClosure)

var statisticUpdateLinksMap: [TFEventTypeWrapper: AnyStatisticUpdateActor] = [:]
statisticUpdateLinksMap[eventType] = anyStatisticUpdateActorWrapper
return StatisticUpdateLinkDatabase(statisticUpdateLinks: statisticUpdateLinksMap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ final class TotalGamesStatistic: Statistic {
self.maximumCurrentValue = maxCurrentValue
}

/*func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
let eventType = TFEventTypeWrapper(type: GameStartEvent.self)
let updateActor: StatisticUpdateActor = { statistic in statistic.updateCurrentValue(by: 1.0) }
let eventUpdateDictionary = [eventType: updateActor]
let statsLink = StatisticUpdateLinkDatabase(statisticUpdateLinks: eventUpdateDictionary)

return statsLink
}*/

func getStatisticUpdateLinks() -> StatisticUpdateLinkDatabase {
let eventType = TFEventTypeWrapper(type: GameStartEvent.self)
let eventUpdateClosure: (Statistic, GameStartEvent?) -> Void = { statistic, event in
Expand All @@ -43,7 +34,7 @@ final class TotalGamesStatistic: Statistic {

let statisticUpdateActor = StatisticUpdateActor<GameStartEvent>(action: eventUpdateClosure)
let anyStatisticUpdateActorWrapper = AnyStatisticUpdateActorWrapper(statisticUpdateActor)

var statisticUpdateLinksMap: [TFEventTypeWrapper: AnyStatisticUpdateActor] = [:]
statisticUpdateLinksMap[eventType] = anyStatisticUpdateActorWrapper
return StatisticUpdateLinkDatabase(statisticUpdateLinks: statisticUpdateLinksMap)
Expand Down

0 comments on commit b5bc89b

Please sign in to comment.