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

Addition of missing and utility unit & item natives. #81

Merged
merged 4 commits into from Jun 4, 2018

Conversation

Projects
None yet
2 participants
@crojewsk
Copy link
Contributor

crojewsk commented Jun 1, 2018

Following extension methods have been defined:

  • public function unit.dropItemPoint(item itm, real x, real y) returns boolean

  • public function unit.dropItemSlot(item itm, int slot) returns boolean

  • public function unit.dropItemTarget(item itm, widget target) returns boolean

  • public function unit.useItem(item itm) returns boolean

  • public function unit.useItemPoint(item itm, real x, real y) returns boolean

  • public function unit.useItemTarget(item itm, widget target) returns boolean

  • public function item.isAlive() returns boolean

  • public function item.isPickupable() returns boolean

Addition of missing and utility unit & item natives.
Following extension methods have been defined:

- public function unit.dropItemPoint(item itm, real x, real y) returns boolean
- public function unit.dropItemSlot(item itm, int slot) returns boolean
- public function unit.dropItemTarget(item itm, widget target) returns boolean
- public function unit.useItem(item itm) returns boolean
- public function unit.useItemPoint(item itm, real x, real y) returns boolean
- public function unit.useItemTarget(item itm, widget target) returns boolean

- public function item.isAlive() returns boolean
- public function item.isPickupable() returns boolean
@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Jun 1, 2018

use vec2 where u are using x y

@@ -65,6 +65,12 @@ public function item.isSellable() returns boolean
public function item.isPawnable() returns boolean
return IsItemPawnable(this)

public function item.isAlive() returns boolean

This comment has been minimized.

@Frotty

Frotty Jun 1, 2018

Member

add hotdoc for these custom functions please.

@crojewsk

This comment has been minimized.

Copy link
Contributor Author

crojewsk commented Jun 1, 2018

I hope next time I get those two comments of yours in a single one ;X

@@ -65,6 +65,14 @@ public function item.isSellable() returns boolean
public function item.isPawnable() returns boolean
return IsItemPawnable(this)

/** Verifies whether item is not destroyed and has a valid type id. */

This comment has been minimized.

@Frotty

Frotty Jun 3, 2018

Member

I believe "verify" is the wrong word to use in both of these functions.
They don't verify anything. Better change to something like:
Returns true if the item is not destroyed and has a valid type id
Returns true if the item can be picked up by a unit at this moment

This comment has been minimized.

@crojewsk

crojewsk Jun 3, 2018

Author Contributor

Checking if item's life is greater than specified amount (.405) equals to item's alive status verification.
"verify" substitute, "check" is used in plenty : )

This comment has been minimized.

@Frotty

Frotty Jun 3, 2018

Member

I still think isPickupable is a bit ambiguous to an item being pickupable by units in general, instead of being pickuable in its current state : )
But I guess it's fine.

@Frotty Frotty merged commit 03b5d14 into wurstscript:master Jun 4, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Frotty

This comment has been minimized.

Copy link
Member

Frotty commented Jun 4, 2018

👍

@crojewsk crojewsk deleted the crojewsk:item-related_natives branch Jun 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment