mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Fix the weird item duplication thing.
This commit is contained in:
parent
0ff772c321
commit
7f90a21db1
4 changed files with 22 additions and 1 deletions
|
@ -8,4 +8,5 @@
|
||||||
- `ctx.hook.on_local_player_spawn(my_player)`
|
- `ctx.hook.on_local_player_spawn(my_player)`
|
||||||
- `ctx.hook.on_client_spawned(peer_id, new_playerdata)`
|
- `ctx.hook.on_client_spawned(peer_id, new_playerdata)`
|
||||||
- `ctx.hook.on_should_send_updates()` - called either when we connect, or somebody else connects (and sends "welcome" message)
|
- `ctx.hook.on_should_send_updates()` - called either when we connect, or somebody else connects (and sends "welcome" message)
|
||||||
|
- `ctx.hook.on_draw_debug_window(imgui)`
|
||||||
|
|
BIN
quant.ew/files/resource/debug/marker.png
Normal file
BIN
quant.ew/files/resource/debug/marker.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 B |
|
@ -104,6 +104,7 @@ function module.on_world_update_post()
|
||||||
show_game_effects()
|
show_game_effects()
|
||||||
end
|
end
|
||||||
-- imgui.Text("lalala")
|
-- imgui.Text("lalala")
|
||||||
|
ctx.hook.on_draw_debug_window(imgui)
|
||||||
imgui.End()
|
imgui.End()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,7 +120,7 @@ function item_sync.make_item_global(item, instant)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
item_sync.ensure_notify_component(item)
|
item_sync.ensure_notify_component(item)
|
||||||
local gid_component = EntityGetFirstComponent(item, "VariableStorageComponent", "ew_global_item_id")
|
local gid_component = EntityGetFirstComponentIncludingDisabled(item, "VariableStorageComponent", "ew_global_item_id")
|
||||||
local gid
|
local gid
|
||||||
if gid_component == nil then
|
if gid_component == nil then
|
||||||
gid = allocate_global_id()
|
gid = allocate_global_id()
|
||||||
|
@ -227,6 +227,25 @@ function item_sync.on_should_send_updates()
|
||||||
rpc.initial_items(item_list)
|
rpc.initial_items(item_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function item_sync.on_draw_debug_window(imgui)
|
||||||
|
local mx, my = DEBUG_GetMouseWorld()
|
||||||
|
local ent = EntityGetClosestWithTag(mx, my, "ew_global_item")
|
||||||
|
if ent ~= nil and ent ~= 0 then
|
||||||
|
if imgui.CollapsingHeader("Item gid") then
|
||||||
|
local x, y = EntityGetTransform(ent)
|
||||||
|
GameCreateSpriteForXFrames("mods/quant.ew/files/resource/debug/marker.png", x, y, true, 0, 0, 1, true)
|
||||||
|
local gid = item_sync.get_global_item_id(ent)
|
||||||
|
imgui.Text("GID: "..tostring(gid))
|
||||||
|
local prevented = ctx.item_prevent_localize[gid]
|
||||||
|
if prevented then
|
||||||
|
imgui.Text("Localize prevented")
|
||||||
|
else
|
||||||
|
imgui.Text("Localize allowed")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function add_stuff_to_globalized_item(item, gid)
|
local function add_stuff_to_globalized_item(item, gid)
|
||||||
EntityAddTag(item, "ew_global_item")
|
EntityAddTag(item, "ew_global_item")
|
||||||
item_sync.ensure_notify_component(item)
|
item_sync.ensure_notify_component(item)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue