-
-
Notifications
You must be signed in to change notification settings - Fork 418
Update Leash Syntax To Entity #8413
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
Open
tibisabau
wants to merge
6
commits into
SkriptLang:dev/feature
Choose a base branch
from
tibisabau:feature/update-leash-syntax-entities
base: dev/feature
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+118
−36
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
275afc1
Update Leash Syntax To Entity
tibisabau 8689286
Improve Leash Syntax and Tests
tibisabau 8ba46e8
Update Leash Classes and Tests
tibisabau 69fd024
Update Since and Tests
tibisabau 7a3cbfa
Update self-leash test and Since annotation
tibisabau 09e4ab8
Update since
tibisabau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
src/main/java/ch/njol/skript/expressions/ExprLeashHolder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| test "is leashed condition": | ||
| spawn a wolf at test-location | ||
| set {_wolf} to last spawned entity | ||
| assert {_wolf} is not leashed with "wolf should not be leashed initially" | ||
| assert {_wolf} isn't leashed with "wolf should not be leashed initially (alternate syntax)" | ||
| clear entity within {_wolf} | ||
|
|
||
| spawn an armor stand at test-location | ||
| set {_stand} to last spawned entity | ||
| assert {_stand} is not leashed with "non-leashable entity should return false for is leashed" | ||
| clear entity within {_stand} | ||
|
|
||
| spawn a wolf at test-location | ||
| set {_leash_holder} to last spawned entity | ||
| spawn a wolf at test-location | ||
| set {_wolf} to last spawned entity | ||
| assert {_wolf} is not leashed with "wolf should not be leashed initially" | ||
| leash {_wolf} to {_leash_holder} | ||
| assert {_wolf} is leashed with "wolf should be leashed after leashing" | ||
| unleash {_wolf} | ||
| assert {_wolf} is not leashed with "wolf should not be leashed after unleashing" | ||
| clear entity within {_wolf} | ||
| clear entity within {_leash_holder} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| test "leash effect": | ||
| spawn a wolf at test-location | ||
| set {_leash_holder} to last spawned entity | ||
| spawn a wolf at test-location | ||
| set {_wolf} to last spawned entity | ||
| assert {_wolf} is not leashed with "wolf should not be leashed initially" | ||
| leash {_wolf} to {_leash_holder} | ||
| assert {_wolf} is leashed with "wolf should be leashed after leash effect" | ||
| assert leash holder of {_wolf} is {_leash_holder} with "wolf should be leashed to the correct entity" | ||
| unleash {_wolf} | ||
| assert {_wolf} is not leashed with "wolf should be unleashed after unleash effect" | ||
| clear entity within {_wolf} | ||
| clear entity within {_leash_holder} | ||
|
|
||
| spawn a wolf at test-location | ||
| set {_leash_holder} to last spawned entity | ||
| spawn 3 wolves at test-location | ||
| assert size of all wolves >= 4 with "at least 4 wolves should be spawned" | ||
| leash all wolves to {_leash_holder} | ||
| loop all wolves: | ||
| if loop-entity is not {_leash_holder}: | ||
| assert loop-entity is leashed with "all wolves (except holder) should be leashed" | ||
| assert leash holder of loop-entity is {_leash_holder} with "all wolves should be leashed to the correct entity" | ||
| unleash all wolves | ||
| loop all wolves: | ||
| assert loop-entity is not leashed with "all wolves should be unleashed" | ||
| clear all entities | ||
|
|
||
| # Test leashing entity to itself | ||
| spawn a wolf at test-location | ||
| set {_self} to last spawned entity | ||
| leash {_self} to {_self} | ||
| # Check if self-leashing is supported by the Leashable API | ||
| if {_self} is leashed: | ||
| assert leash holder of {_self} is {_self} with "if self-leashing works, holder should be itself" | ||
|
Comment on lines
+33
to
+35
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a bit iffy, we should really be checking exact versions it should work on. |
||
| clear entity within {_self} | ||
20 changes: 20 additions & 0 deletions
20
src/test/skript/tests/syntaxes/expressions/ExprLeashHolder.sk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| test "leash holder expression": | ||
| spawn a wolf at test-location | ||
| set {_leash_holder} to last spawned entity | ||
| spawn a wolf at test-location | ||
| set {_wolf} to last spawned entity | ||
| assert {_wolf} is not leashed with "wolf should not be leashed initially" | ||
| assert leash holder of {_wolf} is not set with "leash holder should not be set initially" | ||
| leash {_wolf} to {_leash_holder} | ||
| assert {_wolf} is leashed with "wolf should be leashed after leashing" | ||
| assert leash holder of {_wolf} is set with "leash holder should be set after leashing" | ||
| assert leash holder of {_wolf} is {_leash_holder} with "leash holder should be the entity it was leashed to" | ||
| unleash {_wolf} | ||
| assert leash holder of {_wolf} is not set with "leash holder should not be set after unleashing" | ||
| clear entity within {_wolf} | ||
| clear entity within {_leash_holder} | ||
|
|
||
| spawn an armor stand at test-location | ||
| set {_stand} to last spawned entity | ||
| assert leash holder of {_stand} is not set with "non-leashable entity should return null for leash holder" | ||
| clear entity within {_stand} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.