Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix random foliage on replaced collisions #2678

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

Merged
patrikjuvonen merged 4 commits into multitheftauto:master from TFP-dev:fix-random-foliage
Apr 7, 2023

Conversation

@TFP-dev
Copy link
Contributor

@TFP-dev TFP-dev commented Jul 22, 2022
edited by patrikjuvonen
Loading

This PR introduces fix for random foliage on custom collisions.

Fixes #2694

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

bum8hj reacted with rocket emoji Lpsd and bum8hj reacted with eyes emoji
Fix random foliage on custom collisions
@lopezloo lopezloo added the bug Something isn't working label Jul 22, 2022
Copy link
Contributor

patrikjuvonen commented Jul 22, 2022
edited
Loading

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?

Copy link
Member

lopezloo commented Jul 22, 2022
edited
Loading

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:

// crash when enabling on surfaces without setting plants and trees
// table at offset 0xC38070 contain information about which are read from plants.dat
// i don't know did this will work on objects created by createObject function
// ADD_ENUM(SURFACE_PROPERTY_CREATEOBJECTS, "createobjects")
// ADD_ENUM(SURFACE_PROPERTY_CREATEPLANTS, "createplants")
case SURFACE_PROPERTY_CREATEPLANTS:
argStream.ReadBool(bEnabled);
if (!argStream.HasErrors())
{
pSurface->setFlagEnabled(1, 8, bEnabled);
lua_pushboolean(luaVM, true);
return 1;
}
break;
Maybe it could be fixed.

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

Copy link
Contributor Author

TFP-dev commented Jul 23, 2022

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.

Copy link
Contributor

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.

Copy link
Contributor Author

TFP-dev commented Jul 28, 2022

Fixes #2694

Copy link
Contributor

patrikjuvonen commented Jan 1, 2023
edited
Loading

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

Copy link
Contributor

@patrikjuvonen patrikjuvonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unloading issue should be addressed somehow in my opinion. But other than that ok.

Copy link
Contributor Author

TFP-dev commented Jan 1, 2023

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

patrikjuvonen reacted with thumbs up emoji

Copy link
Contributor

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 patrikjuvonen merged commit 0a1cbb8 into multitheftauto:master Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@patrikjuvonen patrikjuvonen patrikjuvonen approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

1.6.0

Development

Successfully merging this pull request may close these issues.

Random foliage on replaced collisions bug

AltStyle によって変換されたページ (->オリジナル) /