From 50fb50f9f0a8512e7658a46bb13b158a565b6ee4 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 27 May 2021 23:41:30 +0200 Subject: [PATCH] rvtl fix hanf --- ReallifeGamemode.Client/drugs/hanf.ts | 8 ++++++-- ReallifeGamemode.Server/Managers/HanfManager.cs | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/drugs/hanf.ts b/ReallifeGamemode.Client/drugs/hanf.ts index 4c5339c1..ac37a8d3 100644 --- a/ReallifeGamemode.Client/drugs/hanf.ts +++ b/ReallifeGamemode.Client/drugs/hanf.ts @@ -333,9 +333,13 @@ export default function hanfSystem(globalData: IGlobalData) { let hanfDataIdToObjectMap: Map = new Map(); let hanfDataIdToTextLabelMap: Map = new Map(); - mp.events.add("SERVER:Hanf_UpdateHanfData", dataJson => { - mp.console.logInfo(dataJson); + mp.events.addDataHandler("hanfData", (entity: EntityMp, value) => { + if (entity == mp.players.local) { + } + }); + + mp.events.add("SERVER:Hanf_UpdateHanfData", dataJson => { var data: Array = >JSON.parse(dataJson) var newPlants = data.filter(d => currentHanfData.filter(x => x.Id === d.Id).length == 0); diff --git a/ReallifeGamemode.Server/Managers/HanfManager.cs b/ReallifeGamemode.Server/Managers/HanfManager.cs index 2ea69f0e..d70c9adf 100644 --- a/ReallifeGamemode.Server/Managers/HanfManager.cs +++ b/ReallifeGamemode.Server/Managers/HanfManager.cs @@ -289,7 +289,8 @@ namespace ReallifeGamemode.Server.Managers { cannabisData ??= _currentCannabisData; await NAPI.Task.WaitForMainThread(); - player.TriggerEvent("SERVER:Hanf_UpdateHanfData", JsonConvert.SerializeObject(cannabisData)); + //player.SetSharedData("hanfData", JsonConvert.SerializeObject(cannabisData)); + player.TriggerEvent("SERVER:Hanf_UpdateHanfData"); } [RemoteEvent("CLIENT:Hanf_BuySeeds")]