iw5-mod/src/game/scripting/entity.hpp

46 lines
1.2 KiB
C++
Raw Normal View History

2019-01-20 07:21:43 -05:00
#pragma once
#include "game/game.hpp"
namespace game
{
namespace scripting
{
class context;
2019-01-20 16:26:18 -05:00
class event_listener_handle;
2019-01-20 07:21:43 -05:00
class entity final
{
public:
entity();
entity(const entity& other);
2019-01-21 17:21:38 -05:00
entity(entity&& other) noexcept;
2019-01-20 07:21:43 -05:00
entity(context* context, unsigned int entity_id);
~entity();
2019-01-21 17:21:38 -05:00
entity& operator=(const entity& other);
entity& operator=(entity&& other) noexcept;
2019-01-20 16:26:18 -05:00
event_listener_handle on_notify(const std::string& event,
2019-01-23 16:27:14 -05:00
const std::function<void(std::vector<chaiscript::Boxed_Value>)>& callback,
bool is_volatile) const;
2019-01-20 07:21:43 -05:00
unsigned int get_entity_id() const;
game::native::scr_entref_t get_entity_reference() const;
chaiscript::Boxed_Value call(const std::string& function,
const std::vector<chaiscript::Boxed_Value>& arguments) const;
void notify(const std::string& event, const std::vector<chaiscript::Boxed_Value>& arguments) const;
void set(const std::string& field, const chaiscript::Boxed_Value& value) const;
chaiscript::Boxed_Value get(const std::string& field) const;
private:
context* context_;
unsigned int entity_id_;
2019-01-21 17:21:38 -05:00
void add() const;
void release() const;
2019-01-20 07:21:43 -05:00
};
}
}