fix hanf performance??
This commit is contained in:
@@ -333,13 +333,8 @@ export default function hanfSystem(globalData: IGlobalData) {
|
||||
let hanfDataIdToObjectMap: Map<number, ObjectMp> = new Map<number, ObjectMp>();
|
||||
let hanfDataIdToTextLabelMap: Map<number, TextLabelMp> = new Map<number, TextLabelMp>();
|
||||
|
||||
mp.events.addDataHandler("hanfData", (entity: EntityMp, value) => {
|
||||
if (entity.type == 'player' && entity.remoteId == mp.players.local.remoteId) {
|
||||
updateHanf(value);
|
||||
}
|
||||
});
|
||||
|
||||
function updateHanf(dataJson: string) {
|
||||
mp.events.add("SERVER:Hanf_UpdateHanf", (dataJsonArr: string[]) => {
|
||||
var dataJson = dataJsonArr.join('');
|
||||
var data: Array<CannabisData> = <Array<CannabisData>>JSON.parse(dataJson)
|
||||
|
||||
var newPlants = data.filter(d => currentHanfData.filter(x => x.Id === d.Id).length == 0);
|
||||
@@ -382,7 +377,7 @@ export default function hanfSystem(globalData: IGlobalData) {
|
||||
});
|
||||
|
||||
currentHanfData = data;
|
||||
}
|
||||
});
|
||||
|
||||
function getPlantModel(plant: CannabisData): number {
|
||||
var diff = Date.now() - Date.parse(plant.Time);
|
||||
|
||||
Reference in New Issue
Block a user