#ifndef STAR_LOUNGING_ENTITIES_HPP #define STAR_LOUNGING_ENTITIES_HPP #include "StarDrawable.hpp" #include "StarAnchorableEntity.hpp" #include "StarStatusTypes.hpp" #include "StarEntityRenderingTypes.hpp" namespace Star { STAR_CLASS(World); STAR_STRUCT(LoungeAnchor); STAR_CLASS(LoungeableEntity); STAR_CLASS(LoungingEntity); enum class LoungeOrientation { None, Sit, Lay, Stand }; extern EnumMap const LoungeOrientationNames; enum class LoungeControl { Left, Right, Down, Up, Jump, PrimaryFire, AltFire, Special1, Special2, Special3 }; extern EnumMap const LoungeControlNames; struct LoungeAnchor : EntityAnchor { LoungeOrientation orientation; EntityRenderLayer loungeRenderLayer; bool controllable; List statusEffects; StringSet effectEmitters; Maybe emote; Maybe dance; Maybe directives; JsonObject armorCosmeticOverrides; Maybe cursorOverride; bool cameraFocus; }; // Extends an AnchorableEntity to have more specific effects when anchoring, // such as status effects and lounge controls. All LoungeableEntity methods // may be called on both the master and slave. class LoungeableEntity : public AnchorableEntity { public: virtual size_t anchorCount() const override = 0; EntityAnchorConstPtr anchor(size_t anchorPositionIndex) const override; virtual LoungeAnchorConstPtr loungeAnchor(size_t anchorPositionIndex) const = 0; // Default does nothing. virtual void loungeControl(size_t anchorPositionIndex, LoungeControl loungeControl); virtual void loungeAim(size_t anchorPositionIndex, Vec2F const& aimPosition); // Queries around this entity's metaBoundBox for any LoungingEntities // reporting that they are lounging in this entity, and returns ones that are // lounging in the given position. Set entitiesLoungingIn(size_t anchorPositionIndex) const; // Returns pairs of entity ids, and the position they are lounging in. Set> entitiesLounging() const; }; // Any lounging entity should report the entity it is lounging in on both // master and slave, so that lounging entities can cooperate and avoid lounging // in the same spot. class LoungingEntity : public virtual Entity { public: virtual Maybe loungingIn() const = 0; // Returns true if the entity is in a lounge achor, but other entities are // also reporting being in that lounge anchor. bool inConflictingLoungeAnchor() const; }; } #endif