Skip to content

Commit

Permalink
🐛 Add missing inits
Browse files Browse the repository at this point in the history
  • Loading branch information
alicerunsonfedora committed Sep 7, 2022
1 parent cc08cc8 commit 041907a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/JensonKit/Models/JensonEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public struct JensonEvent: Codable {

/// The question being asked, if provided.
public let question: JensonQuestion?

public init(type: EventType, who: String, what: String, question: JensonQuestion?) {
self.type = type
self.who = who
self.what = what
self.question = question
}
}

/// A struct that represents a question event.
Expand All @@ -51,6 +58,11 @@ public struct JensonQuestion: Codable {

/// The list of choices the player can make.
public let options: [JensonChoice]

public init(question: String, options: [JensonChoice]) {
self.question = question
self.options = options
}
}

/// A struct that represents a choice that can be made by the player.
Expand All @@ -60,4 +72,9 @@ public struct JensonChoice: Codable {

/// The events that follow this choice.
public let events: [JensonEvent]

public init(name: String, events: [JensonEvent]) {
self.name = name
self.events = events
}
}
5 changes: 5 additions & 0 deletions Sources/JensonKit/Models/JensonFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ public struct JensonFile: Codable {

/// The timeline of events that will be played.
let timeline: [JensonEvent]

public init(version: Int, timeline: [JensonEvent]) {
self.version = version
self.timeline = timeline
}
}

0 comments on commit 041907a

Please sign in to comment.