Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for trackCollision(e), can now be done on first execution #3137

Merged

Conversation

DerelictDrone
Copy link
Member

Switches check for registered_chips[self.entity] (which is reliant on the constructor running) to self.entity.registered_events["entityCollision"] which appears to be populated by the compiler / e2 upload, and is available before first execution of chip (before constructors are run).

Not extensively tested, but upon initial inspection, fixes code like

interval(500)
if( first() ){
    E = entity():isWeldedTo()
    trackCollision(E) // Runtime error - event entityCollision is needed
}

print( isTrackingCollision(E) )

event entityCollision(Entity:entity, HitEntity:entity, CollisionData:collision) {
    print("event", Entity)
}

@thegrb93 thegrb93 merged commit 64a9398 into wiremod:master Sep 10, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants