mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix end fight, try to make end fight less laggy, sync angry ghost position, maybe fix shops with dedup off,
This commit is contained in:
parent
adbf6c6a63
commit
343e48a362
5 changed files with 78 additions and 6 deletions
62
quant.ew/data/scripts/animals/tiny_ghost_move.lua
Normal file
62
quant.ew/data/scripts/animals/tiny_ghost_move.lua
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
dofile_once("data/scripts/lib/utilities.lua")
|
||||||
|
|
||||||
|
local lerp_amount = 0.975
|
||||||
|
local bob_h = 6
|
||||||
|
local bob_w = 20
|
||||||
|
local bob_speed_y = 0.065
|
||||||
|
local bob_speed_x = 0.01421
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local pos_x, pos_y = EntityGetTransform( entity_id )
|
||||||
|
|
||||||
|
if pos_x == 0 and pos_y == 0 then
|
||||||
|
-- get position from wand when starting
|
||||||
|
pos_x, pos_y = EntityGetTransform(EntityGetParent(entity_id))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ghost continously lerps towards a target that floats around the parent
|
||||||
|
local target_x, target_y = EntityGetTransform(EntityGetParent(entity_id))
|
||||||
|
if target_x == nil then return end
|
||||||
|
target_y = target_y - 10
|
||||||
|
|
||||||
|
local time = CrossCall("ew_host_frame_num")
|
||||||
|
local r
|
||||||
|
local var_rnd = EntityGetFirstComponentIncludingDisabled(entity_id, "VariableStorageComponent", "ew_ghost_rnd")
|
||||||
|
if var_rnd == nil then
|
||||||
|
r = ProceduralRandomf(entity_id, 0, -1, 1)
|
||||||
|
EntityAddComponent2(entity_id, "VariableStorageComponent", {_tags="ew_ghost_rnd", value_float = r})
|
||||||
|
else
|
||||||
|
r = ComponentGetValue(var_rnd, "value_float")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- randomize times and speeds slightly so that multiple ghosts don't fly identically
|
||||||
|
time = time + r * 10000
|
||||||
|
bob_speed_y = bob_speed_y + (r * bob_speed_y * 0.1)
|
||||||
|
bob_speed_x = bob_speed_x + (r * bob_speed_x * 0.1)
|
||||||
|
lerp_amount = lerp_amount - (r * lerp_amount * 0.01)
|
||||||
|
|
||||||
|
-- bob
|
||||||
|
target_y = target_y + math.sin(time * bob_speed_y) * bob_h
|
||||||
|
target_x = target_x + math.sin(time * bob_speed_x) * bob_w
|
||||||
|
|
||||||
|
local dist_x = pos_x - target_x
|
||||||
|
|
||||||
|
-- move towards target
|
||||||
|
pos_x,pos_y = vec_lerp(pos_x, pos_y, target_x, target_y, lerp_amount)
|
||||||
|
EntitySetTransform( entity_id, pos_x, pos_y, 0, 1, 1)
|
||||||
|
|
||||||
|
-- animation state
|
||||||
|
edit_component( entity_id, "SpriteComponent", function(comp,vars)
|
||||||
|
local current_anim = ComponentGetValue( comp, "rect_animation")
|
||||||
|
|
||||||
|
-- float when nearby and fly when further away
|
||||||
|
local mode = "float_"
|
||||||
|
if math.abs(dist_x) > 28 then mode = "fly_" end
|
||||||
|
|
||||||
|
-- check if changing the animation is needed based on current animation and heading
|
||||||
|
if dist_x < 2 and current_anim ~= mode.."right" then
|
||||||
|
ComponentSetValue( comp, "rect_animation", mode.."right")
|
||||||
|
elseif dist_x > 2 and current_anim ~= mode.."left" then
|
||||||
|
ComponentSetValue( comp, "rect_animation", mode.."left")
|
||||||
|
end
|
||||||
|
end)
|
|
@ -4,7 +4,9 @@ local ghost = {}
|
||||||
function rpc.send_ghost_data(ghosts_memory)
|
function rpc.send_ghost_data(ghosts_memory)
|
||||||
for i, entity in ipairs(EntityGetAllChildren(ctx.rpc_player_data.entity, "angry_ghost") or {}) do
|
for i, entity in ipairs(EntityGetAllChildren(ctx.rpc_player_data.entity, "angry_ghost") or {}) do
|
||||||
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
|
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
|
||||||
ComponentSetValue2(memory, "value_string", ghosts_memory[i])
|
ComponentSetValue2(memory, "value_string", ghosts_memory[i][1])
|
||||||
|
EntitySetTransform(entity, ghosts_memory[i][2], ghosts_memory[i][3])
|
||||||
|
ComponentSetValue2(EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "ew_ghost_rnd"), "value_float", ghosts_memory[i][4])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,7 +17,9 @@ function ghost.on_world_update()
|
||||||
local ghosts_memory = {}
|
local ghosts_memory = {}
|
||||||
for _, entity in ipairs(EntityGetAllChildren(ctx.my_player.entity, "angry_ghost") or {}) do
|
for _, entity in ipairs(EntityGetAllChildren(ctx.my_player.entity, "angry_ghost") or {}) do
|
||||||
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
|
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
|
||||||
table.insert(ghosts_memory, ComponentGetValue2(memory, "value_string"))
|
local x, y = EntityGetTransform(entity)
|
||||||
|
local rnd = ComponentGetValue2(EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "ew_ghost_rnd"), "value_float")
|
||||||
|
table.insert(ghosts_memory, {ComponentGetValue2(memory, "value_string"), x, y, rnd})
|
||||||
end
|
end
|
||||||
if #ghosts_memory ~= 0 then
|
if #ghosts_memory ~= 0 then
|
||||||
rpc.send_ghost_data(ghosts_memory)
|
rpc.send_ghost_data(ghosts_memory)
|
||||||
|
|
|
@ -156,9 +156,13 @@ function end_fight.on_world_update()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if init == -1 then
|
if init == -1 then
|
||||||
local x, y = EntityGetTransform(ctx.my_player.entity)
|
ModTextFileSetContent("data/entities/misc/loose_chunks.xml", "<Entity/>")
|
||||||
if is_in_box(5632, 7168, 14336, 15872, x, y) then
|
ModTextFileSetContent("data/entities/misc/loose_chunks_huge.xml", "<Entity/>")
|
||||||
|
ModTextFileSetContent("data/entities/projectiles/deck/crumbling_earth_effect.xml", "<Entity/>")
|
||||||
|
local _, y = EntityGetTransform(ctx.my_player.entity)
|
||||||
|
if y < 10414 then
|
||||||
stop_fully = true
|
stop_fully = true
|
||||||
|
return
|
||||||
end
|
end
|
||||||
np.MagicNumbersSetValue("STREAMING_CHUNK_TARGET", 6)
|
np.MagicNumbersSetValue("STREAMING_CHUNK_TARGET", 6)
|
||||||
if EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
if EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
||||||
|
|
|
@ -36,7 +36,7 @@ function add_funginess_level(entity_who_picked)
|
||||||
if peer_id ~= "DEBUG_NAME:player" then
|
if peer_id ~= "DEBUG_NAME:player" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local funginess = tonumber( GlobalsGetValue( "PLAYER_FUNGAL_LEVEL" .. peer_id, "0" ) )
|
local funginess = tonumber( GlobalsGetValue( "PLAYER_FUNGAL_LEVEL", "0" ) )
|
||||||
funginess = funginess + 1
|
funginess = funginess + 1
|
||||||
GlobalsSetValue( "PLAYER_FUNGAL_LEVEL", tostring( funginess ) )
|
GlobalsSetValue( "PLAYER_FUNGAL_LEVEL", tostring( funginess ) )
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,9 @@ local function load_modules()
|
||||||
ctx.load_system("essence_sync")
|
ctx.load_system("essence_sync")
|
||||||
ctx.load_system("spectate")
|
ctx.load_system("spectate")
|
||||||
ctx.load_system("effect_data_sync")
|
ctx.load_system("effect_data_sync")
|
||||||
ctx.load_system("gen_sync")
|
if ctx.proxy_opt.item_dedup then
|
||||||
|
ctx.load_system("gen_sync")
|
||||||
|
end
|
||||||
ctx.load_system("karl")
|
ctx.load_system("karl")
|
||||||
ctx.load_system("remove_wand_sound")
|
ctx.load_system("remove_wand_sound")
|
||||||
if ctx.proxy_opt.randomize_perks then
|
if ctx.proxy_opt.randomize_perks then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue