[BEHAVIOR] EasyStar.js pathfinding for tilemap

Post your completed addons to share with the community

Post » Wed Apr 29, 2015 1:05 pm

newt wrote:Its breaking nw.js with minification.

Probably has something to do with the fact that I used an external JS file. I'll investigate further when I get the chance to !
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Apr 29, 2015 2:22 pm

Ok thanks!
This plugs perfect for what Im trying.
Image ImageImage
B
169
S
50
G
170
Posts: 8,291
Reputation: 108,726

Post » Wed Apr 29, 2015 3:52 pm

According to this, I'd have to create an extern definition file and supply it to the command line when calling the minifying module. However, we have no control on how the module is called, so I guess it's tough luck for minifying when using an external library. However, you could probably incorporate the JS file of the library inside the runtime.js and remove the dependency inside the edittime.js, and hopefully let the closure compiler do its magic withtout breaking anything...
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Apr 29, 2015 4:03 pm

How do you do that before it gets compiled?
I mean the runtime gets created and then minified in basically the same step.
Image ImageImage
B
169
S
50
G
170
Posts: 8,291
Reputation: 108,726

Post » Wed Apr 29, 2015 4:16 pm

Oh, I meant the runtime and edittime of the behavior. There's an external file called easystar-0.1.13.js, I think that by copying all its content over to the runtime.js of the behavior, it should allow the minification to perform without breaking anything. The "dependency" inside the plugin setting (edittime.js) should also be removed.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Apr 29, 2015 5:06 pm

Change
this.easystarjs.enableDiagonals();

to
this.easystarjs["enableDiagonals"]();

for example. i.e. change the style of the name in external js call.
Then the name would not be minify.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

Post » Wed Apr 29, 2015 5:16 pm

Hope its an easy fix.
Heres a icon to use for the effort:
https://dl.dropboxusercontent.com/u/666 ... inIcon.ico
Image ImageImage
B
169
S
50
G
170
Posts: 8,291
Reputation: 108,726

Post » Wed Apr 29, 2015 8:21 pm

rexrainbow wrote:Change
this.easystarjs.enableDiagonals();

to
this.easystarjs["enableDiagonals"]();

for example. i.e. change the style of the name in external js call.
Then the name would not be minify.

@rexrainbow I see, should be a simple enough fix. How about the actual instanciation of the easystarjs, will the compiler break the "new EasyStar.js()" call ?

edit: Nevermind, obviously I had to use the same notation as you said, and go with "new EasyStar["js"]()"

@newt Behavior files were updated with the quick fix, it seems to work as intended now when you minify.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Thu Apr 30, 2015 12:38 am

nice.. cool behavior...thanks for sharing!
B
97
S
32
G
16
Posts: 1,200
Reputation: 16,682

Post » Thu Apr 30, 2015 12:43 am

@Magistross

I would use
new window["EasyStar"]["js"]();
to ensure the name would not be minify.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 7 guests