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

Add ability to replace clump model with atomic and vice-versa #4052

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

Open
FileEX wants to merge 20 commits into multitheftauto:master
base: master
Choose a base branch
Loading
from FileEX:bugfix/clump_atomic_models

Conversation

@FileEX
Copy link
Member

@FileEX FileEX commented Feb 23, 2025
edited
Loading

Fixed #3699

Until now, when replacing an atomic model with a clump model, only one atomic was visible in the game. On the other hand, when replacing a clump model with an atomic model, the function would either return false or cause a crash.

Now MTA also supports replacing clump-type objects. However, to maintain backward compatibility, models are not automatically converted based on the number of atomics. If you want to replace an atomic-type object with a clump-type object, you need to convert it using the function below

Syntax

bool engineConvertModelToType(number modelId, string modelType)
  • modelType: object (atomic) | damageable-object | timed-object | clump.

Once this PR is merged, the next item on my to-do list is object animations.

image

-- ATOMIC -> CLUMP
local dff = engineLoadDFF('nt_windmill.dff');
engineConvertModelToType(1337, 'clump');
engineReplaceModel(dff, 1337);
-- CLUMP -> ATOMIC
local dff = engineLoadDFF('binnt07_la.dff');
engineConvertModelToType(3425, 'object');
engineReplaceModel(dff, 3425);

RughCuttle reacted with laugh emoji Fernando-A-Rocha, RughCuttle, Wannacry-ops, thealex-br, and delusionalismHQ reacted with heart emoji Fernando-A-Rocha, MegadreamsBE, RughCuttle, Wannacry-ops, Nico8340, thealex-br, and delusionalismHQ reacted with rocket emoji RughCuttle, Wannacry-ops, and delusionalismHQ reacted with eyes emoji
@FileEX FileEX marked this pull request as draft February 23, 2025 02:10
@FileEX FileEX marked this pull request as ready for review February 23, 2025 02:33
Copy link
Member

TheNormalnij commented Feb 23, 2025
edited
Loading

Is it possible to use a general solution?

engineConvertModelToType(modelId, "ped" | "vehicle" | "object" | "timed-object" | "clump" | "object-damageable")

It looks like automatic conversation may break some models.
And i don't think that somebody will be happy, when 'timed-object' converts to 'object' or 'clump' silently.

Copy link
Member Author

FileEX commented Feb 23, 2025

Is it possible to use a general solution?

engineConvertModelToType(modelId, "ped" | "vehicle" | "object" | "timed-object" | "clump" | "object-damageable")

It looks like automatic conversation may break some models. And i don't think that somebody will be happy, when 'timed-object' converts to 'object' or 'clump' silintly.

Yes, you're probably right. This could be backwards incompatible in some way, and additionally, automatically 'guessing' the model type is quite problematic and results in more complex code. I think this solution is appropriate, allowing the user to define which model type should be created

@FileEX FileEX marked this pull request as draft February 23, 2025 23:40
Copy link
Member Author

FileEX commented Mar 11, 2025

I added engineConvertModelToType to convert the model to another type (atomic, clump, damageable-atomic, timed object). I tested this in many different variations to eliminate as many crashes as possible. I think the PR is ready, as I haven't observed any new crashes. The default behavior is the same as before, meaning only one atomic is replaced

bool engineConvertModelToType(number modelId, string newType = "object" | "timed-object" | "damageable-object" | "clump")

@FileEX FileEX marked this pull request as ready for review March 11, 2025 22:57
@FileEX FileEX added enhancement New feature or request bugfix Solution to a bug of any kind labels Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@TheNormalnij TheNormalnij TheNormalnij left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

bugfix Solution to a bug of any kind enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

After the model replacement, the frames are not properly loaded

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