Skip to content

Commit a5f8da6

Browse files
committed
fix pickup radius of wands, try to make spells not slip into walls
1 parent 5de4cab commit a5f8da6

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

ewext/src/modules/entity_sync/diff_model.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,19 @@ impl LocalDiffModelTracker {
297297
(info.vx, info.vy) = vel.m_velocity()?;
298298
}
299299

300+
if entity.has_tag("card_action") {
301+
if let Some(vel) = entity.try_get_first_component::<VelocityComponent>(None)? {
302+
let (cx, cy) = noita_api::raw::game_get_camera_pos()?;
303+
if (cx as f32 - x).powi(2) + (cy as f32 - y).powi(2) > 256.0 * 256.0 {
304+
vel.set_gravity_y(0.0)?;
305+
vel.set_air_friction(10.0)?;
306+
} else {
307+
vel.set_gravity_y(400.0)?;
308+
vel.set_air_friction(0.55)?;
309+
}
310+
}
311+
}
312+
300313
if let Some(damage) = entity.try_get_first_component::<DamageModelComponent>(None)? {
301314
let hp = damage.hp()?;
302315
info.hp = hp as f32;
@@ -588,6 +601,13 @@ impl LocalDiffModel {
588601
var.set_value_int(i32::from_le_bytes(lid.0.to_le_bytes()))?;
589602
var.set_value_bool(true)?;
590603

604+
if entity.has_tag("card_action") {
605+
if let Some(vel) = entity.try_get_first_component::<VelocityComponent>(None)? {
606+
vel.set_gravity_y(0.0)?;
607+
vel.set_air_friction(10.0)?;
608+
}
609+
}
610+
591611
if entity
592612
.try_get_first_component::<BossDragonComponent>(None)?
593613
.is_some()

quant.ew/files/system/explosion_cuts/explosion_cuts.lua

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,6 @@ function mod.on_world_update()
226226
for ent = last + 1, n do
227227
if EntityGetIsAlive(ent) then
228228
update(ent, 1)
229-
local com = EntityGetFirstComponentIncludingDisabled(ent, "AbilityComponent")
230-
if com ~= nil and ComponentGetValue2(com, "use_gun_script") then
231-
com = EntityGetFirstComponentIncludingDisabled(ent, "ItemComponent")
232-
if com ~= nil then
233-
ComponentSetValue2(com, "item_pickup_radius", 256)
234-
end
235-
end
236229
end
237230
end
238231
if exists then

quant.ew/files/system/orb_sync/orb_sync.lua

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,33 @@ end
6060
local last = 0
6161

6262
function module.on_world_update()
63-
if GameGetFrameNum() % 4 == 3 then
64-
local found_local = orbs_found_this_run()
65-
local n = EntitiesGetMaxID()
66-
for ent = last + 1, n do
67-
if EntityGetIsAlive(ent) then
68-
local comp = EntityGetFirstComponent(ent, "OrbComponent")
69-
if comp ~= nil then
70-
local orb = ComponentGetValue2(comp, "orb_id")
71-
if table.contains(found_local, orb) then
72-
EntityKill(ent)
73-
end
74-
elseif EntityGetFilename(ent) == "data/entities/base_item.xml" then
63+
local found_local = orbs_found_this_run()
64+
local n = EntitiesGetMaxID()
65+
for ent = last + 1, n do
66+
if EntityGetIsAlive(ent) then
67+
local comp = EntityGetFirstComponent(ent, "OrbComponent")
68+
if comp ~= nil then
69+
local orb = ComponentGetValue2(comp, "orb_id")
70+
if table.contains(found_local, orb) then
7571
EntityKill(ent)
7672
end
73+
elseif EntityGetFilename(ent) == "data/entities/base_item.xml" then
74+
EntityKill(ent)
75+
end
76+
local com = EntityGetFirstComponentIncludingDisabled(ent, "AbilityComponent")
77+
if com ~= nil and ComponentGetValue2(com, "use_gun_script") then
78+
com = EntityGetFirstComponentIncludingDisabled(ent, "ItemComponent")
79+
if com ~= nil then
80+
ComponentSetValue2(com, "item_pickup_radius", 256)
81+
end
7782
end
7883
end
79-
last = n
8084
end
85+
last = n
8186
if wait_for_these ~= nil and not EntityHasTag(ctx.my_player.entity, "polymorphed") then
8287
actual_orbs_update(wait_for_these)
8388
wait_for_these = nil
84-
elseif last_orb_count ~= GameGetOrbCountThisRun() or GameGetFrameNum() % (60 * 60) == 20 then
89+
elseif last_orb_count ~= GameGetOrbCountThisRun() or GameGetFrameNum() % (60 * 5) == 23 then
8590
last_orb_count = GameGetOrbCountThisRun()
8691
rpc.update_orbs(orbs_found_this_run())
8792
end

0 commit comments

Comments
 (0)