Skip to content

Commit a164448

Browse files
gps: Removed redundant word and removeLinePoints function returns true/false (#523)
* Added description and new export functions * Check whether parameters can be converted to numbers and convert them * Check whether parameters can be converted to numbers and convert them * Added spacing in the text in some places * Fixed warning that posX and posY was defined before * Fixed spacing * Few text improvements in meta.xml * removeLinePoints function returns true/false * Removed redundant word * Adjusted description removeLinePoints function * Fixed that when addLinePoint was called multiple times without deleting the previous points at different paths, not all drawn lines of the client HUD mini map were removed * Increased version --------- Co-authored-by: Dutchman101 <12105539+Dutchman101@users.noreply.github.com>
1 parent 6189fc1 commit a164448

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

[gameplay]/gps/linedrawer.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ local linePoints = { }
1010
local renderStuff = { }
1111

1212
function removeLinePoints ( )
13+
if not next(linePoints) then
14+
return false
15+
end
1316
linePoints = { }
1417
for name, data in pairs ( renderStuff ) do
1518
unloadTile ( name )
1619
end
20+
return true
1721
end
1822

1923
function addLinePoint ( posX, posY )

[gameplay]/gps/meta.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<meta>
2-
<info author="arc_" type="script" version="1.1.0" description="Calculates and displays the quickest road path between two points/nodes on the map. Commands: /path node1 node2 /path2 x y [z]. Resource contains export functions for custom logic."/>
2+
<info author="arc_" type="script" version="1.1.1" description="Calculates and displays the quickest road path between two points/nodes on the map. Commands: /path node1 node2 /path2 x y [z]. Resource contains export functions for custom logic."/>
33

44
<script src="util.lua" type="client"/>
55
<script src="client.lua" type="client"/>
@@ -22,9 +22,9 @@
2222
Function returns true if successful otherwise false.
2323
Draws the path on the client HUD mini map in ascending order. For example, if you use the table returned by the calculatePathByCoords
2424
or calculatePathByNodeIDs function.
25-
If you add your own line points points they must be very close to each other, otherwise the path will not be drawn properly.-->
25+
If you add your own line points they must be very close to each other, otherwise the path will not be drawn properly.-->
2626
<export function="removeLinePoints" type="client"/> <!--removeLinePoints()
27-
Function returns nil.
27+
Function returns true if the drawn lines of the client HUD mini map were removed otherwise false if there was nothing to remove.
2828
Removes the line points of the addLinePoint function respectively the drawn lines of the client HUD mini map.
2929
This can be used, for example, when the target node point has been reached or a player gets out of the vehicle.-->
3030
</meta>

0 commit comments

Comments
 (0)