Fernando-A-Rocha / mta-add-models

Library for Multi Theft Auto: San Andreas that lets you add new models to your server
GNU General Public License v3.0
66 stars 16 forks source link

Weird behavior with object streaming out & then engineFreeModel #8

Closed Fernando-A-Rocha closed 3 years ago

Fernando-A-Rocha commented 3 years ago

Explained here: testing script line 71 (where it says NOT OK)

The added unittest_newmodels resource is for stress-testing everything and trying to find issues like this one :) Special thanks to @httpRick for helping out

Fernando-A-Rocha commented 3 years ago

How to reproduce bug:

quiret commented 3 years ago

I had the same issue when working on my own model streamer. I fixed it by detecting the recursion directly. You see, you can expect the streamer to stream-out the element in the way you detected it, all the time. That was the "fix" for me at scene2res.

Fernando-A-Rocha commented 3 years ago

I had the same issue when working on my own model streamer. I fixed it by detecting the recursion directly. You see, you can expect the streamer to stream-out the element in the way you detected it, all the time. That was the "fix" for me at scene2res.

Interesting! But don't you believe we could get to the root of the problem in MTA code and prevent it from happening? Or is there a reason this happens?

Fernando-A-Rocha commented 3 years ago

I went ahead and implemented a simple solution to detect the recursion and prevent it as you said @quiret ^^

Reopening issue because I think we need to discuss why this bug happens and if there an actual way to fix it within MTA code?

quiret commented 3 years ago

Technically the stream-out is related to the destruction of the real game entity. You can fix it by doing a manual model, texture and collision update on the entity. I am not sure about all the game variables that need adjustment, especially since there could be hooks all over the place and dependent MTA hacks, but it should be possible. But do you really want to mess with the buggy game logic any further and risk evoking more bugs in MTA?

quiret commented 3 years ago
Fernando-A-Rocha commented 3 years ago

Thank you for making it clearer @quiret ! I guess this temp fix will be fine for now...