mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Fix random foliage on replaced collisions

Open TFP-dev opened this issue 2 years ago • 5 comments

This PR introduces fix for random foliage on custom collisions.

This is how custom model and custom collision looks like on current MTA version:

mta-screen_2022-07-22_15-35-06

This is how it looks after this fix:

mta-screen_2022-07-22_15-36-42 test_resource.zip

TFP-dev avatar Jul 22 '22 15:07 TFP-dev

This changes MTA current default behavior and may be unwanted in a number of cases so I think we should introduce some way (client-side Lua) to toggle this flag before merging as such.

Also, does randomfoliage world property affect this?

patrikjuvonen avatar Jul 22 '22 18:07 patrikjuvonen

This changes MTA current default behavior and may be unwanted in a number of cases so I think we should introduce some way (client-side Lua) to toggle this flag before merging as such.

There is engineSetSurfaceProperties function with disabled createobjects and createplants flag: https://github.com/multitheftauto/mtasa-blue/blob/cd1d2088a92b685b3b6294acb388fc1154ddbee4/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp#L611-L615 https://github.com/multitheftauto/mtasa-blue/blob/ebf54d4fcfe9b0b5600c2b632595029ea97f2b3f/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp#L1280-L1288 Maybe it could be fixed.

//edit: I have created issue about that: #2681.

lopezloo avatar Jul 22 '22 19:07 lopezloo

This changes MTA current default behavior and may be unwanted in a number of cases so I think we should introduce some way (client-side Lua) to toggle this flag before merging as such.

Appropriate materials assigned in the collision are required for this to generate. Most servers use material 0 in their collisions, so I think lua function is unnecessary.

Also, does randomfoliage world property affect this?

setWorldSpecialPropertyEnabled works fine with this

There is engineSetSurfaceProperties function with disabled createobjects and createplants flag:

But engineSetSurfaceProperties works completely different.

TFP-dev avatar Jul 23 '22 08:07 TFP-dev

This changes MTA current default behavior and may be unwanted in a number of cases so I think we should introduce some way (client-side Lua) to toggle this flag before merging as such.

Appropriate materials assigned in the collision are required for this to generate. Most servers use material 0 in their collisions, so I think lua function is unnecessary.

Also, does randomfoliage world property affect this?

setWorldSpecialPropertyEnabled works fine with this

There is engineSetSurfaceProperties function with disabled createobjects and createplants flag:

But engineSetSurfaceProperties works completely different.

Ok thanks for clarification. I think we just need to test this and try the existing property function on this.

Great find all in all.

patrikjuvonen avatar Jul 23 '22 11:07 patrikjuvonen

Fixes #2694

TFP-dev avatar Jul 28 '22 13:07 TFP-dev

When you unload the resource, the foliage stays there. Probably should be fixed, but can be worked around by warping out of stream distance and warping back (and maybe some other method). engineRestreamWorld did not remove the foliage.

Untitled

patrikjuvonen avatar Jan 01 '23 14:01 patrikjuvonen

When you unload the resource, the foliage stays there. Probably should be fixed, but can be worked around by warping out of stream distance and warping back (and maybe some other method). engineRestreamWorld did not remove the foliage.

Untitled

Foliage also stays when you use removeWorldModel in current MTA version on original models, so this is not an issue with this PR. obraz

TFP-dev avatar Jan 01 '23 17:01 TFP-dev

Foliage also stays when you use removeWorldModel in current MTA version on original models, so this is not an issue with this PR.

Thanks for clarifying. Maybe we'll create a new issue for that.

patrikjuvonen avatar Jan 01 '23 17:01 patrikjuvonen