From 43c24a8f3d3808958e8a7b9f64c3ba32fe483f51 Mon Sep 17 00:00:00 2001 From: bgkillas Date: Wed, 13 Nov 2024 16:56:49 -0500 Subject: [PATCH] sync ingestion --- quant.ew/files/system/player_sync.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quant.ew/files/system/player_sync.lua b/quant.ew/files/system/player_sync.lua index 1603652c..c4755aad 100644 --- a/quant.ew/files/system/player_sync.lua +++ b/quant.ew/files/system/player_sync.lua @@ -6,12 +6,16 @@ local rpc = net.new_rpc_namespace() local module = {} -function rpc.send_money(money) +function rpc.send_money_and_ingestion(money, ingestion_size) local entity = ctx.rpc_player_data.entity local wallet = EntityGetFirstComponentIncludingDisabled(entity, "WalletComponent") if wallet ~= nil then ComponentSetValue2(wallet, "money", money) end + local ingestion = EntityGetFirstComponentIncludingDisabled(entity, "IngestionComponent") + if ingestion ~= nil then + ComponentSetValue2(ingestion, "ingestion_size", ingestion_size) + end end function rpc.player_update(input_data, pos_data, current_slot, team) @@ -126,8 +130,10 @@ function module.on_world_update() if GameGetFrameNum() % 60 == 47 then local wallet = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "WalletComponent") - if wallet ~= nil then - rpc.send_money(ComponentGetValue2(wallet, "money")) + local ingestion = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "IngestionComponent") + if wallet ~= nil or ingestion ~= nil then + rpc.send_money_and_ingestion(wallet and ComponentGetValue2(wallet, "money"), + ingestion and ComponentGetValue2(ingestion, "ingestion_size")) end end end