2023-06-20 04:33:09 +00:00
|
|
|
#ifndef STAR_MATERIAL_ITEM_HPP
|
|
|
|
#define STAR_MATERIAL_ITEM_HPP
|
|
|
|
|
|
|
|
#include "StarItem.hpp"
|
|
|
|
#include "StarFireableItem.hpp"
|
|
|
|
#include "StarBeamItem.hpp"
|
|
|
|
#include "StarEntityRendering.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
STAR_CLASS(MaterialItem);
|
|
|
|
|
|
|
|
class MaterialItem : public Item, public FireableItem, public BeamItem {
|
|
|
|
public:
|
|
|
|
MaterialItem(Json const& config, String const& directory, Json const& settings);
|
|
|
|
virtual ~MaterialItem() {}
|
|
|
|
|
|
|
|
ItemPtr clone() const override;
|
|
|
|
|
|
|
|
void init(ToolUserEntity* owner, ToolHand hand) override;
|
2023-07-31 06:41:12 +00:00
|
|
|
void uninit() override;
|
2023-07-20 14:58:49 +00:00
|
|
|
void update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
List<Drawable> nonRotatedDrawables() const override;
|
|
|
|
|
|
|
|
void fire(FireMode mode, bool shifting, bool edgeTriggered) override;
|
2023-07-31 06:00:19 +00:00
|
|
|
void endFire(FireMode mode, bool shifting) override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
MaterialId materialId() const;
|
|
|
|
MaterialHue materialHueShift() const;
|
|
|
|
|
|
|
|
bool canPlace(bool shifting) const;
|
|
|
|
bool multiplaceEnabled() const;
|
|
|
|
|
|
|
|
// FIXME: Why isn't this a PreviewTileTool then??
|
|
|
|
List<PreviewTile> preview(bool shifting) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
MaterialHue placementHueShift(Vec2I const& position) const;
|
|
|
|
|
|
|
|
MaterialId m_material;
|
|
|
|
MaterialHue m_materialHueShift;
|
|
|
|
|
|
|
|
float m_blockRadius;
|
|
|
|
float m_altBlockRadius;
|
|
|
|
bool m_shifting;
|
|
|
|
bool m_multiplace;
|
2023-07-31 06:00:19 +00:00
|
|
|
Maybe<Vec2F> m_lastAimPosition;
|
2023-06-20 04:33:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|