Skip to content

Commit a984a38

Browse files
committed
fix some minor notplayer issues
1 parent bfb0808 commit a984a38

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

quant.ew/files/system/notplayer_ai/notplayer_ai.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,13 @@ local function aim_at(world_x, world_y)
468468
else
469469
local arm = EntityGetAllChildren(ctx.my_player.entity, "player_arm_r")[1]
470470
local ch_x, ch_y = EntityGetHotspot(arm, "hand", true)
471-
local dx, dy = world_x - ch_x, world_y - ch_y
471+
local dx, dy = math.min(world_x - ch_x, 300), math.min(world_y - ch_y, 300)
472472

473473
local dist = math.sqrt(dx * dx + dy * dy)
474474

475475
ComponentSetValue2(state.control_component, "mAimingVector", dx, dy)
476476

477-
ComponentSetValue2(state.control_component, "mMousePosition", world_x, world_y)
477+
ComponentSetValue2(state.control_component, "mMousePosition", ch_x + dx, ch_y + dy)
478478

479479
if dist > 0 then
480480
-- ComponentSetValue2(state.control_component, "mAimingVectorNonZeroLatest", dx, dy)
@@ -1660,4 +1660,4 @@ function module.on_world_update()
16601660
end
16611661
end
16621662

1663-
return module
1663+
return module

0 commit comments

Comments
 (0)