fireblade-engine / ecs

A dependency free, lightweight, fast Entity-Component System (ECS) implementation in Swift
MIT License
110 stars 11 forks source link

Entity.assign no longer produces ComponentAdded event for NexusEventDelegate #36

Closed igorkravchenko closed 3 years ago

igorkravchenko commented 3 years ago

Steps to reproduce:

import FirebladeECS

let nexus = Nexus()

class EventDelegate: NexusEventDelegate {
    func nexusEvent(_ event: NexusEvent) {
        if event is ComponentAdded {
            print("component added")
        }
    }

    func nexusNonFatalError(_ message: String) {}
}

let delegate = EventDelegate()
nexus.delegate = delegate

class Comp: Component {}
class Comp2: Component {}

nexus.createEntity().assign(Comp(), Comp2())

In 0.17.2 the ComponentAdded event is triggered.

ctreffs commented 3 years ago

Affected version: 0.17.3

ctreffs commented 3 years ago

Hi @igorkravchenko ,

thanks for reporting this. It was in fact a bug, which will be fixed with PR #37. I will create a patch release 0.17.4 for that in the future, but you will be able to pull the bugfix from master as soon as the PR is merged.

Thank you again and have a great week 👋

ctreffs commented 3 years ago

PR #37 is now merged. Please give me some feedback if this solved your issue, so that the issue can be closed. Thank you 🙏

igorkravchenko commented 3 years ago

Yeah, recent PR solves the issue for me. Thank you!