Skip to content

ExprArmorSlot With EquipmentSlots #7906

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
wants to merge 5 commits into
base: dev/feature
Choose a base branch
from

Conversation

Absolutionism
Copy link
Contributor

Problem

The pattern for ExprArmorSlot was getting clunky and would become hard to follow for any other slots that would be added.

Solution

This PR revamps the pattern to allow EquipmentSlot to be used and multiple.
To reduce breaking changes, extra patterns were added to the types.equipment slots to reflect what was available in the prior pattern of ExprArmorSlot
Also adds support for the new saddle equipment slot.

Testing Completed

ExprArmorSlot.sk
Manual spawning of select entities to ensure the new saddle equipment slot would be visible on these entities for the restriction of getting saddle slots of entities that don't.

Supporting Information

N/A


Completes: none
Related: none

@Absolutionism Absolutionism requested a review from a team as a code owner May 31, 2025 04:18
@Absolutionism Absolutionism requested review from APickledWalrus and erenkarakal and removed request for a team May 31, 2025 04:18
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label May 31, 2025
@Absolutionism Absolutionism requested a review from sovdeeth May 31, 2025 06:06
@Absolutionism Absolutionism requested a review from sovdeeth May 31, 2025 06:28

static {
if (Material.getMaterial("WOLF_ARMOR") != null)
bodyEntities.add(Wolf.class);

register(ExprArmorSlot.class, Slot.class, "((boots:(boots|shoes)|leggings:leg[ging]s|chestplate:chestplate[s]|helmet:helmet[s]) [(item|:slot)]|armour:armo[u]r[s]|bodyarmor:body armo[u]r)", "livingentities");
register(ExprArmorSlot.class, Slot.class, "(%-*equipmentslots%|[the] armo[u]r[s]) [item:item[s]]", "livingentities");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little tenative to allow so few keywords here
%livingentities%'[s] %-*equipmentslots% and %-*equipmentslots% of %livingentities% are slightly scary but probably ok? @APickledWalrus any thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would conflict with ExprXOf if not for the literal requirement, so that's probably ok, but I worry there may be parsing slowdowns in there? Are the test parse/run times any noticeably different before/after?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the build timings I got:

dev/feature
	- quickTest: 55s
	- skriptTestJava17: 1m 5s
	- skriptTestJava21: 2m 29s
	- JUnitQuick: 25s
	- JUnitJava17: 30s
	- JUnitJava21: 1m 12s
		
ExprArmorSlot
	- quickTest: 46s
	- skriptTestJava17: 56s
	- skriptTestJava21: 2m 13s
	- JUnitQuick: 24s
	- JUnitJava17: 31s
	- JUnitJava21: 1m 11s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patterns should be ok, but we can consider bumping up the priority if necessary

@sovdeeth sovdeeth moved this to Needs Reviews in 2.12 Release Jun 3, 2025
@sovdeeth sovdeeth added enhancement Feature request, an issue about something that could be improved, or a PR improving something. dependencies Pull requests that update a dependency file (Dependabot) labels Jun 3, 2025
@sovdeeth sovdeeth removed the dependencies Pull requests that update a dependency file (Dependabot) label Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants