sync levi, maybe fix pyramid boss rewards, fix worms error, dont sync tower wands in generation

This commit is contained in:
bgkillas 2024-11-23 10:21:57 -05:00
parent 7f13a03d85
commit b8e16e1f1f
5 changed files with 35 additions and 7 deletions

View file

@ -92,12 +92,21 @@ function inventory_helper.serialize_single_item(item)
if vel and vel ~= 0 then
vx, vy = ComponentGetValue2(vel, "mVelocity")
end
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
if sprite ~= nil then
sprite = ComponentGetValue2(sprite, "image_file")
local sprite_com = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
local animation
local sprite
if sprite_com ~= nil and sprite_com ~= 0 then
sprite = ComponentGetValue2(sprite_com, "image_file")
animation = ComponentGetValue2(sprite_com, "rect_animation")
end
local shoot_pos = {}
local hotspot = EntityGetFirstComponentIncludingDisabled(item, "HotspotComponent")
if hotspot ~= nil and hotspot ~= 0 then
shoot_pos[1], shoot_pos[2] = ComponentGetValue2(hotspot, "offset")
end
local varp = EntityGetFilename(item) == "data/entities/items/wand_varpuluuta.xml"
item_data = {true, wand:Serialize(true, true), x, y, extra, is_new, {vx, vy}, sprite, image_inv, varp}
item_data = {true, wand:Serialize(true, true), x, y, extra, is_new, {vx, vy},
sprite, image_inv, varp, shoot_pos, animation}
else
item_data = {false, util.serialize_entity(item), x, y}
end
@ -121,9 +130,17 @@ function inventory_helper.deserialize_single_item(item_data)
local vx, vy = item_data[7][1], item_data[7][2]
local image = item_data[8]
local image_inv = item_data[9]
local shoot_pos = item_data[11]
local animation = item_data[12]
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
if sprite ~= nil then
ComponentSetValue2(sprite, "image_file", image)
ComponentSetValue2(sprite, "rect_animation", animation)
ComponentSetValue2(sprite, "next_rect_animation", animation)
end
local hotspot = EntityGetFirstComponentIncludingDisabled(item, "HotspotComponent")
if hotspot ~= nil then
ComponentSetValue2(hotspot, "offset", shoot_pos[1], shoot_pos[2])
end
if item_data[10] then
local varp = EntityCreateNew()

View file

@ -117,6 +117,9 @@ local function get_sync_entities(return_all)
table_extend(entities, EntityGetWithTag("seed_c"))
table_extend(entities, EntityGetWithTag("perk_fungus_tiny"))
table_extend(entities, EntityGetWithTag("helpless_animal"))
table_extend_filtered(entities, EntityGetWithTag("touchmagic_immunity"), function(ent)
return EntityGetName(ent) == "$animal_fish_giga"
end)
table_extend_filtered(entities, EntityGetWithTag("prop_physics"), function (ent)
local f = EntityGetFilename(ent)
if f ~= nil then
@ -659,7 +662,10 @@ function rpc.handle_death_data(death_data)
end
EntityInflictDamage(enemy_id, 1000000000, "DAMAGE_CURSE", "", "NONE", 0, 0, responsible_entity) -- Just to be sure
EntityKill(enemy_id)
async(function()
wait(1)
EntityKill(enemy_id)
end)
end
::continue::
end

View file

@ -27,6 +27,10 @@ local function is_sync_item(ent_path)
if exclude[ent_path] then
return false
end
local good = "data/entities/items/wands/wand_good"
if string.sub(ent_path, 1, #good) == good then
return false
end
local start = "data/entities/items/"
if string.sub(ent_path, 1, #start) == start then
return true

View file

@ -4,7 +4,7 @@ local function get_closest_alive(x, y)
local min_dist
local min_ent
for _, player in pairs(ctx.players) do
if player.status.is_alive then
if not EntityHasTag(player.entity, "ew_notplayer") then
local tx, ty = EntityGetTransform(player.entity)
local dx, dy = tx - x, ty - y
local dist = dx * dx + dy * dy

View file

@ -26,7 +26,8 @@ constants = dofile_once("mods/quant.ew/files/core/constants.lua")
local perk_fns = dofile_once("mods/quant.ew/files/core/perk_fns.lua")
local version = dofile_once("mods/quant.ew/files/version.lua") or "unknown (dev build)"
local version = ModDoesFileExist("mods/quant.ew/files/version.lua") and dofile_once("mods/quant.ew/files/version.lua")
or "unknown (dev build)"
print("Noita EW version: "..version)
dofile_once("data/scripts/lib/coroutines.lua")