Skip to content

Conversation

@TheMug06
Copy link
Contributor

Problem

No syntax currently exists for interaction entities. SkBee used to have it, but it is disabled along with its display syntaxes in favor of Skript's.

Solution

This PR introduces several new syntaxes for each aspect of interaction entities.
Includes Height, Width, Responsiveness, Last interaction/attack date/player and a condition for responsiveness.

Testing Completed

Manually tested scripts, all syntax works locally. Can add tests if wanted :D

Supporting Information

None


Completes: none
Related: none

@TheMug06 TheMug06 requested a review from a team as a code owner November 20, 2025 00:26
@TheMug06 TheMug06 added the feature Pull request adding a new feature. label Nov 20, 2025
@TheMug06 TheMug06 requested review from Pesekjak and removed request for a team November 20, 2025 00:26
@TheMug06 TheMug06 added the 2.14 Targeting a 2.14.X version release. label Nov 20, 2025
@TheMug06 TheMug06 requested a review from cheeezburga November 20, 2025 00:26
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

Haven't looked at code in detail, but this is missing last attacker support

@TheMug06
Copy link
Contributor Author

Haven't looked at code in detail, but this is missing last attacker support

See ExprLastInteractionPlayer, same goes for last attack date in ExprLastInteractionDate.

@sovdeeth
Copy link
Member

Haven't looked at code in detail, but this is missing last attacker support

See ExprLastInteractionPlayer, same goes for last attack date in ExprLastInteractionDate.

No, ExprLastAttacker (unless it already works?)

@TheMug06
Copy link
Contributor Author

TheMug06 commented Nov 20, 2025

Haven't looked at code in detail, but this is missing last attacker support

See ExprLastInteractionPlayer, same goes for last attack date in ExprLastInteractionDate.

No, ExprLastAttacker (unless it already works?)

Interaction extends Entity, so ExprLastAttacker should work fine (?). Though idk if it would due to getLastDamageCause()?

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

lot of edits needed for code quality and conventions
requested comments don't cover everything


@Name("Is Responsive")
@Description({
"Checks whether an interaction entity is responsive"
Copy link
Member

Choose a reason for hiding this comment

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

responsive to what? what does this mean?

Comment on lines +32 to +33
isNegated = parseResult.mark == 1;
return super.init(exprs, matchedPattern, isDelayed, parseResult);
Copy link
Member

Choose a reason for hiding this comment

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

isnegated is going to be overridden here by the propertycondition init()

@Override
protected String getPropertyName() {
return isNegated ? "unresponsive" : "responsive";
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

protected String getPropertyName() {
return isNegated ? "unresponsive" : "responsive";
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

"set interaction height of last spawned interaction to 5.3"
})
@Since("INSERT VERSION")
public class ExprInteractionHeight extends SimplePropertyExpression<Entity, Number> {
Copy link
Member

Choose a reason for hiding this comment

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

this should probably be a type property but that edit can be done in a later pr that adds the property

}
}

} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

final Interaction i = (Interaction) getExpr().getSingle(e);
if (i == null)
return;
float n = ((Number) delta[0]).floatValue();
Copy link
Member

Choose a reason for hiding this comment

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

use full variable names please


@Name("Interaction Responsiveness")
@Description({
"Returns the responsiveness of an interaction entity"
Copy link
Member

Choose a reason for hiding this comment

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

what's responsiveness

public class ExprInteractionResponsiveness extends SimplePropertyExpression<Entity, Boolean> {

static {
register(ExprInteractionResponsiveness.class, Boolean.class, "interaction Responsiveness[es]", "entities");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
register(ExprInteractionResponsiveness.class, Boolean.class, "interaction Responsiveness[es]", "entities");
register(ExprInteractionResponsiveness.class, Boolean.class, "interaction responsiveness", "entities");

Should this even be an expression? Seems more appropriate as an effect + condition.

Comment on lines +38 to +61
protected String getPropertyName() {
return "interaction responsiveness";
}

@Override
public Class<? extends Boolean> getReturnType() {
return Boolean.class;
}

@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
if ((mode == ChangeMode.SET || mode == ChangeMode.RESET)
&& getExpr().isSingle())
return new Class[] {Boolean.class};
return null;
}

@Override
public void change(final Event e, final @Nullable Object[] delta, final ChangeMode mode) throws UnsupportedOperationException {
assert !(getExpr().getSingle(e) instanceof Interaction) || delta != null;
final Interaction i = (Interaction) getExpr().getSingle(e);
if (i == null)
return;
Copy link
Member

Choose a reason for hiding this comment

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

fix ordering and code quality

@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Nov 20, 2025
Copy link
Contributor

@Absolutionism Absolutionism left a comment

Choose a reason for hiding this comment

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

As per Sovde's review of following coding conventions, things I've noticed

  • Use SyntaxRegistry to register elements
  • Forgot to load the InteractionModule via main Skript class
  • No finals
  • Use @Example instead of @Examples
  • Each example should be in it's own @Example
  • One liner @Example and @Description should not be encased in {}
  • Inline Nullable annotation, i.e. @Nullable blah or blah @Nullable []
  • No 1 letter variable names
  • Tests
  • Expression change should allow changing of multiple interactions, not just one

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.14 Targeting a 2.14.X version release. feature Pull request adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants