2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#include "StarToolUserEntity.hpp"
|
|
|
|
#include "StarPhysicsEntity.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
STAR_EXCEPTION(ToolUserItemException, StarException);
|
|
|
|
|
|
|
|
STAR_CLASS(ToolUserItem);
|
|
|
|
|
|
|
|
// FIXME: You know what another name for an item that a tool user uses is? A
|
|
|
|
// Tool. Three words when one will do, rename.
|
|
|
|
class ToolUserItem {
|
|
|
|
public:
|
|
|
|
ToolUserItem();
|
|
|
|
virtual ~ToolUserItem() = default;
|
|
|
|
|
|
|
|
// Owner must be initialized when a ToolUserItem is initialized and
|
|
|
|
// uninitialized before the owner is uninitialized.
|
|
|
|
virtual void init(ToolUserEntity* owner, ToolHand hand);
|
|
|
|
virtual void uninit();
|
|
|
|
|
|
|
|
// Default implementation does nothing
|
2023-07-20 14:58:49 +00:00
|
|
|
virtual void update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
// Default implementations return empty list
|
|
|
|
virtual List<DamageSource> damageSources() const;
|
|
|
|
virtual List<PolyF> shieldPolys() const;
|
|
|
|
virtual List<PhysicsForceRegion> forceRegions() const;
|
|
|
|
|
|
|
|
bool initialized() const;
|
|
|
|
|
|
|
|
// owner, entityMode, hand, and world throw ToolUserException if
|
|
|
|
// initialized() is false
|
|
|
|
ToolUserEntity* owner() const;
|
|
|
|
EntityMode entityMode() const;
|
|
|
|
ToolHand hand() const;
|
|
|
|
World* world() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ToolUserEntity* m_owner;
|
|
|
|
Maybe<ToolHand> m_hand;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|