[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
62
S
26
G
24
Posts: 954
Reputation: 18,318

Post » Wed Apr 29, 2015 2:22 pm

Ok thanks!
This plugs perfect for what Im trying.
Image ImageImage
B
166
S
49
G
154
Posts: 8,106
Reputation: 100,233

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
62
S
26
G
24
Posts: 954
Reputation: 18,318

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
166
S
49
G
154
Posts: 8,106
Reputation: 100,233

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
62
S
26
G
24
Posts: 954
Reputation: 18,318

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
107
S
25
G
243
Posts: 4,387
Reputation: 137,466

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
166
S
49
G
154
Posts: 8,106
Reputation: 100,233

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
62
S
26
G
24
Posts: 954
Reputation: 18,318

Post » Thu Apr 30, 2015 12:38 am

nice.. cool behavior...thanks for sharing!
B
85
S
27
G
14
Posts: 1,121
Reputation: 14,650

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
107
S
25
G
243
Posts: 4,387
Reputation: 137,466

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests