test
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
|
const Natives = {
|
||||||
|
SET_BLIP_CATEGORY: RageEnums.Natives.Ui.SET_BLIP_CATEGORY,
|
||||||
const Natives = {
|
SHOW_HEADING_INDICATOR_ON_BLIP: RageEnums.Natives.Ui.SHOW_HEADING_INDICATOR_ON_BLIP,
|
||||||
SET_BLIP_CATEGORY: "0x234CDD44D996FD9A",
|
SET_BLIP_AS_SHORT_RANGE: RageEnums.Natives.Ui.SET_BLIP_AS_SHORT_RANGE,
|
||||||
SHOW_HEADING_INDICATOR_ON_BLIP: "0x5FBCA48327B914DF",
|
SET_BLIP_DISPLAY: RageEnums.Natives.Ui.SET_BLIP_DISPLAY
|
||||||
SET_BLIP_AS_SHORT_RANGE: "0xBE8BE4FE60E27B72",
|
|
||||||
SET_BLIP_DISPLAY: "0x9029B2F3DA924928"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function playerBlips() {
|
export default function playerBlips() {
|
||||||
mp.events.add("entityStreamIn", (entity) => {
|
mp.events.add("entityStreamIn", (entity) => {
|
||||||
if (entity.type === "player") {
|
if (entity.type === "player") {
|
||||||
|
|
||||||
|
var entityMp = <EntityMp>entity;
|
||||||
|
|
||||||
mp.gui.chat.push("Player recieved: Yes");
|
mp.gui.chat.push("Player recieved: Yes");
|
||||||
|
|
||||||
let color = parseInt(entity.getVariable("blipColor"));
|
let color = parseInt(entity.getVariable("blipColor"));
|
||||||
@@ -19,19 +19,22 @@ export default function playerBlips() {
|
|||||||
|
|
||||||
entity.createBlip(1);
|
entity.createBlip(1);
|
||||||
|
|
||||||
|
var blip: BlipMp;
|
||||||
|
|
||||||
|
|
||||||
mp.gui.chat.push(parseInt(entity.blip) == 0 ? "Blip was not created" : "Blip was created");
|
mp.gui.chat.push(parseInt(entity.blip) == 0 ? "Blip was not created" : "Blip was created");
|
||||||
|
|
||||||
mp.gui.chat.push("entity.blip is actually " + entity.blip);
|
mp.gui.chat.push("entity.blip is actually " + entity.blip);
|
||||||
var blip = mp.blips.at(entity.blip);
|
var blip = mp.blips.at(entity.blip);
|
||||||
|
|
||||||
mp.gui.chat.push("1 -" + blip.getAlpha() + " 2- " + blip.doesExist() + " 3-" + blip.dimension);
|
mp.gui.chat.push("1 -" + blip.getAlpha() + " 2- " + blip.doesExist() + " 3-" + blip.dimension + " 4-" + entityMp.dimension);
|
||||||
|
|
||||||
entity.setBlipColor(isNaN(color) ? 0 : color);
|
entity.setBlipColor(isNaN(color) ? 0 : color);
|
||||||
|
|
||||||
mp.game.invoke(Natives.SET_BLIP_CATEGORY, entity.blip, 7);
|
mp.game.invoke(Natives.SET_BLIP_CATEGORY, entity.blip, 7);
|
||||||
mp.game.invoke(Natives.SHOW_HEADING_INDICATOR_ON_BLIP, entity.blip, true);
|
mp.game.invoke(Natives.SHOW_HEADING_INDICATOR_ON_BLIP, entity.blip, true);
|
||||||
mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, entity.blip, true);
|
mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, entity.blip, true);
|
||||||
mp.game.invoke(Natives.SET_BLIP_DISPLAY, entity.blip, 8);
|
//mp.game.invoke(Natives.SET_BLIP_DISPLAY, entity.blip, 8);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ class RageEntity implements IEntity {
|
|||||||
return this.entity.id;
|
return this.entity.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get handle() {
|
||||||
|
return this.entity.handle;
|
||||||
|
}
|
||||||
|
|
||||||
get remoteId(): number {
|
get remoteId(): number {
|
||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ interface IBrowser {
|
|||||||
interface IEntity {
|
interface IEntity {
|
||||||
id: number;
|
id: number;
|
||||||
remoteId: number;
|
remoteId: number;
|
||||||
|
handle: number;
|
||||||
type: EntityType;
|
type: EntityType;
|
||||||
getSharedData<T>(key: string): T;
|
getSharedData<T>(key: string): T;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { IGame, EntityType } from "../game";
|
import { IGame, EntityType, IEntity } from "../game";
|
||||||
import relativeVector from "./relativevector";
|
import relativeVector from "./relativevector";
|
||||||
|
|
||||||
|
var attachId = 0;
|
||||||
|
|
||||||
export default function attachmentManager(game: IGame) {
|
export default function attachmentManager(game: IGame) {
|
||||||
mp.events.add("SERVER:LoadAttachments", () => {
|
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));
|
attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));
|
||||||
@@ -21,11 +23,19 @@ export default function attachmentManager(game: IGame) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let entity;
|
++attachId;
|
||||||
|
|
||||||
|
let entity: IEntity;
|
||||||
if (entityRage.type === "player") {
|
if (entityRage.type === "player") {
|
||||||
entity = game.players.at(entityRage.remoteId);
|
var player = game.players.at(entityRage.remoteId);
|
||||||
|
entity = player;
|
||||||
|
mp.gui.chat.push(`ATTACH: ${attachId} - Player: ${player.name}`);
|
||||||
|
|
||||||
} else if (entityRage.type === "vehicle") {
|
} else if (entityRage.type === "vehicle") {
|
||||||
entity = game.vehicles.at(entityRage.remoteId);
|
var vehicle = game.vehicles.at(entityRage.remoteId);
|
||||||
|
entity = vehicle;
|
||||||
|
var realName = mp.game.ui.getLabelText(mp.game.vehicle.getDisplayNameFromVehicleModel(entityRage.model));
|
||||||
|
mp.gui.chat.push(`ATTACH: ${attachId} - Vehicle: ${vehicle.remoteId}, ${realName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let e = game.attachments.get(entity);
|
let e = game.attachments.get(entity);
|
||||||
@@ -36,12 +46,16 @@ export default function attachmentManager(game: IGame) {
|
|||||||
let attInfo = this.attachments[id];
|
let attInfo = this.attachments[id];
|
||||||
let object = mp.objects.new(attInfo.model, entityRage.position);
|
let object = mp.objects.new(attInfo.model, entityRage.position);
|
||||||
|
|
||||||
object.attachTo(entityRage.handle,
|
var bone = (typeof (attInfo.boneName) === 'string') ? entityRage.getBoneIndexByName(attInfo.boneName) : entityRage.getBoneIndex(attInfo.boneName)
|
||||||
(typeof (attInfo.boneName) === 'string') ? entityRage.getBoneIndexByName(attInfo.boneName) : entityRage.getBoneIndex(attInfo.boneName),
|
|
||||||
|
mp.gui.chat.push(`ATTACH: ${attachId} - bone = ${bone}`)
|
||||||
|
|
||||||
|
object.attachTo(entity.id,
|
||||||
|
bone,
|
||||||
attInfo.offset.x, attInfo.offset.y, attInfo.offset.z,
|
attInfo.offset.x, attInfo.offset.y, attInfo.offset.z,
|
||||||
attInfo.rotation.x, attInfo.rotation.y, attInfo.rotation.z,
|
attInfo.rotation.x, attInfo.rotation.y, attInfo.rotation.z,
|
||||||
false, false, false, false, 2, true);
|
false, false, false, false, 2, true);
|
||||||
|
mp.gui.chat.push(`ATTACH: ${attachId} - Attaching ${JSON.stringify(attInfo)}`);
|
||||||
e.__attachmentObjects[id] = object;
|
e.__attachmentObjects[id] = object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user