item_sync capability.

This commit is contained in:
IQuant 2024-07-14 12:19:26 +03:00
parent 8a76a632cd
commit 6e4230c9c7
4 changed files with 28 additions and 1 deletions

View file

@ -20,4 +20,12 @@ Provided by:
- damage (shared health) system
Used by:
- heart pickups (core)
- heart pickups system
## 'item_sync' capability
Functions:
- `globalize(entity_id, instantly: bool)`
Provided by:
- item_sync system

View file

@ -1,3 +1,4 @@
-- Synchronizes item pickup and item drop
local inventory_helper = dofile_once("mods/quant.ew/files/src/inventory_helper.lua")
local ctx = dofile_once("mods/quant.ew/files/src/ctx.lua")
local net = dofile_once("mods/quant.ew/files/src/net.lua")
@ -210,5 +211,8 @@ function rpc.item_localize_req(gid)
item_sync.host_localize_item(gid, ctx.rpc_peer_id)
end
ctx.cap.item_sync = {
globalize = item_sync.make_item_global
}
return item_sync

View file

@ -0,0 +1,13 @@
local util = dofile_once("mods/quant.ew/files/src/util.lua")
local ctx = dofile_once("mods/quant.ew/files/src/ctx.lua")
local net = dofile_once("mods/quant.ew/files/src/net.lua")
local player_fns = dofile_once("mods/quant.ew/files/src/player_fns.lua")
local np = require("noitapatcher")
local rpc = net.new_rpc_namespace()
local module = {}
return module

View file

@ -57,6 +57,8 @@ local function load_modules()
if ctx.proxy_opt.player_tether == "true" then
ctx.dofile_and_add_hooks("mods/quant.ew/files/src/system/player_tether/player_tether.lua")
end
ctx.dofile_and_add_hooks("mods/quant.ew/files/src/system/kolmi/kolmi.lua")
end
function OnProjectileFired(shooter_id, projectile_id, initial_rng, position_x, position_y, target_x, target_y, send_message,