Allow skills to process player input when not locked on
Closed this issue · 2 comments
coolAlias commented
Key (and mouse) releases are already passed to all skills whether locked on or not, but key (and mouse) presses are currently only processed while locked on.
coolAlias commented
This would be specifically to support skills added by other mods.
coolAlias commented
An additional method such as boolean SkillActive#requiresTarget()
could streamline the key processing methods in DSSPlayerInfo
so that individual skills don't need to check if currently locked on, e.g.:
@SideOnly(Side.CLIENT)
public boolean onKeyPressed(Minecraft mc, KeyBinding key) {
for (SkillBase skill : skills.values()) {
if ((!skill.requiresTarget() || this.isLockedOn())
&& skill instanceof SkillActive
&& ((SkillActive) skill).isKeyListener(mc, key)
) {
if (((SkillActive) skill).keyPressed(mc, key, player)) {
return true;
}
}
}
// etc.
return false;
}
Alternatively, since the above might be too restrictive (e.g. it doesn't allow a skill that accepts input only when not locked on), the isLockedOn
value or, even better, the current targeting skill could be passed to the isKeyListener
function.