test
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { IGame, IEntity } from "../game";
|
||||
|
||||
|
||||
export default function attachmentManager(game: IGame) {
|
||||
mp.events.add("SERVER:LoadAttachments", () => {
|
||||
attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));
|
||||
@@ -11,9 +10,7 @@ export default function attachmentManager(game: IGame) {
|
||||
attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180));
|
||||
});
|
||||
|
||||
|
||||
|
||||
const attachmentMngr =
|
||||
const attachmentMngr =
|
||||
{
|
||||
attachments: {},
|
||||
|
||||
@@ -26,7 +23,7 @@ export default function attachmentManager(game: IGame) {
|
||||
let attInfo = this.attachments[id];
|
||||
|
||||
let object = mp.objects.new(attInfo.model, entity.position);
|
||||
|
||||
|
||||
object.__attMgrData = {
|
||||
targetEntity: entity.handle,
|
||||
bone: (typeof (attInfo.boneName) === 'string') ? entity.getBoneIndexByName(attInfo.boneName) : entity.getBoneIndex(attInfo.boneName),
|
||||
@@ -157,6 +154,17 @@ export default function attachmentManager(game: IGame) {
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.addDataHandler("attachToPlayer", (player: PlayerMp, attachedPlayer: PlayerMp) => {
|
||||
if (!attachedPlayer)
|
||||
return;
|
||||
|
||||
let handle = player.handle;
|
||||
if (player == mp.players.local)
|
||||
handle = mp.players.local.handle;
|
||||
|
||||
attachedPlayer.attachTo(handle, 0, 0, 1, 0, 0, 0, 0, false, true, false, true, 2, true);
|
||||
});
|
||||
|
||||
mp.events.addDataHandler("attachmentsData", (entity, data) => {
|
||||
let newAttachments = (data.length > 0) ? data.split('|').map(att => parseInt(att, 36)) : [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user