Show job blips on edge when off of screen
This commit is contained in:
@@ -14,7 +14,7 @@ let jobRouteLocationSphere = null;
|
|||||||
let jobRouteLocationRadius = 5.0;
|
let jobRouteLocationRadius = 5.0;
|
||||||
|
|
||||||
let jobRouteLocationIndicatorPosition = toVector3(0.0, 0.0, 0.0);
|
let jobRouteLocationIndicatorPosition = toVector3(0.0, 0.0, 0.0);
|
||||||
let jobRouteLocationIndicatorSize = [32, 32];
|
let jobRouteLocationIndicatorSize = toVector2(32, 32);
|
||||||
let jobRouteLocationIndicatorEnabled = false;
|
let jobRouteLocationIndicatorEnabled = false;
|
||||||
let jobRouteLocationIndicatorImagePath = "files/images/icons/objective-icon.png";
|
let jobRouteLocationIndicatorImagePath = "files/images/icons/objective-icon.png";
|
||||||
let jobRouteLocationIndicatorImage = null;
|
let jobRouteLocationIndicatorImage = null;
|
||||||
@@ -288,7 +288,8 @@ function processJobLocationIndicatorRendering() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let screenPosition = getScreenFromWorldPosition(jobRouteLocationIndicatorPosition);
|
let screenPosition = getScreenFromWorldPosition(jobRouteLocationIndicatorPosition);
|
||||||
graphics.drawRectangle(jobRouteLocationIndicatorImage, [screenPosition.x - (jobRouteLocationIndicatorSize[0] / 2), screenPosition.y - (jobRouteLocationIndicatorSize[1] / 2)], [jobRouteLocationIndicatorSize[0], jobRouteLocationIndicatorSize[1]]);
|
screenPosition = fixOffScreenPosition(screenPosition, jobRouteLocationIndicatorSize);
|
||||||
|
graphics.drawRectangle(jobRouteLocationIndicatorImage, [screenPosition.x - (jobRouteLocationIndicatorSize.x / 2), screenPosition.y - (jobRouteLocationIndicatorSize.y / 2)], [jobRouteLocationIndicatorSize.x, jobRouteLocationIndicatorSize.y]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -594,3 +594,19 @@ function setLocalPlayerMoney(amount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function fixOffScreenPosition(position, margin = toVector2(0.0, 0.0)) {
|
||||||
|
if (position.x <= 0) {
|
||||||
|
position.x = 0.0 + (margin.x / 2);
|
||||||
|
} else if (position.x > game.width) {
|
||||||
|
position.x = game.width - (margin.x / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position.y <= 0) {
|
||||||
|
position.y = 0.0 + (margin.y / 2);
|
||||||
|
} else if (position.y > game.height) {
|
||||||
|
position.y = game.height - (margin.y / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user