#5706 (New) cats and butterflies have Attack menu option


Puppy gets a Pet action and no attack but cats and butterflies are still Attack


  • Katie Russell

    Katie Russell - 2013-06-03
    • summary: Cats and butterflies have Attack menu option --> (New) cats and butterflies have Attack menu option
  • Kimmo Rundelin

    Kimmo Rundelin - 2013-09-13

    The puppy (ab)uses the custom menu system to override the default menu items for RPEntities. The other PassiveNPCs can use the same trick if there are nice alternate actions for them.

  • Balaur

    Balaur - 2013-12-01

    Here's the current situation:

    The cats in Felina's house are PassiveNPCs and they already have a custom menu entry - "Own", which makes the non-attackable.
    The pet cats are instances of a different class - Cat. They're not PassiveNPCs and have no custom menu entry, so they're attackable.
    Attackable PassiveNPCs are butterflies (Semos) and fishes (Ados).

    There's not much one could do to a fish (... maybe disturb it, and make it swim the other way?) or a butterfly. So adding a custom menu entry is not always easy.

    There's a check in Entity2DView.buildActions()

    if (!entity.getRPObject().has("menu")) {
        if (entity.isAttackedBy(User.get())) {
        } else {

    Maybe we could replace this "has-menu" condition with something more meaningful, like a NotAttackable marker interface. Something like:

    public interface NotAttackable {
    public class Cat extends Pet implements NotAttackable
    public class PassiveNPC extends NPC implements NotAttackable

    and then check this way:

    if (!entity.getRPObject() instanceof NotAttackable)

    What do you guys think?

  • Hendrik Brummermann

    Although this is more work and requires compatibility code:

    I think it may be a good idea to let the server decide to add an Attack menu.

    A quick idea (without looking too deep into the code) is to extend the "menu" attribute to contain a list of all menu items. The client will still need to do some situation specific processing, e. g. convert "Attack" into "Stop Attack".

    This way the client will become more generic. And it is one step forward on untangling the various aspects of Sheeps, Pets, Creatures, SpeakerNPCs, PassiveNPCs on the server side in the future.



Cancel  Add attachments