New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lightning handle package & hero attribute functions for units #42

Merged
merged 30 commits into from Jan 22, 2018

Conversation

Projects
None yet
2 participants
@Trokkin
Copy link
Contributor

Trokkin commented Jan 19, 2018

A simple wrappers on lightning handle using vec3/vec2 and color/colorA packages along with some utility wrappers for hero attributes.

Trokkin added some commits Nov 26, 2017

Merge pull request #1 from wurstscript/master
Update to current version
@Frotty
Copy link
Member

Frotty left a comment

Nice 👍

@@ -42,6 +42,24 @@ public function unit.addState( unitstate state, real value )

public function unit.addXp(int toAdd, boolean showEyeCandy)
AddHeroXP(this, toAdd, showEyeCandy)
public function unit.getStr(bool includeBonuses) returns int

This comment has been minimized.

@Frotty

Frotty Jan 19, 2018

Member

Leave empty lines between functions

return SetLightningColor(this, c.red / 255, c.green / 255, c.blue / 255, 1)

public function lightning.getColor() returns color
return color((255 * GetLightningColorR(this) + .5).toInt(), (255 * GetLightningColorG(this) + .5).toInt(), (255 * GetLightningColorB(this) + .5).toInt())

This comment has been minimized.

@Frotty

Frotty Jan 19, 2018

Member

should make extension funcs for getRed/getBlue etc. also I think

This comment has been minimized.

@Trokkin

Trokkin Jan 20, 2018

Author Contributor

I thought them would be bad to use,... ok then.

import Vectors
import Colors

public function addLightning(string codeName, bool checkVisibility, vec2 start, vec2 finish) returns lightning

This comment has been minimized.

@Frotty

Frotty Jan 19, 2018

Member

"finish" should probably be "end" on these functions.
Also what about adding all the default lightning strings in this package?

This comment has been minimized.

@Trokkin

Trokkin Jan 20, 2018

Author Contributor

I had trouble that "end" is a keyword so I can't use that name.
Well, ok, I'll do it if you mind not something like "_end"

@Trokkin

This comment has been minimized.

Copy link
Contributor Author

Trokkin commented Jan 20, 2018

This should work.
Also, hasn't nobody missed unit.getMaxMana() apart from me? I wonder how it hadn't been added before.

UPD: Uh, I don't know how can these changes suddenly break linkedlist tests D:
Offtopic: @Frotty, do you know how to increase limits for object descriptions? Cause I'm not happy having only ~512 characters for a hero description (anything more than that limit crashes wc3 on init).

import Vectors
import Colors

enum LightningType

This comment has been minimized.

@Frotty

Frotty Jan 20, 2018

Member

No, I ment simple string constants. an enum doesn't work since the user can define custom lightnings.

return s

/** Acts as with vec3 version but with z equal to terrain height. */
public function addLightning(LightningType lType, bool checkVisibility, vec2 start, vec2 _end) returns lightning

This comment has been minimized.

@Frotty

Frotty Jan 20, 2018

Member

I forgot "end" is keyword. I guess "stop" or "finish" or even "_end" is fine.

@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Jan 20, 2018

running build again seemed to have worked.
Not sure what you mean by object description. If you can't write more in editor I don't think it will work.

@Frotty Frotty self-assigned this Jan 20, 2018

@Trokkin

This comment has been minimized.

Copy link
Contributor Author

Trokkin commented Jan 21, 2018

By description I mean extended tooltip. Well, I believe I can, looking onto Dota heroes description. They're definitely larger than what I place in my descriptions.
It can be also that I use Cyrillic alphabet for that, but I feel like I saw maps in Russian that contained pretty much same length descriptions.
Also, do you remember a problem with my legacy map when it crashed because of one description that contained unknown symbol at the end? This seems to be similar to what I have, and I know that default world editor won't make the map crash on loading by any means, so I assume the root of the problem is somewhere in wurst obj editing core.
I should create an issue for wurstscript about that anyway.

import Vectors
import Colors

public constant string LIGHTNING_CHAIN_LIGHTNING_PRIMARY = "CLPB"

This comment has been minimized.

@Frotty

Frotty Jan 21, 2018

Member

omit "string" defs here. if you have "constant" it will infer the type.

@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Jan 21, 2018

@Trokkin yes, you should make a ticket then.
Please fix the last comment and I'll merge this. Thanks.

@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Jan 22, 2018

Sweet 🍭

@Frotty Frotty merged commit 445b93b into wurstscript:master Jan 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment