Attachmen Manager

This commit is contained in:
kookroach
2021-04-04 22:42:49 +02:00
parent af0b51d0dc
commit cf6fa13080
7 changed files with 28 additions and 10 deletions

View File

@@ -19,14 +19,14 @@ export default function attachmentManager(game: IGame) {
addFor: async function (entity, id) {
if (this.attachments.hasOwnProperty(id)) {
if (!entity.__attachmentObjects) {
entity.__attachmentObjects = {};
}
if (!entity.__attachmentObjects.hasOwnProperty(id)) {
let attInfo = this.attachments[id];
let object = mp.objects.new(attInfo.model, entity.position);
while (object.handle === 0) {
await mp.game.waitAsync(0);
}
object.__attMgrData = {
targetEntity: entity.handle,
bone: (typeof (attInfo.boneName) === 'string') ? entity.getBoneIndexByName(attInfo.boneName) : entity.getBoneIndex(attInfo.boneName),