@@ -124,6 +124,7 @@ function Create(self)
124
124
self .toAutoBuild = false ;
125
125
self .operatedByAI = false ;
126
126
self .cursorMoveSpeed = 2 ;
127
+ self .maxCursorDist = Vector (FrameMan .PlayerScreenWidth * 0.5 - 6 , FrameMan .PlayerScreenHeight * 0.5 - 6 );
127
128
128
129
-- autobuild for standard units
129
130
self .autoBuildList = {
@@ -426,8 +427,6 @@ function Update(self)
426
427
end
427
428
428
429
if self .cursor then
429
-
430
- actor .ViewPoint = self .cursor ;
431
430
432
431
local cursorMovement = Vector ();
433
432
local mouseControlled = ctrl :IsMouseControlled ();
@@ -472,6 +471,14 @@ function Update(self)
472
471
PrimitiveMan :DrawLinePrimitive (screen , self .cursor + Vector (4 , 0 ), self .cursor + Vector (- 4 , 0 ), displayColorYellow );
473
472
end
474
473
PrimitiveMan :DrawBoxPrimitive (screen , map , map + Vector (self .blockSize - 1 , self .blockSize - 1 ), displayColorYellow );
474
+
475
+ local dist = SceneMan :ShortestDistance (actor .ViewPoint , self .cursor , SceneMan .SceneWrapsX );
476
+ if math.abs (dist .X ) > self .maxCursorDist .X then
477
+ self .cursor .X = actor .ViewPoint .X + self .maxCursorDist .X * (dist .X < 0 and - 1 or 1 );
478
+ end
479
+ if math.abs (dist .Y ) > self .maxCursorDist .Y then
480
+ self .cursor .Y = actor .ViewPoint .Y + self .maxCursorDist .Y * (dist .Y < 0 and - 1 or 1 );
481
+ end
475
482
476
483
if ctrl :IsState (Controller .PIE_MENU_ACTIVE ) or ctrl :IsState (Controller .ACTOR_NEXT_PREP ) or ctrl :IsState (Controller .ACTOR_PREV_PREP ) then
477
484
self .cursor = nil ;
0 commit comments