#ifndef STAR_ACTIVE_ITEM_HPP #define STAR_ACTIVE_ITEM_HPP #include "StarNetElementBasicFields.hpp" #include "StarNetElementFloatFields.hpp" #include "StarItem.hpp" #include "StarToolUserItem.hpp" #include "StarLuaComponents.hpp" #include "StarLuaActorMovementComponent.hpp" #include "StarNetworkedAnimator.hpp" #include "StarLuaAnimationComponent.hpp" #include "StarDurabilityItem.hpp" namespace Star { STAR_CLASS(AudioInstance); STAR_CLASS(ActiveItem); class ActiveItem : public Item, public DurabilityItem, public virtual ToolUserItem, public virtual NetElementGroup { public: ActiveItem(Json const& config, String const& directory, Json const& parameters = JsonObject()); ActiveItem(ActiveItem const& rhs); ItemPtr clone() const override; void init(ToolUserEntity* owner, ToolHand hand) override; void uninit() override; void update(float dt, FireMode fireMode, bool shifting, HashSet const& moves) override; List damageSources() const override; List shieldPolys() const override; List forceRegions() const override; bool holdingItem() const; Maybe backArmFrame() const; Maybe frontArmFrame() const; bool twoHandedGrip() const; bool recoil() const; bool outsideOfHand() const; float armAngle() const; Maybe facingDirection() const; // Hand drawables are in hand-space, everything else is in world space. List handDrawables() const; List>> entityDrawables() const; List lights() const; List pullNewAudios(); List pullNewParticles(); Maybe cursor() const; Maybe receiveMessage(String const& message, bool localMessage, JsonArray const& args = {}); float durabilityStatus() override; private: Vec2F armPosition(Vec2F const& offset) const; Vec2F handPosition(Vec2F const& offset) const; LuaCallbacks makeActiveItemCallbacks(); LuaCallbacks makeScriptedAnimationCallbacks(); mutable LuaMessageHandlingComponent>>>> m_script; NetworkedAnimator m_itemAnimator; NetworkedAnimator::DynamicTarget m_itemAnimatorDynamicTarget; mutable LuaAnimationComponent>> m_scriptedAnimator; HashMap m_activeAudio; FireMode m_currentFireMode; Maybe m_cursor; NetElementBool m_holdingItem; NetElementData> m_backArmFrame; NetElementData> m_frontArmFrame; NetElementBool m_twoHandedGrip; NetElementBool m_recoil; NetElementBool m_outsideOfHand; NetElementFloat m_armAngle; NetElementData> m_facingDirection; NetElementData> m_damageSources; NetElementData> m_itemDamageSources; NetElementData> m_shieldPolys; NetElementData> m_itemShieldPolys; NetElementData> m_forceRegions; NetElementData> m_itemForceRegions; NetElementHashMap m_scriptedAnimationParameters; }; } #endif