29 lines
823 B
C++
29 lines
823 B
C++
#ifndef UTILITY_LOCK_HPP
|
|
#define UTILITY_LOCK_HPP
|
|
|
|
#include "goal_marker.hpp"
|
|
#include "item.hpp"
|
|
#include <godot_cpp/variant/utility_functions.hpp>
|
|
#include <godot_cpp/templates/hash_set.hpp>
|
|
|
|
namespace gd = godot;
|
|
|
|
class UtilityLock : public GoalMarker {
|
|
GDCLASS(UtilityLock, GoalMarker)
|
|
static void _bind_methods();
|
|
public:
|
|
bool can_use(Item const *with, Unit *by) const;
|
|
bool begin_activate(Item const *with, Unit *by);
|
|
bool finish_activate(Item const *with, Unit *by);
|
|
virtual void _begin_activate(Item const *with, Unit *by) {}
|
|
virtual void _finish_activate(Item const *with, Unit *by) {}
|
|
|
|
void set_allowed_items(gd::Array array);
|
|
gd::Array get_allowed_items() const;
|
|
private:
|
|
gd::HashSet<Item const *> allowed_items{};
|
|
Unit *user{nullptr};
|
|
};
|
|
|
|
#endif // !UTILITY_LOCK_HPP
|