#pragma once #include "game/game.hpp" #include "variable_value.hpp" #include "vector.hpp" #include "animation.hpp" namespace scripting { class entity; class array; class script_value { public: script_value() = default; script_value(const game::VariableValue& value); script_value(int value); script_value(unsigned int value); script_value(bool value); script_value(float value); script_value(double value); script_value(const char* value); script_value(const std::string& value); script_value(const entity& value); script_value(const array& value); script_value(const vector& value); script_value(const animation& value); template bool is() const; template T as() const { if (!this->is()) { throw std::runtime_error("Invalid type"); } return get(); } const game::VariableValue& get_raw() const; std::string to_string() const; variable_value value_{}; private: template T get() const; }; }