fix some errors, unbreak kolmi probably

This commit is contained in:
bgkillas 2024-10-12 15:55:00 -04:00
parent 6e7a2257b0
commit 4ae00e000d
4 changed files with 14 additions and 6 deletions

View file

@ -157,7 +157,7 @@ function inventory_helper.deserialize_single_item(item_data)
ComponentSetValue2(item_cost_component, "cost", item_data.shop_info[1])
if item_data.gid == nil then
ComponentSetValue2(item_cost_component, "stealable", false)
print("ERROR: why is ".. item_data.shop_info .. " gid nil" .. " item")
print("ERROR: why is ".. tostring(item) .. " gid nil")
elseif string.sub(item_data.gid, 1, 16) ~= ctx.my_id then
ComponentSetValue2(item_cost_component, "stealable", false)
else

View file

@ -367,6 +367,9 @@ local function sync_enemy(enemy_info_raw, force_no_cull)
local x, y = en_data.x, en_data.y
if not force_no_cull and not dont_cull then
local my_x, my_y = EntityGetTransform(ctx.my_player.entity)
if my_x == nil then
goto continue
end
local c_x, c_y = GameGetCameraPos()
local dx, dy = my_x - x, my_y - y
local cdx, cdy = c_x - x, c_y - y

View file

@ -129,10 +129,6 @@ ctx.cap.item_sync.register_pickup_handler(function(item_id)
GameAddFlagRun("ew_sampo_picked")
dofile("data/entities/animals/boss_centipede/sampo_pickup.lua")
item_pickup(item_id)
local newgame_n = tonumber( SessionNumbersGetValue("NEW_GAME_PLUS_COUNT") )
local orbcount = GameGetOrbCountThisRun() + newgame_n
rpc.kolmi_shield(true, orbcount)
rpc.init_boss(orbcount)
local x, y = EntityGetTransform(ctx.my_player.entity)
if not is_in_box(1530, 4130, 12300, 13300, x, y) then
async(function()
@ -142,6 +138,13 @@ ctx.cap.item_sync.register_pickup_handler(function(item_id)
EntitySetTransform(ctx.my_player.entity, x, y)
end)
end
async(function()
wait(10) -- Wait a bit for enemy sync to do it's thing.
local newgame_n = tonumber( SessionNumbersGetValue("NEW_GAME_PLUS_COUNT") )
local orbcount = GameGetOrbCountThisRun() + newgame_n
rpc.kolmi_shield(true, orbcount)
rpc.init_boss(orbcount)
end)
end
end
end)

View file

@ -4,7 +4,9 @@ ModLuaFileAppend("data/scripts/animals/wand_charm.lua", "mods/quant.ew/files/sys
rpc.opts_reliable()
function rpc.charm(gid)
local item = item_sync.find_by_gid(gid)
EntityAddComponent2(item, "LuaComponent", {script_source_file = "mods/quant.ew/files/system/wand_charm/charm.lua", remove_after_executed = true})
if item ~= nil then
EntityAddComponent2(item, "LuaComponent", {script_source_file = "mods/quant.ew/files/system/wand_charm/charm.lua", remove_after_executed = true})
end
end
np.CrossCallAdd("ew_charm_sync", function(id)
local gid = EntityGetFirstComponentIncludingDisabled(id, "VariableStorageComponent", "ew_global_item_id")