From c222234adcce1453272765bcf8b2c085dfd74d93 Mon Sep 17 00:00:00 2001 From: Igor Kravchenko Date: Thu, 1 Oct 2020 12:47:21 +0300 Subject: [PATCH] replaces fatalError with assertionFailure in 'changeState' --- Sources/FirebladeECS/FSM.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/FirebladeECS/FSM.swift b/Sources/FirebladeECS/FSM.swift index 9b91234..cd7309e 100644 --- a/Sources/FirebladeECS/FSM.swift +++ b/Sources/FirebladeECS/FSM.swift @@ -270,6 +270,7 @@ public class StateComponentMapping { /// so that a fluent interface can be used when configuring entity states. /// - Parameter type: The type of component to add a mapping to the state for /// - Returns: The new ComponentMapping for that type + @discardableResult public func add(_ type: ComponentInitializable.Type) -> StateComponentMapping { creatingState.add(type) } @@ -327,7 +328,8 @@ public class EntityStateMachine { /// - Parameter name: The name of the state to change to. public func changeState(name: StateName) { guard let newState = states[name] else { - fatalError("Entity state '\(name)' doesn't exist") + assertionFailure("Entity state '\(name)' doesn't exist") + return } if newState === currentState {