mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
sync ingestion
This commit is contained in:
parent
38eb84bd28
commit
43c24a8f3d
1 changed files with 9 additions and 3 deletions
|
@ -6,12 +6,16 @@ local rpc = net.new_rpc_namespace()
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
function rpc.send_money(money)
|
function rpc.send_money_and_ingestion(money, ingestion_size)
|
||||||
local entity = ctx.rpc_player_data.entity
|
local entity = ctx.rpc_player_data.entity
|
||||||
local wallet = EntityGetFirstComponentIncludingDisabled(entity, "WalletComponent")
|
local wallet = EntityGetFirstComponentIncludingDisabled(entity, "WalletComponent")
|
||||||
if wallet ~= nil then
|
if wallet ~= nil then
|
||||||
ComponentSetValue2(wallet, "money", money)
|
ComponentSetValue2(wallet, "money", money)
|
||||||
end
|
end
|
||||||
|
local ingestion = EntityGetFirstComponentIncludingDisabled(entity, "IngestionComponent")
|
||||||
|
if ingestion ~= nil then
|
||||||
|
ComponentSetValue2(ingestion, "ingestion_size", ingestion_size)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function rpc.player_update(input_data, pos_data, current_slot, team)
|
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
|
if GameGetFrameNum() % 60 == 47 then
|
||||||
local wallet = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "WalletComponent")
|
local wallet = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "WalletComponent")
|
||||||
if wallet ~= nil then
|
local ingestion = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "IngestionComponent")
|
||||||
rpc.send_money(ComponentGetValue2(wallet, "money"))
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue