Attachmen Manager
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user