Show job blips on edge when off of screen

This commit is contained in:
Vortrex
2023-03-02 08:09:14 -06:00
parent 453a946a1c
commit 868bb10091
2 changed files with 20 additions and 3 deletions

View File

@@ -593,4 +593,20 @@ function setLocalPlayerMoney(amount) {
updateLocalPlayerMoney();
}
// ===========================================================================
// ===========================================================================
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;
}